Bug 28108: Fix filtering
[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                     <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]">
118                         [% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
119                         [% IF ( CHOICE.selected ) %]
120                         <option value="[% CHOICE.value | html %]" selected="selected">
121                         [% ELSE %]
122                         <option value="[% CHOICE.value | html %]">
123                         [% END %]
124                             [% CHOICE.text | html %]
125                         </option>
126                         [% END %]
127                     </select>
128                     [% ELSIF ( CHUNK.type_modalselect ) %]
129                         <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 %]"/>
130                     [% ELSIF ( CHUNK.type_multiple ) %]
131                     <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
132                         [% 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 %]
133                     </select>
134                     [% ELSIF ( CHUNK.type_textarea )%]
135                         [% IF ( CHUNK.syntax == "text/html" && Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
136                             <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>
137                         [% ELSE %]
138                             <a class="expand-textarea" id="expand_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" href="#">Click to edit</a>
139                             <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>
140                             <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>
141                         [% END %]
142                     [% ELSIF ( CHUNK.type_languages ) %]
143                         <ul class="sortable">
144                             [% FOREACH language IN CHUNK.languages %]
145                                 [% IF ( language.plural ) %]
146                                     <li>
147                                         [% IF ( language.native_description ) %]
148                                             [% language.native_description | html %]
149                                         [% ELSE %]
150                                             [% language.rfc4646_subtag | html %]
151                                         [% END %]
152                                         [% IF language.sublanguages_loop.size > 0 %]
153                                             <ul>
154                                                 [% FOREACH sublanguages_loo IN language.sublanguages_loop %]
155                                                     <li>
156                                                         <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>
157                                                         [% IF ( sublanguages_loo.enabled ) %]
158                                                             <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"/>
159                                                         [% ELSE %]
160                                                             <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"/>
161                                                         [% END %]
162                                                     </li>
163                                                 [% END # FOREACH sublanguages %]
164                                             </ul>
165                                         [% END %]
166                                     </li>
167                                 [% ELSE %]
168                                     <li>
169                                         <label for="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]">[% language.native_description | html %] ([% language.rfc4646_subtag | html %])</label>
170                                         [% IF ( language.group_enabled ) %]
171                                             <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"/>
172                                         [% ELSE %]
173                                             <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"/>
174                                         [% END %]
175                                     </li>
176                                 [% END # IF language.plural %]
177                             [% END # FOREACH language %]
178                         </ul> <!-- / ul.sortable -->
179                     [% END %]
180                     [% END %]
181                 </div></td>
182             </tr>
183             [% IF ( loop.last ) %]</tbody></table>[% END %]
184             [% END %]
185         [% END %]
186         <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>
187     </form>
188     </div>
189     [% END %]
190
191             </main>
192         </div> <!-- /.col-sm-10.col-sm-push-2 -->
193
194         <div class="col-sm-2 col-sm-pull-10">
195             <aside>
196                 [% INCLUDE 'prefs-menu.inc' %]
197             </aside>
198         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
199      </div> <!-- /.row -->
200
201 <!-- Modal -->
202 <div class="modal" id="prefModal" tabindex="-1" role="dialog" aria-labelledby="prefModalLabel">
203     <div class="modal-dialog modal-wide" role="document">
204         <div class="modal-content">
205             <div class="modal-header">
206                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
207                 <h4 class="modal-title" id="prefModalLabel">Modal title</h4>
208             </div>
209             <div class="modal-body">
210                 <p>
211                     <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
212                     |
213                     <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
214                 </p>
215                 <form action="#" id="prefModalForm">
216                 </form>
217             </div>
218             <div class="modal-footer">
219                 <button id="saveModalPrefs" data-target="" type="button" class="btn btn-default">Save</button>
220                 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
221             </div>
222         </div>
223     </div>
224 </div>
225
226 [% MACRO jsinclude BLOCK %]
227     [% INCLUDE 'datatables.inc' %]
228     [% Asset.js("lib/hc-sticky.js") | $raw %]
229     [% Asset.js("lib/jquery/plugins/multiple-select/jquery.multiple.select.js") | $raw %]
230     [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
231     [% Asset.js( "lib/codemirror/css.min.js" ) | $raw %]
232     [% Asset.js( "lib/codemirror/javascript.min.js" ) | $raw %]
233     [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
234     [% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %]
235     [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
236     [% Asset.js( "lib/linters/jshint.min.js" ) | $raw %]
237     [% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
238     [% Asset.js( "lib/linters/csslint.min.js" ) | $raw %]
239     [% Asset.js( "lib/linters/js-yaml.min.js" ) | $raw %]
240     [% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
241     [% Asset.js( "lib/codemirror/javascript-lint.min.js" ) | $raw %]
242     [% Asset.js( "lib/codemirror/css-lint.min.js" ) | $raw %]
243     [% Asset.js( "lib/codemirror/yaml-lint.min.js" ) | $raw %]
244
245     <script>
246         var Sticky;
247         var themelang = "[% themelang | html %]";
248         $(document).ready(function(){
249             [% UNLESS ( searchfield ) %]
250                 Sticky = $("#toolbar");
251                 Sticky.hcSticky({
252                     stickTo: "main",
253                     stickyClass: "floating"
254                 });
255             [% END %]
256             $("select[multiple='multiple']").multipleSelect( {
257                 placeholder: _("Please select ..."),
258                 selectAllText: _("Select all"),
259                 allSelected: _("All selected"),
260                 countSelected: _("# of % selected"),
261                 noMatchesFound: _("No matches found")
262             } );
263             $(".force_reload").on("click",function(e){
264                 e.preventDefault();
265                 window.location.reload(true);
266             });
267         });
268         // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
269         var to_highlight = "[% To.json( searchfield ) | $raw %]";
270         var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
271     </script>
272     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
273     [% Asset.js("js/ajax.js") | $raw %]
274     [% Asset.js("js/pages/preferences.js") | $raw %]
275     [%# Add WYSIWYG editor for htmlarea system preferences %]
276     [% INCLUDE 'wysiwyg-systempreferences.inc' %]
277 [% END %]
278
279 [% INCLUDE 'intranet-bottom.inc' %]