added topics list to article generation
[nyc.indymedia.org.git] / etc / producer / producers.xml
1 <!--
2   This XML file defines a set of producers intended for a typical indymedia 
3   site:
4     - a start page
5     - a navigational bar
6     - topic pages
7     - a newswire archive
8     - a feature archive
9     - articles
10     - media
11 -->  
12
13 <producers>
14   <nodedefinition name="Language">
15     <parameters>
16       <string name="languagecondition" defaultvalue="code != 'ot'"/>
17       <string name="bundle" defaultvalue="bundles.producer" />
18       <node name="sub"/>    
19     </parameters>
20
21     <definition>
22       <List key="languages" table="language" selection="${languagecondition}" order="code"/>
23       <Enumerate key="language" table="language" selection="${languagecondition}" order="code">
24         <Resource bundle="${bundle}" key="lang" language="${language.code}"/>
25         <Define key="pathprefix" value="${language.code}" />
26         <Define key="languagepreference" value="${language.code}" />
27         <sub/>
28         <If condition="language.code=='en'">
29           <then>
30             <Define key="pathprefix" value="or" />
31             <Define key="languagepreference" value="" />
32             <sub/>
33           </then>
34         </If>
35       </Enumerate>
36     </definition>
37   </nodedefinition>
38
39 <nodedefinition name="Pull">
40     <parameters>
41       <string name="url"/>
42       <string name="blogname"/>
43       <string name="blogurl"/>
44       <string name="articletype"/>
45     </parameters>
46
47     <definition>
48       <Log message="Pulling 1.0 feed from ${blogname} at ${url}" type="info" />
49       <RSS key="feeditems" url="${url}" encoding="UTF-8" />
50       <Enumerate key="item" list="feeditems['rss:item']" >
51         <Define key="languagecode" value="ot" />
52         <If condition="item['dc:language']">
53           <then>
54             <Set key="languagecode" value="item['dc:language']"/>
55           </then>
56         </If>
57
58         <If condition="item['dc:source']">
59           <then>
60             <Set key="origin" value="item['dc:source']"/>
61           </then>
62           <else>
63             <Set key="origin" value="item.identifier"/>
64           </else>
65         </If>
66         
67         
68
69         <If condition="item['dcterms:hasPart']">
70           <then>
71             <Set key="haspartimg" value="'&lt;img align=&quot;right&quot; src=&quot;'++item['dcterms:hasPart'] ++'&quot; /&gt;' " />
72           </then>
73           <else>
74             <Set key="haspartimg" value="' '" />
75           </else>
76         </If>
77
78         <Set key="present" value="0" />
79         <Enumerate
80           key="article"
81           table="content"
82           selection="source='${utility.escapeJDBCString(origin)}'" limit="1">
83           <Set key="present" value="1" />
84         </Enumerate>
85         <If condition="present==0">
86           <then>
87             <Log message="  new entry from ${blogname}: ${item['rss:title']}" type="info" />
88              <CreateEntity
89                key="article"
90                table="content"
91
92                date="utility.datetime.formatDate(item['dc:date'], 'yyyyMMdd')"
93                publish_path="' '"
94                to_publisher="'0'"
95                is_produced="'0'"
96                is_published="'1'"
97                is_html="'1'"
98
99                source="origin"
100                to_article_type="articletype"
101
102                content_data="item['content:encoded']++' '"
103                creator_main_url="blogurl"
104                description="haspartimg++item['rss:description']++' '"
105                to_language="languageCodeToId(languagecode)"
106                title="item['rss:title']++''"
107                webdb_create="item['dc:date']"
108                creator="blogname"
109                comment="'Taken from ' ++ blogname"
110              />
111           </then>
112         </If>
113       </Enumerate>
114     </definition>
115   </nodedefinition>
116
117
118   <nodedefinition name="RSSChannel">
119     <parameters>
120       <string name="articleSelection"/>
121       <string name="extratables" defaultvalue="none" />
122       <integer name="limit" defaultvalue="15"/>
123       <string name="channelidentifier" defaultvalue=""/>
124       <string name="channelfilename"/>
125       <string name="channeltitle"/>
126       <string name="articleprefix" defaultvalue="${config['Producer.PublicationHost']}/or" />
127       <string name="iconprefix" defaultvalue="${config['Producer.PublicationHost']}/icon" />
128       <string name="channelpublisher" defaultvalue="${config['Mir.Name']}" />
129       <string name="encoding" defaultvalue="UTF-8" />
130       <string name="channeldescription" defaultvalue=""/>
131       <string name="generator" defaultvalue="/RSS.template" />
132     </parameters>
133
134     <definition>
135       <If condition="extratables == 'none' ">
136         <then>
137           <List key="articles" table="content c" selection="${articleSelection}" order = "c.webdb_create desc, c.date desc" limit="limit" />
138         </then>
139         <else>
140           <List key="articles" table="content c" selection="${articleSelection}" order = "c.webdb_create desc, c.date desc" limit="limit" extratables="${extratables}" />
141         </else>
142       </If>
143       <If condition="channeldescription==''">
144         <then>
145           <Define key="channeldescription" value="${channeltitle}"/>
146         </then>
147       </If>
148       <If condition="channelidentifier==''">
149         <then>
150           <Define key="channelidentifier" value="${config['Producer.PublicationHost']}/or/${channelfilename}"/>
151         </then>
152       </If>
153
154       <Generate
155          parameters="${encoding}"
156          generator="${generator}"
157          destination="${config.storageRoot}/${channelfilename}"/>
158     </definition>
159   </nodedefinition>
160
161   <nodedefinition name="RSSChannelBundle">
162     <parameters>
163       <string name="extratables" defaultvalue="none" />
164       <string name="selection" defaultvalue="c.is_published='1'" />  
165       <string name="basefilename" defaultvalue="main" />
166     </parameters>
167     <definition>
168       <!-- newswire -->
169       <RSSChannel
170         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}"
171         channelfilename="${basefilename}-newswire.rss"
172         channeltitle="${config['Mir.Name']} ${basefilename} newswire"
173         limit="20"
174         extratables="${extratables}"
175       />
176       <RSSChannel
177         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}"
178         channelfilename="${basefilename}-newswire-content.rss"
179         channeltitle="${config['Mir.Name']} ${basefilename} newswire"
180         limit="20"
181         generator="RSS-full.template"
182         extratables="${extratables}"
183       />    
184       <!-- features -->
185       <RSSChannel
186         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}"
187         channelfilename="${basefilename}-features.rss"
188         channeltitle="${config['Mir.Name']} ${basefilename} features"
189         limit="20"
190         extratables="${extratables}"
191       />
192       <RSSChannel
193         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}"
194         channelfilename="${basefilename}-features-content.rss"
195         channeltitle="${config['Mir.Name']} ${basefilename} features"
196         limit="20"
197         generator="RSS-full.template"
198         extratables="${extratables}"
199       />
200     </definition>
201   </nodedefinition>
202
203  
204   <producer name="articles">
205     <verbs>
206       <verb name="changed" default="1">
207         <Define key="verbcondition" value="(not is_produced)"/>
208         <Set key="limit" value="10"/>
209       </verb>
210       <verb name="all">
211         <Define key="verbcondition" value=""/>
212         <Set key="limit" value="-1"/>
213       </verb>
214
215       <verb name="sample">
216         <Define key="verbcondition" value=""/>
217         <Set key="limit" value="10"/>
218       </verb>
219     </verbs>
220     <body>
221       <Enumerate key="article" table="content" selection="${verbcondition}"
222                   limit="limit" order="webdb_create desc">
223         <Enumerate 
224             key="media" table="image" 
225             selection="exists (select * from content_x_media where media_id=images.id and content_id=${article.id})
226                or      exists (select * from comment_x_media, comment
227                            where comment_id = comment.id and media_id=images.id and comment.to_media=${article.id})"
228             order="id desc">
229             
230            <GenerateMedia key="media" />
231         </Enumerate>
232         <Enumerate 
233             key="media" table="video" 
234             selection="exists (select * from content_x_media where media_id=video.id and content_id=${article.id})
235                or      exists (select * from comment_x_media, comment
236                            where comment_id = comment.id and media_id=video.id and comment.to_media=${article.id})"
237             order="id desc">
238            <GenerateMedia key="media" />
239         </Enumerate>
240         <Enumerate 
241             key="media" table="audio" 
242             selection="exists (select * from content_x_media where media_id=audio.id and content_id=${article.id})
243                or      exists (select * from comment_x_media, comment
244                                        where comment_id = comment.id and media_id=audio.id and comment.to_media=${article.id})"
245             order="id desc">
246             
247            <GenerateMedia key="media" />
248         </Enumerate>
249         
250       
251         <Enumerate 
252             key="media" table="otherMedia" 
253             selection="exists (select * from content_x_media where media_id=other_media.id and content_id=${article.id})
254                or      exists (select * from comment_x_media, comment
255                                        where comment_id = comment.id and media_id=other_media.id and comment.to_media=${article.id})"
256             order="id desc">
257             
258            <GenerateMedia key="media" />
259         </Enumerate>
260
261
262               <List key="topics" table="topic t"
263                 selection="ctx.content_id = ${article.id} AND ctx.topic_id = t.id" />
264
265         <If condition="article.is_published == '1'">
266           <then>
267             <Language>
268               <Generate 
269                 generator="/article.template" 
270                 destination="${config.storageRoot}/${pathprefix}/${article.date.formatted.yyyy}/${article.date.formatted.MM}/${article.id}.shtml"/>
271              </Language>
272              <Generate 
273                 generator="/languagebar.template" 
274                 destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.shtml"/>   
275              <IndexContent key="article" pathToIndex="${config['IndexPath']}"/>
276           </then>
277           <else>
278             <UnIndexContent key="article" pathToIndex="${config['IndexPath']}"/>
279           </else>
280         </If>
281         <MarkContent key="article"/>            
282       </Enumerate>
283     </body>
284   </producer>  
285
286   <producer name="staticpages">
287     <verbs>
288       <verb name="changed" default="1">
289         <Define key="verbcondition" value="(not is_produced)"/>
290         <Set key="limit" value="10"/>
291       </verb>
292       <verb name="all">
293         <Define key="verbcondition" value=""/>
294         <Set key="limit" value="-1"/>
295       </verb>
296     </verbs>
297
298     <body>
299       <Enumerate key="article" table="content" selection="${verbcondition}  and to_article_type = ${articletype.static}"
300                   limit="limit" order="webdb_create desc">
301         <Enumerate 
302             key="media" table="image" 
303             selection="exists (select * from content_x_media where media_id=images.id and content_id=${article.id})"
304             order="id desc">
305             
306            <GenerateMedia key="media" />
307         </Enumerate>
308         <Enumerate 
309             key="media" table="video" 
310             selection="exists (select * from content_x_media where media_id=video.id and content_id=${article.id})"
311             order="id desc">
312
313            <GenerateMedia key="media" />
314         </Enumerate>
315         <Enumerate 
316             key="media" table="audio" 
317             selection="exists (select * from content_x_media where media_id=audio.id and content_id=${article.id})"
318             order="id desc">
319             
320            <GenerateMedia key="media" />
321         </Enumerate>
322         <Enumerate 
323             key="media" table="otherMedia" 
324             selection="exists (select * from content_x_media where media_id=other_media.id and content_id=${article.id})"
325
326             order="id desc">
327             
328            <GenerateMedia key="media" />
329         </Enumerate>
330
331         <If condition="article.is_published == '1'">
332           <then>
333             <Language>
334               <Generate 
335                 generator="/article.template" 
336                 destination="${config.storageRoot}/${pathprefix}/static/${article.edittitle}.shtml"/>
337              </Language>
338              <Generate 
339                 generator="/languagebar.template" 
340                 destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.shtml"/>   
341              <IndexContent key="article" pathToIndex="${config['IndexPath']}"/>
342           </then>
343           <else>
344             <UnIndexContent key="article" pathToIndex="${config['IndexPath']}"/>
345           </else>
346         </If>
347         <MarkContent key="article"/>            
348       </Enumerate>
349     </body>
350   </producer>
351
352   <producer name="navigation">
353     <verbs>
354       <verb name="generate" default="1" description="generates the left column"/>
355     </verbs>
356     <body>
357       <Language>
358         <Generate 
359             generator="/navigation.template" 
360             destination="${config.storageRoot}/${pathprefix}/navigation.inc"/>
361       </Language>
362     </body>
363   </producer>
364   
365   <producer name="staticimages">
366     <verbs>
367       <verb name="generate" default="1" description="copies all the static image files into place"/>
368     </verbs>
369     <body>
370       <CopyDir destination="img" source="etc/producer/images"/>
371     </body>
372   </producer>
373   
374   <producer name="newswirearchive">
375     <verbs>
376       <verb name="new">
377         <Set key="pages" value="3"/>
378       </verb>
379       <verb name="all">
380         <Set key="pages" value="-1"/>
381       </verb>
382     </verbs>
383     <body>
384         <Define key="docSuffix" value=".shtml"/>
385         <Define key="storageSuffix" value=".shtml"/>
386
387         <Batch key="articles" infokey="batch" table="content"
388                process="pages" batchsize="20" minbatchsize="10"
389                selection="is_published='1' and to_article_type = ${articletype.newswire}"
390                order="webdb_create asc">
391           <batches>
392             <Language>
393               <Define key="pagePrefix" value="${pathprefix}/newswire/archive"/>
394               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
395               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
396
397               <Generate
398                   generator="newswirearchive.template"
399                   destination="${storagePrefix}${batch.current.identifier}${storageSuffix}"/>
400
401             </Language>
402           </batches>
403           <batchlist>
404             <Language>
405               <Define key="pagePrefix" value="${pathprefix}/newswire/archive"/>
406               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
407               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
408               <Generate
409                   generator="batchnav.template"
410                   destination="${storagePrefix}nav${storageSuffix}"/>
411             </Language>
412           </batchlist>
413         </Batch>
414     </body>
415   </producer>
416
417   <producer name="featurearchive">
418     <verbs>
419       <verb name="new">
420         <Set key="pages" value="3"/>
421       </verb>
422       <verb name="all">
423         <Set key="pages" value="-1"/>
424       </verb> 
425     </verbs>
426     <body>
427         <Define key="docSuffix" value=".shtml"/>
428         <Define key="storageSuffix" value=".shtml"/>
429         
430         <Batch key="articles" infokey="batch" table="content" 
431                process="pages" batchsize="20" minbatchsize="10"
432                selection="is_published='1' and to_article_type in (${articletype.feature}, ${articletype.startspecial})"
433                order="webdb_create asc">
434           <batches>
435             <Language>
436               <Define key="pagePrefix" value="${pathprefix}/feature/archive"/>
437               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
438               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
439
440               <Generate 
441                   generator="featurearchive.template" 
442                   destination="${storagePrefix}${batch.current.identifier}${storageSuffix}"/>
443
444             </Language>
445           </batches>
446           <batchlist>
447             <Language>
448               <Define key="pagePrefix" value="${pathprefix}/feature/archive"/>
449               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
450               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
451               <Generate 
452                   generator="batchnav.template" 
453                   destination="${storagePrefix}nav${storageSuffix}"/>
454             </Language>
455           </batchlist>
456         </Batch>
457     </body>
458   </producer>
459
460   <producer name="topicpages">
461     <verbs>
462       <verb name="new">
463         <Set key="_topics" value="-1"/>
464         <Set key="pages" value="3"/>
465       </verb>
466       <verb name="all">
467         <Set key="_topics" value="-1"/>
468         <Set key="pages" value="-1"/>
469       </verb> 
470       <verb name="sample">
471         <Set key="_topics" value="2"/>
472         <Set key="pages" value="4"/>
473       </verb> 
474     </verbs>
475     <body>
476       <Enumerate key="topic" table="topic">
477         <Define key="docSuffix" value=".html"/>
478         <Define key="storageSuffix" value=".html"/>
479         
480         <Log message="topic = ${topic.title}" />
481         <List key="special" table="content c" 
482           selection="c.is_published='1' and c.to_article_type = ${articletype.topicspecial} and c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
483           order = "webdb_create desc" limit="1"
484           extratables="content_x_topic cxt"/>
485       
486         <Batch key="articles" infokey="batch" table="content c" 
487                process="pages" batchsize="20" minbatchsize="10"
488                selection="c.is_published='1' and c.to_article_type in (${articletype.newswire}, ${articletype.feature}) and c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
489                order="webdb_create asc" extratables="content_x_topic cxt">
490           <batches>
491             <Language>
492               <Define key="pagePrefix" value="${pathprefix}/${topic.filename}/archive"/>
493               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
494               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
495                   <Log message="topic now = ${topic.title}" />
496
497               <Generate 
498                   generator="topicpage.template" 
499                   destination="${storagePrefix}${batch.current.identifier}${storageSuffix}"/>
500
501             </Language>
502           </batches>
503           <batchlist>
504             <Language>
505               <Define key="pagePrefix" value="${pathprefix}/${topic.filename}/archive"/>
506               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
507               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
508               <Generate 
509                   generator="batchnav.template" 
510                   destination="${storagePrefix}nav${storageSuffix}"/>
511             </Language>
512           </batchlist>
513         </Batch>
514       </Enumerate>
515     </body>
516   </producer>
517
518
519   <producer name="opnewswireinclude">
520     <verbs>
521       <verb name="generate" default="1" description="Generates the op newswire"/>
522     </verbs>
523 <body>
524 <Set key="whichnewswire" value="Open Publishing News" />
525       <List key="newswire" table="content" limit="20"
526         selection="is_published=true and to_article_type=${articletype.newswire}"
527         order="webdb_create desc"/>
528       <Language>
529         <Generate 
530             generator="/newswireinclude.template" 
531             destination="${config.storageRoot}/${pathprefix}/newswireinclude.shtml"/>
532       </Language>
533
534
535 </body>
536 </producer>
537
538   <producer name="rssnewswireinclude">
539     <verbs>
540       <verb name="generate" default="1" description="Generates the rss newswire"/>
541     </verbs>
542 <body>
543 <Set key="whichnewswire" value="RSS Publishing News" />
544       <List key="newswire" table="content" limit="20"
545         selection="is_published=true and to_article_type=${articletype.communityrssarticle}"
546         order="webdb_create desc"/>
547       <Language>
548         <Generate 
549             generator="/newswireinclude.template" 
550             destination="${config.storageRoot}/${pathprefix}/rssnewswireinclude.shtml"/>
551       </Language>
552
553
554 </body>
555 </producer>
556
557
558   
559   <producer name="startpage">
560     <verbs>
561       <verb name="generate" default="1" description="Generates the startpage"/>
562     </verbs>
563
564     <body>
565       <List key="startspecial" table="content" limit="1"
566         selection="is_published=true and to_article_type=${articletype.startspecial}"
567         order="webdb_create desc"/>
568                                         
569       <List key="features" table="content" limit="5" 
570         selection="is_published=true and to_article_type in (${articletype.feature},${articletype.promotedcommunityarticle},${articletype.promotednewswire})"
571         order="webdb_create desc"/>
572
573       <List key="communityrssarticles" table="content" limit="10" 
574         selection="is_published=true and to_article_type in (${articletype.communityrssarticle},${articletype.promotedcommunityarticle})"
575         order="webdb_create desc"/>
576
577       <List key="newswire" table="content" limit="20"
578         selection="is_published=true and to_article_type=${articletype.newswire}"
579         order="webdb_create desc"/>
580         
581       <List key="mostcomments"
582                   table="content c"
583                   extratables="comment cm"
584                   selection="c.webdb_create > NOW()-'2 years'::interval and c.is_published=true and c.id=cm.to_media group by c.id,c.title,
585                                          c.subtitle,c.edittitle,c.date,c.creator,c.creator_main_url,c.creator_email,c.creator_address,c.creator_phone,c.description,
586                                          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,
587                                          c.content_data,c.is_html,c.to_article_type,c.to_content,c.keywords,c.to_locking_user"
588                           order="count(cm.id) desc"
589                           limit="3"
590                     />    
591                 
592         
593       <List key="breakingnews" table="breakingNews" limit="10"
594          order="webdb_create desc"/>
595         
596       <Language>
597         <Generate 
598             generator="/startpage.template" 
599             destination="${config.storageRoot}/${pathprefix}/index.html"/>
600       </Language>
601     </body>
602   </producer>  
603   
604   <producer name="synchronization">
605     <verbs>
606       <verb name="run" default="1" description="Synchronizes the publication site with the production site"/>
607     </verbs>
608
609     <body>
610       <If condition="config['Rsync'] in ('1', 'y', 'yes', 'Y')">
611         <then>
612           <Execute command="${config['Rsync.Script.Path']}"/>
613         </then>
614       </If>
615     </body>
616   </producer>  
617   
618   
619   <producer name="media">
620     <verbs>
621       <verb name="new" default="1">
622         <Define key="verbcondition" value="(not is_produced)"/>
623         <Set key="limit" value="10"/>
624       </verb>
625       <verb name="all">
626         <Define key="verbcondition" value=""/>
627         <Set key="limit" value="-1"/>
628       </verb>
629
630       <verb name="sample">
631         <Define key="verbcondition" value=""/>
632         <Set key="limit" value="10"/>
633       </verb>
634     </verbs>
635     <body>
636       <Enumerate 
637           key="media" table="image" 
638           selection="${verbcondition}"
639           limit="limit" 
640           order="webdb_create desc">
641           
642          <GenerateMedia key="media" />
643       </Enumerate>
644       <Enumerate 
645           key="media" table="video" 
646           selection="${verbcondition}"
647           limit="limit" 
648           order="webdb_create desc">
649           
650          <GenerateMedia key="media" />
651       </Enumerate>
652       <Enumerate 
653           key="media" table="audio" 
654           selection="${verbcondition}"
655           limit="limit" 
656           order="webdb_create desc">
657           
658          <GenerateMedia key="media" />
659       </Enumerate>
660       <Enumerate 
661           key="media" table="otherMedia" 
662           selection="${verbcondition}"
663           limit="limit" 
664           order="webdb_create desc">
665           
666          <GenerateMedia key="media" />
667       </Enumerate>
668     </body>
669   </producer>  
670
671   <producer name="syndication">
672     <verbs>
673       <verb name="generate" />
674     </verbs>
675     <body>
676       <!-- the main features and newswire -->
677       <RSSChannelBundle />
678       
679       <!-- the topic features and newswires -->
680       <Enumerate key="topic" table="topic">
681         <RSSChannelBundle
682           basefilename="${topic.filename}"
683           selection="c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
684           extratables="content_x_topic cxt"
685         />
686       </Enumerate>
687       
688       
689
690     </body>
691
692   </producer>
693
694   <producer name="radicalendar">
695     <verbs>
696       <verb name="pull" />
697     </verbs>
698     <body>
699       <!-- groupname you will see as the value of "group" in the url for your radicalendar page, -->
700       <!--      gmtoffset is in minutes                                                          -->
701       <Radicalendar key="calendar" groupname="_imc" gmtoffset="60"  />
702       <Generate 
703         generator="/radicalendar.template" 
704         destination="${config.storageRoot}/calendarinclude.shtml"/>
705
706
707     </body>
708   </producer>
709
710
711   <producer name="update">
712     <verbs>
713       <verb name="templates" description="updates templates and bundles">
714         <Define key="command" value="/usr/bin/rsync -rb --include=*/ --include=*.template  /var/lib/mir/nyc/mir/etc/ /var/lib/mir/nyc/mir/bin/mir/WEB-INF/etc/"/>
715       </verb>
716     </verbs>
717
718     <body>
719       <Execute command="${command}"/>
720     </body>
721   </producer>
722
723
724
725
726
727  <producer name="generatefpincludes">
728    <verbs>
729      <verb name="doit" />
730    </verbs>
731    <body>
732
733         <Set key="counter" value="1"/>
734       <Enumerate key="fpimage" table="image" selection="to_media_folder=8 and is_published=true" >
735         <Log message="generating include for image id: ${fpimage.id}" type="info" />
736
737           <Generate
738                 generator="/fpinclude.template"
739                 destination="${config.storageRoot}/fpincludes/${fpimage.id}.inc" />
740        <Set key="counter" value="counter+1" />
741       </Enumerate>
742
743
744            <List key="fpincludes" table="image" selection="to_media_folder=8 and is_published=true" />
745                 <Generate
746                         generator="/fpmapping.template"
747                         destination="${config.storageRoot}/fpincludes/map.txt" />
748
749     </body>
750   </producer>
751
752
753
754
755  <!-- generates a count for each topic -->
756  
757  <!-- TODO: add date limit when we actually are going live with this -->        
758  <producer name="generateTopicCounts"> 
759  <verbs>
760         <verb name="doit" />
761  </verbs>
762  <body>
763         <FreeQuery key="topicCounts" query=" SELECT count(x.content_id) as count, t.title FROM topic as t LEFT OUTER JOIN content_x_topic 
764                                                                                  as x ON (t.id=x.topic_id) LEFT OUTER JOIN content as c ON (c.id=x.content_id) 
765                                                                                  WHERE t.archiv_url = 'Category' GROUP BY t.title ORDER BY length(t.title)"
766                    type="set"/>
767                    
768         <Generate generator="/topiccount.template"
769                 destination="${config.storageRoot}/${pathprefix}/topiccount.shtml" />
770   </body>
771   </producer>
772                 
773
774
775  <producer name="generateRandomTopics">
776   <verbs>
777     <verb name="doit" />
778   </verbs>
779   <body>
780         <Set key="counter" value="1"/>
781         
782         <Enumerate key="category" table="topic t" extratables="topic t2"
783                 selection="t.id=t2.id AND t.archiv_url = 'Category' AND (SELECT count(*) from content_x_topic where topic_id = t.id) > 0" order="RANDOM()" limit="20">
784         
785         <Log message="Getting Last 5 articles for category: ${category.title} - counter: ${counter}" />
786         <Define key="topictitle" value="${category.title}" />
787         
788         
789         <List key="randomarticles" table="content"
790                 selection ="id in (select content_id from content_x_topic where topic_id = ${category.id})" order="date DESC"
791                 limit="1" />
792         <Language>      
793         <Generate
794                 generator="/randomcategory.template"
795                 destination="${config.storageRoot}/fpincludes/random${counter}.inc" />        
796         </Language>
797         
798         <Set key="counter" value="counter+1" />
799     </Enumerate>
800   </body>
801  </producer>
802                           
803  <producer name="getlocalblogs">
804    <verbs>
805      <verb name="doit" />
806    </verbs>
807    <body>
808       <Enumerate key="article" table="content" selection="to_article_type in(${articletype.communityrssfeed}) and is_published=true"  order="webdb_create desc">
809         <Log message="Pulling 1.0 feed from ${article.title} at ${article.source}" type="info" />
810         <Pull
811           url="${article.source}"
812           articletype="${articletype.communityrssarticle}"
813           blogurl="${article.creator_main_url}"
814           blogname="${article.title}"
815         />
816       </Enumerate>
817     </body>
818   </producer>
819
820
821   
822 </producers>
823
824