made it outside of language
[nyc.indymedia.org.git] / etc / producer / producers.xml
index d503656..73c45b1 100755 (executable)
@@ -1,7 +1,5 @@
-
 <!--
-  This XML file defines a set of producers intended for a typical indymedia 
-  site:
+    This XML file defines a set of producers intended for a typical indymedia site:
     - a start page
     - a navigational bar
     - topic pages
@@ -64,6 +62,8 @@
             <Set key="origin" value="item.identifier"/>
           </else>
         </If>
+        
+        
 
         <If condition="item['dcterms:hasPart']">
           <then>
@@ -88,7 +88,7 @@
                key="article"
                table="content"
 
-               date="config.now.formatted.yyyymmdd"
+               date="utility.datetime.formatDate(item['dc:date'], 'yyyyMMdd')"
                publish_path="' '"
                to_publisher="'0'"
                is_produced="'0'"
                description="haspartimg++item['rss:description']++' '"
                to_language="languageCodeToId(languagecode)"
                title="item['rss:title']++''"
-               webdb_create="config.now"
+               webdb_create="item['dc:date']"
                creator="blogname"
                comment="'Taken from ' ++ blogname"
              />
     <definition>
       <If condition="extratables == 'none' ">
         <then>
-          <List key="articles" table="content c" selection="${articleSelection}" order = "c.webdb_create desc, c.date desc" limit="limit" />
+          <List key="articles" table="content" selection="${articleSelection}" order = "webdb_create desc, date desc" limit="limit" />
         </then>
         <else>
-          <List key="articles" table="content c" selection="${articleSelection}" order = "c.webdb_create desc, c.date desc" limit="limit" extratables="${extratables}" />
+          <List key="articles" table="content" selection="${articleSelection}" order = "webdb_create desc, date desc" limit="limit" extratables="${extratables}" />
         </else>
       </If>
       <If condition="channeldescription==''">
   <nodedefinition name="RSSChannelBundle">
     <parameters>
       <string name="extratables" defaultvalue="none" />
-      <string name="selection" defaultvalue="c.is_published='1'" />  
+      <string name="selection" defaultvalue="is_published='1'" />  
       <string name="basefilename" defaultvalue="main" />
     </parameters>
     <definition>
       <!-- newswire -->
       <RSSChannel
-        articleSelection="(c.to_article_type in (${articletype.newswire}) or (c.to_article_type=${articletype.translation} and c.to_original.to_articletype in (${articletype.newswire}))) and ${selection}"
+        articleSelection="(to_article_type in (${articletype.newswire}) or (to_article_type=${articletype.translation} and to_original.to_articletype in (${articletype.newswire}))) and ${selection}"
         channelfilename="${basefilename}-newswire.rss"
         channeltitle="${config['Mir.Name']} ${basefilename} newswire"
         limit="20"
        extratables="${extratables}"
       />
       <RSSChannel
-        articleSelection="(c.to_article_type in (${articletype.newswire}) or (c.to_article_type=${articletype.translation} and c.to_original.to_articletype in (${articletype.newsire}))) and ${selection}"
+        articleSelection="(to_article_type in (${articletype.newswire}) or (to_article_type=${articletype.translation} and to_original.to_articletype in (${articletype.newsire}))) and ${selection}"
         channelfilename="${basefilename}-newswire-content.rss"
         channeltitle="${config['Mir.Name']} ${basefilename} newswire"
         limit="20"
       />    
       <!-- features -->
       <RSSChannel
-        articleSelection="(c.to_article_type in (${articletype.feature},${articletype.startspecial},${articletype.topicspecial}) or (c.to_article_type=${articletype.translation} and c.to_original.to_articletype in (${articletype.feature},${articletype.startspecial},${articletype.topicspecial}))) and ${selection}"
+        articleSelection="(to_article_type in (${articletype.feature},${articletype.startspecial},${articletype.topicspecial})) and ${selection}"
         channelfilename="${basefilename}-features.rss"
         channeltitle="${config['Mir.Name']} ${basefilename} features"
         limit="20"
        extratables="${extratables}"
       />
       <RSSChannel
