made newswire longer, took out hidden posts from random categories,
[nyc.indymedia.org.git] / etc / producer / routines.template
1 <comment>
2   This file contains several routines to be used in the templates
3 </comment>
4
5 <function showArticleUrl(aPrefix, anArticle, aText, aCSSClass)>
6   <a class="${aCSSClass}" href="/${aPrefix}/${anArticle.date.formatted.yyyy}/${anArticle.date.formatted.MM}/${anArticle.id}.shtml">${aText}</a>
7 </function>
8
9 <function showSafeText(aText)>
10   ${utility.encodeHTML(aText)}
11 </function>
12
13 <function showSafeTextOrDefault(aField, aDefault)>
14   <if aField>
15     <call showSafeText(aField)>
16   <else>
17     ${aDefault}
18   </if>
19 </function>
20
21 <function showAddCommentLink(anArticle, aText, aLanguage)>
22   <a href="${config["Producer.OpenAction"]}?do=addcomment&aid=${anArticle.id}&language=${aLanguage.code}">${aText}</a>
23 </function>
24                             
25 <function showArticleMedia(anArticle)>
26  <!-- media -->
27    <list anArticle.to_media_audio as audio>
28       <br>
29       <br>
30       <a href="${audio["publish_server"]}${audio["publish_path"]}">
31           <img src="/images/${video["big_icon"]}" border="0" alt="">
32           <call showSafeText(audio.title)> - <call showSafeText(audio.descr)>
33       </a>
34    </list>
35
36    <list anArticle.to_media_video as video>
37       <br>
38       <br>
39       <a href="${video["publish_server"]}${video["publish_path"]}">
40           <img src="/images/${video["big_icon"]}" border="0" alt="">
41           <call showSafeText(video.title)> - <call showSafeText(video.descr)>
42       </a>
43    </list>
44
45    <list anArticle.to_media_other as other>
46       <br>
47       <br>
48       <a href="${other["publish_server"]}${other["publish_path"]}">
49           <img src="/images/${other["big_icon"]}" border="0" alt="">
50           <call showSafeText(other.title)> - <call showSafeText(other.descr)>
51       </a>
52    </list>
53
54    <list anArticle.to_media_images as image>
55       <br>
56       <br>
57       <img src="${image["publish_server"]}${image["publish_path"]}"
58               border="0" width="${image["img_width"]}"
59               height="${image["img_height"]}" alt="${image["title"]}"><br>
60       <i><call showSafeText(image.title)></i>
61    </list>
62  <!-- media -->
63 </function>
64
65 <function showArticleMediaIcons(anArticle)>
66     <if anArticle.to_media_audio > 
67       <img src="/img/${anArticle.to_media_audio[0]["big_icon"]}">
68     </if> 
69     
70     <if anArticle.to_media_video > 
71       <img src="/img/${anArticle.to_media_video[0]["big_icon"]}">
72     </if> 
73     
74     <if anArticle.to_media_other > 
75       <img src="/img/${anArticle.to_media_other[0]["big_icon"]}">
76     </if> 
77     
78       <if anArticle.to_media_images >
79         <img src="${anArticle.to_media_images[0]["icon_path"]}"
80           width="${anArticle.to_media_images[0]["icon_width"]}"
81           height="${anArticle.to_media_images[0]["icon_height"]}"
82           border=0 alt="${anArticle.to_media_images[0]["title"]}">
83       </if> 
84 </function>
85
86 <function showArticleAsFeature(anArticle)>
87   <h3><call showSafeText(anArticle.title)></h3>
88   <h4><i><call showSafeText(anArticle.creator)>, ${anArticle.creationdate.formatted["dd.MM.yyyy HH:mm"]}</i></h4>
89     <p>      
90         <call showArticleMediaIcons(anArticle)>
91         ${anArticle.description_parsed} 
92     </p>
93
94     <p align="right">
95       [<call showArticleUrl(pathprefix, anArticle, lang("general.readarticle"), "featurelink")>]
96     </p>
97 </function>
98
99
100 <function showArticleAsNewswire(anArticle)>
101   <img alt=${anArticle.to_media_icon["icon_alt"]} border="0" height="10"
102        src="${anArticle.to_media_icon["tiny_icon"]}" width="12"> 
103        
104   <call showArticleUrl(pathprefix, anArticle, anArticle.title, "")><br />
105   <font size="-2">${n.creationdate.formatted["dd-MM-yyyy HH:mm"]}</font><br>
106 </function>
107