forked from chapitreneuf/nova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros_personnes.html
126 lines (113 loc) · 4.01 KB
/
macros_personnes.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
<CONTENT VERSION="1.0" LANG="fr" CHARSET="utf-8"/>
/**
* Initialisation de la page.
*/
<DEFMACRO NAME="PERSONNES_INIT">
<LET VAR="titre_page" GLOBAL="1">
<IF COND="[#TYPE.TITLE]"><IF COND="[#TYPE.ALTERTITLE:#SITELANG]">[#TYPE.ALTERTITLE:#SITELANG]<ELSE/>[#TYPE.TITLE]</IF></IF> – [#OPTIONS.METADONNEESSITE.TITRESITE]
</LET>
</DEFMACRO>
/**
* Macro principale appelée par le template.
*/
<DEFMACRO NAME="PERSONNES_MAIN">
<MACRO NAME="PERSONNES_TITLE" />
<MACRO NAME="PERSONNES_RACCOURCIS" />
<MACRO NAME="PERSONNES_INDEX" />
</DEFMACRO>
/**
* Titre h1 de la page (type de personnes).
*/
<DEFMACRO NAME="PERSONNES_TITLE">
<h1 id="indexes-alphabet" class="main-title personnes__title">
[@INDEX] | <span class="personnes__type"><IF COND="[#TYPE.ALTERTITLE:#SITELANG]">[#TYPE.ALTERTITLE:#SITELANG]<ELSE/>[#TYPE.TITLE]</IF></span>
</h1>
</DEFMACRO>
/**
* Raccourcis vers les autres personnes.
*/
<DEFMACRO NAME="PERSONNES_RACCOURCIS">
<LOOP NAME="personnes_raccourcis"
TABLE="persons, persontypes"
SELECT="idtype, type AS ptype, title, altertitle"
WHERE="persons.idtype = persontypes.id"
GROUPBY="persontypes.type"
ORDER="persontypes.rank">
<BEFORE>
<IF COND="[#NBLIGNES] GT 1">
<div id="page-shortcuts" class="page-shortcuts">
<ul class="nav nav-pills">
</IF>
</BEFORE>
<DO>
<IF COND="[#NBLIGNES] GT 1">
<LET VAR="active_class"><IF COND="[#TYPE.TYPE] EQ [#PTYPE]">active</IF></LET>
<li class="page-shortcuts__item [#ACTIVE_CLASS]"><a href="[#IDTYPE|makeurlwithid]"><FUNC NAME="BASE_ML_TITRE" INDEX="1" /></a></li>
</IF>
</DO>
<AFTER>
<IF COND="[#NBLIGNES] GT 1">
</ul>
</div>
</IF>
</AFTER>
</LOOP>
</DEFMACRO>
/**
* Affiche le nombre d'entités liées à une autre entité (pour les indexes).
*/
<DEFMACRO NAME="PERSONNES_NOMBRE_ENTITES">
<LOOP NAME="personnes_nombre_entites"
TABLE="relations, entities"
SELECT="count(id) AS n"
WHERE="id2 = '[#ID]' AND type NOT IN ('informations', 'actualite') AND id1 = entities.id AND entities.id [#NOT_IN_TRADUCTIONS]">
<span class="index-list__count">([#N])</span>
</LOOP>
</DEFMACRO>
/**
* Liste des entrées d'index de personnes.
*/
<DEFMACRO NAME="PERSONNES_INDEX">
<LET VAR="table">#_TP_persons</LET>
<LET VAR="field">sortkey</LET>
<LET VAR="idtype">[#TYPE.ID]</LET>
<MACRO NAME="NAV_ALPHABET" />
<div id="indexes-index" class="index-list index-list--plat index-list--type-[%CURRENT_TYPE]">
<LOOP NAME="alphabetSpec">
<LET VAR="lettresql">[#LETTRE|replace("'", "\'")]</LET>
<LOOP NAME="personnes_index_entries"
TABLE="relations, entities, persons, types, persontypes"
SELECT="persons.id, g_firstname, g_familyname"
WHERE="UPPER(SUBSTRING([#FIELD],1,1)) = '[#LETTRESQL]' AND types.type NOT IN ('informations', 'actualite') AND persontypes.type = '[#TYPE.TYPE]' AND persons.idtype = persontypes.id AND relations.id1 = entities.id AND relations.id2 = persons.id"
GROUPBY="persons.id"
ORDER="[#FIELD]">
<BEFORE>
<section id="alpha[#LETTRE|ord]" class="index-list__section">
<div class="row">
<div class="index-list__letter-col col-sm-2 col-sm-offset-1">
<h2 class="index-list__letter">
<a href="#indexes-alphabet">[#LETTRE]</a>
</h2>
</div>
<div class="index-list__contents-col col-sm-8">
<ul class="index-list__list index-list__list--plat index-list__list--personnes">
</BEFORE>
<DO>
<li class="index-list__item index-list__item--plat">
<IF COND="[#OPTIONS.OPTIONSAFFICHAGE.AFFICHAGEINDEXPERSONNES] EQ 'Surname; First name'">
<a href="[#ID|makeurlwithid]"><span class="family-name">[#G_FAMILYNAME]</span><IF COND="[#G_FIRSTNAME]">, [#G_FIRSTNAME]</IF></a> <MACRO NAME="PERSONNES_NOMBRE_ENTITES" />
<ELSE/>
<a href="[#ID|makeurlwithid]">[#G_FIRSTNAME] <span class="family-name">[#G_FAMILYNAME]</span></a> <MACRO NAME="PERSONNES_NOMBRE_ENTITES" />
</IF>
</li>
</DO>
<AFTER>
</ul>
</div>
</div>
</section>
</AFTER>
</LOOP>
</LOOP>
</div>
</DEFMACRO>