Browse Source

Bug 25402: Put OPAC cart download options into dropdown menu

This patch modifies the process of downloading a cart so that it doesn't
involve a separate popup window.

To test, apply the patch and add some titles to the cart in the OPAC.

 - Open the cart
 - The "Download" button should now be a dropdown menu.
 - Selecting any of the download options should trigger a download
   prompt.
 - Test with and without some CSV profiles which have been configured
   for use in the OPAC

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Owen Leonard 4 years ago
committed by Jonathan Druart
parent
commit
174ea44dcc
  1. 27
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
  2. 3
      opac/opac-basket.pl

27
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt

@ -27,7 +27,22 @@
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
<a class="btn btn-link send" href="opac-basket.pl"><i class="fa fa-fw fa-envelope" aria-hidden="true"></i> Send</a>
[% END %]
<a class="btn btn-link download" href="opac-basket.pl"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download</a>
<div id="download-cart" class="btn-group dropdown">
<a id="format" class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download <b class="caret"></b></a>
<ul class="dropdown-menu pull-left" role="menu" aria-labelledby="format">
<li><a role="menuitem" class="download-cart" data-format="bibtex" href="#">BibTeX</a></li>
<li><a role="menuitem" class="download-cart" data-format="isbd" href="#">ISBD</a></li>
<li><a role="menuitem" class="download-cart" data-format="iso2709" href="#">MARC</a></li>
<li><a role="menuitem" class="download-cart" data-format="ris" href="#">RIS (Zotero, EndNote, others)</a></li>
[% FOREACH csv_profile IN csv_profiles %]
<li>
<a role="menuitem" class="download-cart" data-format="[% csv_profile.export_format_id | html %]" href="#">CSV - [% csv_profile.profile | html %]</a>
</li>
[% END %]
</ul>
</div>
<a class="btn btn-link remove empty" href="opac-basket.pl"><i class="fa fa-fw fa-trash" aria-hidden="true"></i> Empty and close</a>
<a class="btn btn-link close" href="opac-basket.pl"><i class="fa fa-fw fa-times-circle" aria-hidden="true"></i> Hide window</a>
[% IF ( verbose ) %]
@ -295,6 +310,10 @@
<form name="myform" action="opac-basket.pl" method="get">
<input type="hidden" name="records" id="records" />
</form>
<form method="post" id="download_cart" action="/cgi-bin/koha/opac-downloadcart.pl">
<input type="hidden" name="format" id="download_format" value="" />
<input type="hidden" name="bib_list" value="[% bib_list | html %]" />
</form>
</div> <!-- / #userbasket -->
</div> <!-- / .span10 -->
@ -369,9 +388,11 @@
sendBasket();
});
$(".download").click(function(e){
$(".download-cart").on("click", function(e){
e.preventDefault();
downloadBasket();
var format = $(this).data("format");
$("#download_format").val( format );
$("#download_cart").submit();
});
$(".empty").click(function(e){

3
opac/opac-basket.pl

@ -26,7 +26,7 @@ use C4::Circulation;
use C4::Auth;
use C4::Output;
use Koha::RecordProcessor;
use Koha::CsvProfiles;
use Koha::AuthorisedValues;
my $query = new CGI;
@ -167,6 +167,7 @@ my $resultsarray = \@results;
# my $itemsarray=\@items;
$template->param(
csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records', opac_option => 1 }) ],
bib_list => $bib_list,
BIBLIO_RESULTS => $resultsarray,
);

Loading…
Cancel
Save