[Koha-patches] [PATCH] Bug 9073 - Download option from the cart should match the menu button in lists

Owen Leonard oleonard at myacpl.org
Tue Nov 20 18:55:08 CET 2012


This patch moves the staff client Cart download choices into a toolbar
menu button instead of requiring that the user make the choice via a form
in the pop-up window.

To test, add items to Cart in the staff client. Open the cart and
choose a download option from the Download menu. Your download
should complete correctly without the page changing or reloading.

Unrelated edit: Eliminating duplicate document.ready() block by
consolidating a couple of lines of JavaScript.
---
 basket/basket.pl                                   |    3 ++
 .../intranet-tmpl/prog/en/modules/basket/basket.tt |   40 ++++++++++++--------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/basket/basket.pl b/basket/basket.pl
index 8fc15e4..d33216c 100755
--- a/basket/basket.pl
+++ b/basket/basket.pl
@@ -24,6 +24,7 @@ use C4::Biblio;
 use C4::Items;
 use C4::Auth;
 use C4::Output;
+use C4::Csv;
 
 my $query = new CGI;
 
@@ -120,6 +121,8 @@ my $resultsarray = \@results;
 
 $template->param(
     BIBLIO_RESULTS => $resultsarray,
+    csv_profiles => GetCsvProfilesLoop(),
+    bib_list => $bib_list,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
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 2fd8832..9989194 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
@@ -14,15 +14,6 @@
 	<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) {
@@ -72,9 +63,30 @@ function placeHold () {
 	    });
         $(".holdsep").text("| ");
         $(".hold").text(_("Place Hold"));
+        $("#downloadcartc").empty();
+        yuiToolbar();
+        $("#itemst").tablesorter({
+            headers: { 0: { sorter: false }}
+        });
 	});
 
-
+function yuiToolbar() {
+    var downloadmenu = [
+    { text: _("iso2709"), url: "/cgi-bin/koha/basket/downloadcart.pl?format=iso2709&bib_list=[% bib_list %]" },
+    { text: _("RIS"), url: "/cgi-bin/koha/basket/downloadcart.pl?format=ris&bib_list=[% bib_list %]" },
+    { text: _("BibTex"), url: "/cgi-bin/koha/basket/downloadcart.pl?format=bibtex&bib_list=[% bib_list %]" },
+[% FOREACH csv_profile IN csv_profiles %]
+    { text: _("CSV - [% csv_profile.profile %]"), url: "/cgi-bin/koha/basket/downloadcart.pl?format=[% csv_profile.export_format_id %]&bib_list=[% bib_list %]" },
+[% END %]
+    ];
+    new YAHOO.widget.Button({
+        type: "menu",
+        label: _("Download"),
+        name: "downloadmenubutton",
+        menu: downloadmenu,
+        container: "downloadcartc"
+    });
+}
 	//]]>
 	</script>
 	[% END %]
@@ -98,11 +110,9 @@ function placeHold () {
 		<a class="send" href="basket.pl" onclick="sendBasket(); return false;">Send</a>
 	    </span></span>
 	</li>
-	<li>
-	    <span id="savemenuc" class="yui-button yui-link-button"><span class="first-child">
-		<a class="download" href="basket.pl" onclick="downloadBasket(); return false;">Download</a>
-	    </span></span>
-	</li>
+    <li id="downloadcartc">
+        <a href="#" id="downloadcart">Download</a>
+    </li>
 	<li>
 	    <span id="printmenuc" class="yui-button yui-link-button"><span class="first-child">
 		<a class="print" href="basket.pl" onclick="printBasket(); return false;">Print</a>
-- 
1.7.9.5


More information about the Koha-patches mailing list