Bug 20568: API key management for OPAC users
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / itemtypes.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE AuthorisedValues %]
4 [% USE Price %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Administration &rsaquo; Item types [% IF op == 'add_form' %]&rsaquo;
8   [% IF ( itemtype ) %]
9 Modify item type '[% itemtype.itemtype %]'
10   [% ELSE %]
11 Add item type
12   [% END %]
13 [% END %]
14 [% IF op == 'delete_confirm' %]&rsaquo;
15   [% IF ( total ) %]
16 Cannot delete item type '[% itemtype.itemtype %]'
17   [% ELSE %]
18 Delete item type '[% itemtype.itemtype %]'?
19   [% END %]
20 [% END %]
21 [% IF op == 'delete_confirmed' %]&rsaquo;
22 Data deleted
23 [% END %]
24 </title>
25 [% INCLUDE 'doc-head-close.inc' %]
26 [% Asset.css("css/datatables.css") %]
27 <style type="text/css">
28         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
29   fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
30         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
31   fieldset.rows .ui-tabs-nav { margin-left : 10px; }
32 </style>
33 </head>
34
35 <body id="admin_itemtypes" class="admin">
36 [% INCLUDE 'header.inc' %]
37 [% INCLUDE 'prefs-admin-search.inc' %]
38
39 <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' %]
40   [% IF itemtype %]
41 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Modify item type '[% itemtype.itemtype %]'
42   [% ELSE %]
43 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Add item type
44   [% END %]
45 [% END %]
46 [% IF op == 'delete_confirm' %]
47   [% IF total %]
48 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Cannot delete item type '[% itemtype.itemtype %]'
49   [% ELSE %]
50 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Delete item type '[% itemtype.itemtype %]'?
51   [% END %]
52 [% END %]
53 [% IF op == 'delete_confirmed' %]
54 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo;Data deleted
55 [% END %]
56 [% IF op == 'list' %]
57 Item types administration
58 [% END %]</div>
59
60 <div id="doc3" class="yui-t2">
61
62    <div id="bd">
63         <div id="yui-main">
64         <div class="yui-b">
65         
66
67 [% IF op == 'list' %]<div id="toolbar" class="btn-toolbar">
68     <a class="btn btn-default btn-sm" id="newitemtype" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form"><i class="fa fa-plus"></i> New item type</a>
69 </div>[% END %]
70
71 [% FOREACH m IN messages %]
72     <div class="dialog [% m.type %]">
73         [% SWITCH m.code %]
74         [% CASE 'error_on_update' %]
75             An error occurred when updating this item type. Perhaps the value already exists.
76         [% CASE 'error_on_insert' %]
77             An error occurred when inserting this item type. Perhaps the value already exists.
78         [% CASE 'error_on_delete' %]
79             An error occurred when deleting this item type. Check the logs.
80         [% CASE 'success_on_update' %]
81             Item type updated successfully.
82         [% CASE 'success_on_insert' %]
83             Item type inserted successfully.
84         [% CASE 'success_on_delete' %]
85             Item type deleted successfully.
86         [% CASE 'already_exists' %]
87             This item type already exists.
88         [% CASE 'cannot_be_deleted' %]
89             Cannot delete this item type. <p><strong>This record is in use</strong>. Deletion is not possible.</p>
90         [% CASE %]
91             [% m.code %]
92         [% END %]
93     </div>
94 [% END %]
95
96
97 [% IF op == 'add_form' %]
98     [% IF itemtype %]
99         <h3>Modify item type</h3>
100     [% ELSE %]
101         <h3>Add item type</h3>
102     [% END %]
103     <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
104         <input type="hidden" name="op" value="add_validate" />
105         <fieldset class="rows">
106             <ol>
107                 [% IF itemtype %]
108                     <li>
109                         <input type="hidden" name="is_a_modif" value="1" />
110                         <span class="label">Item type: </span> <input type="hidden" name="itemtype" value="[% itemtype.itemtype %]" />
111                         [% itemtype.itemtype %]
112                     </li>
113                 [% ELSE %]
114                     <li>
115                         <label for="itemtype" class="required">Item type: </label>
116                         <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" required="required" /> <span class="required">Required</span>
117                     </li>
118                 [% END %]
119                 <li>
120                     <label for="description" class="required">Description: </label>
121                     <input type="text" id="description" name="description" size="48" value="[% itemtype.description |html %]" required="required" /> <span class="required">Required</span>
122                     [% IF can_be_translated %]
123                         <a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype %]" title="Translate item type [% itemtype.itemtype %]" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
124                     [% END %]
125                 </li>
126                 <li>
127                     <span class="label">Search category</span>
128                     <select id="searchcategory" name="searchcategory">
129                     <option value="">None</option>
130                         [% FOREACH cat IN searchcategory %]
131                             [% IF cat.authorised_value == itemtype.searchcategory %]
132                                 <option value="[% cat.authorised_value %]" selected="selected">
133                                     [% cat.lib %]
134                                 </option>
135                             [% ELSE %]
136                                 <option value="[% cat.authorised_value %]" >
137                                     [% cat.lib %]
138                                 </option>
139                             [% END %]
140                         [% END %]
141                     </select>
142                     (Options are defined as the authorized values for the ITEMTYPECAT category)
143                 </li>
144                 [% IF Koha.Preference('noItemTypeImages') %]
145                     <li>
146                         <span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages system preference</a>
147                     </li>
148                 [% END %]
149             </ol>
150             [% UNLESS Koha.Preference('noItemTypeImages') %]
151                 <div id="icons" class="toptabs" style="clear:both">
152                     <h5 style="margin-left:10px;">Choose an icon:</h5>
153                     <ul>
154                         <li><a href="#none">None</a></li>
155                         [% FOREACH imageset IN imagesets %]
156                             [% IF ( imageset.imagesetactive ) %]
157                                 <li class="ui-tabs-active">
158                             [% ELSE %]
159                                 <li>
160                             [% END %]
161                             <a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a>
162                             </li>
163                         [% END %]
164                         [% IF itemtype.image_location('intranet').match('^http') %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
165                     </ul>
166                     <div id="none">
167                         <ul>
168                             <li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
169                         </ul>
170                         <br class="clear" />
171                     </div>
172
173                     [% FOREACH imageset IN imagesets %]
174                         <div id="[% imageset.imagesetname %]">
175                             <ul>
176                                 [% FOREACH image IN imageset.images %]
177                                     <li style="float: none; display: inline-block; clear : none; width: auto;">
178                                         <label>
179                                             [% IF image.StaffImageUrl %]
180                                                 <img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
181                                             [% END %]
182                                             [% IF image.checked %]
183                                                 <input type="radio" name="image" value="[% image.KohaImage %]" checked="checked" />
184                                             [% ELSIF image.KohaImage %] <!-- to delete the radio button if there is no image after -->
185                                                 <input type="radio" name="image" value="[% image.KohaImage %]" />
186                                             [% END %]
187                                         </label>
188                                     </li>
189                                 [% END %]
190                             </ul>
191                             <br class="clear" />
192                         </div>
193                     [% END %]
194
195                     <div id="remote">
196                         <ul>
197                             <li>
198                                 <label for="remote_image_check"> Remote image:</label>
199                                 [% IF itemtype.imageurl %]
200                                     <input type="radio" id="remote_image_check" name="image" value="remoteImage" checked="checked" />
201                                 [% ELSE %]
202                                     <input type="radio" id="remote_image_check" name="image" value="remoteImage" />
203                                 [% END %]
204                                 <input type="text" name="remoteImage" size="48" maxlength="200" value="[% itemtype.imageurl %]" onmousedown="document.getElementById('remote_image_check').checked = true;" />
205                                 [% IF itemtype.imageurl %]
206                                     <img src="[% itemtype.imageurl %]" alt="" />
207                                 [% END %]
208                             </li>
209                         </ul>
210                         <br class="clear" />
211                     </div>
212                 </div>
213             [% END %]
214             <ol class="oladditemtype">
215                 <li>
216                     <label for="hideinopac">Hide in OPAC: </label>
217                     [% IF ( itemtype.hideinopac ) %]
218                         <input type="checkbox" id="hideinopac" name="hideinopac" checked="checked" value="1" />
219                     [% ELSE %]
220                         <input type="checkbox" id="hideinopac" name="hideinopac" value="1" />
221                     [% END %]
222                     (if checked, items of this type will be hidden as filters in OPAC's advanced search)
223                 </li>
224                 <li>
225                     <label for="notforloan">Not for loan: </label>
226                         [% IF itemtype.notforloan %]
227                             <input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" />
228                         [% ELSE %]
229                             <input type="checkbox" id="notforloan" name="notforloan" value="1" />
230                         [% END %]
231                       (if checked, no item of this type can be issued. If not checked, every item of this type can be issued unless notforloan is set for a specific item)
232                 </li>
233                 <li>
234                     <label for="rentalcharge">Rental charge: </label>
235                     <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% itemtype.rentalcharge %]" />
236                 </li>
237                 <li>
238                     <label for="defaultreplacecost">Default replacement cost: </label>
239                     <input type="text" id="defaultreplacecost" name="defaultreplacecost" size="10" value="[% itemtype.defaultreplacecost %]" />
240                 </li>
241                 <li>
242                     <label for="processfee">Processing fee (when lost): </label>
243                     <input type="text" id="processfee" name="processfee" size="10" value="[% itemtype.processfee %]" />
244                 </li>
245                 <li>
246                     <label for="checkinmsg">Checkin message: </label>
247                     <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% itemtype.checkinmsg %]</textarea>
248                 </li>
249                 <li>
250                     <label for="checkinmsgtype">Checkin message type: </label>
251                     <select type="text" id="checkinmsgtype" name="checkinmsgtype">
252                         [% IF itemtype.checkinmsgtype == 'message' %]
253                             <option value="message" selected="selected">Message</option>
254                         [% ELSE %]
255                             <option value="message">Message</option>
256                         [% END %]
257                         [% IF itemtype.checkinmsgtype == 'alert' %]
258                             <option value="alert" selected="selected">Alert</option>
259                         [% ELSE %]
260                             <option value="alert">Alert</option>
261                         [% END %]
262                     </select>
263                 </li>
264                 <li>
265                     <label for="sip_media_type">SIP media type: </label>
266                     <select id="sip_media_type" name="sip_media_type">
267                         <option value=""></option>
268                         [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE') %]
269                             [% IF a.authorised_value == itemtype.sip_media_type %]
270                                 <option value="[% a.authorised_value %]" selected="selected">[% a.lib %]</option>
271                             [% ELSE %]
272                                 <option value="[% a.authorised_value %]">[% a.lib %]</option>
273                             [% END %]
274                         [% END %]
275                     </select>
276                 </li>
277                 <li>
278                     <label for="summary">Summary: </label>
279                    <textarea id="summary" name="summary" cols="55" rows="5">[% itemtype.summary %]</textarea>
280                     <p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p>
281                     <p><b>&lt;a href="[856u]"&gt;open site&lt;/a&gt;</b> will show the link just below the title</p>
282                 </li>
283             </ol>
284         </fieldset>
285
286         <fieldset class="action">
287             <input type="submit" value="Save changes" />
288             <a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
289         </fieldset>
290     </form>
291 [% END %]
292
293 [% IF op == 'delete_confirm' %]
294     <div class="dialog alert">
295         <h3>Delete item type '[% itemtype.itemtype %]'?</h3>
296         <table>
297             <tr>
298                 <th scope="row">Item type</th>
299                 <td>[% itemtype.itemtype %]</td>
300             </tr>
301             <tr><th scope="row">Description</th><td>[% itemtype.translated_description %]</td></tr>
302             [% UNLESS Koha.Preference('noItemTypeImages') %]
303                 <tr>
304                     <th scope="row">Image</th>
305                     <td>
306                         [% SET image_location = itemtype.image_location('intranet') %]
307                         [% IF image_location %]<img src="[% image_location %]" alt="" />[% END %]
308                     </td>
309                 </tr>
310             [% END %]
311             <tr><th scope="row">Rental charge</th><td>[% itemtype.rentalcharge | $Price %]</td></tr>
312         </table>
313         <form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
314             <input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="[% itemtype.itemtype %]" />
315             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this item type</button>
316         </form>
317         <form action="/cgi-bin/koha/admin/itemtypes.pl" method="post">
318             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
319         </form>
320     </div>
321 [% END %]
322
323 [% IF op == 'list' %]
324     <h2>Item types administration</h2>
325     [% IF itemtypes %]
326         <table id="table_item_type">
327           <thead>
328             [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %]
329             <th>Code</th>
330             <th>Description</th>
331             <th>Search category</th>
332             <th>Not for loan</th>
333             <th>Hide in OPAC</th>
334             <th>Charge</th>
335             <th>Default replacement cost</th>
336             <th>Processing fee (when lost)</th>
337             <th>Checkin message</th>
338             <th>Actions</th>
339           </thead>
340           [% FOREACH itemtype IN itemtypes %]
341             <tr>
342                 [% UNLESS Koha.Preference('noItemTypeImages') %]
343                     <td>
344                         [% SET image_location = itemtype.image_location('intranet') %]
345                         [% IF image_location %]<img src="[% image_location %]" alt="" />[% ELSE %]&nbsp;[% END %]
346                     </td>
347                 [% END %]
348             <td>
349               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype |html %]">
350                 [% itemtype.itemtype %]
351               </a>
352             </td>
353             <td>
354                 [% IF itemtype.translated_descriptions.size %]
355                     [% itemtype.description %] (default)<br/>
356                     [% FOR description IN itemtype.translated_descriptions %]
357                         [% IF description.translation == itemtype.translated_description %]
358                             <b>[% description.translation %]</b>
359                         [% ELSE %]
360                             [% description.translation %] ([% description.lang %])
361                         [% END %]
362                         <br/>
363                     [% END %]
364                 [% ELSE %]
365                     [% itemtype.description |html %]
366                 [% END %]
367             </td>
368             <td>[% itemtype.searchcategory %]</td>
369             <td>[% IF ( itemtype.notforloan ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
370             <td>[% IF ( itemtype.hideinopac ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
371             <td>
372             [% UNLESS ( itemtype.notforloan ) %]
373               [% itemtype.rentalcharge | $Price %]
374             [% END %]
375             </td>
376             <td>[% itemtype.defaultreplacecost | $Price %]</td>
377             <td>[% itemtype.processfee | $Price %]</td>
378             <td>[% itemtype.checkinmsg | html | html_line_break %]</td>
379             <td class="actions">
380               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype |html %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
381               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=delete_confirm&amp;itemtype=[% itemtype.itemtype |html %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
382             </td>
383           </tr>
384           [% END %]
385         </table>
386     [% ELSE %]
387         <div class="dialog message">There are no itemtypes defined</div>
388     [% END %]
389 [% END %]
390
391 </div>
392 </div>
393 <div class="yui-b">
394 [% INCLUDE 'admin-menu.inc' %]
395 </div>
396 </div>
397
398 [% MACRO jsinclude BLOCK %]
399     [% Asset.js("js/admin-menu.js") %]
400     [% INCLUDE 'greybox.inc' %]
401     [% INCLUDE 'datatables.inc' %]
402     <script type="text/javascript">
403          $(document).ready(function() {
404             $('#icons').tabs();
405             $("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
406                 "aoColumnDefs": [
407                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
408                 ],
409                 "aaSorting": [[ 2, "asc" ]],
410                 "iDisplayLength": 10,
411                 "sPaginationType": "four_button"
412             }));
413             $( "#itemtypeentry" ).validate({
414                 rules: {
415                     itemtype: { required: true },
416                     description: { required: true },
417                     rentalcharge: { number: true }
418                 }
419             });
420             $("#itemtype").on("blur",function(){
421                 toUC(this);
422             });
423          });
424     </script>
425 [% END %]
426
427 [% INCLUDE 'intranet-bottom.inc' %]