Bug 10376: fix ability to print cart from IE9 & 10
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / opac-basket.tt
index 5f79ac0..df1d1f1 100644 (file)
@@ -6,40 +6,48 @@
     [% 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 %]
     <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-    <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+    [% INCLUDE 'datatables.inc' %]
     <script type="text/javascript">
     //<![CDATA[
 
-$.tablesorter.addParser({
-    // set a unique id
-    id: 'links',
-    is: function(s)
-    {
-        // return false so this parser is not auto detected
-        return false;
-    },
-    format: function(s)
-    {
-        // format your data for normalization
-        return s.replace(new RegExp(/<.*?>/),"");
-    },
-    // set type, either numeric or text
-    type: 'text'
-});
+$(document).ready(function(){
+    $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
+        "aaSorting": [[ 1, "asc" ]],
+        "aoColumnDefs": [
+          { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false }
+        ],
+        "aoColumns": [
+            null,
+            { "sType": "anti-the" },
+            null,
+            null,
+            null
+        ]
+    }));
 
-$(document).ready(function()
-    {
-        $("#itemst").tablesorter({
-                        headers: { 0: { sorter: false }, 1: {sorter: 'links'}, 4:{sorter:false}}
-                });
     $(".cb").click(function(){
       enableCheckboxActions();
     });