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