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