[Koha-patches] [PATCH] Suggested change to Bug 5725 - Batch modifications for Biblios

Owen Leonard oleonard at myacpl.org
Tue Oct 4 17:52:22 CEST 2011


This modification changes the "Batch edit" button to a link
in the "Selected items: " set alongside "add to a list," "place
hold," etc. Instead of always batch editing all items, the user
can select individual ones to be passed to the batch edit page.
---
 koha-tmpl/intranet-tmpl/prog/en/js/basket.js       |   12 ++++---
 .../intranet-tmpl/prog/en/modules/basket/basket.tt |   31 +++++++++-----------
 2 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
index 03dc306..31ffc11 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js
@@ -434,9 +434,11 @@ $(document).ready(function(){
 });
 
 function batchEdit(){
-    var valCookie = readCookie(nameCookie);
-    var strCookie = nameParam + "=" + valCookie;
-
-    var loc = CGIBIN + "tools/batchedit.pl?" + strCookie;
-    window.opener.location = loc;
+    var items = document.getElementById('records').value;
+    if(items){
+        var loc = CGIBIN + "tools/batchedit.pl?" + nameParam + "=" + items;
+        window.opener.location = loc;
+    } else {
+        alert(MSG_NO_RECORD_SELECTED);
+    }
 }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
index 05a8acc..6049f08 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
@@ -13,16 +13,6 @@
 	<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 	<script type="text/javascript">
 	//<![CDATA[
-
-$(document).ready(function()
-    {
-        $("#itemst").tablesorter({
-                        headers: { 0: { sorter: false }}
-                });
-    }
-);
-
-
 function placeHold () {
     var checkedItems = $("input:checkbox:checked");
     if ($(checkedItems).size() == 0) {
@@ -65,6 +55,9 @@ function placeHold () {
 	    });
         $(".holdsep").text("| ");
         $(".hold").text(_("Place Hold"));
+        [% UNLESS ( verbose ) %]$("#itemst").tablesorter({
+            headers: { 0: { sorter: false }}
+        });[% END %]
 	});
 
 
@@ -86,13 +79,6 @@ function placeHold () {
 		[% IF ( verbose ) %]<a href="basket.pl" class="brief" onclick="showLess(); return false;">Brief Display</a>[% ELSE %]<a href="basket.pl" class="detail" onclick="showMore(); return false;">More Details</a>[% END %]
 	    </span></span>
 	</li>
-    [% IF ( CAN_user_tools_batchedit ) %]
-    <li>
-        <span id="batchedit" class="yui-button yui-link-button"><span class="first-child">
-        <a class="batchedit" href="basket.pl" onclick="batchEdit(); return false;">Batch Edit</a>
-        </span></span>
-    </li>
-    [% END %]
 	<li>
 	    <span id="receive" class="yui-button yui-link-button"><span class="first-child">
 		<a class="send" href="basket.pl" onclick="sendBasket(); return false;">Send</a>
@@ -135,6 +121,10 @@ function placeHold () {
      | <a href="#" onclick="placeHold(); return false;">Place Hold</a>
 [% END %]
 
+[% IF ( CAN_user_tools_batchedit ) %]
+     | <a class="batchedit" href="#" onclick="batchEdit(); return false;">Batch Edit</a>
+[% END %]
+
 </p>[% END %]
             <form action="basket.pl" method="get" name="bookbag_form" id="bookbag_form">
     [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
@@ -303,9 +293,13 @@ function placeHold () {
      | <a href="#" onclick="placeHold(); return false;">Place Hold</a>
 [% END %]
 
+[% IF ( CAN_user_tools_batchedit ) %]
+     | <a class="batchedit" href="#" onclick="batchEdit(); return false;">Batch Edit</a>
+[% END %]
 
 [% END %]
 </p>
+    [% IF ( BIBLIO_RESULTS ) %]
     <table id="itemst">
 	<thead><tr>
 	    [% UNLESS ( print_basket ) %]<th>&nbsp;</th>[% END %]
@@ -352,6 +346,9 @@ function placeHold () {
             </tr>
         [% END %]
     </table></form>
+    [% ELSE %]
+    <div class="dialog message">Your cart is empty.</div>
+    [% END %]
 [% END %]
 
 <form name="myform" action="basket/basket.pl" method="get">
-- 
1.7.3



More information about the Koha-patches mailing list