Bug 9073 - Download option from the cart should match the menu button in lists

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>
This commit is contained in:
Owen Leonard 2012-11-20 12:27:25 -05:00 committed by Jared Camins-Esakov
parent f13b13dc16
commit 3a7488f874
2 changed files with 28 additions and 15 deletions

View file

@ -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;

View file

@ -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>