-
Notifications
You must be signed in to change notification settings - Fork 4
/
macros_rss.html
253 lines (228 loc) · 8.88 KB
/
macros_rss.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<CONTENT VERSION="1.0" LANG="fr" CHARSET="utf-8"/>
/**
* Initialisation de la page.
*/
<DEFMACRO NAME="RSS_INIT">
</DEFMACRO>
/**
* Macro principale appelée par le template.
*/
<DEFMACRO NAME="RSS_MAIN">
<MACRO NAME="RSS_HEADER" />
<rss version="2.0">
<channel>
<MACRO NAME="RSS_DOCUMENT" />
<MACRO NAME="RSS_INDEX_AUTEURS" />
<MACRO NAME="RSS_INDEX_GENERAL" />
<MACRO NAME="RSS_INDIVIDU" />
</channel>
</rss>
</DEFMACRO>
/**
* Header XML.
*/
<DEFMACRO NAME="RSS_HEADER">
<?php
header("Content-type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
</DEFMACRO>
/**
* Flux RSS des documents.
*/
<DEFMACRO NAME="RSS_DOCUMENT">
<LOOP NAME="rss_document" TABLE="entities, types" WHERE="entities.id='[#IDENTITY]' AND entities.idtype=types.id AND entities.status GT 0" LIMIT="0,1">
<DO>
<IF COND="([#TPL] EQ 'sommaire') OR ([#TPL] EQ 'article')">
<title>[#G_TITLE|textebrut|htmlspecialchars]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<IF COND="[#ID|get_dc_fields('description')]">
<description>[#ID|get_dc_fields('description')|textebrut|htmlspecialchars]</description>
</IF>
<LOOP NAME="rss_document_parent" TABLE="relations, entities" WHERE="id2 = '[#ID]' AND nature = 'P' AND id1 = entities.id" ORDER="degree DESC">
<category domain="[#SITEINFOS.URL]/[#ID|makeurlwithid]">
[#G_TITLE|couper(50)]<IF COND="[#G_TITLE|hasbeencut]">...</IF>
</category>
</LOOP>
<language>fr</language>
<pubDate>[#CREATIONDATE|formateddate('%a, %d %b %Y %T %z')]</pubDate>
<lastBuildDate>[#MODIFICATIONDATE|formateddate('%a, %d %b %Y %T %z')]</lastBuildDate>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
<ttl>0</ttl>
<IF COND="[#TPL] EQ 'sommaire'">
<FUNC NAME="RSS_CHILDREN" TYPENAME="[#TYPENAME]" IDPARENT="[#ID]" />
</IF>
</IF>
</DO>
<ALTERNATIVE>
<IF COND="(![#IDENTITY]) AND (![#QUERY])">
<MACRO NAME="RSS_HOME" />
</IF>
</ALTERNATIVE>
</LOOP>
</DEFMACRO>
/**
* Affiche les enfants de l'entité courante.
* @param {integer} idparent - Identifiant du parent.
* @param {string} [typename] - N'afficher que les élements de ce type.
*/
<DEFFUNC NAME="RSS_CHILDREN" REQUIRED="idparent" OPTIONAL="typename">
<LOOP NAME="rss_children" TABLE="relations, entities, types" WHERE="id1 = '[#IDPARENT]' AND nature = 'P' AND id2 = entities.id AND degree='1' AND entities.status GT 0 AND entities.idtype=types.id">
<DO>
<IF COND="[#CLASS] EQ 'publications' AND [#TYPE] EQ 'souspartie'">
<FUNC NAME="RSS_CHILDREN" TYPENAME="[#TYPENAME]" IDPARENT="[#ID]" />
<ELSEIF COND="![#TYPENAME] OR ([#TYPE] EQ [#TYPENAME])" />
<item>
<title>[#G_TITLE|textebrut|htmlspecialchars] </title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<IF COND="[#ID|get_dc_fields('description')]">
<description>[#ID|get_dc_fields('description')|textebrut|htmlspecialchars]</description>
</IF>
<pubDate>[#CREATIONDATE|formateddate('%a, %d %b %Y %T %z')]</pubDate>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
</item>
</IF>
</DO>
</LOOP>
</DEFFUNC>
/**
* Flux RSS du site.
*/
<DEFMACRO NAME="RSS_HOME">
<!--[ Flux page d'accueil : dix derniers documents publiés ]-->
<LOOP NAME="rss_home" TABLE="sites" WHERE="name='[#SITE]' AND status GT 0" LIMIT="0,1">
<title>[#TITLE]</title>
</LOOP>
<link>[#SITEINFOS.URL]</link>
<IF COND="[#OPTIONS.METADONNEESSITE.DESCRIPTIONSITE]">
<description>[#OPTIONS.METADONNEESSITE.DESCRIPTIONSITE|textebrut|cleanBadChars|replacequotationmark]</description>
</IF>
<language>fr</language>
<LOOP NAME="rss_home_latest_textes" TABLE="textes" LIMIT="0,10" ORDER="datepubli DESC">
<DO>
<item>
<title>[#G_TITLE|textebrut|htmlspecialchars]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<IF COND="[#RESUME|textebrut]">
<description>[#RESUME|textebrut]</description>
<ELSE />
<description>[#TEXTE|textebrut|couper(1500)]</description>
</IF>
<pubDate>[(#DATEPUBLI|formateddate('%a, %d %b %Y %T %z'))]</pubDate>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
</item>
</DO>
</LOOP>
</DEFMACRO>
/**
* Flux RSS des index de personnes.
*/
<DEFMACRO NAME="RSS_INDEX_AUTEURS">
<LOOP NAME="rss_index_auteurs_types" TABLE="persontypes" WHERE="persontypes.id='[#IDENTITY]'">
<DO>
<title>[#TITLE]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<description>[@INDEX]</description>
<language>fr</language>
<ttl>0</ttl>
<LOOP NAME="rss_index_auteurs_entries" TABLE="persons" WHERE="persons.idtype='[#ID]'" LIMIT="0,10" ORDER="upd DESC">
<item>
<title>[#G_FIRSTNAME|removenotes] [#G_FAMILYNAME|removenotes]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
<pubDate>[#UPD]</pubDate>
</item>
</LOOP>
</DO>
</LOOP>
<LOOP NAME="rss_index_auteurs" TABLE="persons, persontypes" WHERE="persons.id='[#IDENTITY]' AND persons.idtype = persontypes.id">
<DO>
<title>[#TITLE] : [#G_FIRSTNAME|removenotes] [#G_FAMILYNAME|removenotes]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<description>[@PUBLICATIONS_DE] [#TITLE] [#G_FIRSTNAME] [#G_FAMILYNAME]</description>
<language>fr</language>
<ttl>0</ttl>
<LOOP NAME="rss_index_auteurs_articles" TABLE="relations, entities" WHERE="relations.id2 = [#ID] AND relations.id1 = entities.id AND entities.status GT 0" LIMIT="0,10" ORDER="creationdate DESC">
<item>
<title>[#G_TITLE|textebrut|htmlspecialchars]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<IF COND="[#ID|get_dc_fields('description')]">
<description>[#ID|get_dc_fields('description')|textebrut|htmlspecialchars]</description>
</IF>
<pubDate>[#CREATIONDATE|formateddate('%a, %d %b %Y %T %z')]</pubDate>
<lastBuildDate>[#MODIFICATIONDATE|formateddate('%a, %d %b %Y %T %z')]</lastBuildDate>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
</item>
</LOOP>
</DO>
</LOOP>
</DEFMACRO>
/**
* Flux RSS des index.
*/
<DEFMACRO NAME="RSS_INDEX_GENERAL">
<LOOP NAME="rss_index_general_types" TABLE="entrytypes" WHERE="entrytypes.id='[#IDENTITY]'">
<DO>
<title>[#TITLE]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<description>[@DERNIERES_ENTREES_INDEX]</description>
<language>fr</language>
<ttl>0</ttl>
<LOOP NAME="rss_index_general_entries" TABLE="entries" WHERE="entries.idtype='[#ID]'" LIMIT="0,10" ORDER="upd DESC">
<item>
<title>[#G_NAME|removenotes]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
<pubDate>[#UPD]</pubDate>
</item>
</LOOP>
</DO>
</LOOP>
<LOOP NAME="rss_index_general" TABLE="entries" WHERE="entries.id='[#IDENTITY]'">
<DO>
<title>[#G_NAME]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<description>[@ENTREES_INDEX]</description>
<language>fr</language>
<ttl>0</ttl>
<LOOP NAME="rss_index_general_entry" TABLE="relations, entities" WHERE="relations.id2 = [#ID] AND relations.id1 = entities.id AND entities.status GT 0" LIMIT="0,10" ORDER="entities.modificationdate DESC">
<item>
<title>[#G_TITLE|textebrut|htmlspecialchars]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<IF COND="[#ID|get_dc_fields('description')]">
<description>[#ID|get_dc_fields('description')|textebrut|htmlspecialchars]</description>
</IF>
<pubDate>[#CREATIONDATE|formateddate('%a, %d %b %Y %T %z')]</pubDate>
<lastBuildDate>[#MODIFICATIONDATE|formateddate('%a, %d %b %Y %T %z')]</lastBuildDate>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
</item>
</LOOP>
</DO>
</LOOP>
</DEFMACRO>
/**
* Flux RSS des individus (n'est plus utilisé).
*/
<DEFMACRO NAME="RSS_INDIVIDU">
<LOOP NAME="rss_individu" TABLE="individus" WHERE="individus.identity='[#IDENTITY]'">
<DO>
<title>[#PRENOM] [#NOM]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<description>[#ACCROCHE]</description>
<language>fr</language>
<ttl>0</ttl>
<LOOP NAME="rss_individu_entry" TABLE="relations, entities" WHERE="relations.id2 = [#ID] AND relations.id1 = entities.id AND entities.status GT 0" LIMIT="0,10" ORDER="entities.modificationdate DESC">
<item>
<title>[#G_TITLE|textebrut|htmlspecialchars]</title>
<link>[#SITEINFOS.URL]/[#ID|makeurlwithid]</link>
<IF COND="[#ID|get_dc_fields('description')]">
<description>[#ID|get_dc_fields('description')|textebrut|htmlspecialchars]</description>
</IF>
<pubDate>[#CREATIONDATE|formateddate('%a, %d %b %Y %T %z')]</pubDate>
<lastBuildDate>[#MODIFICATIONDATE|formateddate('%a, %d %b %Y %T %z')]</lastBuildDate>
<guid isPermaLink="true">[#SITEINFOS.URL]/[#ID|makeurlwithid]</guid>
</item>
</LOOP>
</DO>
</LOOP>
</DEFMACRO>