Bug 22015: Move DataTables CSS to global include
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / preferences.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo; System preferences</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/preferences.css") | $raw %]
9 [% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.css") | $raw %]
10 [% Asset.css("css/humanmsg.css") | $raw %]
11 </head>
12 <body id="admin_preferences" class="admin">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'prefs-admin-search.inc' %]
15
16 <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>
17
18 <div class="main container-fluid">
19     <div class="row">
20         <div class="col-sm-10 col-sm-push-2">
21             <main>
22
23     [% IF ( jump_not_found ) %]
24     <h2>System preferences</h2>
25     <div class="dialog alert">
26         Could not find a system preference named <code>[% jumpfield | html %]</code>.
27     </div>
28     [% END %]
29     [% IF ( search_not_found ) %]
30     <div class="dialog alert">
31         No system preferences matched your search for: <strong>[% searchfield | html %]</strong>
32     </div>
33     [% ELSIF searchfield %]
34         <h1>You searched for: [% searchfield | html %]</h1>
35     [% END %]
36     [% FOREACH TAB IN TABS %]
37     <div class="prefs-tab">
38     <h2>[% TAB.tab_title | html %] preferences</h2>
39     <form action="/cgi-bin/koha/admin/preferences.pl" method="post">
40         [% UNLESS ( searchfield ) %]<div id="toolbar"><button class="save-all submit" type="submit">Save all [% TAB.tab_title | html %] preferences</button></div>[% END %]
41         <input type="hidden" name="op" value="save" />
42         <input type="hidden" name="tab" value="[% TAB.tab_id | html %]" />
43
44             [% FOREACH LINE IN TAB.LINES %]
45             [% IF ( LINE.is_group_title ) %]
46             [% UNLESS ( loop.first ) %]</tbody></table>[% END %]
47             <h3>[% LINE.title | html %]</h3>
48             <table class="preferences">
49             <thead><tr><th>Preference</th><th>Value</th></tr></thead>
50             [% UNLESS ( loop.last ) %]<tbody>[% END %]
51             [% ELSE %]
52             [% IF ( loop.first ) %]<table class="preferences"><thead><tr><th>Preference</th><th>Value</th></tr></thead><tbody>[% END %]
53             <tr class="name-row">
54                 <td class="name-cell">
55                     <code>
56                         [% FOREACH NAME IN LINE.NAMES %]
57                                                 <label for="pref_[% NAME.name | html %]">
58                                                         [% IF ( NAME.jumped ) %]
59                                                         <span class="term" id="jumped">[% NAME.name | html %]</span>
60                             [% ELSIF ( NAME.highlighted ) %]
61                                                         <span class="term">[% NAME.name | html %]</span>
62                                                         [% ELSE %]
63                                                         [% NAME.name | html %]
64                                                         [% END %]
65
66                             [% IF NAME.overridden %]
67                                 <span class="overridden" title="The system preference [% NAME.name | html %] may have been overridden from this value by one or more virtual hosts.">
68                                     [Overridden]
69                                 </span>
70                             [% END %]
71                                                 </label>
72                         [% UNLESS ( loop.last ) %]<br />[% END %]
73                         [% END %]
74                     </code>
75                 </td>
76                 <td><div>
77                     [% FOREACH CHUNK IN LINE.CHUNKS %]
78                     [% IF ( CHUNK.type_text ) %]
79                     [% CHUNK.contents | $raw %]
80                     [% ELSIF ( CHUNK.type_input ) %]
81                     <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 %]
82                     [% ELSIF ( CHUNK.type_select ) %]
83                     <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]">
84                         [% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
85                         [% IF ( CHOICE.selected ) %]
86                         <option value="[% CHOICE.value | html %]" selected="selected">
87                         [% ELSE %]
88                         <option value="[% CHOICE.value | html %]">
89                         [% END %]
90                             [% CHOICE.text | html %]
91                         </option>
92                         [% END %]
93                     </select>
94                     [% ELSIF ( CHUNK.type_multiple ) %]
95                     <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
96                         [% 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 %]
97                     </select>
98                     [% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%]
99                         [% IF ( CHUNK.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
100                         <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>
101                         [% ELSE %]
102                         <a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
103                         <textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" rows="10" cols="40">[% CHUNK.value | html %]</textarea>
104                         <a class="collapse-textarea" style="display:none" href="#">Click to collapse</br></a>
105                         [% END %]
106                     [% ELSIF ( CHUNK.type_languages ) %]
107                     <dl class="sortable">
108                     [% FOREACH language IN CHUNK.languages %]
109                     <div>
110                         [% IF ( language.plural ) %]
111                         <dt>
112                             [% IF ( language.native_description ) %][% language.native_description | html %][% ELSE %][% language.rfc4646_subtag | html %][% END %]
113                         </dt>
114                         [% FOREACH sublanguages_loo IN language.sublanguages_loop %]
115                         <dd>
116                             <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>
117                             [% IF ( sublanguages_loo.enabled ) %]
118                             <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"/>
119                             [% ELSE %]
120                             <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"/>
121                             [% END %]
122                         </dd>
123                         [% END %]
124                         [% ELSE %]
125                         <dt>
126                             <label for="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]">[% language.native_description | html %]([% language.rfc4646_subtag | html %])</label>
127                             [% IF ( language.group_enabled ) %]
128                             <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"/>
129                             [% ELSE %]
130                             <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"/>
131                             [% END %]
132                         </dt>
133                         [% END %]
134                     </div>
135                     [% END %]
136                     </dl>
137                     [% END %]
138                     [% END %]
139                 </div></td>
140             </tr>
141             [% IF ( loop.last ) %]</tbody></table>[% END %]
142             [% END %]
143         [% END %]
144         <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>
145     </form>
146     </div>
147     [% END %]
148
149             </main>
150         </div> <!-- /.col-sm-10.col-sm-push-2 -->
151
152         <div class="col-sm-2 col-sm-pull-10">
153             <aside>
154                 [% INCLUDE 'prefs-menu.inc' %]
155             </aside>
156         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
157      </div> <!-- /.row -->
158
159 [% MACRO jsinclude BLOCK %]
160     [% INCLUDE 'datatables.inc' %]
161     [% Asset.js("lib/hc-sticky.js") | $raw %]
162     [% Asset.js("lib/jquery/plugins/multiple-select/jquery.multiple.select.js") | $raw %]
163     <script>
164         var Sticky;
165         $(document).ready(function(){
166             [% UNLESS ( searchfield ) %]
167                 Sticky = $("#toolbar");
168                 Sticky.hcSticky({
169                     stickTo: "main",
170                     stickyClass: "floating"
171                 });
172             [% END %]
173             $("select[multiple='multiple']").multipleSelect( {
174                 placeholder: _("Please select ..."),
175                 selectAllText: _("Select all"),
176                 allSelected: _("All selected"),
177                 countSelected: _("# of % selected"),
178                 noMatchesFound: _("No matches found")
179             } );
180             $(".force_reload").on("click",function(e){
181                 e.preventDefault();
182                 window.location.reload(true);
183             });
184         });
185         // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
186         var to_highlight = "[% searchfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
187         var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
188         var MSG_NOTHING_TO_SAVE = _("Nothing to save");
189         var MSG_SAVING = _("Saving...");
190         var MSG_SAVED_PREFERENCE = _("Saved preference %s");
191         var MSG_MODIFIED = _("modified");
192         var MSG_MADE_CHANGES = _("You have made changes to system preferences.");
193         var MSG_CLICK_TO_EXPAND = _("Click to expand this section");
194         var MSG_CLICK_TO_COLLAPSE = _("Click to collapse this section");
195         var MSG_INTERNAL_SERVER_ERROR = _( "Internal Server Error, please reload the page" );
196         var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" );
197         var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" );
198         var MSG_LOADING = _( "Loading..." );
199     </script>
200     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
201     [% Asset.js("js/ajax.js") | $raw %]
202     [% Asset.js("js/pages/preferences.js") | $raw %]
203     [%# Add WYSIWYG editor for htmlarea system preferences %]
204     [% INCLUDE 'wysiwyg-systempreferences.inc' %]
205 [% END %]
206
207 [% INCLUDE 'intranet-bottom.inc' %]