Bug 10291: Clarify misleading variable name
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
index 540b141..de67517 100644 (file)
@@ -1,10 +1,13 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Batch item modification</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'background-job.inc' %]
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/pages/batchMod.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script src="[% themelang %]/lib/yui/cookie/cookie-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<script type="text/javascript" src="[% themelang %]/js/pages/batchMod.js"></script>
+<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>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <script type="text/javascript">
 //<![CDATA[
 // Prepare array of all column headers, incrementing each index by
 // two to accomodate control and title columns
 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
-console.log(allColumns);
 for( x=0; x<allColumns.length; x++ ){
   allColumns[x] = Number(allColumns[x]) + 2;
 }
-$("#itemst").tablesorter({ widgets : ['zebra'], headers: {0:{sorter: false}} });
-$("#selectallbutton").click(function() {
-    $("#itemst").find("input:checkbox").each(function() {
- $(this).attr("checked", true);
-    });
-});
-$("#clearallbutton").click(function() {
-    $("#itemst").find("input:checkbox").each(function() {
- $(this).attr("checked", false);
-    });
+$(document).ready(function(){
+  $("#selectallbutton").click(function() {
+      $("#itemst").find("input:checkbox").each(function() {
+   $(this).attr("checked", "checked");
+      });
+  });
+  $("#clearallbutton").click(function() {
+      $("#itemst").find("input:checkbox").each(function() {
+   $(this).removeAttr("checked");
+      });
+  });
+  $("input[name='disable_input']").click(function() {
+      var row = $(this).attr("id");
+      row = row.replace("row","hint");
+      var subfield = $(this).next();
+      if ($(this).is(":checked")){
+          $(this).val($(this).siblings("[name='subfield']").val());
+          $(subfield).attr('disabled',true);
+          $("#"+row).html(_("This subfield will be deleted"));
+      } else {
+          $(subfield).removeAttr('disabled');
+          $("#"+row).html("");
+      }
+  });
 });
-$("input[name='disable_input']").click(function() {
-    if ($(this).is(":checked")){
- $(this).val($(this).siblings("[name='subfield']").val());
- $(this).siblings().attr('disabled',true);
-    }
-    else {
- $(this).siblings().removeAttr('disabled');
-    }
-});
-
 //]]>
 </script>
-<script type="text/javascript" src="[% themelang %]/js/pages/batchMod.js"></script>
 <!--[if IE]>
 <style type="text/css">#selections { display: none; }</style>
 <![endif]-->
+<style type="text/css">input[type=checkbox]{ margin : 0 .5em; }</style>
 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
 </head>
-<body>
+<body id="tools_batchMod-edit" class="tools">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
@@ -76,8 +82,10 @@ $("input[name='disable_input']").click(function() {
         [% END %]
     </tbody>
       </table>
-      [% UNLESS ( too_many_items ) %]
-      <h4>The following barcodes were found: </h4>
+      [% IF ( item_loop ) %]
+          [% UNLESS ( too_many_items ) %]
+          <h4>The following barcodes were found: </h4>
+          [% END %]
       [% END %]
   [% END %] <!-- /notfoundbarcodes -->
 
@@ -86,6 +94,7 @@ $("input[name='disable_input']").click(function() {
      <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
      <input type="hidden" name="runinbackground" id="runinbackground" value="" />
      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
+     <input type="hidden" name="src" id="src" value="[% src %]" />
 
 [% IF ( item_loop ) %]
   [% IF ( show ) %]<div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>[% ELSE %][% END %]
@@ -132,32 +141,38 @@ $("input[name='disable_input']").click(function() {
 
 [% IF ( too_many_items ) %]
     <p>Too many items ([% too_many_items %]): not displaying each one individually.</p>
-    [% FOREACH itemnumbers_hashre IN itemnumbers_hashref %]
-  <input type="hidden" name="itemnumber" value="[% itemnumbers_hashre.itemnumber %]" />
+    [% FOREACH itemnumber IN itemnumbers_array %]
+  <input type="hidden" name="itemnumber" value="[% itemnumber %]" />
     [% END %]
 [% END %]<!-- /too_many_items -->
 
+[% IF ( item_loop ) %]
 <div id="cataloguing_additem_newitem">
         <h2>Edit Items</h2>
-        <div class="hint">Checking the box right next the subfield label will disable the entry and delete the values of that subfield on all selected items</div>
+        <div class="hint">Checking the box right next the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div>
   <fieldset class="rows">
   <ol>
         [% FOREACH ite IN item %]
                <li><div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
-               <label>[% ite.subfield %] - 
-          [% IF ( ite.mandatory ) %]<b>[% END %]
+              [% IF ( ite.mandatory ) %]
+              <label class="required" for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
+              [% ELSE %]
+              <label for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
+              [% END %]
+              [% ite.subfield %] -
           [% ite.marc_lib %]
-          [% IF ( ite.mandatory ) %] *</b>[% END %]
          </label>
-                <input type="checkbox" title="check to delete subfield [% ite.subfield %]" name="disable_input" value="[% ite.subfield %]" />
+                [% UNLESS ( ite.mandatory ) %]<input type="checkbox" id="row[% ite.tag %][% ite.subfield %][% ite.random %]" title="Check to delete subfield [% ite.subfield %]" name="disable_input" value="[% ite.subfield %]" />[% ELSE %]<span class="required">Required</span>[% END %]
                 [% ite.marc_value %]
                 <input type="hidden" name="tag"       value="[% ite.tag %]" />
                 <input type="hidden" name="subfield"       value="[% ite.subfield %]" />
                 <input type="hidden" name="mandatory"       value="[% ite.mandatory %]" />
                 [% IF ( ite.repeatable ) %]
-                    <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span>
+                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
+                        <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+                    </a>
                 [% END %]
-   
+                <span class="hint" id="hint[% ite.tag %][% ite.subfield %][% ite.random %]"></span>
             </div></li>
         [% END %]
     </ol>
@@ -171,9 +186,16 @@ $("input[name='disable_input']").click(function() {
          <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel" onclick="history.back();return false;">Cancel</a>
     </fieldset>
 </div>
+[% ELSE %]
+    <p><a href="/cgi-bin/koha/tools/batchMod.pl">Return to batch item modification</a></p>
+[% END %]
 [% ELSE %] <!-- // show -->
 <fieldset class="action">
-  <a href="/cgi-bin/koha/tools/batchMod.pl">Done</a>
+[% IF ( src == 'CATALOGUING') %]
+   <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">Done</a>
+[% ELSE %]
+   <a href="/cgi-bin/koha/tools/batchMod.pl">Done</a>
+[% END %]
 </fieldset>
          
 [% END %]