Bug 27634: Add the ability to exclude fields from "modal" sysprefs
[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         [% UNLESS ( searchfield ) %]<div id="toolbar"><button class="save-all btn btn-primary" type="submit">Save all [% TAB.tab_title | html %] preferences</button></div>[% END %]
62         <input type="hidden" name="op" value="save" />
63         <input type="hidden" name="tab" value="[% TAB.tab_id | html %]" />
64
65             [% FOREACH LINE IN TAB.LINES %]
66             [% IF ( LINE.is_group_title ) %]
67             [% UNLESS ( loop.first ) %]</tbody></table></div>[% END %]
68             <div class="page-section">
69             <div class="row">
70                 <div class="col-sm-6">
71                     <h3 id="[% TAB.tab_id | $HtmlId %]_[% LINE.title | $HtmlId %]"><i class="fa fa-caret-down"></i> [% LINE.title | html %]</h3>
72                 </div>
73                 <div class="col-sm-6">
74                     [% IF ( searchfield ) %]
75                         <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>
76                     [% END %]
77                 </div>
78             </div>
79
80             <table class="preferences" id="collapse_[% TAB.tab_id | $HtmlId %]_[% LINE.title | $HtmlId %]">
81             <thead><tr><th>Preference</th><th>Value</th></tr></thead>
82             [% UNLESS ( loop.last ) %]<tbody>[% END %]
83             [% ELSE %]
84             [% IF ( loop.first ) %]<table class="preferences"><thead><tr><th>Preference</th><th>Value</th></tr></thead><tbody>[% END %]
85             <tr class="name-row">
86                 <td class="name-cell">
87                     <code>
88                         [% FOREACH NAME IN LINE.NAMES %]
89                         <label for="pref_[% NAME.name | html %]" class="nowrap">
90                             <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=[% NAME.name | uri %]">
91                                 <i class="fa fa-bookmark" aria-hidden="true"></i></a>
92                             [% IF ( NAME.jumped ) %]
93                                 <span class="term" id="jumped">[% NAME.name | html %]</span>
94                             [% ELSIF ( NAME.highlighted ) %]
95                                 <span class="term">[% NAME.name | html %]</span>
96                             [% ELSE %]
97                                 [% NAME.name | html %]
98                             [% END %]
99
100                             [% IF NAME.overridden %]
101                                 <span class="overridden" title="The system preference [% NAME.name | html %] may have been overridden from this value by one or more virtual hosts.">
102                                     [Overridden]
103                                 </span>
104                             [% END %]
105                                                 </label>
106                         [% UNLESS ( loop.last ) %]<br />[% END %]
107                         [% END %]
108                     </code>
109                 </td>
110                 <td><div>
111                     [% FOREACH CHUNK IN LINE.CHUNKS %]
112                     [% IF ( CHUNK.type_text ) %]
113                     [% CHUNK.contents | $raw %]
114                     [% ELSIF ( CHUNK.type_input ) %]
115                         [% IF CHUNK.name == 'UsageStatsGeolocation' %]
116                             <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 %]
117                         [% ELSE %]
118                             <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 %]
119                         [% END %]
120                     [% ELSIF ( CHUNK.type_select ) %]
121                         [% IF CHUNK.disabled %]
122                         <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" disabled="disabled" class="preference preference-[% CHUNK.class or "choice" | html %]">
123                         [% ELSE %]
124                         <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]">
125                         [% END %]
126                         [% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
127                         [% IF ( CHOICE.selected ) %]
128                         <option value="[% CHOICE.value | html %]" selected="selected">
129                         [% ELSE %]
130                         <option value="[% CHOICE.value | html %]">
131                         [% END %]
132                             [% CHOICE.text | html %]
133                         </option>
134                         [% END %]
135                     </select>
136                     [% ELSIF ( CHUNK.type_modalselect ) %]
137                         <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 %]"/>
138                     [% ELSIF ( CHUNK.type_modaljs ) %]
139                         <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 %]"/>
140                     [% ELSIF ( CHUNK.type_multiple ) %]
141                     <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
142                         [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %]
143                     </select>
144                     [% ELSIF ( CHUNK.type_textarea )%]
145                         [% IF ( CHUNK.syntax == "text/html" && Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
146                             <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>
147                         [% ELSE %]
148                             <a class="expand-textarea" id="expand_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" href="#">Click to edit</a>
149                             <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>
150                             <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>
151                         [% END %]
152                     [% ELSIF ( CHUNK.type_languages ) %]
153                         <ul class="sortable">
154                             [% FOREACH language IN CHUNK.languages %]
155                                 [% IF ( language.plural ) %]
156                                     <li>
157                                         [% IF ( language.native_description ) %]
158                                             [% language.native_description | html %]
159                                         [% ELSE %]
160                                             [% language.rfc4646_subtag | html %]
161                                         [% END %]
162                                         [% IF language.sublanguages_loop.size > 0 %]
163                                             <ul>
164                                                 [% FOREACH sublanguages_loo IN language.sublanguages_loop %]
165                                                     <li>
166                                                         <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>
167                                                         [% IF ( sublanguages_loo.enabled ) %]
168                                                             <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"/>
169                                                         [% ELSE %]
170                                                             <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"/>
171                                                         [% END %]
172                                                     </li>
173                                                 [% END # FOREACH sublanguages %]
174                                             </ul>
175                                         [% END %]
176                                     </li>
177                                 [% ELSE %]
178                                     <li>
179                                         <label for="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]">[% language.native_description | html %] ([% language.rfc4646_subtag | html %])</label>
180                                         [% IF ( language.group_enabled ) %]
181                                             <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"/>
182                                         [% ELSE %]
183                                             <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"/>
184                                         [% END %]
185                                     </li>
186                                 [% END # IF language.plural %]
187                             [% END # FOREACH language %]
188                         </ul> <!-- / ul.sortable -->
189                     [% END %]
190                     [% END %]
191                     [% IF LINE.WARNINGS.size %]
192                         [% FOR w IN LINE.WARNINGS %]
193                             <div class="dialog alert">
194                                 [% SWITCH w %]
195                                 [% 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>
196                                 [% CASE %]<span>Unknown warning "[% w | html %]"</span>
197                                 [% END %]
198                             </div>
199                         [% END %]
200                     [% END %]
201                 </div></td>
202             </tr>
203             [% IF ( loop.last ) %]</tbody></table></div>[% END %]
204             [% END %]
205         [% END %]
206         <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>
207     </form>
208     </div>
209     [% END %]
210
211             </main>
212         </div> <!-- /.col-sm-10.col-sm-push-2 -->
213
214         <div class="col-sm-2 col-sm-pull-10">
215             <aside>
216                 [% INCLUDE 'prefs-menu.inc' %]
217             </aside>
218         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
219      </div> <!-- /.row -->
220
221 <!-- Modal -->
222 <div class="modal" id="prefModal" tabindex="-1" role="dialog" aria-labelledby="prefModalLabel">
223     <div class="modal-dialog modal-wide" role="document">
224         <div class="modal-content">
225             <div class="modal-header">
226                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
227                 <h4 class="modal-title" id="prefModalLabel">Modal title</h4>
228             </div>
229             <div class="modal-body">
230                 <p>
231                     <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
232                     |
233                     <a href="#" id="clear_all"><i class="fa fa-times"></i> Clear all</a>
234                 </p>
235                 <form action="#" id="prefModalForm">
236                 </form>
237             </div>
238             <div class="modal-footer">
239                 <button id="saveModalPrefs" data-target="" type="button" class="btn btn-primary">Save</button>
240                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
241             </div>
242         </div>
243     </div>
244 </div>
245
246 [% MACRO jsinclude BLOCK %]
247     [% INCLUDE 'datatables.inc' %]
248     [% Asset.js("lib/hc-sticky.js") | $raw %]
249     [% Asset.js("lib/jquery/plugins/multiple-select/multiple-select.min.js") | $raw %]
250     [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
251     [% Asset.js( "lib/codemirror/css.min.js" ) | $raw %]
252     [% Asset.js( "lib/codemirror/javascript.min.js" ) | $raw %]
253     [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
254     [% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %]
255     [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
256     [% Asset.js( "lib/linters/jshint.min.js" ) | $raw %]
257     [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
258     [% Asset.js( "lib/linters/csslint.min.js" ) | $raw %]
259     [% Asset.js( "lib/linters/js-yaml.min.js" ) | $raw %]
260     [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
261     [% Asset.js( "lib/codemirror/javascript-lint.min.js" ) | $raw %]
262     [% Asset.js( "lib/codemirror/css-lint.min.js" ) | $raw %]
263     [% Asset.js( "lib/codemirror/yaml-lint.min.js" ) | $raw %]
264
265     <script>
266         var Sticky;
267         var themelang = "[% themelang | html %]";
268         $(document).ready(function(){
269             [% UNLESS ( searchfield ) %]
270                 Sticky = $("#toolbar");
271                 Sticky.hcSticky({
272                     stickTo: "main",
273                     stickyClass: "floating"
274                 });
275             [% END %]
276             $("select[multiple='multiple']").multipleSelect( {
277                 placeholder: _("Please select ..."),
278                 selectAllText: _("Select all"),
279                 allSelected: _("All selected"),
280                 countSelected: _("# of % selected"),
281                 noMatchesFound: _("No matches found")
282             } );
283             $(".force_reload").on("click",function(e){
284                 e.preventDefault();
285                 window.location.reload(true);
286             });
287         });
288         // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
289         var to_highlight = "[% To.json( searchfield ) | html %]";
290         var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
291         var db_columns = [% To.json( db_columns ) | $raw %];
292     </script>
293     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
294     [% Asset.js("js/ajax.js") | $raw %]
295     [% Asset.js("js/pages/preferences.js") | $raw %]
296     [%# Add WYSIWYG editor for htmlarea system preferences %]
297     [% INCLUDE 'wysiwyg-systempreferences.inc' %]
298 [% END %]
299
300 [% INCLUDE 'intranet-bottom.inc' %]