Bug 13218: (RM followup) only scroll on actually variable stuff
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / itemtypes.tt
index 210b575..9a691fb 100644 (file)
@@ -1,3 +1,5 @@
+[% USE EncodeUTF8 %]
+[% USE AuthorisedValues %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Administration &rsaquo; Item types [% IF ( add_form ) %]&rsaquo;
   [% IF ( itemtype ) %]
@@ -19,81 +21,31 @@ Data deleted
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+[% INCLUDE 'datatables.inc' %]
 <script type="text/javascript">
 //<![CDATA[
-
-function isNotNull(f,noalert) {
-       if (f.value.length ==0) {
-               return false;
-       }
-       return true;
-}
-
-function toUC(f) {
-       var x=f.value.toUpperCase();
-       f.value=x;
-       return true;
-}
-
-function isNum(v,maybenull) {
-var n = new Number(v.value);
-if (isNaN(n)) {
-       return false;
-       }
-if (maybenull==0 && v.value=='') {
-       return false;
-}
-return true;
-}
-
-function isDate(f) {
-       var t = Date.parse(f.value);
-       if (isNaN(t)) {
-               return false;
-       }
-}
-
-function Check(f) {
-       var ok=1;
-       var _alertString="";
-       var alertString2;
-       if (f.itemtype.value.length==0) {
-               _alertString += "\n- " + _("Itemtype missing");
-       }
-       if (!(isNotNull(window.document.Aform.description,1))) {
-               _alertString += "\n- " + _("Description missing");
-       }
-       if ((!isNum(f.rentalcharge,0)) && f.rentalcharge.value.length > 0) {
-               _alertString += "\n- " + _("Rental charge is not a number");
-       }
-       if (_alertString.length==0) {
-               document.Aform.submit();
-       } else {
-               alertString2  = _("Form not submitted because of the following problem(s)");
-               alertString2 += "\n------------------------------------------------------------------------------------\n";
-               alertString2 += _alertString;
-               alert(alertString2);
-       }
-}
      $(document).ready(function() {
         $('#icons').tabs();
         $("#table_item_type").dataTable($.extend(true, {}, dataTablesDefaults, {
             "aoColumnDefs": [
                 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
             ],
-            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
             "aaSorting": [[ 2, "asc" ]],
             "iDisplayLength": 10
         }));
+        $( "#itemtypeentry" ).validate({
+            rules: {
+                itemtype: { required: true },
+                description: { required: true },
+                rentalcharge: { number: true }
+            }
+        });
      });
 //]]>
 </script>
 <style type="text/css">
        fieldset.rows div.toptabs li { clear:none;margin-right:.5em;padding-bottom:0;width:auto; }
-  fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-selected {background-color : #F4F8F9; }
+  fieldset.rows div.toptabs .ui-tabs-nav li.ui-tabs-active {background-color : #F4F8F9; }
        fieldset.rows .ui-tabs-panel { margin-right : 10px; margin-left : 10px;margin-bottom:10px;}
   fieldset.rows .ui-tabs-nav { margin-left : 10px; }
 </style>
@@ -139,7 +91,7 @@ Item types administration
   [% ELSE %]
       <h3>Add item type</h3>
   [% END %]
-<form action="[% script_name %]" name="Aform" method="post">
+<form action="[% script_name %]" name="Aform" method="post" id="itemtypeentry">
   <input type="hidden" name="op" value="add_validate" />
     <input type="hidden" name="checked" value="0" />
                
@@ -152,15 +104,11 @@ Item types administration
      </li>
   [% ELSE %]
       <li>
-          <label for="itemtype">Item type: </label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" class="focus" />
+          <label for="itemtype" class="required">Item type: </label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" required="required" /> <span class="required">Required</span>
       </li>
   [% END %]
       <li>
-      [% IF ( itemtype ) %]
-          <label for="description">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" class="focus" /></li>
-      [% ELSE %]
-          <label for="description">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /></li>
-      [% END %]
+          <label for="description" class="required">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" required="required" /> <span class="required">Required</span></li>
      [% IF ( noItemTypeImages ) %]
         <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>
         [% ELSE %]</ol>
@@ -169,9 +117,9 @@ Item types administration
                        <ul>
           <li><a href="#none">None</a></li>
                                  [% FOREACH imageset IN imagesets %]
-            [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
+            [% IF ( imageset.imagesetactive ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a></li>
                                  [% END %]
-                  [% IF ( remote_image ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
+                  [% IF ( remote_image ) %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
                        </ul>
   <div id="none"><ul>
   <li><label for="noimage">No image: </label><input type="radio" name="image" id="noimage" value="removeImage" /></li>
@@ -212,8 +160,8 @@ Item types administration
 </ul>
   <br class="clear" />
 </div>
-[% END %]
 </div>
+[% END %]
 <ol>
       <li>
           <label for="notforloan">Not for loan: </label>   [% IF ( notforloan ) %]
@@ -228,6 +176,38 @@ Item types administration
           <label for="rentalcharge">Rental charge: </label>
                  <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
          </li>
+      <li>
+          <label for="checkinmsg">Checkin message: </label>
+          <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% checkinmsg %]</textarea>
+      </li>
+      <li>
+          <label for="checkinmsgtype">Checkin message type: </label>
+          <select type="text" id="checkinmsgtype" name="checkinmsgtype">
+              [% IF ( checkinmsgtype == 'message' ) %]
+              <option value="message" selected="selected">Message</option>
+              [% ELSE %]
+                 <option value="message">Message</option>
+              [% END %]
+              [% IF ( checkinmsgtype == 'alert' ) %]
+              <option value="alert" selected="selected">Alert</option>
+              [% ELSE %]
+                  <option value="alert">Alert</option>
+              [% END %]
+          </select>
+      </li>
+      <li>
+          <label for="sip_media_type">SIP media type: </label>
+          <select id="sip_media_type" name="sip_media_type">
+              <option value=""></option>
+              [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE', sip_media_type ) %]
+                  [% IF a.selected %]
+                      <option value="[% a.authorised_value %]" selected="selected">[% a.lib | $EncodeUTF8 %]</option>
+                  [% ELSE %]
+                      <option value="[% a.authorised_value %]">[% a.lib | $EncodeUTF8  %]</option>
+                  [% END %]
+              [% END %]
+          </select>
+      </li>
       <li>
           <label for="summary">Summary: </label>
          <textarea id="summary" name="summary" cols="55" rows="5">[% summary %]</textarea>
@@ -238,7 +218,7 @@ Item types administration
     </fieldset>
 
     <fieldset class="action">
-      <input type="button" value="Save changes" onclick="Check(this.form)" />
+      <input type="submit" value="Save changes" />
          <a href="/cgi-bin/koha/admin/itemtypes.pl" class="cancel">Cancel</a>
     </fieldset>
 </form>
@@ -282,14 +262,11 @@ Item types administration
     <th>Description</th>
     <th>Not for loan</th>
     <th>Charge</th>
+    <th>Checkin message</th>
     <th>Actions</th>
   </thead>
   [% FOREACH loo IN loop %]
-    [% UNLESS ( loop.odd ) %]
-  <tr class="highlight">
-    [% ELSE %]
-  <tr>
-    [% END %]
+    <tr>
    [% UNLESS ( noItemTypeImages ) %] <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt="" />[% ELSE %]&nbsp;[% END %]</td>[% END %]
     <td>
       <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">
@@ -303,6 +280,7 @@ Item types administration
       [% loo.rentalcharge %]
     [% END %]
     </td>
+    <td>[% loo.checkinmsg | html_line_break %]</td>
     <td>
       <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
       <a href="[% loo.script_name %]?op=delete_confirm&amp;itemtype=[% loo.itemtype |html %]">Delete</a>