-        articleSelection="(c.to_article_type in (${articletype.feature},${articletype.startspecial},${articletype.topicspecial}) or (c.to_article_type=${articletype.translation} and c.to_original.to_articletype in (${articletype.feature},${articletype.startspecial},${articletype.topicspecial}))) and ${selection}"
+        articleSelection="(to_article_type in (${articletype.feature},${articletype.startspecial},${articletype.topicspecial})) and ${selection}"
         channelfilename="${basefilename}-features-content.rss"
         channeltitle="${config['Mir.Name']} ${basefilename} features"
         limit="20"
   <producer name="articles">
     <verbs>
       <verb name="changed" default="1">
-        <Define key="verbcondition" value="(not is_produced)"/>
+        <Define key="verbcondition" value="(not is_produced) and to_article_type != ${articletype.static}"/>
         <Set key="limit" value="10"/>
       </verb>
       <verb name="all">
-        <Define key="verbcondition" value=""/>
+        <Define key="verbcondition" value="to_article_type != ${articletype.static}"/>
         <Set key="limit" value="-1"/>
       </verb>
 
       <verb name="sample">
-        <Define key="verbcondition" value=""/>
+        <Define key="verbcondition" value="to_article_type != ${articletype.static}"/>
         <Set key="limit" value="10"/>
       </verb>
+
+      <verb name="test" >
+        <Define key="verbcondition" value="(id&gt;=5000 and id&lt;7500 ) and to_article_type != ${articletype.static}"/>
+        <Set key="limit" value="2500"/>
+      </verb>
+
+      <verb name="regen">
+       <Define key="verbcondition" value="(not is_produced) and to_article_type != ${articletype.static}"/>
+       <Set key="limit" value="5000"/>
+      </verb>
     </verbs>
     <body>
       <Enumerate key="article" table="content" selection="${verbcondition}"
             
            <GenerateMedia key="media" />
         </Enumerate>
+        
+      
         <Enumerate 
             key="media" table="otherMedia" 
             selection="exists (select * from content_x_media where media_id=other_media.id and content_id=${article.id})
            <GenerateMedia key="media" />
         </Enumerate>
 
-        <If condition="article.is_published == '1'">
+
+             <List key="topics" table="topic t" extratables="content_x_topic ctx"
+               selection="ctx.content_id = ${article.id} AND ctx.topic_id = t.id"  />
+                  <!--<If condition="utility.listSize(topics) > 0">
+                  <then>
+                       <Log message="I have a topic list with ${utility.listSize(topics)}" />
+                   </then>
+                  </If>-->
+             <Log message="I am generating: ${article.id}"/>
+
+  <If condition="article.is_published == '1'">
           <then>
             <Language>
               <Generate 
                 generator="/article.template" 
-                destination="${config.storageRoot}/${pathprefix}/${article.date.formatted.yyyy}/${article.date.formatted.MM}/${article.id}.shtml"/>
+                destination="${config.storageRoot}/${pathprefix}/${article.date.formatted.yyyy}/${article.date.formatted.MM}/${article.id}.html"/>
              </Language>
             <Generate 
                 generator="/languagebar.template" 
-                destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.shtml"/>  
+                destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.html"/>   
              <IndexContent key="article" pathToIndex="${config['IndexPath']}"/>
           </then>
           <else>
   <producer name="staticpages">
     <verbs>
       <verb name="changed" default="1">
-        <Define key="verbcondition" value="(not is_produced)"/>
+        <Define key="verbcondition" value="(not is_produced) and to_article_type = ${articletype.static}"/>
         <Set key="limit" value="10"/>
       </verb>
       <verb name="all">
