Merge remote-tracking branch 'kc/new/enh/bug_5263' into kcmaster
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / batchMod-edit.tt
index 461b6bc..540b141 100644 (file)
 // 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);
+    });
+});
+$("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>
@@ -71,7 +93,7 @@ for( x=0; x<allColumns.length; x++ ){
 
 <p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
         [% FOREACH item_header_loo IN item_header_loop %]
-        <span class="selected"><input id="checkheader[% item_header_loo.__counter %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
+        <span class="selected"><input id="checkheader[% loop.count %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
         [% END %]
 </p>
         <table id="itemst">
@@ -85,7 +107,7 @@ for( x=0; x<allColumns.length; x++ ){
     </tr>
       </thead>
       <tbody>
-            [% FOREACH item_loo IN item_loop %] <tr> [% IF ( item_loo.show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% ELSE %]<td>&nbsp;</td>[% END %]
+            [% FOREACH item_loo IN item_loop %] <tr> [% IF ( show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% ELSE %]<td>&nbsp;</td>[% END %]
                 <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
                 [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
         [% END %] </tr>
@@ -117,6 +139,7 @@ for( x=0; x<allColumns.length; x++ ){
 
 <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>
   <fieldset class="rows">
   <ol>
         [% FOREACH ite IN item %]
@@ -126,6 +149,7 @@ for( x=0; x<allColumns.length; x++ ){
           [% 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 %]" />
                 [% ite.marc_value %]
                 <input type="hidden" name="tag"       value="[% ite.tag %]" />
                 <input type="hidden" name="subfield"       value="[% ite.subfield %]" />