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