Bug 12904: Force browser to load new javascript files after upgrade
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / authorised_values.tt
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Administration &rsaquo; Authorized values
4 [% IF op == 'add_form' %]
5   [% IF ( action_modify ) %] &rsaquo; Modify authorized value[% END %]
6   [% IF ( action_add_value ) %] &rsaquo;  New authorized value[% END %]
7   [% IF ( action_add_category ) %] &rsaquo; New category[% END %]
8 [% END %]
9 </title>
10 [% INCLUDE 'doc-head-close.inc' %]
11
12 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
13
14 <style type="text/css">
15         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
16     fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
17         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
18     fieldset.rows .ui-tabs-nav { margin-left : 10px; }
19 </style>
20 </head>
21
22 <body id="admin_authorised_values" class="admin">
23 [% INCLUDE 'header.inc' %]
24 [% INCLUDE 'prefs-admin-search.inc' %]
25 <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; [% IF op == 'add_form' %] <a href="/cgi-bin/koha/admin/authorised_values.pl">Authorized values</a> &rsaquo; [% IF ( action_modify ) %]Modify authorized value[% END %]
26            [% IF ( action_add_value ) %]New authorized value[% END %]
27            [% IF ( action_add_category ) %]New category[% END %][% END %]
28 [% IF op == 'list' %]Authorized values[% END %]</div>
29
30 <div id="doc3" class="yui-t2">
31    
32    <div id="bd">
33         <div id="yui-main">
34         <div class="yui-b">
35
36 [% IF op == 'add_form' %]
37         <h1>
38            [% IF ( action_modify ) %]Modify authorized value[% END %]
39            [% IF ( action_add_value ) %]New authorized value[% END %]
40            [% IF ( action_add_category ) %]New category[% END %]
41         </h1>
42
43     [% IF ( action_modify ) %]<div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>[% END %]
44
45  <form action="/cgi-bin/koha/admin/authorised_values.pl" name="Aform" method="post" class="validated">
46         <fieldset class="rows"><ol>
47         [% IF action_add_category %]
48             <li>
49                 <label for="category" class="required">Category: </label>
50                 <input type="text" name="category"  id="category" size="32" maxlength="32" class="focus required" />
51                 <span class="required">Required</span>
52                 <input type="hidden" name="op" value="add_category" />
53             </li>
54         [% ELSE %]
55             <li>
56                 <span class="label">Category</span>
57                 <input type="hidden" name="op" value="add" />
58                 <input type="hidden" name="category" value="[% category | html %]" /> [% category | html %]
59             </li>
60         <li>
61             <label for="authorised_value">Authorized value: </label>
62             [% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
63             <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value | html %]" maxlength="80" class="focus" />
64         </li>
65         <li>
66             <label for="lib">Description: </label>
67             <input type="text" name="lib" id="lib" value="[% lib %]" maxlength="200" />
68         </li>
69         <li>
70             <label for="lib_opac">Description (OPAC): </label>
71             <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac %]" maxlength="200" />
72         </li>
73         <li><label for="branches">Libraries limitation: </label>
74             <select id="branches" name="branches" multiple size="10">
75                 <option value="">All libraries</option>
76                 [% FOREACH branch IN branches_loop %]
77                   [% IF ( branch.selected ) %]
78                     <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname |html %]</option>
79                   [% ELSE %]
80                     <option value="[% branch.branchcode %]">[% branch.branchname |html %]</option>
81                   [% END %]
82                 [% END %]
83             </select>
84             <span>Select 'All libraries' if this authorized value must be displayed all the time. Otherwise select libraries you want to associate with this value.</span>
85         </li>
86
87                 </ol>
88         <div id="icons" class="toptabs" style="clear:both">
89         <h5 style="margin-left:10px;">Choose an icon:</h5>
90                         <ul>
91                   <li><a href="#none">None</a></li>
92                                   [% FOREACH imageset IN imagesets %]
93                         [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
94                                   [% END %]
95                         </ul>
96   <div id="none"><ul>
97   <li><label for="noimage">No image: </label><input type="radio" name="imageurl" id="noimage" value="removeImage" /></li>
98   </ul>
99   <br class="clear" /></div>
100   [% FOREACH imageset IN imagesets %]
101   <div id="[% imageset.imagesetname %]"><ul>
102   [% FOREACH image IN imageset.images %]
103                         <li style="float: none; display: inline-block; clear : none; width: auto;">
104             <label> [% IF ( image.StaffImageUrl ) %]
105               <img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
106         [% ELSE %]
107         [% END %]
108     [% IF ( image.checked ) %]
109               <input type="radio" name="imageurl" value="[% image.KohaImage %]" checked="checked" />
110     [% ELSE %]
111               [% IF ( image.KohaImage ) %] <!-- to delete the radio button if there is no image after -->
112               <input type="radio" name="imageurl" value="[% image.KohaImage %]" />
113               [% END %]
114     [% END %]
115             </label>
116                         </li>
117   [% END %]</ul>
118   <br class="clear" />
119   </div>
120   [% END %]
121   </div>
122         [% END %]
123         </fieldset>
124        <fieldset class="action"> <input type="hidden" name="id" value="[% id %]" />
125         <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=[% category | url %]">Cancel</a></fieldset>
126     </form>
127 [% END %]
128
129
130 [% IF op == 'list' %]
131
132 <div id="toolbar" class="btn-toolbar">
133     <a id="addauth" class="btn btn-default btn-sm" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;category=[% category | url %]"><i class="fa fa-plus"> </i> New authorized value for [% category |html %]</a>
134     <a id="addcat" class="btn btn-default btn-sm" href= "/cgi-bin/koha/admin/authorised_values.pl?op=add_form"><i class="fa fa-plus"> </i> New category</a>
135 </div>
136
137 <h1>Authorized values</h1>
138 <div class="note"><i class="fa fa-exclamation"></i> <strong>NOTE:</strong> If you change an authorized value code, existing records using it won't be updated. Changes to value descriptions will show immediately.</div>
139
140 [% FOR m IN messages %]
141     <div class="dialog [% m.type %]">
142         [% SWITCH m.code %]
143         [% CASE 'error_on_update' %]
144             An error occurred when updating this authorized value. Perhaps the value already exists.
145         [% CASE 'error_on_insert' %]
146             An error occurred when inserting this authorized value. Perhaps the value or the category already exists.
147         [% CASE 'error_on_insert_cat' %]
148             An error occurred when inserting this authorized value category. Perhaps the category name already exists.
149         [% CASE 'error_on_delete' %]
150             An error occurred when deleting this authorized value. Check the logs.
151         [% CASE 'success_on_update' %]
152             Authorized value updated successfully.
153         [% CASE 'success_on_insert' %]
154             Authorized value added successfully.
155         [% CASE 'success_on_insert_cat' %]
156             Authorized value category added successfully.
157         [% CASE 'success_on_delete' %]
158             Authorized value deleted successfully.
159         [% CASE 'already_exists' %]
160             This authorized value already exists.
161         [% CASE 'cat_already_exists' %]
162             This authorized value category already exists.
163         [% CASE 'invalid_category_name' %]
164             The authorized value category 'branches', 'itemtypes' and 'cn_source' are used internally by Koha and are not valid.
165         [% CASE %]
166             [% m.code %]
167         [% END %]
168     </div>
169 [% END %]
170
171 <form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category">
172   <label for="searchfield">Show category: </label>
173   <select name="searchfield" id="searchfield" size="1">
174   [% FOR c IN categories %]
175     [% IF c == searchfield %]
176       <option value="[% c %]" selected="selected">[% c |html %]</option>
177     [% ELSE %]
178       <option value="[% c %]">[% c |html %]</option>
179     [% END %]
180   [% END %]
181   <input type="submit" value="Submit" />
182 </form>
183 [% IF ( category == 'Bsort1' ) %]
184     <p>An authorized value attached to patrons, that can be used for stats purposes</p>
185 [% END %]
186 [% IF ( category == 'Bsort2' ) %]
187     <p>An authorized value attached to patrons, that can be used for stats purposes</p>
188 [% END %]
189 [% IF ( category == 'Asort1' ) %]
190     <p>An authorized value attached to acquisitions, that can be used for stats purposes</p>
191 [% END %]
192 [% IF ( category == 'Asort2' ) %]
193     <p>An authorized value attached to acquisitions, that can be used for stats purposes</p>
194 [% END %]
195 [% IF ( category == 'SUGGEST' ) %]
196     <p>Reasons to reject or accept patron suggestions</p>
197 [% END %]
198 [% IF ( category == 'DAMAGED' ) %]
199     <p>Statuses to describe a damaged item</p>
200 [% END %]
201 [% IF ( category == 'LOST' ) %]
202    <p>Statuses to describe a lost item</p>
203 [% END %]
204 [% IF ( category == 'MANUAL_INV' ) %]
205     <p>Additional values for manual invoice types</p>
206 [% END %]
207 [% IF ( category == 'BOR_NOTES' ) %]
208     <p>Values for custom patron notes</p>
209 [% END %]
210 [% IF ( category == 'LOC' ) %]
211     <p>Values for shelving locations</p>
212 [% END %]
213 [% IF ( category == 'CCODE' ) %]
214     <p>Values for collection codes</p>
215  [% END %]
216  [% IF ( category == 'NOT_LOAN' ) %]
217     <p>Statuses to describe why an item is not for loan</p>
218  [% END %]
219 <h3>Authorized values for category [% category |html %]:</h3>
220
221 [% IF ( loop ) %]<div id="pagertable_authorized_values">
222 </div>[% END %]
223
224 [% IF ( loop ) %]<table id="table_authorized_values">
225 <thead><tr>
226         <th>Authorized value</th>
227         <th>Description</th>
228         <th>Description (OPAC)</th>
229         <th>Icon</th>
230     <th>Branches limitations</th>
231     <th>Actions</th>
232         </tr>
233 </thead><tbody>
234 [% FOREACH loo IN loop %]
235 [% UNLESS ( loop.odd ) %]
236 <tr>
237 [% ELSE %]
238 <tr>
239 [% END %]
240         <td>[% loo.authorised_value | html %]</td>
241     <td>[% loo.lib |html %]</td>
242     <td>[% loo.lib_opac |html %]</td>
243         <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
244     <td>
245         [% IF loo.branches.size > 0 %]
246             [% branches_str = "" %]
247             [% FOREACH branch IN loo.branches %]
248                 [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
249             [% END %]
250             <span href="#" title="[% branches_str %]">
251                 [% IF loo.branches.size > 1 %]
252                     [% loo.branches.size %] branches limitations
253                 [% ELSE %]
254                     [% loo.branches.size %] branch limitation
255                 [% END %]
256         [% ELSE %]
257             No limitation
258         [% END %]
259     </td>
260     <td class="actions"><a href="/cgi-bin/koha/admin/authorised_values.pl?op=add_form&amp;id=[% loo.id %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
261     <a class="delete btn btn-default btn-xs" href="/cgi-bin/koha/admin/authorised_values.pl?op=delete&amp;searchfield=[% searchfield | url %]&amp;id=[% loo.id %]"><i class="fa fa-trash"></i> Delete</a></td>
262 </tr>
263 [% END %]
264 </tbody></table>[% ELSE %]
265 <div class="dialog message">There are no authorized values defined for [% category |html %]</div>
266 [% END %]
267
268 [% IF ( isprevpage ) %]
269 <form class="inline" action="/cgi-bin/koha/admin/authorised_values.pl" method="post">
270 <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
271         <input type="submit" value="&lt;&lt; Previous" /></form>
272 [% END %] 
273
274 [% END %]
275
276 </div>
277 </div>
278 <div class="yui-b">
279 [% INCLUDE 'admin-menu.inc' %]
280 </div>
281 </div>
282
283 [% MACRO jsinclude BLOCK %]
284     <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu_[% KOHA_VERSION %].js"></script>
285     [% INCLUDE 'datatables.inc' %]
286     <script type="text/javascript">
287         $(document).ready(function() {
288             $("#table_authorized_values").dataTable($.extend(true, {}, dataTablesDefaults, {
289                 "aoColumnDefs": [
290                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
291                 ],
292                 "aaSorting": [[ 1, "asc" ]],
293                 "sPaginationType": "four_button"
294             }));
295
296             if ( $("#branches option:selected").length < 1 ) {
297                 $("#branches option:first").attr("selected", "selected");
298             }
299             $('#icons').tabs();
300
301             $("a.delete").click(function(){
302                 return confirm(_("Are you sure you want to delete this authorized value?"));
303             });
304             [% IF op == 'list' %]
305                 $('#category').find("input:submit").hide();
306                 $('#searchfield').change(function() {
307                     $('#category').submit();
308                 });
309             [% END %]
310         });
311     </script>
312
313 [% END %]
314 [% INCLUDE 'intranet-bottom.inc' %]