commons_site.html
1 <#assign optSiteCommons=.get_optional_template('commons_site.ftl')>
2 <#if optSiteCommons.exists><@optSiteCommons.include /></#if>
3 <#-- WARNING : be careful to white-space and lines break in FreeMarker macros.
4 # This macro template can be used to output white-space-sensitive formats (like RSS files).
5 # See http://dev.lutece.paris.fr/jira/browse/LUTECE-765
6 -->
7 <#-- Do not remove this comment -->
8 <#macro comboSiteWithParams name default_value additionalParameters items >
9 <select id="${name}" name="${name}" ${additionalParameters} >
10 <#list items as item>
11 <#if default_value="${item.code}">
12 <option selected="selected" value="${item.code}" >${item.name}</option>
13 <#else>
14 <option value="${item.code}" >${item.name}</option>
15 </#if>
16 </#list>
17 </select>
18 </#macro>
19 <#macro comboSiteSortedWithParams name default_value additionalParameters items >
20 <select id="${name}" name="${name}" ${additionalParameters} >
21 <#list items?sort_by("name") as item>
22 <#if default_value="${item.code}">
23 <option selected="selected" value="${item.code}" >${item.name}</option>
24 <#else>
25 <option value="${item.code}" >${item.name}</option>
26 </#if>
27 </#list>
28 </select>
29 </#macro>
30 <#macro comboSiteWithParamsAndLength name default_value additionalParameters items max_length >
31 <select id="${name}" name="${name}" ${additionalParameters} >
32 <#list items as item>
33 <#if max_length < item.name?length >
34 <#assign item_new = "..." + "${item.name?substring(item.name?length-max_length+3)}" >
35 <#else>
36 <#assign item_new = "${item.name}">
37 </#if>
38 <#if default_value="${item.code}">
39 <option selected="selected" value="${item.code}" >${item_new}</option>
40 <#else>
41 <option value="${item.code}" >${item_new}</option>
42 </#if>
43 </#list>
44 </select>
45 </#macro>
46 <#macro comboSite name default_value items >
47 <@comboSiteWithParams name="${name}" default_value="${default_value}" additionalParameters="" items=items />
48 </#macro>
49 <#macro comboSiteSorted name default_value items >
50 <@comboSite name="${name}" default_value="${default_value}" items=items?sort_by("name") />
51 </#macro>
52 <#macro sortSite jsp_url attribute id="" >
53 <#if jsp_url?contains("?")>
54 <#assign sort_url = jsp_url + "&sorted_attribute_name=" + attribute + "&asc_sort=" />
55 <#else>
56 <#assign sort_url = jsp_url + "?sorted_attribute_name=" + attribute + "&asc_sort=" />
57 </#if>
58 <a id="sort${id!}_${attribute!}" href="${sort_url}true#sort${id!}_${attribute!}" title="#i18n{portal.util.sort.asc}" >
59 <i class="icon-chevron-up"> </i>
60 </a>
61 <a href="${sort_url}false#sort${id!}_${attribute!}" title="#i18n{portal.util.sort.desc}">
62 <i class="icon-chevron-down"> </i>
63 </a>
64 </#macro>
65 <#macro paginationSite paginator combo=0 form=1 nb_items_per_page=nb_items_per_page showcount=0>
66 <#if (paginator.pagesCount > 1) >
67 <@paginationSitePageLinks paginator=paginator />
68 </#if>
69 <#if form == 1 >
70 <form method="post" action="">
71 </#if>
72 <div class="row-fluid">
73 <div class="pull-right" >
74 <div class="form-inline">
75 <@paginationSiteItemCount paginator=paginator combo=combo nb_items_per_page=nb_items_per_page showcount=showcount />
76 </div>
77 </div>
78 </div>
79 <#if form == 1 >
80 </form>
81 </#if>
82 <div class="table"></div>
83 </#macro>
84 <#macro paginationSitePageLinks paginator >
85 <#assign nbLinkPagesToDisplay = 10 />
86 <#assign offsetPrev = nbLinkPagesToDisplay / 2 />
87 <#assign offsetNext = nbLinkPagesToDisplay / 2 />
88 <#if ( paginator.pageCurrent <= nbLinkPagesToDisplay - offsetPrev )>
89 <#assign offsetPrev = paginator.pageCurrent - 1 />
90 <#assign offsetNext = nbLinkPagesToDisplay - offsetPrev />
91 <#elseif ( paginator.pageCurrent + offsetNext > paginator.pagesCount )>
92 <#assign offsetNext = paginator.pagesCount - paginator.pageCurrent />
93 <#assign offsetPrev = nbLinkPagesToDisplay - offsetNext />
94 </#if>
95 <ul class="pagination pagination-sm">
96 <#if ( paginator.pageCurrent - offsetPrev > 1 )>
97 <li>
98 <a href="${paginator.firstPageLink?xhtml}">
99 ${paginator.labelFirst}
100 </a>
101 </li>
102 </#if>
103 <#if (paginator.pageCurrent > 1) >
104 <li class="previous">
105 <a href="${paginator.previousPageLink?xhtml}">
106 ${paginator.labelPrevious}
107 </a>
108 </li>
109 <#else>
110 <li class="disabled">
111 <a href="${paginator.firstPageLink?xhtml}">${paginator.labelPrevious}</a>
112 </li>
113 </#if>
114 <#if ( paginator.pageCurrent - offsetPrev > 1 )>
115 <li>
116 <a href="${(paginator.pagesLinks?first).url?xhtml}"><strong>...</strong></a>
117 </li>
118 </#if>
119 <#list paginator.pagesLinks as link>
120 <#if ( link.index == paginator.pageCurrent )>
121 <li class="active">
122 <a href="${link.url?xhtml}">${link.name}</a>
123 </li>
124 <#else>
125 <li>
126 <a href="${link.url?xhtml}">${link.name}</a>
127 </li>
128 </#if>
129 </#list>
130 <#if ( paginator.pageCurrent + offsetNext < paginator.pagesCount )>
131 <li>
132 <a href="${(paginator.pagesLinks?last).url?xhtml}"><strong>...</strong></a>
133 </li>
134 </#if>
135 <#if (paginator.pageCurrent < paginator.pagesCount) >
136 <li class="next">
137 <a href="${paginator.nextPageLink?xhtml}">
138 ${paginator.labelNext}
139 </a>
140 </li>
141 <#if ( paginator.pageCurrent + offsetNext < paginator.pagesCount )>
142 <li class="next">
143 <a href="${paginator.lastPageLink?xhtml}">
144 ${paginator.labelLast}
145 </a>
146 </li>
147 </#if>
148 <#else>
149 <li class="disabled">
150 <a href="${paginator.lastPageLink?xhtml}">${paginator.labelNext}</a>
151 </li>
152 </#if>
153 </ul>
154 </#macro>
155 <#macro paginationSiteCombo paginator nb_items_per_page=nb_items_per_page>
156 <span class="add-on">${paginator.labelItemCountPerPage}</span>
157 <select class="input-mini" name="${paginator.itemsPerPageParameterName}" id="${paginator.itemsPerPageParameterName}" title="${paginator.labelItemCountPerPage}">
158 <#list [ "10" , "20" , "50" , "100" ] as nb>
159 <#if nb_items_per_page = nb >
160 <option selected="selected" value="${nb}">${nb}</option>
161 <#else>
162 <option value="${nb}">${nb}</option>
163 </#if>
164 </#list>
165 </select>
166 <button class="btn btn-small" type="submit" title="#i18n{portal.util.labelRefresh}"/>
167 <i class="icon-repeat"></i>
168 </button>
169 -
170 </#macro>
171 <#macro paginationSiteItemCount paginator combo=0 nb_items_per_page=nb_items_per_page showcount=0>
172 <#-- Display combo -->
173 <#if combo == 1 >
174 <@paginationSiteCombo paginator=paginator nb_items_per_page=nb_items_per_page/>
175 </#if>
176 <#if showcount == 1 >
177 <#-- Display item count -->
178 <#if (paginator.labelItemCount)?? && paginator.labelItemCount?has_content>${paginator.labelItemCount} : </#if>${paginator.itemsCount}
179 </#if>
180 </#macro>
181 <#macro item_navigationSite item_navigator>
182 <div id="item-navigator">
183 <#if (item_navigator.currentItemId > 0)>
184 <a href="${item_navigator.previousPageLink?xhtml}" title="#i18n{portal.util.labelPrevious}">
185 <i class="icon-circle-arrow-left"></i>
186 #i18n{portal.util.labelPrevious}
187 </a>
188 <#else>
189
190 </#if>
191 <#if (item_navigator.currentItemId < item_navigator.listItemSize - 1) >
192 <a href="${item_navigator.nextPageLink?xhtml}" title="#i18n{portal.util.labelNext}">
193 #i18n{portal.util.labelNext}
194 <i class="icon-circle-arrow-right"></i>
195 </a>
196 <#else>
197
198 </#if>
199 </div>
200 </#macro>
201 <#macro dataTableSite dataTableManager actionMacro="" tableClass="table table-striped table-condensed" caption=" " summary="data table" >
202 <#if 0 < dataTableManager.items?size >
203 <#if dataTableManager.enablePaginator>
204 <form class="form-inline" method="post" action="${dataTableManager.sortUrl}">
205 <#if (dataTableManager.paginator.pagesCount > 1) >
206 <@paginationSitePageLinks paginator=dataTableManager.paginator />
207 </#if>
208 <div class="pull-right">
209 <@paginationSiteItemCount paginator=dataTableManager.paginator combo=1 nb_items_per_page=dataTableManager.paginator.itemsPerPage?string/>
210 </div>
211 </form>
212 </#if>
213 <table class="${tableClass}" summary="${summary}">
214 <caption>${caption}</caption>
215 <tr>
216 <#list dataTableManager.listColumn as column>
217 <th scope="col">
218 #i18n{${column.titleKey}}
219 <#if !(column.typeColumn = "ACTION") && column.sortable>
220 <@sortSite jsp_url=dataTableManager.sortUrl attribute=column.parameterName />
221 </#if>
222 </th>
223 </#list>
224 </tr>
225 <#list dataTableManager.items as item>
226 <tr>
227 <#list dataTableManager.listColumn as column>
228 <#if column.typeColumn = "STRING">
229 <#assign propName = "item." + column.parameterName>
230 <#assign value = propName?eval>
231 <td>${value!}</td>
232 <#elseif column.typeColumn = "LABEL">
233 <#assign propName = "item." + column.parameterName>
234 <#assign value = propName?eval>
235 <td>#i18n{${value!}}</td>
236 <#elseif column.typeColumn = "BOOLEAN">
237 <#assign propName = "item." + column.parameterName>
238 <#assign value = propName?eval>
239 <#if value?? && value>
240 <td><span class="label label-success" title="#i18n{${column.labelTrue!}}"><i class="icon-ok-sign icon-white"></i>#i18n{${column.labelTrue!}}</span></td>
241 <#else>
242 <td><span class="label label-important" title="#i18n{${column.labelFalse!}}"><i class="icon-remove-sign icon-white"></i>#i18n{${column.labelFalse!}}</span></td>
243 </#if>
244 <#elseif column.typeColumn = "EMAIL">
245 <#assign propName = "item." + column.parameterName>
246 <#assign value = propName?eval>
247 <td><#if value?? && value != ""><a href="mailto:${value}" title="${value}" >${value}</a></#if></td>
248 <#elseif column.typeColumn = "ACTION">
249 <#if column.parameterName?? && column.parameterName != "">
250 <#assign macroName = column.parameterName>
251 <#elseif actionMacro?? && actionMacro != "">
252 <#assign macroName = actionMacro>
253 </#if>
254 <#if macroName?? && macroName != "">
255 <td><@.vars[macroName] item=item /></td>
256 </#if>
257 </#if>
258 </#list>
259 </tr>
260 </#list>
261 </table>
262 <#if dataTableManager.enablePaginator>
263 <form class="form-inline" method="post" action="${dataTableManager.sortUrl}">
264 <#if (dataTableManager.paginator.pagesCount > 1) >
265 <@paginationSitePageLinks paginator=dataTableManager.paginator />
266 </#if>
267 <div class="pull-right">
268 <@paginationSiteItemCount paginator=dataTableManager.paginator combo=0 nb_items_per_page=dataTableManager.paginator.itemsPerPage?string/>
269 </div>
270 </form>
271 </#if>
272 <#else>
273 #i18n{portal.util.labelNoItem}
274 </#if>
275 </#macro>
276 <#macro filterPanelSite dataTableManager formClass="form-horizontal" >
277 <#if dataTableManager.filterPanel.listFilter?? && 0 < dataTableManager.filterPanel.listFilter?size>
278 <form class="${formClass}" method="post" action="${dataTableManager.filterPanel.formUrl}" >
279 <fieldset>
280 <#list dataTableManager.filterPanel.listFilter as filter>
281 <div class="control-group">
282 <label class="control-label" for="description" >#i18n{${filter.filterLabel}} :</label>
283 <div class="controls">
284 <#if filter.filterType = "STRING">
285 <input type="text" name="${dataTableManager.filterPanelPrefix}${filter.parameterName}" id="${filter.parameterName}" size="30" value="${filter.value!}"/>
286 <#elseif filter.filterType = "BOOLEAN">
287 <input type="checkbox" value="true" name="${dataTableManager.filterPanelPrefix}${filter.parameterName}" id="${dataTableManager.filterPanelPrefix}${filter.parameterName}" <#if filter.value?? && filter.value = "true">checked="checked" </#if>/>
288 <#elseif filter.filterType = "DROPDOWNLIST">
289 <#if filter.value??>
290 <#assign filter_value = filter.value >
291 <#else>
292 <#assign filter_value = "" >
293 </#if>
294 <@comboSite name=dataTableManager.filterPanelPrefix+filter.parameterName default_value=filter_value items=filter.refList />
295 </#if>
296 </div>
297 </div>
298 </#list>
299 <div class="form-actions">
300 <input type="hidden" name="${dataTableManager.filterPanelPrefix}updateFilters" id="${dataTableManager.filterPanelPrefix}updateFilters" value="true" />
301 <button class="btn btn-primary btn-small" type="submit" >
302 <i class="icon-search icon-white"></i>
303 <span class="hidden-phone" >#i18n{portal.util.labelSearch}</span>
304 </button>
305 <#if dataTableManager.filterPanel.formUrl?contains("?")>
306 <#assign dataTableResetUrl = dataTableManager.filterPanel.formUrl + "&" + dataTableManager.filterPanelPrefix + "resetFilters=true" />
307 <#else>
308 <#assign dataTableResetUrl = dataTableManager.filterPanel.formUrl + "?" + dataTableManager.filterPanelPrefix + "resetFilters=true" />
309 </#if>
310 <a class="btn btn-primary btn-small" href="${dataTableResetUrl}" title="#i18n{portal.util.labelReset}">
311 <i class="icon-remove-circle icon-white"></i>
312 <span class="hidden-phone" >#i18n{portal.util.labelReset}</span>
313 </a>
314 </div>
315 </fieldset>
316 </form>
317 </#if>
318 </#macro>
319 <#macro fieldInputTextSite i18nLabelKey inputName mandatory=false value="" maxlength=0 i18nHelpBlockKey='' cssClass=''>
320 <div class="control-group">
321 <label class="control-label" for="${inputName}">#i18n{${i18nLabelKey}} <#if mandatory>*</#if> :</label>
322 <div class="controls">
323 <input class="${cssClass}" id="${inputName}" name="${inputName}" type="text" value="${value}" <#if maxlength > 0>maxlength=${maxlength}</#if> />
324 <#if i18nHelpBlockKey != ''><span class="help-block">#i18n{${i18nHelpBlockKey}}</span></#if>
325 </div>
326 </div>
327 </#macro>
328 <#macro fieldInputCalendarSite i18nLabelKey inputName mandatory=false value="" i18nHelpBlockKey='' cssClass='' language='fr'>
329 <div class="control-group">
330 <label class="control-label" for="${inputName}">#i18n{${i18nLabelKey}} <#if mandatory>*</#if> :</label>
331 <div class="controls">
332 <div class="input-prepend">
333 <span class="add-on"><i class="icon-calendar"> </i></span>
334 <input class="${cssClass}" id="${inputName}" name="${inputName}" type="text" value="${value}" />
335 </div>
336 <#if i18nHelpBlockKey != ''><span class="help-block">#i18n{${i18nHelpBlockKey}}</span></#if>
337 </div>
338 </div>
339 <@getDatePicker idField=inputName language=language />
340 </#macro>
341 <#macro fieldInputCheckBoxSite i18nLabelKey inputName value="" checked=false i18nHelpBlockKey='' cssClass='' >
342 <div class="control-group">
343 <label class="control-label" for="${inputName}">#i18n{${i18nLabelKey}} :</label>
344 <div class="controls">
345 <input class="${cssClass}" id="${inputName}" name="${inputName}" type="checkbox" value="${value}" <#if checked>checked="checked"</#if> />
346 <#if i18nHelpBlockKey != ''><span class="help-block">#i18n{${i18nHelpBlockKey}}</span></#if>
347 </div>
348 </div>
349 </#macro>
350 <#macro fieldInputComboSite i18nLabelKey inputName items value="" mandatory=false i18nHelpBlockKey='' cssClass='' >
351 <div class="control-group">
352 <label class="control-label" for="${inputName}">#i18n{${i18nLabelKey}} <#if mandatory>* </#if>:</label>
353 <div class="controls">
354 <#assign params = "class='" + cssClass + "'" >
355 <@comboWithParams name=inputName items=items default_value=value additionalParameters=params />
356 <#if i18nHelpBlockKey != ''><span class="help-block">#i18n{${i18nHelpBlockKey}}</span></#if>
357 </div>
358 </div>
359 </#macro>
360 <#macro fieldTextAreaSite i18nLabelKey inputName mandatory=false value="" maxlength=0 i18nHelpBlockKey='' cssClass=''>
361 <div class="control-group">
362 <label class="control-label" for="${inputName}">#i18n{${i18nLabelKey}} <#if mandatory>*</#if> :</label>
363 <div class="controls">
364 <textarea class="${cssClass}" id="${inputName}" name="${inputName}" <#if maxlength > 0>maxlength=255</#if> >${value}</textarea>
365 <#if i18nHelpBlockKey != ''><span class="help-block">#i18n{${i18nHelpBlockKey}}</span></#if>
366 </div>
367 </div>
368 </#macro>
369 <#macro autocompleteFO id name suggestionsUrl suggestionsPath="" itemValueFieldName="value" btnColor="light" btnSize="" itemLabelFieldNames="[]" itemTitleFieldNames=itemLabelFieldNames itemDescriptionFieldNames="[]" itemTagsFieldNames="[]" copyFields="[]" currentValue="" currentLabel="" required=false minimumInputLength=1 minimumInputLenghtLabel="#i18n{portal.util.labelMinimumSearchLenght}" searchLabel="#i18n{portal.util.labelSearch}" placeHolder="#i18n{portal.util.labelSearch}" emptyLabel="#i18n{portal.util.labelNoItem}" additionnalRequestParamInputId="" >
370 <div id="${id}" class="lutece-autocomplete dropdown form-group form-floating" data-itemTitleFieldNames=${itemTitleFieldNames} data-suggestionsUrl="${suggestionsUrl}" data-suggestionsPath="${suggestionsPath}" data-itemValueFieldName=${itemValueFieldName} data-minimumInputLength=${minimumInputLength} data-itemDescriptionFieldNames=${itemDescriptionFieldNames} data-itemTagsFieldNames=${itemTagsFieldNames} data-copyFields=${copyFields} data-emptyLabel="${emptyLabel}" data-currentValue="${currentValue}" data-currentLabel="${currentLabel}" data-suggestionItemClass='["list-group-item", "p-3"]' data-titleClass='["mb-0", "fw-bolder"]' data-descriptionClass='["text-muted", "mb-0"]' data-tagClass='["badge", "bg-blue-lt", "me-1"]' data-loaderIconClasses='{"loading": ["ti-loader-2", "icon-rotate"], "error": ["ti-zoom-exclamation", "text-danger"], "search": ["ti-search"]}' data-emptyClass='["list-group-item", "p-3", "text-muted", "text-center"]' data-searchLabel="${searchLabel}">
371 <label for="${id}-input">${searchLabel}</label>
372 <div class="input-group">
373 <input class="form-control lutece-autocomplete-search-input w-75" type="text" name="${name}" role="combobox" autocomplete="off" value="<#if currentValue!=''>${currentValue!}</#if>" id="${id}-input" aria-expanded="false" aria-owns="${id}-list-container" aria-autocomplete="list" aria-describedby="${id}-lutece-autocomplete-default-assistive">
374 <span role="button" class="input-group-text lutece-autocomplete-remove <#if currentValue=''>d-none</#if> text-danger">
375 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 6l-12 12" /><path d="M6 6l12 12" /></svg>
376 </span>
377 <span role="button" class="input-group-text lutece-autocomplete-search-icon">
378 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" /><path d="M21 21l-6 -6" /></svg>
379 </span>
380 </div>
381 <div id="${id}-dropdown" class="lutece-autocomplete-dropdown dropdown-menu p-0" aria-labelledby="dropdownMenuButton">
382 <ul id="${id}-list-container" class="lutece-autocomplete-result-container list-group list-group-flush overflow-auto bg-white" role="listbox" id="suggestions-list" aria-labelledby="${id}-input" style="max-height:15rem;"></ul>
383 <span id="${id}-lutece-autocomplete-default-assistive" class="sr-only visually-hidden">#i18n{portal.util.message.autocomplete.avalailbleResults}</span>
384 <div class="sr-only lutece-autocomplete-status" role="status" aria-atomic="true" aria-live="polite"></div>
385 </div>
386 </div>
387 <script type="module">
388 import LuteceAutoComplete from "./themes/shared/modules/luteceAutoComplete.js";
389 new LuteceAutoComplete(document.getElementById(`${id}`), document.getElementById(`${additionnalRequestParamInputId}`));
390 </script>
391 </#macro>
392 <#-- Macro: deprecatedWarningSite
393 Description: Generates a warning message for deprecated or incorrect arguments.
394 Parameters:
395 - args (map, optional): a map of arguments and their values.
396 -->
397 <#macro deprecatedWarningSite args=[] >
398 <#if args?size != 0 ><!-- Warning : wrong or deprecated argument(s) : <#list args?keys as key >${key}, </#list> ... --></#if>
399 </#macro>