Bug 9073 - Download option from the cart should match the menu button in lists
authorOwen Leonard <oleonard@myacpl.org>
Tue, 20 Nov 2012 17:27:25 +0000 (12:27 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sun, 25 Nov 2012 23:08:46 +0000 (18:08 -0500)
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.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Checked all export formats can be selected and downloaded, including
CSV profiles.
All tests and perlcritic pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>

basket/basket.pl
koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt

index 8fc15e4..d33216c 100755 (executable)
@@ -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;
index 2fd8832..9989194 100644 (file)
        <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>