Bug 10513: display a warning/message when returning a chosen item type
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / itemtypes.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Item types [% IF ( add_form ) %]&rsaquo;
3   [% IF ( itemtype ) %]
4 Modify item type '[% itemtype %]'
5   [% ELSE %]
6 Add item type
7   [% END %]
8 [% END %]
9 [% IF ( delete_confirm ) %]&rsaquo; 
10   [% IF ( total ) %]
11 Cannot delete item type '[% itemtype %]'
12   [% ELSE %]
13 Delete item type '[% itemtype %]'?
14   [% END %]
15 [% END %]
16 [% IF ( delete_confirmed ) %]&rsaquo; 
17 Data deleted
18 [% END %]
19 </title>
20 [% INCLUDE 'doc-head-close.inc' %]
21 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
22 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
23 [% INCLUDE 'datatables-strings.inc' %]
24 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
25 <script type="text/javascript">
26 //<![CDATA[
27
28 function isNotNull(f,noalert) {
29         if (f.value.length ==0) {
30                 return false;
31         }
32         return true;
33 }
34
35 function toUC(f) {
36         var x=f.value.toUpperCase();
37         f.value=x;
38         return true;
39 }
40
41 function isNum(v,maybenull) {
42 var n = new Number(v.value);
43 if (isNaN(n)) {
44         return false;
45         }
46 if (maybenull==0 && v.value=='') {
47         return false;
48 }
49 return true;
50 }
51
52 function isDate(f) {
53         var t = Date.parse(f.value);
54         if (isNaN(t)) {
55                 return false;
56         }
57 }
58
59 function Check(f) {
60         var ok=1;
61         var _alertString="";
62         var alertString2;
63         if (f.itemtype.value.length==0) {
64                 _alertString += "\n- " + _("Itemtype missing");
65         }
66         if (!(isNotNull(window.document.Aform.description,1))) {
67                 _alertString += "\n- " + _("Description missing");
68         }
69         if ((!isNum(f.rentalcharge,0)) && f.rentalcharge.value.length > 0) {
70                 _alertString += "\n- " + _("Rental charge is not a number");
71         }
72         if (_alertString.length==0) {
73                 document.Aform.submit();
74         } else {
75                 alertString2  = _("Form not submitted because of the following problem(s)");
76                 alertString2 += "\n------------------------------------------------------------------------------------\n";
77                 alertString2 += _alertString;
78                 alert(alertString2);
79         }
80 }
81      $(document).ready(function() {
82         $('#icons').tabs();
83         $("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
84             "aoColumnDefs": [
85                 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
86             ],
87             "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
88             "aaSorting": [[ 2, "asc" ]],
89             "iDisplayLength": 10
90         }));
91      });
92 //]]>
93 </script>
94 <style type="text/css">
95         fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
96   fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-selected {background-color : #F4F8F9; }
97         fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
98   fieldset.rows .ui-tabs-nav { margin-left : 10px; }
99 </style>
100 </head>
101 <body id="admin_itemtypes" class="admin">
102 [% INCLUDE 'header.inc' %]
103 [% INCLUDE 'cat-search.inc' %]
104
105 <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 ( add_form ) %]
106   [% IF ( itemtype ) %]
107 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Modify item type '[% itemtype %]'
108   [% ELSE %]
109 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Add item type
110   [% END %]
111 [% END %]
112 [% IF ( delete_confirm ) %]
113   [% IF ( total ) %]
114 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Cannot delete item type '[% itemtype %]'
115   [% ELSE %]
116 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo; Delete item type '[% itemtype %]'?
117   [% END %]
118 [% END %]
119 [% IF ( delete_confirmed ) %]
120 <a href="/cgi-bin/koha/admin/itemtypes.pl">Item types</a> &rsaquo;Data deleted
121 [% END %]
122 [% IF ( else ) %]
123 Item types administration
124 [% END %]</div>
125
126 <div id="doc3" class="yui-t2">
127    
128    <div id="bd">
129         <div id="yui-main">
130         <div class="yui-b">
131         
132 [% IF ( else ) %]<div id="toolbar" class="btn-toolbar">
133     <a class="btn btn-small" id="newitemtype" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form"><i class="icon-plus"></i> New item type</a>
134 </div>[% END %]
135
136 [% IF ( add_form ) %]
137   [% IF ( itemtype ) %]
138       <h3>Modify item type</h3>
139   [% ELSE %]
140       <h3>Add item type</h3>
141   [% END %]
142 <form action="[% script_name %]" name="Aform" method="post">
143   <input type="hidden" name="op" value="add_validate" />
144     <input type="hidden" name="checked" value="0" />
145                 
146     <fieldset class="rows">
147         <ol>
148   [% IF ( itemtype ) %]
149       <li>
150           <span class="label">Item type: </span> <input type="hidden" name="itemtype" value="[% itemtype %]" />
151           [% itemtype %]
152      </li>
153   [% ELSE %]
154       <li>
155           <label for="itemtype">Item type: </label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" class="focus" />
156       </li>
157   [% END %]
158       <li>
159       [% IF ( itemtype ) %]
160           <label for="description">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" class="focus" /></li>
161       [% ELSE %]
162           <label for="description">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /></li>
163       [% END %]
164      [% IF ( noItemTypeImages ) %]
165          <li><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></li></ol>
166          [% ELSE %]</ol>
167     <div id="icons" class="toptabs" style="clear:both">
168         <h5 style="margin-left:10px;">Choose an icon:</h5>
169                         <ul>
170           <li><a href="#none">None</a></li>
171                                   [% FOREACH imageset IN imagesets %]
172             [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
173                                   [% END %]
174                   [% IF ( remote_image ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
175                         </ul>
176   <div id="none"><ul>
177   <li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
178   </ul>
179   <br class="clear" /></div>
180
181   [% FOREACH imageset IN imagesets %]
182   <div id="[% imageset.imagesetname %]"><ul>
183   [% FOREACH image IN imageset.images %]
184                         <li style="float: none; display: inline-block; clear : none; width: auto;">
185             <label> [% IF ( image.StaffImageUrl ) %]
186               <img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
187         [% ELSE %]
188         [% END %]
189     [% IF ( image.checked ) %]
190               <input type="radio" name="image" value="[% image.KohaImage %]" checked="checked" />
191     [% ELSE %]
192               [% IF ( image.KohaImage ) %] <!-- to delete the radio button if there is no image after -->
193               <input type="radio" name="image" value="[% image.KohaImage %]" />
194               [% END %]
195     [% END %]
196             </label>
197                         </li>
198   [% END %]
199   </ul>
200   <br class="clear" />
201   </div>
202   [% END %]
203 <div id="remote"><ul>
204 <li> <label for="remote_image_check"> Remote image:</label>
205   [% IF ( remote_image ) %]
206             <input type="radio" id="remote_image_check" name="image" value="remoteImage" checked="checked" />
207   [% ELSE %]
208             <input type="radio" id="remote_image_check" name="image" value="remoteImage" />
209   [% END %]<input type="text" name="remoteImage" size="48" maxlength="200" value="[% remote_image %]" onmousedown="document.getElementById('remote_image_check').checked = true;" /> [% IF ( remote_image ) %]
210             <img src="[% remote_image %]" alt="" />
211   [% END %]</li>
212 </ul>
213   <br class="clear" />
214 </div>
215 [% END %]
216 </div>
217 <ol>
218       <li>
219           <label for="notforloan">Not for loan: </label>   [% IF ( notforloan ) %]
220                 <input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" />
221             [% ELSE %]
222                 <input type="checkbox" id="notforloan" name="notforloan" value="1" />
223             [% END %]
224           (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)
225         
226       </li>
227       <li>
228           <label for="rentalcharge">Rental charge: </label>
229                   <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
230          </li>
231       <li>
232           <label for="checkinmsg">Check in message: </label>
233           <input type="text" id="checkinmsg" name="checkinmsg" size="48" value="[% checkinmsg %]" />
234       </li>
235       <li>
236           <label for="checkinmsgtype">Check in message type: </label>
237           <select type="text" id="checkinmsgtype" name="checkinmsgtype">
238               [% IF ( checkinmsgtype == 'message' ) %]
239               <option value="message" selected="selected">Message</option>
240               [% ELSE %]
241                  <option value="message">Message</option>
242               [% END %]
243               [% IF ( checkinmsgtype == 'alert' ) %]
244               <option value="alert" selected="selected">Alert</option>
245               [% ELSE %]
246                   <option value="alert">Alert</option>
247               [% END %]
248           <select>
249       </li>
250       <li>
251           <label for="summary">Summary: </label>
252          <textarea id="summary" name="summary" cols="55" rows="5">[% summary %]</textarea>
253           <p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p>
254           <p><b>&lt;a href="[856u]"&gt;open site&lt;/a&gt;</b> will show the link just below the title</p>
255       </li>
256           </ol>
257     </fieldset>
258
259     <fieldset class="action">
260       <input type="button" value="Save changes" onclick="Check(this.form)" />
261           <a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
262     </fieldset>
263 </form>
264 [% END %]
265
266 [% IF ( delete_confirm ) %]
267 [% IF ( total ) %]<div class="dialog message">
268 <h3>Cannot delete item type</h3>
269 <p><strong>This record is used [% total %] times</strong>. Deletion is not possible.</p>
270 [% ELSE %]<div class="dialog alert">
271 <h3>Delete item type '[% itemtype %]'?</h3>
272 [% END %]
273 <table>
274                 <tr>
275                         <th scope="row">Item type</th>
276                         <td>[% itemtype %]</td>
277                 </tr>
278
279         <tr><th scope="row">Description</th><td>[% description %]</td></tr>
280         <tr><th scope="row">Loan length</th><td>[% loanlength %]</td></tr>
281 <tr><th scope="row">Rental charge</th><td>[% rentalcharge %]</td></tr></table>
282                 <form action="[% script_name %]" method="post">
283                 <input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="[% itemtype %]" />[% IF ( total ) %]
284                 </form>
285                 
286                 <form action="[% script_name %]" method="post"><input type="submit" class="approve" value="OK" /></form>
287         [% ELSE %]
288                 <input type="submit" class="approve" value="Delete this Item Type" /></form> <form action="[% script_name %]" method="post"><input type="submit" class="deny" value="Do Not Delete" /></form>
289         [% END %]
290 </div>
291         
292 [% END %]
293
294 [% IF ( else ) %]
295 <h2>Item types administration</h2>
296 [% IF ( loop ) %]
297 <table id="table_item_type">
298   <thead>
299     [% UNLESS ( noItemTypeImages ) %]<th>Image</th>[% END %]
300     <th>Code</th>
301     <th>Description</th>
302     <th>Not for loan</th>
303     <th>Charge</th>
304     <th>Check in message</th>
305     <th>Actions</th>
306   </thead>
307   [% FOREACH loo IN loop %]
308     [% UNLESS ( loop.odd ) %]
309   <tr class="highlight">
310     [% ELSE %]
311   <tr>
312     [% END %]
313    [% UNLESS ( noItemTypeImages ) %] <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt="" />[% ELSE %]&nbsp;[% END %]</td>[% END %]
314     <td>
315       <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">
316         [% loo.itemtype %]
317       </a>
318     </td>
319     <td>[% loo.description %]</td>
320     <td>[% IF ( loo.notforloan ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
321     <td>
322     [% UNLESS ( loo.notforloan ) %]
323       [% loo.rentalcharge %]
324     [% END %]
325     </td>
326     <td>[% loo.checkinmsg %]</td>
327     <td>
328       <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
329       <a href="[% loo.script_name %]?op=delete_confirm&amp;itemtype=[% loo.itemtype |html %]">Delete</a>
330     </td>
331   </tr>
332   [% END %]
333 </table>[% ELSE %]
334 <div class="dialog message">There are no itemtypes defined</div>
335 [% END %]
336
337 <div class="pages">[% pagination_bar %]</div>
338
339 [% END %]
340
341
342
343 </div>
344 </div>
345 <div class="yui-b">
346 [% INCLUDE 'admin-menu.inc' %]
347 </div>
348 </div>
349 [% INCLUDE 'intranet-bottom.inc' %]