Merge remote-tracking branch 'origin/new/bug_6634'
[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">
131         <script type="text/javascript">
132         //<![CDATA[
133
134         // prepare DOM for YUI Toolbar
135
136          $(document).ready(function() {
137             yuiToolbar();
138          });
139
140         // YUI Toolbar Functions
141
142         function yuiToolbar() {
143             new YAHOO.widget.Button("newitemtype");
144         }
145
146         //]]>
147         </script>
148         <ul class="toolbar">
149     <li><a id="newitemtype" href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form">New item type</a></li>
150 </ul></div>[% ELSE %]&nbsp;[% END %]
151
152 [% IF ( add_form ) %]
153   [% IF ( itemtype ) %]
154       <h3>Modify item type</h3>
155   [% ELSE %]
156       <h3>Add item type</h3>
157   [% END %]
158 <form action="[% script_name %]" name="Aform" method="post">
159   <input type="hidden" name="op" value="add_validate" />
160     <input type="hidden" name="checked" value="0" />
161                 
162     <fieldset class="rows">
163         <ol>
164   [% IF ( itemtype ) %]
165       <li>
166           <span class="label">Item type</span> <input type="hidden" name="itemtype" value="[% itemtype %]" />
167           [% itemtype %]
168      </li>
169   [% ELSE %]
170       <li>
171           <label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" />
172       </li>
173   [% END %]
174       <li>
175           <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" />      </li>
176      [% IF ( noItemTypeImages ) %]
177          <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>
178          [% ELSE %]</ol>
179     <div id="icons" class="toptabs" style="clear:both">
180         <h5 style="margin-left:10px;">Choose an icon:</h5>
181                         <ul>
182           <li><a href="#none">None</a></li>
183                                   [% FOREACH imageset IN imagesets %]
184             [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
185                                   [% END %]
186                   [% IF ( remote_image ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
187                         </ul>
188   <div id="none"><ul>
189   <li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
190   </ul>
191   <br class="clear" /></div>
192
193   [% FOREACH imageset IN imagesets %]
194   <div id="[% imageset.imagesetname %]"><ul>
195   [% FOREACH image IN imageset.images %]
196                         <li style="float: none; display: inline; clear : none; width: auto;">
197             <label> [% IF ( image.StaffImageUrl ) %]
198               <img src="[% image.StaffImageUrl %]" alt="[% image.StaffImageUrl %]" title="[% image.StaffImageUrl %]" />
199         [% ELSE %]
200         [% END %]
201     [% IF ( image.checked ) %]
202               <input type="radio" name="image" value="[% image.KohaImage %]" checked="checked" />
203     [% ELSE %]
204               [% IF ( image.KohaImage ) %] <!-- to delete the radio button if there is no image after -->
205               <input type="radio" name="image" value="[% image.KohaImage %]" />
206               [% END %]
207     [% END %]
208             </label>
209                         </li>
210   [% END %]
211   </ul>
212   <br class="clear" />
213   </div>
214   [% END %]
215 <div id="remote"><ul>
216 <li> <label for="remote_image_check"> Remote image:</label>
217   [% IF ( remote_image ) %]
218             <input type="radio" id="remote_image_check" name="image" value="remoteImage" checked="checked" />
219   [% ELSE %]
220             <input type="radio" id="remote_image_check" name="image" value="remoteImage" />
221   [% END %]<input type="text" name="remoteImage" size="48" maxlength="200" value="[% remote_image %]" onmousedown="document.getElementById('remote_image_check').checked = true;" /> [% IF ( remote_image ) %]
222             <img src="[% remote_image %]" alt="" />
223   [% END %]</li>
224 </ul>
225   <br class="clear" />
226 </div>
227 [% END %]
228 </div>
229 <ol>
230       <li>
231           <label for="notforloan">Not for loan</label>   [% IF ( notforloan ) %]
232                 <input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" />
233             [% ELSE %]
234                 <input type="checkbox" id="notforloan" name="notforloan" value="1" />
235             [% END %]
236           (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)
237         
238       </li>
239       <li>
240           <label for="rentalcharge">Rental charge: </label>
241                   <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
242          </li>
243       <li>
244           <label for="summary">Summary: </label>
245          <textarea id="summary" name="summary" cols="55" rows="5">[% summary %]</textarea>
246           <p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p>
247           <p><b>&lt;a href="[856u]"&gt;open site&lt;/a&gt;</b> will show the link just below the title</p>
248       </li>
249           </ol>
250     </fieldset>
251
252     <fieldset class="action">
253       <input type="button" value="Save Changes" onclick="Check(this.form)" />
254           <a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
255     </fieldset>
256 </form>
257 [% END %]
258
259 [% IF ( delete_confirm ) %]
260 [% IF ( total ) %]<div class="dialog message">
261 <h3>Cannot delete item type</h3>
262 <p><strong>This record is used [% total %] times</strong>. Deletion is not possible.</p>
263 [% ELSE %]<div class="dialog alert">
264 <h3>Delete item type '[% itemtype %]'?</h3>
265 [% END %]
266 <table>
267                 <tr>
268                         <th scope="row">Item type</th>
269                         <td>[% itemtype %]</td>
270                 </tr>
271
272         <tr><th scope="row">Description</th><td>[% description %]</td></tr>
273         <tr><th scope="row">Loan length</th><td>[% loanlength %]</td></tr>
274 <tr><th scope="row">Rental charge</th><td>[% rentalcharge %]</td></tr></table>
275                 <form action="[% script_name %]" method="post">
276                 <input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="[% itemtype %]" />[% IF ( total ) %]
277                 </form>
278                 
279                 <form action="[% script_name %]" method="post"><input type="submit" class="approve" value="OK" /></form>
280         [% ELSE %]
281                 <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>
282         [% END %]
283 </div>
284         
285 [% END %]
286
287 [% IF ( else ) %]
288 <h2>Item types administration</h2>
289 [% IF ( loop ) %]<div id="pagertable_item_type">
290 [% INCLUDE 'table-pager.inc' perpage='10' %]
291 </div>
292 <table id="table_item_type">
293   <thead>
294     [% UNLESS ( noItemTypeImages ) %]<th>Image</th>[% END %]
295     <th>Code</th>
296     <th>Description</th>
297     <th>Not for loan</th>
298     <th>Charge</th>
299     <th>Actions</th>
300   </thead>
301   [% FOREACH loo IN loop %]
302     [% UNLESS ( loop.odd ) %]
303   <tr class="highlight">
304     [% ELSE %]
305   <tr>
306     [% END %]
307    [% UNLESS ( noItemTypeImages ) %] <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt="" />[% ELSE %]&nbsp;[% END %]</td>[% END %]
308     <td>
309       <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">
310         [% loo.itemtype %]
311       </a>
312     </td>
313     <td>[% loo.description %]</td>
314     <td>[% IF ( loo.notforloan ) %]Yes[% ELSE %]&nbsp;[% END %]</td>
315     <td>
316     [% UNLESS ( loo.notforloan ) %]
317       [% loo.rentalcharge %]
318     [% END %]
319     </td>
320     <td>
321       <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
322       <a href="[% loo.script_name %]?op=delete_confirm&amp;itemtype=[% loo.itemtype |html %]">Delete</a>
323     </td>
324   </tr>
325   [% END %]
326 </table>[% ELSE %]
327 <div class="dialog message">There are no itemtypes defined</div>
328 [% END %]
329
330 <div class="pages">[% pagination_bar %]</div>
331
332 [% END %]
333
334
335
336 </div>
337 </div>
338 <div class="yui-b">
339 [% INCLUDE 'admin-menu.inc' %]
340 </div>
341 </div>
342 [% INCLUDE 'intranet-bottom.inc' %]