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