preparing for a new logging framework
[mir.git] / templates-dist / producer / producers.xml
index 7ea479d..40cbb5f 100755 (executable)
@@ -1,3 +1,13 @@
+<!-- 
+  This XML file defines a set of producers intended for a typical indymedia 
+  site:
+    - a start page
+    - a navigational bar
+    - topic pages
+    - a newswire archive
+    - articles
+-->  
+
 <producers>
   <nodedefinition name="Language">
     <parameters>
     </parameters>
 
     <definition>
-      <Log message="logging: "/>
+      <List key="languages" table="language" selection="${languagecondition}" order="code"/>
       <Enumerate key="language" table="language" selection="${languagecondition}" order="code">
-        <Log message="  language.code = ${language.code}" />
         <Resource bundle="${bundle}" key="lang" language="${language.code}"/>
-        <Define key="pathprefix" value="${language.code}/" />
+        <Define key="pathprefix" value="${language.code}" />
         <sub/>
       </Enumerate>
     </definition>
   </nodedefinition>
  
-  <producer name="content">
+  <producer name="articles">
     <verbs>
-      <verb name="new">
-        <Set key="verbcondition" value="' and (not is_produced)'"/>
+      <verb name="changed" default="1">
+        <Define key="verbcondition" value=" and (not is_produced)"/>
+        <Set key="limit" value="10"/>
       </verb>
       <verb name="all">
-        <Set key="verbcondition" value="''"/>
+        <Define key="verbcondition" value=""/>
+        <Set key="limit" value="-1"/>
+      </verb>
+
+      <verb name="sample">
+        <Define key="verbcondition" value=""/>
+        <Set key="limit" value="10"/>
       </verb>
     </verbs>
     <body>
