added topic countv code in producers and created a new template for it
authormtopper <mtopper>
Tue, 12 Jul 2005 18:30:36 +0000 (18:30 +0000)
committermtopper <mtopper>
Tue, 12 Jul 2005 18:30:36 +0000 (18:30 +0000)
etc/producer/producers.xml
etc/producer/topiccount.template [new file with mode: 0755]

index 9ae9910..f5b7473 100755 (executable)
 
 
 
+
+ <!-- generates a count for each topic -->
+ <producer name="generateTopicCounts">
+ <verbs>
+       <verb name="doit" />
+ </verbs>
+ <body>
+       <FreeQuery key="topicCounts" query=" SELECT count(c.id) AS count, t.title AS title from content c, topic t, content_x_topic x
+                                            WHERE c.id = x.content_id AND t.id = x.topic_id GROUP BY t.title"
+                  type="set"/>
+                  
+       <Generate generator="/topiccount.template"
+               destination="${config.storageRoot}/${pathprefix}/topiccount.shtml" />
+  </body>
+  </producer>
+               
+
+
  <producer name="generateRandomTopics">
   <verbs>
     <verb name="doit" />
         <Log message="Getting Last 5 articles for category: ${category.title} - counter: ${counter}" />
         <Define key="topictitle" value="${category.title}" />
         
-        <!--
+        
         <List key="randomarticles" table="content"
                selection ="id in (select content_id from content_x_topic where topic_id = ${category.id})" order="date DESC"
                limit="5" />
                <Generate
                        generator="/randomcategory.template"
                        destination="${config.storageRoot}/fpincludes/random${counter}.inc" />        
-       -->
+      
         
         <Set key="counter" value="counter+1" />
     </Enumerate>
diff --git a/etc/producer/topiccount.template b/etc/producer/topiccount.template
new file mode 100755 (executable)
index 0000000..30de8ae
--- /dev/null
@@ -0,0 +1,26 @@
+
+<table id="topicCount" cellspacing="0">
+   <list topicCounts as tc>
+   <tr>
+      <td class="count"><p>${tc.count}</p></td>
+      <td class="topic"><p><a href="#">${tc.title}</a></p></td>
+   </tr>
+   </list>
+</table>
+<script language="JavaScript 1.2" type="text/javascript">
+<!-- 
+
+   // apply css styles on <table> row mouseover
+   var rows = document.getElementById('topicCount').getElementsByTagName('tr');
+   var lngth = rows.length;
+   for ( i=0; i<lngth; i++ ) {
+      rows[i].onmouseover = function() {
+         this.className="mouseOn";
+      };
+      rows[i].onmouseout = function() {
+         this.className="mouseOff";
+      };
+   }
+
+// -->
+</script>