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