-      <Enumerate key="data.content" table="content" selection="is_published='t' ${verbcondition}"
-                  limit="10" order="webdb_create desc, date desc">
-        <Generate 
-            generator="/producer/content.template" 
-            destination="${config.storageRoot}/${data.content.date.formatted.yyyy}/${data.content.date.formatted.MM}/${data.content.id}.shtml"/>
-        <MarkContent key="data.content"/>            
+      <Enumerate key="article" table="content" selection="is_published='t' ${verbcondition}"
+                  limit="limit" order="webdb_create desc, date desc">
+        <Language>
+          <Generate 
+              generator="/article.template" 
+              destination="${config.storageRoot}/${pathprefix}/${article.date.formatted.yyyy}/${article.date.formatted.MM}/${article.id}.shtml"/>
+        </Language>
+
+        <MarkContent key="article"/>            
+
+    <!-- uncomment the following if you want to make a pdf version of each article  -->
+    <!-- also, you could move it up into the language tag and adjust the paths accordingly
+         to make pdfs in each language -->
+    <!-- PDFPreFormat splits up the text and mixes images in with it -->
+    <!--<PDFPreFormat key="article.content" numLinesBetweenImages="3" charWidthCM="0.19" pixelWidthCM="0.035" contentAreaWidthCM="16" lineHeightCM="0.5" />-->
+    <!-- Regular Generate Tag is used to produce an fo file(but using the split-up content -->
+    <!--<Generate generator="/printablecontent.template" destination="${config.storageRoot}/${article.content.date.formatted.yyyy}/${article.content.date.formatted.MM}/${article.content.id}.fo"/>-->
+    <!-- Finally, PDFGenerate turns the fo file into a pdf.  You could leave this step out 
+    and generate pdfs on the fly using the getpdf OpenMir module as well.  Make sure to fill in the real path on the stylesheet attribute-->
+    <!--<PDFGenerate generator="${config.storageRoot}/${article.content.date.formatted.yyyy}/${article.content.date.formatted.MM}/${article.content.id}.fo" destination="${config.storageRoot}/${article.content.date.formatted.yyyy}/${article.content.date.formatted.MM}/${article.content.id}.pdf" stylesheet="/real/path/goes/here/templates/producer/html2fo.xsl" />-->
+
+
       </Enumerate>
     </body>
   </producer>  
 
+  <producer name="stylesheet">
+    <verbs>
+      <verb name="generate" default="1" description="generates the style sheet"/>
+    </verbs>
+    <body>
+      <Language>
+        <Generate 
+            generator="/stylesheet.template" 
+            destination="${config.storageRoot}/${pathprefix}/style.css"/>
+      </Language>
+    </body>
+  </producer>
+
   <producer name="navigation">
     <verbs>
-      <verb name="new"/>
+      <verb name="generate" default="1" description="generates the left column"/>
     </verbs>
     <body>
-      <Log message="logging"/>
       <Language>
         <Generate 
-            generator="/producer/navigation.template" 
+            generator="/navigation.template" 
             destination="${config.storageRoot}/${pathprefix}/navigation.inc"/>
       </Language>
     </body>
   </producer>
   
-  <producer name="topics">
+  <producer name="topicpages">
     <verbs>
       <verb name="new">
-        <Set key="pages" value="1 + 1 -2 * 3 + 4 * ( 5+6 ) - 40 + 2"/>
+        <Set key="pages" value="3"/>
       </verb>
       <verb name="all">
         <Set key="pages" value="-1"/>
     </verbs>
     <body>
       <Enumerate key="topic" table="topic">
-        <List key="data.special" table="content" 
+        <List key="special" table="content" 
           selection="is_published='1' and to_article_type = ${articletype.topicspecial} and id in (select content_id from content_x_topic where topic_id = ${topic.id})"
           order = "webdb_create desc, date desc" limit="1"/>
       
-        <Batch key="data.contentlist" infokey="batch" table="content" 
+        <Batch key="articles" infokey="batch" table="content" 
                process="pages" batchsize="20" minbatchsize="10"
                selection="is_published='1' and to_article_type in (${articletype.newswire}, ${articletype.feature}) and id in (select content_id from content_x_topic where topic_id = ${topic.id})"
                order="webdb_create asc">
           <batches>
             <Set key="filename" value="topic.filename ++ batch.current.identifier"/>
-            <Generate 
-                generator="/producer/topiclist.template" 
-                destination="${config.storageRoot}/${topic.filename}/${filename}.shtml"/>
+            <Language>
+              <Generate 
+                  generator="/topicpage.template" 
+                  destination="${config.storageRoot}/${pathprefix}/${topic.filename}/${filename}.shtml"/>
+            </Language>
           </batches>
           <batchlist>
           </batchlist>
     </body>
   </producer>
   
+  <producer name="newswirearchive">
+    <verbs>
+      <verb name="new">
+        <Set key="pages" value="3"/>
+      </verb>
+      <verb name="all">
+        <Set key="pages" value="-1"/>
+      </verb> 
+    </verbs>
+    <body> 
+        <Batch key="articles" infokey="batch" table="content" 
+               process="pages" batchsize="20" minbatchsize="10"
+               selection="is_published='1' and to_article_type in (${articletype.newswire})"
+               order="webdb_create asc">
+          <batches>
+            <Set key="filename" value="archive ++ batch.current.identifier"/>
+            <Language>
+              <Generate 
+                  generator="/archive.template" 
+                  destination="${config.storageRoot}/${pathprefix}/archive/${filename}.shtml"/>
+            </Language>
+          </batches>
+          <batchlist>
+          </batchlist>
+        </Batch>
+    </body>
+  </producer>
+
   <producer name="startpage">
     <verbs>
-      <verb name="new"/>
+      <verb name="generate" default="1" description="Generates the startpage"/>
     </verbs>
 
     <body>
         selection="is_published=true and to_article_type=${articletype.startspecial}"
         order="webdb_create desc, date desc"/>
                                         
-      <List key="data.features" table="content" limit="10 12
+      <List key="features" table="content" limit="10
         selection="is_published=true and to_article_type=${articletype.feature}"
         order="webdb_create desc, date desc"/>
-      <List key="data.newswire" table="content" limit="30"
+
+      <List key="newswire" table="content" limit="30"
         selection="is_published=true and to_article_type=${articletype.newswire}"
         order="webdb_create desc, date desc"/>
-         
-      <Generate 
-          generator="/producer/startpage.template" 
-          destination="${config.storageRoot}/index.shtml"/>
+        
+      <Language>
+        <Generate 
+            generator="/startpage.template" 
+            destination="${config.storageRoot}/${pathprefix}/index.shtml"/>
+      </Language>
     </body>
   </producer>