Bug 10376: fix ability to print cart from IE9 & 10

Test plan:
1) Test with Firefox (or any other browser except IE):
Add biblio to cart
Go to Cart and click Print
Does the Cart window come back to its original state after confirm/cancel Print?
2) Test with Internet Explorer (I used IE9; testing another version is fine)
Do the same as above. Is behavior now more or less the same?

Signed-off-by: Marc Veron <veron@veron.ch>

1) Test without patch:
IE 10: Does not show print dialog
IE 9 (Developer Emulation in IE 10): Does not show print dialog (as expected)
FF 21.0 OK
Chrome 27.0.1453.110 m: OK

2) Test with patch:
IE 10: OK
IE 9 (Developer Emulation in IE 10): OK
IE 8 (Developer Emulation in IE 10): OK
IE 7 (Developer Emulation in IE 10): OK
FF 21.0 OK
Chrome 27.0.1453.110 m: OK

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Trusting Marc here, as I don't have IE available.
Regression tests in Firefox and Chromium went well.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Marcel de Rooy 2013-05-29 14:24:05 +02:00 committed by Galen Charlton
parent da9863f1a5
commit 990eebf132
1 changed files with 17 additions and 2 deletions

View File

@ -6,10 +6,25 @@
[% IF ( print_basket ) %]
<script type="text/javascript">
//<![CDATA[
var IEprint=0;
$(document).ready(function(){
print();
location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]";
if(navigator.appName.indexOf("Internet Explorer")>-1) {
// too bad that we need this trick to make printing work in IE...
window.setTimeout(function () {IE_Print_Page();}, 500);
}
else {
print();
location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]";
}
});
function IE_Print_Page() {
if(IEprint==0) {
IEprint++;
window.print(); // IE needs the window object here
window.onfocus=function() { // focus will not work in Firefox a.o.
location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]"; }
}
}
//]]>
</script>
[% ELSE %]