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