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