-        <Define key="verbcondition" value=""/>
+        <Define key="verbcondition" value="to_article_type = ${articletype.static}"/>
         <Set key="limit" value="-1"/>
       </verb>
     </verbs>
 
     <body>
-      <Enumerate key="article" table="content" selection="${verbcondition}  and to_article_type = ${articletype.static}"
+      <Enumerate key="article" table="content" selection="${verbcondition}"
                   limit="limit" order="webdb_create desc">
         <Enumerate 
             key="media" table="image" 
             
            <GenerateMedia key="media" />
         </Enumerate>
+       <List key="topics" table="topic t" extratables="content_x_topic ctx"
+               selection="ctx.content_id = ${article.id} AND ctx.topic_id = t.id"  />
 
         <If condition="article.is_published == '1'">
           <then>
             <Language>
               <Generate 
-                generator="/article.template" 
-                destination="${config.storageRoot}/${pathprefix}/static/${article.edittitle}.shtml"/>
+                generator="/staticpage.template" 
+                destination="${config.storageRoot}/${pathprefix}/static/${article.edittitle}.html"/>
              </Language>
+
             <Generate 
                 generator="/languagebar.template" 
-                destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.shtml"/>  
+                destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.html"/>   
              <IndexContent key="article" pathToIndex="${config['IndexPath']}"/>
           </then>
           <else>
       <Language>
         <Generate 
             generator="/navigation.template" 
-            destination="${config.storageRoot}/${pathprefix}/navigation.inc"/>
+            destination="${config.storageRoot}/${pathprefix}/navigation.html"/>
       </Language>
     </body>
   </producer>
     </body>
   </producer>
   
+  
+   <producer name="staticfiles">
+    <verbs>
+      <verb name="generate" default="1" description="copies all the static image files into place"/>
+    </verbs>
+    <body>
+      <CopyDir destination="js" source="etc/producer/js"/>
+    </body>
+  </producer>
+  
   <producer name="newswirearchive">
     <verbs>
       <verb name="new">
       </verb>
     </verbs>
     <body>
-        <Define key="docSuffix" value=".shtml"/>
-        <Define key="storageSuffix" value=".shtml"/>
+        <Define key="docSuffix" value=".html"/>
+        <Define key="storageSuffix" value=".html"/>
 
         <Batch key="articles" infokey="batch" table="content"
                process="pages" batchsize="20" minbatchsize="10"
       </verb> 
     </verbs>
     <body>
-        <Define key="docSuffix" value=".shtml"/>
-        <Define key="storageSuffix" value=".shtml"/>
+        <Define key="docSuffix" value=".html"/>
+        <Define key="storageSuffix" value=".html"/>
         
         <Batch key="articles" infokey="batch" table="content" 
                process="pages" batchsize="20" minbatchsize="10"
       </verb> 
     </verbs>
     <body>
-      <Enumerate key="topic" table="topic" limit="_topics">
-        <Define key="docSuffix" value=".shtml"/>
-        <Define key="storageSuffix" value=".shtml"/>
+      <Enumerate key="topic" table="topic">
+        <Define key="docSuffix" value=".html"/>
+        <Define key="storageSuffix" value=".html"/>
         
+        <Log message="topic = ${topic.title}" />
         <List key="special" table="content c" 
           selection="c.is_published='1' and c.to_article_type = ${articletype.topicspecial} and c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
           order = "webdb_create desc" limit="1"
               <Define key="pagePrefix" value="${pathprefix}/${topic.filename}/archive"/>
               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
+                 <Log message="topic now = ${topic.title}" />
 
               <Generate 
                   generator="topicpage.template" 
     </verbs>
 <body>
 <Set key="whichnewswire" value="Open Publishing News" />
-      <List key="newswire" table="content" limit="30"
+      <List key="newswire" table="content" limit="50"
         selection="is_published=true and to_article_type=${articletype.newswire}"
         order="webdb_create desc"/>
       <Language>
         <Generate 
             generator="/newswireinclude.template" 
