Bug 31731: Offer user a dropdown of authorized values instead of a text field in...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / preferences.tt
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% USE Koha %]
5 [% USE HtmlId %]
6 [% PROCESS 'i18n.inc' %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>[% FILTER collapse %]
10     [% t("System preferences") | html %] &rsaquo;
11     [% t("Administration") | html %] &rsaquo;
12     [% t("Koha") | html %]
13 [% END %]</title>
14 [% INCLUDE 'doc-head-close.inc' %]
15 [% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.min.css") | $raw %]
16 [% Asset.css("css/preferences.css") | $raw %]
17 [% Asset.css("css/humanmsg.css") | $raw %]
18 [% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
19 [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
20 </head>
21 <body id="admin_preferences" class="admin">
22 [% WRAPPER 'header.inc' %]
23     [% INCLUDE 'prefs-admin-search.inc' %]
24 [% END %]
25
26 [% WRAPPER 'sub-header.inc' %]
27     [% WRAPPER breadcrumbs %]
28         [% WRAPPER breadcrumb_item %]
29             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
30         [% END %]
31         [% WRAPPER breadcrumb_item bc_active= 1 %]
32             <span>System preferences</span>
33         [% END %]
34     [% END #/ WRAPPER breadcrumbs %]
35 [% END #/ WRAPPER sub-header.inc %]
36
37 <div class="main container-fluid">
38     <div class="row">
39         <div class="col-sm-10 col-sm-push-2">
40             <main>
41
42     [% IF ( jump_not_found ) %]
43     <div class="dialog alert">
44         Could not find a system preference named <code>[% jumpfield | html %]</code>.
45     </div>
46     [% END %]
47     [% IF ( search_not_found ) %]
48     <div class="dialog alert">
49         No system preferences matched your search for: <strong>[% searchfield | html %]</strong>
50     </div>
51     <h1>System preferences</h1>
52     [% ELSIF searchfield %]
53     <h1>System preferences matching: [% searchfield | html %]</h1>
54     [% ELSE %]
55     <h1>System preferences</h1>
56     [% END %]
57     [% FOREACH TAB IN TABS %]
58     <div class="prefs-tab">
59     <h2>[% TAB.tab_title | html %] preferences</h2>
60     <form action="/cgi-bin/koha/admin/preferences.pl" method="post">
61         [% INCLUDE 'csrf-token.inc' %]
62         [% UNLESS ( searchfield ) %]<div id="toolbar"><button class="save-all btn btn-primary" type="submit">Save all [% TAB.tab_title | html %] preferences</button></div>[% END %]
63         <input type="hidden" name="op" value="save" />
64         <input type="hidden" name="tab" value="[% TAB.tab_id | html %]" />
65
66             [% FOREACH LINE IN TAB.LINES %]
67             [% IF ( LINE.is_group_title ) %]
68             [% UNLESS ( loop.first ) %]</tbody></table></div>[% END %]
69             <div class="page-section">
70             <div class="row">
71                 <div class="col-sm-6">
72                     <h3 id="[% TAB.tab_id | $HtmlId %]_[% LINE.title | $HtmlId %]"><i class="fa fa-caret-down"></i> [% LINE.title | html %]</h3>
73                 </div>
74                 <div class="col-sm-6">
75                     [% IF ( searchfield ) %]
76                         <div class="pull-right"><a class="btn btn-link" href="/cgi-bin/koha/admin/preferences.pl?tab=[% TAB.tab_id | html %]#[% TAB.tab_id | $HtmlId %]_[% LINE.title | $HtmlId %]"><i class="fa fa-list-ul"></i> View all [% LINE.title | html %] preferences</a></div>
77                     [% END %]
78                 </div>
79             </div>
80
81             <table class="preferences" id="collapse_[% TAB.tab_id | $HtmlId %]_[% LINE.title | $HtmlId %]">
82             <thead><tr><th>Preference</th><th>Value</th></tr></thead>
83             [% UNLESS ( loop.last ) %]<tbody>[% END %]
84             [% ELSE %]
85             [% IF ( loop.first ) %]<table class="preferences"><thead><tr><th>Preference</th><th>Value</th></tr></thead><tbody>[% END %]
86             <tr class="name-row">
87                 <td class="name-cell">
88                     <code>
89                         [% FOREACH NAME IN LINE.NAMES %]
90                         <label for="pref_[% NAME.name | html %]" class="nowrap">
91                             <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=[% NAME.name | uri %]">
92                                 <i class="fa fa-bookmark" aria-hidden="true"></i></a>
93                             [% IF ( NAME.jumped ) %]
94                                 <span class="term" id="jumped">[% NAME.name | html %]</span>
95                             [% ELSIF ( NAME.highlighted ) %]
96                                 <span class="term">[% NAME.name | html %]</span>
97                             [% ELSE %]
98                                 [% NAME.name | html %]
99                             [% END %]
100
101                             [% IF NAME.overridden %]
102                                 <span class="overridden" title="The system preference [% NAME.name | html %] may have been overridden from this value by one or more virtual hosts.">
103                                     [Overridden]
104                                 </span>
105                             [% END %]
106                                                 </label>
107                         [% UNLESS ( loop.last ) %]<br />[% END %]
108                         [% END %]
109                     </code>
110                 </td>
111                 <td><div>
112                     [% FOREACH CHUNK IN LINE.CHUNKS %]
113                     [% IF ( CHUNK.type_text ) %]
114                     [% CHUNK.contents | $raw %]
115                     [% ELSIF ( CHUNK.type_input ) %]
116                         [% IF CHUNK.name == 'UsageStatsGeolocation' %]
117                             <input type="[%IF CHUNK.input_type %][% CHUNK.input_type | html %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" value="[% CHUNK.value | html %]" autocomplete="off" readonly="readonly" size="40" style="width: auto;"/> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
118                         [% ELSE %]
119                             <input type="[%IF CHUNK.input_type %][% CHUNK.input_type | html %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" value="[% CHUNK.value | html %]" autocomplete="off" /> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
120                         [% END %]
121                     [% ELSIF ( CHUNK.type_select ) %]
122                         [% IF CHUNK.disabled %]
123                         <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" disabled="disabled" class="preference preference-[% CHUNK.class or "choice" | html %]">
124                         [% ELSE %]
125                         <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]">
126                         [% END %]
127                         [% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
128                         [% IF ( CHOICE.selected ) %]
129                         <option value="[% CHOICE.value | html %]" selected="selected">
130                         [% ELSE %]
131                         <option value="[% CHOICE.value | html %]">
132                         [% END %]
133                             [% CHOICE.text | html %]
134                         </option>
135                         [% END %]
136                     </select>
137                     [% ELSIF ( CHUNK.type_modalselect ) %]
138                         <input type="text" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="modalselect preference preference-[% CHUNK.type | html %]" data-source="[% CHUNK.source | html %]" data-required="[% CHUNK.required | html %]" data-exclusions="[% CHUNK.exclusions | html %]" data-inclusions="[% CHUNK.inclusions | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/>
139                     [% ELSIF ( CHUNK.type_modaljs ) %]
140                         <input type="text" name="pref_[% CHUNK.name | html %]" data-initiator="[% CHUNK.initiator | html %]" data-processor="[% CHUNK.processor | html %]" id="pref_[% CHUNK.name | html %]" class="modaljs preference preference-[% CHUNK.type | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/>
141                     [% ELSIF ( CHUNK.type_multiple ) %]
142                         <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
143                             [% FOREACH CHOICE IN CHUNK.CHOICES %]
144                                 [% IF ( CHOICE.selected ) %]
145                                     <option value="[% CHOICE.value | html %]" selected="selected">
146                                 [% ELSE %]
147                                     <option value="[% CHOICE.value | html %]">
148                                 [% END %]
149                                     [% CHOICE.text | html %]
150                                 </option>
151                             [% END %]
152                         </select>
153                     [% ELSIF ( CHUNK.type_textarea )%]
154                         [% IF ( CHUNK.syntax == "text/html" && Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
155                             <textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] mce" rows="20" cols="60">[% CHUNK.value | html %]</textarea>
156                         [% ELSE %]
157                             <a class="expand-textarea" id="expand_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" href="#">Click to edit</a>
158                             <textarea style="display:none" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] codemirror" rows="10" cols="40">[% CHUNK.value | html %]</textarea>
159                             <a class="collapse-textarea" id="collapse_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" style="display:none" href="#">Click to collapse</br></a>
160                         [% END %]
161                     [% ELSIF ( CHUNK.type_languages ) %]
162                         <ul class="sortable">
163                             [% FOREACH language IN CHUNK.languages %]
164                                 [% IF ( language.plural ) %]
165                                     <li><i class="fa-solid fa-fw fa-grip-vertical" aria-hidden="true" style="color:#B7B7B7"></i>
166                                         [% IF ( language.native_description ) %]
167                                             [% language.native_description | html %]
168                                         [% ELSE %]
169                                             [% language.rfc4646_subtag | html %]
170                                         [% END %]
171                                         [% IF language.sublanguages_loop.size > 0 %]
172                                             <ul>
173                                                 [% FOREACH sublanguages_loo IN language.sublanguages_loop %]
174                                                     <li>
175                                                         <label for="pref_[% CHUNK.name | html %]_[% sublanguages_loo.rfc4646_subtag | html %]">[% sublanguages_loo.native_description | html %] [% sublanguages_loo.script_description | html %] [% sublanguages_loo.region_description | html %] [% sublanguages_loo.variant_description | html %]([% sublanguages_loo.rfc4646_subtag | html %])</label>
176                                                         [% IF ( sublanguages_loo.enabled ) %]
177                                                             <input value="[% sublanguages_loo.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% sublanguages_loo.rfc4646_subtag | html %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
178                                                         [% ELSE %]
179                                                             <input value="[% sublanguages_loo.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% sublanguages_loo.rfc4646_subtag | html %]" type="checkbox" class="preference preference-checkbox"/>
180                                                         [% END %]
181                                                     </li>
182                                                 [% END # FOREACH sublanguages %]
183                                             </ul>
184                                         [% END %]
185                                     </li>
186                                 [% ELSE %]
187                                     <li><i class="fa-solid fa-fw fa-grip-vertical" aria-hidden="true" style="color:#B7B7B7"></i>
188                                         <label for="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]">[% language.native_description | html %] ([% language.rfc4646_subtag | html %])</label>
189                                         [% IF ( language.group_enabled ) %]
190                                             <input value="[% language.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
191                                         [% ELSE %]
192                                             <input value="[% language.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]" type="checkbox" class="preference preference-checkbox"/>
193                                         [% END %]
194                                     </li>
195                                 [% END # IF language.plural %]
196                             [% END # FOREACH language %]
197                         </ul> <!-- / ul.sortable -->
198                     [% END %]
199                     [% END %]
200                     [% IF LINE.WARNINGS.size %]
201                         [% FOR w IN LINE.WARNINGS %]
202                             <div class="dialog alert">
203                                 [% SWITCH w %]
204                                 [% CASE "bcrypt_config_not_set" %]<span>Pseudonymization must only be turned on if the 'bcrypt_settings' configuration entry exists and is correctly filled in the Koha configuration file.</span>
205                                 [% CASE %]<span>Unknown warning "[% w | html %]"</span>
206                                 [% END %]
207                             </div>
208                         [% END %]
209                     [% END %]
210                 </div></td>
211             </tr>
212             [% IF ( loop.last ) %]</tbody></table></div>[% END %]
213             [% END %]
214         [% END %]
215         <fieldset class="action"><button class="save-all submit btn btn-primary" type="submit">Save all [% TAB.tab_title | html %] preferences</button> <a href="/cgi-bin/koha/admin/preferences.pl" class="force_reload cancel">Cancel</a></fieldset>
216     </form>
217     </div>
218     [% END %]
219
220             </main>
221         </div> <!-- /.col-sm-10.col-sm-push-2 -->
222
223         <div class="col-sm-2 col-sm-pull-10">
224             <aside>
225                 [% INCLUDE 'prefs-menu.inc' %]
226             </aside>
227         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
228      </div> <!-- /.row -->
229
230 <!-- Modal -->
231 <div class="modal" id="prefModal" tabindex="-1" role="dialog" aria-labelledby="prefModalLabel">
232     <div class="modal-dialog modal-wide" role="document">
233         <div class="modal-content">
234             <div class="modal-header">
235                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
236                 <h4 class="modal-title" id="prefModalLabel">Modal title</h4>
237             </div>
238             <div class="modal-body">
239                 <p>
240                     <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
241                     |
242                     <a href="#" id="clear_all"><i class="fa fa-times"></i> Clear all</a>
243                 </p>
244                 <form action="#" id="prefModalForm">
245                 </form>
246             </div>
247             <div class="modal-footer">
248                 <button id="saveModalPrefs" data-target="" type="button" class="btn btn-primary">Save</button>
249                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
250             </div>
251         </div>
252     </div>
253 </div>
254
255 [% MACRO jsinclude BLOCK %]
256     [% INCLUDE 'datatables.inc' %]
257     [% Asset.js("lib/hc-sticky.js") | $raw %]
258     [% Asset.js("lib/jquery/plugins/multiple-select/multiple-select.min.js") | $raw %]
259     [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
260     [% Asset.js( "lib/codemirror/css.min.js" ) | $raw %]
261     [% Asset.js( "lib/codemirror/javascript.min.js" ) | $raw %]
262     [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
263     [% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %]
264     [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
265     [% Asset.js( "lib/linters/jshint.min.js" ) | $raw %]
266     [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
267     [% Asset.js( "lib/linters/csslint.min.js" ) | $raw %]
268     [% Asset.js( "lib/linters/js-yaml.min.js" ) | $raw %]
269     [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
270     [% Asset.js( "lib/codemirror/javascript-lint.min.js" ) | $raw %]
271     [% Asset.js( "lib/codemirror/css-lint.min.js" ) | $raw %]
272     [% Asset.js( "lib/codemirror/yaml-lint.min.js" ) | $raw %]
273     [% Asset.js( "lib/sortable/Sortable.min.js" ) | $raw %]
274
275     <script>
276         var Sticky;
277         var themelang = "[% themelang | html %]";
278         $(document).ready(function(){
279             [% UNLESS ( searchfield ) %]
280                 Sticky = $("#toolbar");
281                 Sticky.hcSticky({
282                     stickTo: "main",
283                     stickyClass: "floating"
284                 });
285             [% END %]
286             $("select[multiple='multiple']").multipleSelect( {
287                 placeholder: _("Please select ..."),
288                 selectAllText: _("Select all"),
289                 allSelected: _("All selected"),
290                 countSelected: _("# of % selected"),
291                 noMatchesFound: _("No matches found")
292             } );
293             $(".force_reload").on("click",function(e){
294                 e.preventDefault();
295                 window.location.reload(true);
296             });
297         });
298         // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
299         var to_highlight = "[% To.json( searchfield ) | html %]";
300         var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
301         var db_columns = [% To.json( db_columns ) | $raw %];
302
303     </script>
304     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
305     [% Asset.js("js/ajax.js") | $raw %]
306     [% Asset.js("js/pages/preferences.js") | $raw %]
307     [%# Add WYSIWYG editor for htmlarea system preferences %]
308     [% INCLUDE 'wysiwyg-systempreferences.inc' %]
309 [% END %]
310
311 [% INCLUDE 'intranet-bottom.inc' %]