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