-            destination="${config.storageRoot}/${pathprefix}/newswireinclude.shtml"/>
+            destination="${config.storageRoot}/${pathprefix}/newswireinclude.html"/>
       </Language>
 
 
     </verbs>
 <body>
 <Set key="whichnewswire" value="RSS Publishing News" />
-      <List key="newswire" table="content" limit="30"
+      <List key="newswire" table="content" limit="20"
         selection="is_published=true and to_article_type=${articletype.communityrssarticle}"
         order="webdb_create desc"/>
       <Language>
         <Generate 
             generator="/newswireinclude.template" 
-            destination="${config.storageRoot}/${pathprefix}/rssnewswireinclude.shtml"/>
+            destination="${config.storageRoot}/${pathprefix}/rssnewswireinclude.html"/>
       </Language>
 
 
       <verb name="generate" default="1" description="Generates the startpage"/>
     </verbs>
 
+
     <body>
-      <List key="startspecial" table="content" limit="2"
+      <List key="startspecial" table="content" limit="1"
         selection="is_published=true and to_article_type=${articletype.startspecial}"
         order="webdb_create desc"/>
+
+      <Enumerate key="ssimage" table="image" selection="to_media_folder=9 and is_published=true" >       
+       <Define key="ssimagepath" value="${ssimage.publish_server}/${ssimage.publish_path}" />
+       <Define key="sstitle" value="${ssimage.title}" />
+      </Enumerate>
+                                        
                                         
-      <List key="features" table="content" limit="10
+      <List key="features" table="content" limit="5
         selection="is_published=true and to_article_type in (${articletype.feature},${articletype.promotedcommunityarticle},${articletype.promotednewswire})"
         order="webdb_create desc"/>
 
         selection="is_published=true and to_article_type in (${articletype.communityrssarticle},${articletype.promotedcommunityarticle})"
         order="webdb_create desc"/>
 
-      <List key="newswire" table="content" limit="30"
+      <List key="newswire" table="content" limit="20"
         selection="is_published=true and to_article_type=${articletype.newswire}"
         order="webdb_create desc"/>
         
+      <List key="mostcomments"
+                 table="content c"
+                 extratables="comment cm"
+                 selection="c.webdb_create > NOW()-'1 week'::interval and c.is_published=true and cm.is_published=true and c.id=cm.to_media group by c.id,c.title,
+                                        c.subtitle,c.edittitle,c.date,c.creator,c.creator_main_url,c.creator_email,c.creator_address,c.creator_phone,c.description,
+                                        c.comment,c.source,c.is_published,c.is_produced,c.to_publisher,c.to_language,c.to_rights,c.webdb_create,c.webdb_lastchange,
+                                        c.content_data,c.is_html,c.to_article_type,c.to_content,c.keywords,c.to_locking_user"
+                         order="count(cm.id) desc, c.webdb_create desc "
+                         limit="3"
+                   />    
+               
+        
       <List key="breakingnews" table="breakingNews" limit="10"
          order="webdb_create desc"/>
         
       <Language>
         <Generate 
             generator="/startpage.template" 
-            destination="${config.storageRoot}/${pathprefix}/index.shtml"/>
+            destination="${config.storageRoot}/${pathprefix}/index.html"/>
       </Language>
     </body>
   </producer>  
       <Enumerate key="topic" table="topic">
         <RSSChannelBundle
           basefilename="${topic.filename}"
-         selection="c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
-          extratables="content_x_topic cxt"
+         selection="id=cxt.content_id and cxt.topic_id = ${topic.id}"
+          extratables="content_x_topic as cxt"
         />
       </Enumerate>
       
       <Radicalendar key="calendar" groupname="_imc" gmtoffset="60"  />
       <Generate 
         generator="/radicalendar.template" 
-        destination="${config.storageRoot}/calendarinclude.shtml"/>
+        destination="${config.storageRoot}/calendarinclude.html"/>
 
 
     </body>
     </body>
   </producer>
 
