This patch updates the OPAC and staff client carts to use CSS to
control print output, removing a print parameter which was passed to the
script.
Currently, when you click "Print" on the OPAC basket, it navigates to
a new page and initiates window.print() followed by a
window.location.href change again. Unfortunately, due to differences in
IE, Chrome, and FF, it will either show the print options, navigate away
without showing them, or refuse to navigate away after printing. By
changing to using print CSS, we don't navigate away from the basket in
the first place, so we prevent this irregular behavior.
TEST PLAN
1) Apply the patch
2) Create an OPAC basket by clicking "Add to cart" on multiple items
3) Using Chrome, IE, and Firefox (of any version), click the "Print"
button
4) You should see the relevant print menu without the OPAC basket
re-loading in any way.
5) After printing is complete, you should still be on the OPAC basket
pop-up
6) Perform the same tests in the staff client
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
);
my $bib_list = $query->param('bib_list');
);
my $bib_list = $query->param('bib_list');
-my $print_basket = $query->param('print');
my $verbose = $query->param('verbose');
if ($verbose) { $template->param( verbose => 1 ); }
my $verbose = $query->param('verbose');
if ($verbose) { $template->param( verbose => 1 ); }
-if ($print_basket) { $template->param( print_basket => 1 ); }
my @bibs = split( /\//, $bib_list );
my @results;
my @bibs = split( /\//, $bib_list );
my @results;
fieldset.action,
.list-actions,
.print,
fieldset.action,
.list-actions,
.print,
+.ui-tabs-nav,
+.cart-controls {
+
+th {
+ text-align: left;
+}
+
+#cart_basket .container,
+#cart_basket table,
+#cart_basket tr,
+#cart_basket th,
+#cart_basket td,
+#cart_basket .sorting_asc,
+#cart_basket .sorting,
+#cart_basket .sorting_desc,
+#cart_basket .sorting_disabled,
+#cart_basket tbody tr:nth-child(2n+1) td {
+ background: transparent none;
+ border: 0;
+}
+
+#cart_basket tr {
+ border-collapse: collapse;
+ border-bottom: 1px solid #DDD;
+}
+
+.container {
+ width:100%;
+}
margin: auto;
margin-bottom: 2px;
}
margin: auto;
margin-bottom: 2px;
}
+
+.cart-controls {
+ border-top: 1px solid #E8E8E8;
+ padding: 7px 0;
+}
[% USE Asset %]
[% SET footerjs = 1 %]
[% BLOCK controls %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% BLOCK controls %]
- <p style="padding: 7px 0; border-top : 1px solid #E8E8E8;">
+ <p class="cart-controls">
<a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a> <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a>
| <b>Selected items :</b>
<a href="#" id="remove_from_cart">Remove</a>
<a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a> <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a>
| <b>Selected items :</b>
<a href="#" id="remove_from_cart">Remove</a>
</p>
[% END %]
[% INCLUDE 'doc-head-open.inc' %]
</p>
[% END %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] Catalog › Your cart</title>
- [% IF ( print_basket ) %]
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
-<style type="text/css">
- @import url([% interface %]/[% theme %]/css/print.css);
-</style>
- [% ELSE %][% INCLUDE 'doc-head-close.inc' %]
-[% Asset.css("css/datatables.css") %]
- [% END %]
+<title>Koha › Catalog › Your cart</title>
+[% INCLUDE 'doc-head-close.inc' %]
-[% IF ( print_basket ) %]<body id="cart_basket" class="cart" onload="print();history.back();">[% ELSE %]<body id="cart_basket" class="cart">[% END %]
+
+<body id="cart_basket" class="cart">
<div class="main container-fluid">
<div class="row">
<div class="col-md-12">
<div class="container">
<div class="main container-fluid">
<div class="row">
<div class="col-md-12">
<div class="container">
-[% UNLESS ( print_basket ) %]
<h1>Your cart</h1>
<div id="toolbar" class="btn-toolbar">
<h1>Your cart</h1>
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default btn-sm" href="basket.pl" id="empty_cart"><i class="fa fa-trash"></i> Empty and close</a>
<a class="btn btn-default btn-sm close" href="basket.pl"><i class="fa fa-times-circle"></i> Hide window</a>
</div>
<a class="btn btn-default btn-sm" href="basket.pl" id="empty_cart"><i class="fa fa-trash"></i> Empty and close</a>
<a class="btn btn-default btn-sm close" href="basket.pl"><i class="fa fa-times-circle"></i> Hide window</a>
</div>
- [% UNLESS ( print_basket ) %]
<form action="basket.pl" method="get" name="bookbag_form" id="bookbag_form">
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
<h3>
<form action="basket.pl" method="get" name="bookbag_form" id="bookbag_form">
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
<h3>
- [% IF ( print_basket ) %]
- [% BIBLIO_RESULT.title |html %]
- [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %][% END %]
- [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author %][% END %]
- [% ELSE %]
- <input type="checkbox" class="select_record" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" />
- [% BIBLIO_RESULT.title |html %]
- [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %][% END %]
- [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author %][% END %]
- [% END %]
+ <input type="checkbox" class="select_record noprint" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" />
+ [% BIBLIO_RESULT.title |html %]
+ [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %][% END %]
+ [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author %][% END %]
</h3>
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=[% BIBLIO_RESULT.author %]&rft.btitle=[% BIBLIO_RESULT.title |url %]&rft.date=[% BIBLIO_RESULT.publicationyear %]&rft.tpages=[% BIBLIO_RESULT.item('size') %]&rft.isbn=[% BIBLIO_RESULT.isbn |url %]&rft.aucorp=&rft.place=[% BIBLIO_RESULT.place %]&rft.pub=[% BIBLIO_RESULT.publisher |url %]&rft.edition=[% BIBLIO_RESULT.edition %]&rft.series=[% BIBLIO_RESULT.series %]&rft.genre="></span>
</h3>
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.au=[% BIBLIO_RESULT.author %]&rft.btitle=[% BIBLIO_RESULT.title |url %]&rft.date=[% BIBLIO_RESULT.publicationyear %]&rft.tpages=[% BIBLIO_RESULT.item('size') %]&rft.isbn=[% BIBLIO_RESULT.isbn |url %]&rft.aucorp=&rft.place=[% BIBLIO_RESULT.place %]&rft.pub=[% BIBLIO_RESULT.publisher |url %]&rft.edition=[% BIBLIO_RESULT.edition %]&rft.series=[% BIBLIO_RESULT.series %]&rft.genre="></span>
-[% UNLESS ( print_basket ) %]
<form action="/cgi-bin/koha/basket/basket.pl" method="get" name="bookbag_form" id="bookbag_form">
[% PROCESS controls %]
<form action="/cgi-bin/koha/basket/basket.pl" method="get" name="bookbag_form" id="bookbag_form">
[% PROCESS controls %]
<table id="itemst">
<thead><tr>
<table id="itemst">
<thead><tr>
- [% UNLESS ( print_basket ) %]<th class="NoSort"> </th>[% END %]
+ <th class="NoSort noprint"> </th>
<th class="anti-the">Title</th>
<th>Item type</th>
<th><a id="items-popover" href="#" data-trigger="hover" data-toggle="popover" data-placement="top" title="Item sorting" data-content="Items are sorted by the highest or lowest callnumber in a group of items respectively.">Items</a></th>
<th class="anti-the">Title</th>
<th>Item type</th>
<th><a id="items-popover" href="#" data-trigger="hover" data-toggle="popover" data-placement="top" title="Item sorting" data-content="Items are sorted by the highest or lowest callnumber in a group of items respectively.">Items</a></th>
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
<tr>
[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
<tr>
- [% UNLESS ( print_basket ) %]<td>
<input type="checkbox" class="select_record" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" />
<input type="checkbox" class="select_record" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" />
<td><a href="[% BIBLIO_RESULT.dest %]?biblionumber=[% BIBLIO_RESULT.biblionumber %]" class="open_title">
[% BIBLIO_RESULT.title |html %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %][% END %]
</a>
<td><a href="[% BIBLIO_RESULT.dest %]?biblionumber=[% BIBLIO_RESULT.biblionumber %]" class="open_title">
[% BIBLIO_RESULT.title |html %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %][% END %]
</a>
</div>
</div>
[% INCLUDE js_includes.inc %]
</div>
</div>
[% INCLUDE js_includes.inc %]
- [% UNLESS ( print_basket ) %]
- [% INCLUDE 'datatables.inc' %]
- [% Asset.js("js/cart.js") %]
- [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
- [% END %]
+ [% INCLUDE 'datatables.inc' %]
+ [% Asset.js("js/cart.js") %]
+ [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
}
function printBasket() {
}
function printBasket() {
- var loc = document.location + "&print=1";
- document.location = loc;
<div class="span12">
<div id="userbasket">
<h2>Your cart</h2>
<div class="span12">
<div id="userbasket">
<h2>Your cart</h2>
- <div id="toolbar" class="toolbar">
+ <div id="toolbar" class="toolbar noprint">
[% IF ( verbose ) %]
<a href="opac-basket.pl" class="brief">Brief display</a>
[% ELSE %]
[% IF ( verbose ) %]
<a href="opac-basket.pl" class="brief">Brief display</a>
[% ELSE %]
- <div id="selections-toolbar" class="toolbar">
+ <div id="selections-toolbar" class="toolbar noprint">
<a id="CheckAll" href="#">Select all</a>
<a id="CheckNone" href="#">Clear all</a>
<span class="sep">|</span>
<a id="CheckAll" href="#">Select all</a>
<a id="CheckNone" href="#">Clear all</a>
<span class="sep">|</span>
- border-top : 1px solid #EEE;
- border-left : 1px solid #EEE;
+ border-collapse: collapse;
body#basket td,
body#basket th {
background-color : transparent;
body#basket td,
body#basket th {
background-color : transparent;
padding : 2px;
}
body#basket th {
background-color : #EEE;
padding : 2px;
}
body#basket th {
background-color : #EEE;
}
body#basket th,
body#basket th[scope=col] {
}
body#basket th,
body#basket th[scope=col] {
text-align : center;
vertical-align : middle;
}
body#basket th[scope=row] {
text-align : center;
vertical-align : middle;
}
body#basket th[scope=row] {
font-size : 89%;
text-align : right;
vertical-align : top;
width : 10%;
}
font-size : 89%;
text-align : right;
vertical-align : top;
width : 10%;
}
+#basket tr {
+ border-bottom: 1px solid #DDD;
+}
+
body#basket p {
font-size : 85%;
margin : .2em 0;
body#basket p {
font-size : 85%;
margin : .2em 0;
#ulactioncontainer {
display: none;
}
#ulactioncontainer {
display: none;
}
+
+.main,
+.table-bordered {
+ border: 0;
+}
\ No newline at end of file