adding doc/comments to producers.xml
[mir.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   please check the mir user's guide and developer's guide
13   for syntax
14 -->  
15
16 <producers>
17   <!-- This first section contains nodedefinitions. -->
18   <!-- A nodedefinition is a sort of "function" that can be "called" later -->
19   <!-- in a producer. -->
20
21   <!-- The Language node enumerates over all  the available languages  -->
22   <!-- and calls the subnode for each language.  This way the subnode  -->
23   <!-- is succesivelly called with its  pathprefix set to "en", "de",  -->
24   <!-- "fr", etc.  -->
25   <nodedefinition name="Language">
26     <parameters>
27       <string name="languagecondition" defaultvalue="code != 'ot'"/>
28       <string name="bundle" defaultvalue="bundles.producer" />
29       <node name="sub"/>    
30     </parameters>
31
32     <definition>
33       <List key="languages" table="language" selection="${languagecondition}" order="code"/>
34       <Enumerate key="language" table="language" selection="${languagecondition}" order="code">
35         <Resource bundle="${bundle}" key="lang" language="${language.code}"/>
36         <Define key="pathprefix" value="${language.code}" />
37         <Define key="languagepreference" value="${language.code}" />
38         <sub/>
39         <If condition="language.code=='en'">
40           <then>
41             <Define key="pathprefix" value="or" />
42             <Define key="languagepreference" value="" />
43             <sub/>
44           </then>
45         </If>
46       </Enumerate>
47     </definition>
48   </nodedefinition>
49
50   <nodedefinition name="RSSChannel">
51     <parameters>
52       <string name="articleSelection"/>
53       <string name="extratables" defaultvalue="none" />
54       <integer name="limit" defaultvalue="15"/>
55       <string name="channelidentifier" defaultvalue=""/>
56       <string name="channelfilename"/>
57       <string name="channeltitle"/>
58       <string name="articleprefix" defaultvalue="${config['Producer.PublicationHost']}/or" />
59       <string name="iconprefix" defaultvalue="${config['Producer.PublicationHost']}/icon" />
60       <string name="channelpublisher" defaultvalue="${config['Mir.Name']}" />
61       <string name="encoding" defaultvalue="UTF-8" />
62       <string name="channeldescription" defaultvalue=""/>
63       <string name="generator" defaultvalue="/RSS.template" />
64     </parameters>
65
66     <definition>
67       <If condition="extratables == 'none' ">
68         <then>
69           <List key="articles" table="content c" selection="${articleSelection}" order = "c.webdb_create desc, c.date desc" limit="limit" />
70         </then>
71         <else>
72           <List key="articles" table="content c" selection="${articleSelection}" order = "c.webdb_create desc, c.date desc" limit="limit" extratables="${extratables}" />
73         </else>
74       </If>
75       <If condition="channeldescription==''">
76         <then>
77           <Define key="channeldescription" value="${channeltitle}"/>
78         </then>
79       </If>
80       <If condition="channelidentifier==''">
81         <then>
82           <Define key="channelidentifier" value="${config['Producer.PublicationHost']}/or/${channelfilename}"/>
83         </then>
84       </If>
85
86       <Generate
87          parameters="${encoding}"
88          generator="${generator}"
89          destination="${config.storageRoot}/${channelfilename}"/>
90     </definition>
91   </nodedefinition>
92
93   <nodedefinition name="RSSChannelBundle">
94     <parameters>
95       <string name="extratables" defaultvalue="none" />
96       <string name="selection" defaultvalue="c.is_published='1'" />  
97       <string name="basefilename" defaultvalue="main" />
98     </parameters>
99     <definition>
100       <!-- newswire -->
101       <RSSChannel
102         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}"
103         channelfilename="${basefilename}-newswire.rss"
104         channeltitle="${config['Mir.Name']} ${basefilename} newswire"
105         limit="20"
106         extratables="${extratables}"
107       />
108       <RSSChannel
109         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}"
110         channelfilename="${basefilename}-newswire-content.rss"
111         channeltitle="${config['Mir.Name']} ${basefilename} newswire"
112         limit="20"
113         generator="RSS-full.template"
114         extratables="${extratables}"
115       />    
116       <!-- features -->
117       <RSSChannel
118         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}"
119         channelfilename="${basefilename}-features.rss"
120         channeltitle="${config['Mir.Name']} ${basefilename} features"
121         limit="20"
122         extratables="${extratables}"
123       />
124       <RSSChannel
125         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}"
126         channelfilename="${basefilename}-features-content.rss"
127         channeltitle="${config['Mir.Name']} ${basefilename} features"
128         limit="20"
129         generator="RSS-full.template"
130         extratables="${extratables}"
131       />
132     </definition>
133   </nodedefinition>
134
135  
136   <!-- This second section contains actual producers that will appear  -->
137   <!-- on the admin->"Generate manually"->"advanced page".             -->
138
139   <!-- This producer generates html  pages, as well as media and video   -->
140   <!-- files for articles stored in the database.  -->
141   <producer name="articles">
142     <verbs>
143       <!-- only generate articles that have not yet been generated  -->
144       <verb name="changed" default="1">
145         <Define key="verbcondition" value="(not is_produced)"/>
146         <Set key="limit" value="10"/>
147       </verb>
148       <!-- generate all articles in the db (under certain condiftions...) -->
149       <verb name="all">
150         <Define key="verbcondition" value=""/>
151         <Set key="limit" value="-1"/>
152       </verb>
153
154       <!-- only generate the last 10 articles in the db  -->
155       <verb name="sample">
156         <Define key="verbcondition" value=""/>
157         <Set key="limit" value="10"/>
158       </verb>
159     </verbs>
160     <body>
161       <!-- loop on all articles requested by the "verb"  -->
162       <Enumerate key="article" table="content" selection="${verbcondition}"
163                   limit="limit" order="webdb_create desc">
164         <!-- for each article, generate it's corresponding image files  -->
165         <Enumerate 
166             key="media" table="image" 
167             selection="exists (select * from content_x_media where media_id=images.id and content_id=${article.id})
168                or      exists (select * from comment_x_media, comment
169                            where comment_id = comment.id and media_id=images.id and comment.to_media=${article.id})"
170             order="id desc">
171             
172            <GenerateMedia key="media" />
173         </Enumerate>
174         <!-- for each article, generate it's corresponding video files -->
175         <Enumerate 
176             key="media" table="video" 
177             selection="exists (select * from content_x_media where media_id=video.id and content_id=${article.id})
178                or      exists (select * from comment_x_media, comment
179                            where comment_id = comment.id and media_id=video.id and comment.to_media=${article.id})"
180             order="id desc">
181            <GenerateMedia key="media" />
182         </Enumerate>
183         <!-- for each article, generate it's corresponding audio files -->
184         <Enumerate 
185             key="media" table="audio" 
186             selection="exists (select * from content_x_media where media_id=audio.id and content_id=${article.id})
187                or      exists (select * from comment_x_media, comment
188                                        where comment_id = comment.id and media_id=audio.id and comment.to_media=${article.id})"
189             order="id desc">
190             
191            <GenerateMedia key="media" />
192         </Enumerate>
193         <!-- for each article, generate it's corresponding other media files -->
194         <Enumerate 
195             key="media" table="otherMedia" 
196             selection="exists (select * from content_x_media where media_id=other_media.id and content_id=${article.id})
197                or      exists (select * from comment_x_media, comment
198                                        where comment_id = comment.id and media_id=other_media.id and comment.to_media=${article.id})"
199             order="id desc">
200             
201            <GenerateMedia key="media" />
202         </Enumerate>
203
204         <If condition="article.is_published == '1'">
205           <!-- only generate published articles -->
206           <then>
207             <!-- loop on all available languages -->
208             <Language>
209               <!-- actually generate the article -->
210               <Generate 
211                 generator="/article.template" 
212                 destination="${config.storageRoot}/${pathprefix}/${article.date.formatted.yyyy}/${article.date.formatted.MM}/${article.id}.shtml"/>
213             </Language>
214              <!-- generate the languagebar -->
215             <Generate 
216               generator="/languagebar.template" 
217               destination="${config.storageRoot}/languagebar/${article.to_original.date.formatted.yyyy}/${article.to_original.date.formatted.MM}/${article.to_original.id}.shtml"/>     
218              <!-- add article to the "search engine" index -->
219              <IndexContent key="article" pathToIndex="${config['IndexPath']}"/>
220           </then>
221           <!-- if article is not published, remove it from the search index -->
222           <else>
223             <UnIndexContent key="article" pathToIndex="${config['IndexPath']}"/>
224           </else>
225         </If>
226         <!-- mark the article as produced -->
227         <MarkContent key="article"/>            
228       </Enumerate>
229     </body>
230   </producer>  
231
232   <!-- generates the left column FIXME more doc?  -->
233   <producer name="navigation">
234     <verbs>
235       <verb name="generate" default="1" description="generates the left column"/>
236     </verbs>
237     <body>
238       <Language>
239         <Generate 
240             generator="/navigation.template" 
241             destination="${config.storageRoot}/${pathprefix}/navigation.inc"/>
242       </Language>
243     </body>
244   </producer>
245   
246   <producer name="staticimages">
247     <verbs>
248       <verb name="generate" default="1" description="copies all the static image files into place"/>
249     </verbs>
250     <body>
251       <CopyDir destination="img" source="etc/producer/images"/>
252     </body>
253   </producer>
254   
255   <producer name="newswirearchive">
256     <verbs>
257       <verb name="new">
258         <Set key="pages" value="3"/>
259       </verb>
260       <verb name="all">
261         <Set key="pages" value="-1"/>
262       </verb>
263     </verbs>
264     <body>
265         <Define key="docSuffix" value=".shtml"/>
266         <Define key="storageSuffix" value=".shtml"/>
267
268         <Batch key="articles" infokey="batch" table="content"
269                process="pages" batchsize="20" minbatchsize="10"
270                selection="is_published='1' and to_article_type = ${articletype.newswire}"
271                order="webdb_create asc">
272           <batches>
273             <Language>
274               <Define key="pagePrefix" value="${pathprefix}/newswire/archive"/>
275               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
276               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
277
278               <Generate
279                   generator="newswirearchive.template"
280                   destination="${storagePrefix}${batch.current.identifier}${storageSuffix}"/>
281
282             </Language>
283           </batches>
284           <batchlist>
285             <Language>
286               <Define key="pagePrefix" value="${pathprefix}/newswire/archive"/>
287               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
288               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
289               <Generate
290                   generator="batchnav.template"
291                   destination="${storagePrefix}nav${storageSuffix}"/>
292             </Language>
293           </batchlist>
294         </Batch>
295     </body>
296   </producer>
297
298   <producer name="featurearchive">
299     <verbs>
300       <verb name="new">
301         <Set key="pages" value="3"/>
302       </verb>
303       <verb name="all">
304         <Set key="pages" value="-1"/>
305       </verb> 
306     </verbs>
307     <body>
308         <Define key="docSuffix" value=".shtml"/>
309         <Define key="storageSuffix" value=".shtml"/>
310         
311         <Batch key="articles" infokey="batch" table="content" 
312                process="pages" batchsize="20" minbatchsize="10"
313                selection="is_published='1' and to_article_type in (${articletype.feature}, ${articletype.startspecial})"
314                order="webdb_create asc">
315           <batches>
316             <Language>
317               <Define key="pagePrefix" value="${pathprefix}/feature/archive"/>
318               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
319               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
320
321               <Generate 
322                   generator="featurearchive.template" 
323                   destination="${storagePrefix}${batch.current.identifier}${storageSuffix}"/>
324
325             </Language>
326           </batches>
327           <batchlist>
328             <Language>
329               <Define key="pagePrefix" value="${pathprefix}/feature/archive"/>
330               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
331               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
332               <Generate 
333                   generator="batchnav.template" 
334                   destination="${storagePrefix}nav${storageSuffix}"/>
335             </Language>
336           </batchlist>
337         </Batch>
338     </body>
339   </producer>
340
341   <producer name="topicpages">
342     <verbs>
343       <verb name="new">
344         <Set key="_topics" value="-1"/>
345         <Set key="pages" value="3"/>
346       </verb>
347       <verb name="all">
348         <Set key="_topics" value="-1"/>
349         <Set key="pages" value="-1"/>
350       </verb> 
351       <verb name="sample">
352         <Set key="_topics" value="2"/>
353         <Set key="pages" value="4"/>
354       </verb> 
355     </verbs>
356     <body>
357       <Enumerate key="topic" table="topic" limit="_topics">
358         <Define key="docSuffix" value=".shtml"/>
359         <Define key="storageSuffix" value=".shtml"/>
360         
361         <List key="special" table="content c" 
362           selection="c.is_published='1' and c.to_article_type = ${articletype.topicspecial} and c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
363           order = "webdb_create desc" limit="1"
364           extratables="content_x_topic cxt"/>
365       
366         <Batch key="articles" infokey="batch" table="content c" 
367                process="pages" batchsize="20" minbatchsize="10"
368                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}"
369                order="webdb_create asc" extratables="content_x_topic cxt">
370           <batches>
371             <Language>
372               <Define key="pagePrefix" value="${pathprefix}/${topic.filename}/archive"/>
373               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
374               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
375
376               <Generate 
377                   generator="topicpage.template" 
378                   destination="${storagePrefix}${batch.current.identifier}${storageSuffix}"/>
379
380             </Language>
381           </batches>
382           <batchlist>
383             <Language>
384               <Define key="pagePrefix" value="${pathprefix}/${topic.filename}/archive"/>
385               <Define key="storagePrefix" value="${config[&quot;Producer.StorageRoot&quot;]}/${pagePrefix}"/>
386               <Define key="docPrefix" value="${config[&quot;Producer.DocRoot&quot;]}/${pagePrefix}"/>
387               <Generate 
388                   generator="batchnav.template" 
389                   destination="${storagePrefix}nav${storageSuffix}"/>
390             </Language>
391           </batchlist>
392         </Batch>
393       </Enumerate>
394     </body>
395   </producer>
396   
397   <!-- generates the main html page (startpage) of an indymedia site  -->
398   <producer name="startpage">
399     <verbs>
400       <verb name="generate" default="1" description="Generates the startpage"/>
401     </verbs>
402
403     <body>
404       <List key="startspecial" table="content" limit="1"
405         selection="is_published=true and to_article_type=${articletype.startspecial}"
406         order="webdb_create desc"/>
407                                         
408       <List key="features" table="content" limit="10" 
409         selection="is_published=true and to_article_type=${articletype.feature}"
410         order="webdb_create desc"/>
411
412       <List key="newswire" table="content" limit="30"
413         selection="is_published=true and to_article_type=${articletype.newswire}"
414         order="webdb_create desc"/>
415         
416       <List key="breakingnews" table="breakingNews" limit="10"
417          order="webdb_create desc"/>
418         
419       <Language>
420         <Generate 
421             generator="/startpage.template" 
422             destination="${config.storageRoot}/${pathprefix}/index.shtml"/>
423       </Language>
424     </body>
425   </producer>  
426   
427   <!-- Use rsync to copy static site to mirrors (only if requested   -->
428   <!-- in config file)  -->
429   <producer name="synchronization">
430     <verbs>
431       <verb name="run" default="1" description="Synchronizes the publication site with the production site"/>
432     </verbs>
433
434     <body>
435       <If condition="config['Rsync'] in ('1', 'y', 'yes', 'Y')">
436         <then>
437           <Execute command="${config['Rsync.Script.Path']}"/>
438         </then>
439       </If>
440     </body>
441   </producer>  
442   
443   
444   <producer name="media">
445     <verbs>
446       <verb name="new" default="1">
447         <Define key="verbcondition" value="(not is_produced)"/>
448         <Set key="limit" value="10"/>
449       </verb>
450       <verb name="all">
451         <Define key="verbcondition" value=""/>
452         <Set key="limit" value="-1"/>
453       </verb>
454
455       <verb name="sample">
456         <Define key="verbcondition" value=""/>
457         <Set key="limit" value="10"/>
458       </verb>
459     </verbs>
460     <body>
461       <Enumerate 
462           key="media" table="image" 
463           selection="${verbcondition}"
464           limit="limit" 
465           order="webdb_create desc">
466           
467          <GenerateMedia key="media" />
468       </Enumerate>
469       <Enumerate 
470           key="media" table="video" 
471           selection="${verbcondition}"
472           limit="limit" 
473           order="webdb_create desc">
474           
475          <GenerateMedia key="media" />
476       </Enumerate>
477       <Enumerate 
478           key="media" table="audio" 
479           selection="${verbcondition}"
480           limit="limit" 
481           order="webdb_create desc">
482           
483          <GenerateMedia key="media" />
484       </Enumerate>
485       <Enumerate 
486           key="media" table="otherMedia" 
487           selection="${verbcondition}"
488           limit="limit" 
489           order="webdb_create desc">
490           
491          <GenerateMedia key="media" />
492       </Enumerate>
493     </body>
494   </producer>  
495
496   <producer name="syndication">
497     <verbs>
498       <verb name="generate" />
499     </verbs>
500     <body>
501       <!-- the main features and newswire -->
502       <RSSChannelBundle />
503       
504       <!-- the topic features and newswires -->
505       <Enumerate key="topic" table="topic">
506         <RSSChannelBundle
507           basefilename="${topic.filename}"
508           selection="c.id=cxt.content_id and cxt.topic_id = ${topic.id}"
509           extratables="content_x_topic cxt"
510         />
511       </Enumerate>
512       
513       
514
515     </body>
516
517   </producer>
518
519   <producer name="radicalendar">
520     <verbs>
521       <verb name="pull" />
522     </verbs>
523     <body>
524       <!-- groupname you will see as the value of "group" in the url for your radicalendar page, -->
525       <!--      gmtoffset is in minutes                                                          -->
526       <Radicalendar key="calendar" groupname="_imc" gmtoffset="60"  />
527       <Generate 
528         generator="/radicalendar.template" 
529         destination="${config.storageRoot}/calendarinclude.shtml"/>
530
531
532     </body>
533   </producer>
534
535   
536 </producers>
537
538