+
+
+
+
+ <producer name="generatefpincludes">
+   <verbs>
+     <verb name="doit" />
+   </verbs>
+   <body>
+
+       <Set key="counter" value="1"/>
+      <Enumerate key="fpimage" table="image" selection="to_media_folder=8 and is_published=true" >
+        <Log message="generating include for image id: ${fpimage.id}" type="info" />
+
+         <Generate
+               generator="/fpinclude.template"
+               destination="${config.storageRoot}/fpincludes/${fpimage.id}.inc" />
+       <Set key="counter" value="counter+1" />
+      </Enumerate>
+
+
+          <List key="fpincludes" table="image" selection="to_media_folder=8 and is_published=true" />
+               <Generate
+                       generator="/fpmapping.template"
+                       destination="${config.storageRoot}/fpincludes/map.txt" />
+
+    </body>
+  </producer>
+
+
+
+
+ <!-- generates a count for each topic -->
+ <!-- TODO: add date limit when we actually are going live with this -->       
+ <producer name="generateTopicCounts"> 
+ <verbs>
+       <verb name="doit" />
+ </verbs>
+ <body>
+       <FreeQuery key="topicCounts" query=" SELECT count(x.content_id) as count, t.title, t.filename FROM topic as t LEFT OUTER JOIN content_x_topic 
+                                                                                as x ON (t.id=x.topic_id) LEFT OUTER JOIN content as c ON (c.id=x.content_id) 
+                                                                                WHERE c.webdb_create > NOW()-'1 day'::interval AND  t.archiv_url = 'Category' GROUP BY t.title , t.filename ORDER BY t.title"
+                  type="set"/>
+       <Language>          
+       <Generate generator="/topiccount.template"
+               destination="${config.storageRoot}/${pathprefix}/topiccount.html" />
+       </Language>
+  </body>
+  </producer>
+               
+
+
+ <producer name="generateRandomTopics">
+  <verbs>
+    <verb name="doit" />
+  </verbs>
+  <body>
+       <Set key="counter" value="1"/>
+       
+       <Enumerate key="category" table="topic t" extratables="topic t2"
+               selection="t.id=t2.id AND t.archiv_url = 'Subcategory' AND (SELECT count(*) from content_x_topic where topic_id = t.id) > 0" order="RANDOM()" limit="10">
+       
+        <Log message="Getting Last 5 articles for category: ${category.title} - counter: ${counter}" />
+        <Define key="topictitle" value="${category.title}" />
+        <Define key="topicfile" value="${category.filename}" /> 
+        
+        <List key="randomarticles" table="content"
+               selection ="id in (select content_id from content_x_topic where topic_id = ${category.id}) AND is_published=true" order="date DESC"
+               limit="3" />
+        <Language>     
+               <Generate
+                       generator="/randomcategory.template"
+                       destination="${config.storageRoot}/${pathprefix}/randomcats/random${counter}.html" />        
+       </Language>
+        
+        <Set key="counter" value="counter+1" />
+    </Enumerate>
+  </body>
+ </producer>
+                          
  <producer name="getlocalblogs">
    <verbs>
      <verb name="doit" />
     </body>
   </producer>
 
+  <producer name="footer">
+    <verbs>
+      <verb name="generate" default="1" description="generates the default footer"/>
+    </verbs>
+    <body>
+      <Language>
+        <Generate
+            generator="/footer.template"
+            destination="${config.storageRoot}/${pathprefix}/footer.html"/>
+      </Language>
+    </body>
+  </producer>
+
 
+  <producer name="headArticle">
+    <verbs>
+      <verb name="generate" default="1" description="generates the article html head"/>
+    </verbs>
+    <body>
+      <Language>
+        <Generate
+            generator="/head.article.template"
+            destination="${config.storageRoot}/${pathprefix}/head.article.html"/>
+      </Language>
+    </body>
+  </producer>
   
 </producers>