Bug 19663: Move JS to the footer: Reports
authorOwen Leonard <oleonard@myacpl.org>
Mon, 20 Nov 2017 19:43:11 +0000 (19:43 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 14 Dec 2017 19:58:22 +0000 (16:58 -0300)
This patch modifies the staff client's reports templates so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of
reports pages: All button controls, DataTables functionality, form
validation, etc.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Fix for QA: Remove unused Dopop function.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
18 files changed:
koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_out.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/orders_by_budget.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt

index a425919..d7fa79d 100644 (file)
 
     [% END %]
 </div>
-
-<script type="text/javascript">
-var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
-
-$(document).ready(function(){
-    $(".delete").on("click",function(){
-        return confirmDelete(MSG_CONFIRM_DELETE);
-    });
-});
-</script>
index 04c09e8..4e5c916 100644 (file)
@@ -1,41 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Acquisitions statistics &rsaquo; Results[% ELSE %]&rsaquo; Acquisitions statistics[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-        $(document).ready(function() {
-        // http://jqueryui.com/demos/datepicker/#date-range
-        var dates = $( "#from, #to" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "from" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                dates.not( this ).datepicker( "option", option, date );
-            }
-        });
-        var datesRO = $( "#fromRO, #toRO" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "fromRO" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                datesRO.not( this ).datepicker( "option", option, date );
-            }
-        });
-        });
-//]]>
-</script>
 </head>
+
 <body id="rep_acquisitions_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            // http://jqueryui.com/demos/datepicker/#date-range
+            var dates = $( "#from, #to" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "from" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    dates.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesRO = $( "#fromRO, #toRO" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "fromRO" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesRO.not( this ).datepicker( "option", option, date );
+                }
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 4b64802..fedf5dc 100644 (file)
@@ -1,44 +1,12 @@
 [% USE Branches %]
 [% USE KohaDates %]
 [% USE ItemTypes %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Patrons with the most checkouts</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-        $(document).ready(function() {
-        // http://jqueryui.com/demos/datepicker/#date-range
-        var dates = $( "#from, #to" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "from" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                dates.not( this ).datepicker( "option", option, date );
-            }
-        });
-        var datesRO = $( "#fromRO, #toRO" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "fromRO" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                datesRO.not( this ).datepicker( "option", option, date );
-            }
-        });
-        });
-//]]>
-</script>
 </head>
+
 <body id="rep_bor_issues_top" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
        <div class="yui-b">
 
 [% IF ( do_it ) %]
-<script language="JavaScript" type="text/javascript">
-function Dopop(link) {
-       newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
-}
-</script>
-
-
        [% FOREACH mainloo IN mainloop %]
         <h1>Patrons with the most checkouts</h1>
                [% IF ( mainloo.loopfilter ) %]
@@ -227,4 +188,40 @@ function Dopop(link) {
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            // http://jqueryui.com/demos/datepicker/#date-range
+            var dates = $( "#from, #to" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "from" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    dates.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesRO = $( "#fromRO, #toRO" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "fromRO" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesRO.not( this ).datepicker( "option", option, date );
+                }
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index e269042..ff4008f 100644 (file)
@@ -1,15 +1,9 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Patrons with no checkouts</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-$(document).ready(function(){
-    $("#to").datepicker({ maxDate: "-1D" });
-});
-//]]>
-</script>
 </head>
+
 <body id="rep_borrowers_out" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
@@ -130,4 +124,14 @@ $(document).ready(function(){
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function(){
+            $("#to").datepicker({ maxDate: "-1D" });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 005886d..95c78f5 100644 (file)
@@ -1,13 +1,14 @@
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Patrons statistics &rsaquo; Results[% ELSE %]&rsaquo; Patrons statistics[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
 <style type="text/css">
        .sql {display:none;}
        .debug {display:none;}
 </style>
 </head>
+
 <body id="rep_borrowers_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index adba384..36c7f7f 100644 (file)
@@ -1,63 +1,13 @@
 [% USE KohaDates %]
 [% USE Price %]
 [% USE ItemTypes %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Cash register statistics &rsaquo; Results[% ELSE %]&rsaquo; Cash register statistics[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" id="js">
- $(document).ready(function() {
-    $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "iDisplayLength": 50,
-        "sPaginationType": "full_numbers"
-    }));
- });
-</script>
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-actTotal = "";
-
-
-$(document).ready(function() {
-    // http://jqueryui.com/demos/datepicker/#date-range
-    var dates = $( "#filter_date_begin, #filter_date_end" ).datepicker({
-        changeMonth: true,
-        numberOfMonths: 1,
-        onSelect: function( selectedDate ) {
-            var option = this.id == "filter_date_begin" ? "minDate" : "maxDate",
-                instance = $( this ).data( "datepicker" );
-                date = $.datepicker.parseDate(
-                    instance.settings.dateFormat ||
-                    $.datepicker._defaults.dateFormat,
-                    selectedDate, instance.settings );
-            dates.not( this ).datepicker( "option", option, date );
-        }
-    });
-
-    $('#frmCashRegister').submit(function() {
-        var isFormValid = true;
-        var alertString= _("Form not submitted because of the following problem(s)")+"\n";
-
-        alertString +="-------------------------------------------------------------------\n\n";
-
-        if ( !$('#from').val() || !$('#to').val()){
-            isFormValid = false;
-            alertString += "\n- " + _("Dates cannot be empty");
-        }
-
-        if (!isFormValid) {
-           alert(alertString);
-           return false;
-        }
-    });
-});
-
-//]]>
-</script>
-
 </head>
+
 <body id="cash_register_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
@@ -300,4 +250,55 @@ $(document).ready(function() {
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript" id="js">
+        $(document).ready(function() {
+            $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "iDisplayLength": 50,
+                "sPaginationType": "full_numbers"
+            }));
+        });
+    </script>
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        actTotal = "";
+
+        $(document).ready(function() {
+            // http://jqueryui.com/demos/datepicker/#date-range
+            var dates = $( "#filter_date_begin, #filter_date_end" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "filter_date_begin" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    dates.not( this ).datepicker( "option", option, date );
+                }
+            });
+
+            $('#frmCashRegister').submit(function() {
+                var isFormValid = true;
+                var alertString= _("Form not submitted because of the following problem(s)")+"\n";
+
+                alertString +="-------------------------------------------------------------------\n\n";
+
+                if ( !$('#from').val() || !$('#to').val()){
+                    isFormValid = false;
+                    alertString += "\n- " + _("Dates cannot be empty");
+                }
+
+                if (!isFormValid) {
+                   alert(alertString);
+                   return false;
+                }
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 555ea64..756d6e0 100644 (file)
@@ -1,45 +1,10 @@
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Most-circulated items[% IF ( do_it ) %] &rsaquo; Results[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-[% IF ( do_it ) %]function Dopop(link) {
-       newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
-}[% ELSE %]
-    $(document).ready(function() {
-        // http://jqueryui.com/demos/datepicker/#date-range
-        var dates = $( "#from, #to" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "from" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                dates.not( this ).datepicker( "option", option, date );
-            }
-        });
-        var datesRO = $( "#fromRO, #toRO" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "fromRO" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                datesRO.not( this ).datepicker( "option", option, date );
-            }
-        });
-    });[% END %]
-//]]>
-</script>
 </head>
+
 <body id="rep_cat_issues_top" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        [% UNLESS ( do_it ) %]
+            $(document).ready(function() {
+                // http://jqueryui.com/demos/datepicker/#date-range
+                var dates = $( "#from, #to" ).datepicker({
+                    changeMonth: true,
+                    numberOfMonths: 1,
+                    onSelect: function( selectedDate ) {
+                        var option = this.id == "from" ? "minDate" : "maxDate",
+                            instance = $( this ).data( "datepicker" );
+                            date = $.datepicker.parseDate(
+                                instance.settings.dateFormat ||
+                                $.datepicker._defaults.dateFormat,
+                                selectedDate, instance.settings );
+                        dates.not( this ).datepicker( "option", option, date );
+                    }
+                });
+                var datesRO = $( "#fromRO, #toRO" ).datepicker({
+                    changeMonth: true,
+                    numberOfMonths: 1,
+                    onSelect: function( selectedDate ) {
+                        var option = this.id == "fromRO" ? "minDate" : "maxDate",
+                            instance = $( this ).data( "datepicker" );
+                            date = $.datepicker.parseDate(
+                                instance.settings.dateFormat ||
+                                $.datepicker._defaults.dateFormat,
+                                selectedDate, instance.settings );
+                        datesRO.not( this ).datepicker( "option", option, date );
+                    }
+                });
+            });
+        [% END %]
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index c1f4aab..f47b00e 100644 (file)
@@ -1,45 +1,10 @@
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Catalog statistics &rsaquo; Results[% ELSE %]&rsaquo; Catalog statistics[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-    function changeRemovedDateTrStatus() {
-        var Cellvalue = $("input[name='Cellvalue']:checked").val();
-        if(Cellvalue == "deleteditems") {
-            $("#removeddatetr").show();
-            $("input[value='deleteditems.timestamp']").prop('disabled', false);
-            $("#deldateFrom").prop('disabled', false);
-            $("#deldateTo").prop('disabled', false);
-        } else {
-            $("#removeddatetr").hide();
-            $("input[value='deleteditems.timestamp']").prop('disabled', true).prop('checked', false);
-            $("#deldateFrom").prop('disabled', true).val('');
-            $("#deldateTo").prop('disabled', true).val('');
-        }
-    }
-
-    $(document).ready(function() {
-        $('#acqdateFrom, #deldateFrom')
-          .datepicker('option', 'onSelect', function(selectedDate) {
-            var id = $(this).attr('id').replace('From', 'To');
-            $('#' + id).datepicker('option', 'minDate', selectedDate);
-          });
-        $('#acqdateTo, #deldateTo')
-          .datepicker('option', 'onSelect', function(selectedDate) {
-            var id = $(this).attr('id').replace('To', 'From');
-            $('#' + id).datepicker('option', 'maxDate', selectedDate);
-          });
-
-        $("input[name='Cellvalue']").change(function() {
-            changeRemovedDateTrStatus();
-        });
-        changeRemovedDateTrStatus();
-    });
-//]]>
-</script>
 </head>
+
 <body id="rep_catalogue_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        function changeRemovedDateTrStatus() {
+            var Cellvalue = $("input[name='Cellvalue']:checked").val();
+            if(Cellvalue == "deleteditems") {
+                $("#removeddatetr").show();
+                $("input[value='deleteditems.timestamp']").prop('disabled', false);
+                $("#deldateFrom").prop('disabled', false);
+                $("#deldateTo").prop('disabled', false);
+            } else {
+                $("#removeddatetr").hide();
+                $("input[value='deleteditems.timestamp']").prop('disabled', true).prop('checked', false);
+                $("#deldateFrom").prop('disabled', true).val('');
+                $("#deldateTo").prop('disabled', true).val('');
+            }
+        }
+
+        $(document).ready(function() {
+            $('#acqdateFrom, #deldateFrom')
+              .datepicker('option', 'onSelect', function(selectedDate) {
+                var id = $(this).attr('id').replace('From', 'To');
+                $('#' + id).datepicker('option', 'minDate', selectedDate);
+              });
+            $('#acqdateTo, #deldateTo')
+              .datepicker('option', 'onSelect', function(selectedDate) {
+                var id = $(this).attr('id').replace('To', 'From');
+                $('#' + id).datepicker('option', 'maxDate', selectedDate);
+              });
+
+            $("input[name='Cellvalue']").change(function() {
+                changeRemovedDateTrStatus();
+            });
+            changeRemovedDateTrStatus();
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 9bcf24b..7e6c45d 100644 (file)
@@ -1,26 +1,10 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Guided reports &rsaquo; Dictionary</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
 <style type="text/css">fieldset.rows table { clear: none; margin: 0;}</style>
-<script type="text/javascript">
-    var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this dictionary definition? This cannot be undone.");
-
-    $(document).ready(function() {
-        $("#delete").on("click",function(){
-            return confirmDelete(MSG_CONFIRM_DELETE);
-        });
-
-        $("#date_range").change(function(){
-            $("input#from").parents('li').show();
-        });
-        $("#all_dates").change(function(){
-            $("input#from").parents('li').hide();
-        });
-        $("#all_dates").click().change();
-    });
-</script>
 </head>
+
 <body id="rep_dictionary" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'circ-search.inc' %]
 [% INCLUDE 'guided-reports-view.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this dictionary definition? This cannot be undone.");
+
+        $(document).ready(function() {
+            $("#delete").on("click",function(){
+                return confirmDelete(MSG_CONFIRM_DELETE);
+            });
+
+            $("#date_range").change(function(){
+                $("input#from").parents('li').show();
+            });
+            $("#all_dates").change(function(){
+                $("input#from").parents('li').hide();
+            });
+            $("#all_dates").click().change();
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 5902b92..dcf8f5a 100644 (file)
@@ -1,6 +1,6 @@
 [% USE KohaDates %]
 [% USE Koha %]
-
+[% SET footerjs = 1 %]
 [%- BLOCK area_name -%]
     [%- SWITCH area -%]
         [%- CASE 'CIRC' -%]Circulation
@@ -29,7 +29,6 @@
 [%- END -%]</title>
 
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
 <style type="text/css">
     #sql { width: 90%; height: 9em;}
     #update_sql .modal-dialog { width: 80%; }
     .show_sql { font-family: monospace; }
 </style>
 [% IF ( saved1 ) %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-<script type="text/javascript" src="[% interface %]/lib/jsdiff/jsdiff.min.js"></script>
-[% INCLUDE 'datatables.inc' %]
-[% END %]
-
-<script type="text/javascript">
-//<![CDATA[
-var group_subgroups = {};
-[% FOREACH group IN groups_with_subgroups %]
-    var gid = "[% group.id %]"
-    group_subgroups[gid] = new Array();
-    [% FOREACH subgroup IN group.subgroups %]
-        var sgid = "[% subgroup.id %]";
-        var sgname = "[% subgroup.name %]";
-        group_subgroups[gid].push([sgid, sgname]);
-    [% END %]
-[% END %]
-
-function load_group_subgroups () {
-    var group = $("#group_select").val();
-    var sg = $("#subgroup");
-    $(sg).find('option[value!=""]').each(function() {
-        $(this).remove();
-    });
-    $(sg).hide();
-    if (group) {
-        var select = $(sg).find('select')[0];
-        $.each( group_subgroups[group], function(index, value) {
-            $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
-        } );
-        $("#subgroup, #subgroup *").show();
-    }
-}
-
-$(document).ready(function(){
-    $('#limit').change(function() {
-        $('#limitselect').submit();
-    });
-
-$(".goback").on("click",function(e){
-    e.preventDefault();
-    window.history.back();
-});
-
-$("#addColumn").on("click",function(){
-    addColumn();
-});
-
-$("#delColumn").on("click",function(){
-    delColumn();
-});
-
-[% IF (saved1) %]
-    var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, {
-        'iDisplayLength': [% Koha.Preference('NumSavedReports') %],
-        'bAutoWidth': false,
-        'sPaginationType': 'four_button',
-        'aaSorting': [[ 1, "asc" ]],
-        'aoColumnDefs': [
-            { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
-            { 'bSearchable': false, 'aTargets': [3] },
-            { "aTargets": [ 1, 2 ], "sType": "natural"  },
-            { "sType": "title-string", "aTargets" : [ "title-string" ] }
-        ],
-        'oLanguage': {
-            'sZeroRecords': _("No matching reports found")
-        }
-    }));
-
-    var rtabs = $("#tabs").tabs();
-    rtabs.on("tabsactivate", function(e, ui) {
-        $("#subgroup_filter option").each(function() {
-            if($(this).val().length > 0) {
-                $(this).remove();
-            }
-        });
-        rtable.fnFilter('', 4);
-        rtable.fnFilter('', 5);
-        rtable.fnSetColumnVis(4, true);
-        rtable.fnSetColumnVis(5, true);
-
-        var g_id = $(ui.newTab).children().attr('id');
-        var g_name = $(ui.newTab).text();
-        if ( g_name == _("All") ) {
-            g_id = "";
-            g_name = "";
-        }
-
-        if (g_id && g_id.length > 0) {
-            rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
-            rtable.fnSetColumnVis(4, false);
-            for(var i in group_subgroups[g_id]) {
-                $("#subgroup_filter").append(
-                    '<option value="' + group_subgroups[g_id][i][0] + '">'
-                    + group_subgroups[g_id][i][1] + '</option>'
-                );
-            }
-            $("#subgroup_filter_block").show();
-        } else {
-            $("#subgroup_filter_block").hide();
-        }
-    });
-    $("#subgroup_filter_block").hide();
-
-    $("#subgroup_filter").change(function() {
-        var selected = $(this).find('option:selected');
-        var sg_id = $(selected).val();
-        var sg_name = $(selected).text();
-        if (sg_id.length > 0) {
-            rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
-            rtable.fnSetColumnVis(5, false);
-        } else {
-            rtable.fnFilter('', 5);
-            rtable.fnSetColumnVis(5, true);
-        }
-    });
-
-    $("#reports_form").submit(function(){
-        var checkedItems = $("input[name=ids]:checked");
-        if ($(checkedItems).size() == 0) {
-            alert(_("You must select one or more reports to delete"));
-            return false;
-        }
-        $(checkedItems).parents('tr').addClass("warn");
-        if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
-            return true;
-        } else {
-            $(checkedItems).parents('tr').removeClass("warn");
-            return false;
-        }
-    });
-
-    $("body").on("click", ".update_sql", function(e){
-        e.preventDefault();
-        var ltitle = $(this).text();
-        var report_id = $(this).data("report_id");
-        var page = $(this).attr("href");
-        $("#update_sql .modal-body").load(page + " div", function(){
-            var diff1 = $("#col1 .show_sql").text();
-            var diff2 = $("#col2 .show_sql").text();
-            var diffs = diffString( escape(diff1), escape(diff2) );
-            $("#col1 .show_sql,#col2 .show_sql").html(diffs);
-        });
-        $('#update_sql').modal('show');
-        $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
-    });
-
-    $("#update_sql").on("hidden.bs.modal", function(){
-        $("#update_sql_label").html("");
-        $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
-    });
+    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
 [% END %]
-
-[% IF ( showsql ) %]
-    $("#sql").focus(function() {
-        $(this).select();
-    });
-[% END %]
-
-    $(".toggle_sql").click(function(){
-        $("#sql_output").toggle();
-        $("#toggle_sql_hid").toggle();
-        $("#toggle_sql_vis").toggle();
-    });
-
-    $("#table_reports").delegate(".confirmdelete", 'click', function(){
-        $(this).parents('tr').attr("class","warn");
-        if(confirm(_("Are you sure you want to delete this saved report?"))){
-            return true;
-        } else {
-            $(this).parents('tr').attr("class","");
-            return false;
-        }
-    });
-
-[% IF (create || editsql || save) %]
-    $("#select_group").change(function() {
-        if($(this).prop('checked')) {
-            $("#group_input").prop('disabled', true);
-            $("#groupdesc_input").prop('disabled', true);
-            $("#group_select").prop('disabled', false);
-            if ($("#group_select").val().length > 0) {
-                $("#select_subgroup").prop('checked', true);
-                $("#select_subgroup").change();
-                $("#subgroup, #subgroup *").show();
-            } else {
-                $("#subgroup").hide();
-            }
-        }
-    });
-    $("#create_group").change(function() {
-        if($(this).prop('checked')) {
-            $("#group_input").prop('disabled', false);
-            $("#groupdesc_input").prop('disabled', false);
-            $("#group_select").prop('disabled', true);
-            $("#create_subgroup").prop('checked', true).change();
-            $("#subgroup_select").hide();
-            $("#subgroup input[type='radio']").hide();
-            $("#subgroup label[for]").hide();
-            $("#subgroup_input").show();
-            $("#subgroupdesc_input").show();
-            $("#subgroup").show();
-        }
-    });
-    $("#select_subgroup").change(function() {
-        if($(this).prop('checked')) {
-            $("#subgroup_select").prop('disabled', false);
-            $("#subgroup_input").prop('disabled', true);
-            $("#subgroupdesc_input").prop('disabled', true);
-        }
-    });
-    $("#create_subgroup").change(function() {
-        if($(this).prop('checked')) {
-            $("#subgroup_input").prop('disabled', false);
-            $("#subgroupdesc_input").prop('disabled', false);
-            $("#subgroup_select").prop('disabled', true);
-        }
-    });
-    $("#select_group").change();
-    $("#select_subgroup").change();
-    $("#group_select").on("change",function(){
-        load_group_subgroups();
-    });
-[% END %]
-});
-//]]>
-</script>
 </head>
+
 <body id="rep_guided_reports_start" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'circ-search.inc' %]
@@ -1138,26 +913,253 @@ Sub report:<select name="subreport">
 [% INCLUDE 'guided-reports-view.inc' %]
 </div>
 </div>
-<script type="text/javascript">
-//<![CDATA[
-function addColumn() {
-    $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
-}
-function delColumn() {
-    $("#selectedColumns option:selected").remove();
-}
-$("#column_submit").submit(function() {
-    if ($("#selectedColumns option").size() < 1) {
-        alert(_("No columns selected!"));
-        return false;
-    }
-    $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
-    return true;
-});
-//]]>
-</script>
-[% INCLUDE 'intranet-bottom.inc' %]
 
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    [% IF ( saved1 ) %]
+        [% INCLUDE 'datatables.inc' %]
+    [% END %]
+    <script type="text/javascript">
+        var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
+        var group_subgroups = {};
+        [% FOREACH group IN groups_with_subgroups %]
+            var gid = "[% group.id %]"
+            group_subgroups[gid] = new Array();
+            [% FOREACH subgroup IN group.subgroups %]
+                var sgid = "[% subgroup.id %]";
+                var sgname = "[% subgroup.name %]";
+                group_subgroups[gid].push([sgid, sgname]);
+            [% END %]
+        [% END %]
+
+        function load_group_subgroups () {
+            var group = $("#group_select").val();
+            var sg = $("#subgroup");
+            $(sg).find('option[value!=""]').each(function() {
+                $(this).remove();
+            });
+            $(sg).hide();
+            if (group) {
+                var select = $(sg).find('select')[0];
+                $.each( group_subgroups[group], function(index, value) {
+                    $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
+                } );
+                $("#subgroup, #subgroup *").show();
+            }
+        }
+
+        $(document).ready(function(){
+            $('#limit').change(function() {
+                $('#limitselect').submit();
+            });
+
+            $(".goback").on("click",function(e){
+                e.preventDefault();
+                window.history.back();
+            });
+
+            $("#addColumn").on("click",function(){
+                addColumn();
+            });
+
+            $("#delColumn").on("click",function(){
+                delColumn();
+            });
+
+            [% IF (saved1) %]
+                var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, {
+                    'iDisplayLength': [% Koha.Preference('NumSavedReports') %],
+                    'bAutoWidth': false,
+                    'sPaginationType': 'four_button',
+                    'aaSorting': [[ 1, "asc" ]],
+                    'aoColumnDefs': [
+                        { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
+                        { 'bSearchable': false, 'aTargets': [3] },
+                        { "aTargets": [ 1, 2 ], "sType": "natural"  },
+                        { "sType": "title-string", "aTargets" : [ "title-string" ] }
+                    ],
+                    'oLanguage': {
+                        'sZeroRecords': _("No matching reports found")
+                    }
+                }));
+
+                var rtabs = $("#tabs").tabs();
+                rtabs.on("tabsactivate", function(e, ui) {
+                    $("#subgroup_filter option").each(function() {
+                        if($(this).val().length > 0) {
+                            $(this).remove();
+                        }
+                    });
+                    rtable.fnFilter('', 4);
+                    rtable.fnFilter('', 5);
+                    rtable.fnSetColumnVis(4, true);
+                    rtable.fnSetColumnVis(5, true);
+
+                    var g_id = $(ui.newTab).children().attr('id');
+                    var g_name = $(ui.newTab).text();
+                    if ( g_name == _("All") ) {
+                        g_id = "";
+                        g_name = "";
+                    }
+
+                    if (g_id && g_id.length > 0) {
+                        rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
+                        rtable.fnSetColumnVis(4, false);
+                        for(var i in group_subgroups[g_id]) {
+                            $("#subgroup_filter").append(
+                                '<option value="' + group_subgroups[g_id][i][0] + '">'
+                                + group_subgroups[g_id][i][1] + '</option>'
+                            );
+                        }
+                        $("#subgroup_filter_block").show();
+                    } else {
+                        $("#subgroup_filter_block").hide();
+                    }
+                });
+                $("#subgroup_filter_block").hide();
+
+                $("#subgroup_filter").change(function() {
+                    var selected = $(this).find('option:selected');
+                    var sg_id = $(selected).val();
+                    var sg_name = $(selected).text();
+                    if (sg_id.length > 0) {
+                        rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
+                        rtable.fnSetColumnVis(5, false);
+                    } else {
+                        rtable.fnFilter('', 5);
+                        rtable.fnSetColumnVis(5, true);
+                    }
+                });
+
+                $("#reports_form").submit(function(){
+                    var checkedItems = $("input[name=ids]:checked");
+                    if ($(checkedItems).size() == 0) {
+                        alert(_("You must select one or more reports to delete"));
+                        return false;
+                    }
+                    $(checkedItems).parents('tr').addClass("warn");
+                    if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
+                        return true;
+                    } else {
+                        $(checkedItems).parents('tr').removeClass("warn");
+                        return false;
+                    }
+                });
+
+                $("body").on("click", ".update_sql", function(e){
+                    e.preventDefault();
+                    var ltitle = $(this).text();
+                    var report_id = $(this).data("report_id");
+                    var page = $(this).attr("href");
+                    $("#update_sql .modal-body").load(page + " div", function(){
+                        var diff1 = $("#col1 .show_sql").text();
+                        var diff2 = $("#col2 .show_sql").text();
+                        var diffs = diffString( escape(diff1), escape(diff2) );
+                        $("#col1 .show_sql,#col2 .show_sql").html(diffs);
+                    });
+                    $('#update_sql').modal('show');
+                    $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
+                });
+
+                $("#update_sql").on("hidden.bs.modal", function(){
+                    $("#update_sql_label").html("");
+                    $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
+                });
+            [% END %]
+
+            [% IF ( showsql ) %]
+                $("#sql").focus(function() {
+                    $(this).select();
+                });
+            [% END %]
+
+                $(".toggle_sql").click(function(){
+                    $("#sql_output").toggle();
+                    $("#toggle_sql_hid").toggle();
+                    $("#toggle_sql_vis").toggle();
+                });
+
+                $("#table_reports").delegate(".confirmdelete", 'click', function(){
+                    $(this).parents('tr').attr("class","warn");
+                    if(confirm(_("Are you sure you want to delete this saved report?"))){
+                        return true;
+                    } else {
+                        $(this).parents('tr').attr("class","");
+                        return false;
+                    }
+                });
+
+            [% IF (create || editsql || save) %]
+                $("#select_group").change(function() {
+                    if($(this).prop('checked')) {
+                        $("#group_input").prop('disabled', true);
+                        $("#groupdesc_input").prop('disabled', true);
+                        $("#group_select").prop('disabled', false);
+                        if ($("#group_select").val().length > 0) {
+                            $("#select_subgroup").prop('checked', true);
+                            $("#select_subgroup").change();
+                            $("#subgroup, #subgroup *").show();
+                        } else {
+                            $("#subgroup").hide();
+                        }
+                    }
+                });
+                $("#create_group").change(function() {
+                    if($(this).prop('checked')) {
+                        $("#group_input").prop('disabled', false);
+                        $("#groupdesc_input").prop('disabled', false);
+                        $("#group_select").prop('disabled', true);
+                        $("#create_subgroup").prop('checked', true).change();
+                        $("#subgroup_select").hide();
+                        $("#subgroup input[type='radio']").hide();
+                        $("#subgroup label[for]").hide();
+                        $("#subgroup_input").show();
+                        $("#subgroupdesc_input").show();
+                        $("#subgroup").show();
+                    }
+                });
+                $("#select_subgroup").change(function() {
+                    if($(this).prop('checked')) {
+                        $("#subgroup_select").prop('disabled', false);
+                        $("#subgroup_input").prop('disabled', true);
+                        $("#subgroupdesc_input").prop('disabled', true);
+                    }
+                });
+                $("#create_subgroup").change(function() {
+                    if($(this).prop('checked')) {
+                        $("#subgroup_input").prop('disabled', false);
+                        $("#subgroupdesc_input").prop('disabled', false);
+                        $("#subgroup_select").prop('disabled', true);
+                    }
+                });
+                $("#select_group").change();
+                $("#select_subgroup").change();
+                $("#group_select").on("change",function(){
+                    load_group_subgroups();
+                });
+            [% END %]
+            $(".delete").on("click",function(){
+                return confirmDelete(MSG_CONFIRM_DELETE);
+            });
+        });
+        function addColumn() {
+            $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
+        }
+        function delColumn() {
+            $("#selectedColumns option:selected").remove();
+        }
+        $("#column_submit").submit(function() {
+            if ($("#selectedColumns option").size() < 1) {
+                alert(_("No columns selected!"));
+                return false;
+            }
+            $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
+            return true;
+        });
+    </script>
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' %]
 
 [% BLOCK group_and_subgroup_selection %]
     <li id="group">
index ae20291..32871a5 100644 (file)
@@ -1,42 +1,10 @@
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Average loan time</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-        $(document).ready(function() {
-        // http://jqueryui.com/demos/datepicker/#date-range
-        var dates = $( "#from, #to" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "from" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                dates.not( this ).datepicker( "option", option, date );
-            }
-        });
-        var datesRO = $( "#fromRO, #toRO" ).datepicker({
-            changeMonth: true,
-            numberOfMonths: 1,
-            onSelect: function( selectedDate ) {
-                var option = this.id == "fromRO" ? "minDate" : "maxDate",
-                    instance = $( this ).data( "datepicker" );
-                    date = $.datepicker.parseDate(
-                        instance.settings.dateFormat ||
-                        $.datepicker._defaults.dateFormat,
-                        selectedDate, instance.settings );
-                datesRO.not( this ).datepicker( "option", option, date );
-            }
-        });
-        });
-//]]>
-</script>
 </head>
+
 <body id="rep_issues_avg_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            // http://jqueryui.com/demos/datepicker/#date-range
+            var dates = $( "#from, #to" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "from" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    dates.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesRO = $( "#fromRO, #toRO" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "fromRO" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesRO.not( this ).datepicker( "option", option, date );
+                }
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index ea7c184..f7ff19f 100644 (file)
@@ -1,12 +1,13 @@
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Circulation statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
 <style type="text/css">
        .sql {display:none;}
 </style>
 </head>
+
 <body id="rep_issues_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index e3b8e26..99d9538 100644 (file)
@@ -2,36 +2,18 @@
 [% USE Branches %]
 [% USE ColumnsSettings %]
 [% USE KohaDates %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Lost items</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-[% INCLUDE 'columns_settings.inc' %]
-<script type='text/javascript'>
-//<![CDATA[
-    $(document).ready(function() {
-        var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'lostitems', 'lostitems-table', 'json' ) %];
-        var lostitems_table = KohaTable("#lostitems-table", {
-            "dom": 'B<"clearfix">t',
-            "aaSorting": [],
-            "aoColumnDefs": [
-                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
-                { "sType": "title-string", "aTargets" : [ "title-string" ] }
-            ],
-            "bPaginate": false,
-        }, columns_settings);
-
-    });
-//]]>
-</script>
-
 </head>
+
 <body id="rep_itemslost" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_items ) %] &rsaquo; <a href="/cgi-bin/koha/reports/itemslost.pl">Lost Items</a> &rsaquo; Results[% ELSE %] &rsaquo; Lost items[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_items ) %] &rsaquo; <a href="/cgi-bin/koha/reports/itemslost.pl">Lost items</a> &rsaquo; Results[% ELSE %] &rsaquo; Lost items[% END %]</div>
 
 <div id="doc3" class="yui-t2">
    
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    [% INCLUDE 'columns_settings.inc' %]
+    <script type='text/javascript'>
+        $(document).ready(function() {
+            var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'lostitems', 'lostitems-table', 'json' ) %];
+            var lostitems_table = KohaTable("#lostitems-table", {
+                "dom": 'B<"clearfix">t',
+                "aaSorting": [],
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
+                ],
+                "bPaginate": false,
+            }, columns_settings);
+
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 1bfd416..706ae16 100644 (file)
@@ -1,28 +1,19 @@
 [% USE Branches %]
 [% USE ItemTypes %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Catalog by item types</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% IF ( do_it ) %]
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-$(document).ready(function(){
-    $("#itemtypest").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "sDom": 't',
-        "bPaginate": false
-    }));
-});
-//]]>
-</script>
 [% END %]
 </head>
+
 <body id="rep_itemtypes" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( do_it ) %] &rsaquo; <a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by Item Type</a> &rsaquo; Results[% ELSE %] &rsaquo; Catalog by item type[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( do_it ) %] &rsaquo; <a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by item type</a> &rsaquo; Results[% ELSE %] &rsaquo; Catalog by item type[% END %]</div>
 
 <div id="doc3" class="yui-t2">
    
@@ -84,4 +75,19 @@ $(document).ready(function(){
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% IF ( do_it ) %]
+        [% INCLUDE 'datatables.inc' %]
+        <script type="text/javascript">
+            $(document).ready(function(){
+                $("#itemtypest").dataTable($.extend(true, {}, dataTablesDefaults, {
+                    "sDom": 't',
+                    "bPaginate": false
+                }));
+            });
+        </script>
+    [% END %]
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index fc4eef7..5b4a678 100644 (file)
@@ -1,4 +1,5 @@
 [% USE Price %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Orders by fund</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -8,23 +9,6 @@
 [% INCLUDE 'cat-search.inc' %]
 
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-    $(document).ready( function () {
-        $('#funds').DataTable($.extend(true, {}, dataTablesDefaults,{"sPaginationType": "full_numbers"}));
-
-        showallbudgets = $('#budgetfilter').html();
-        $('#budgetfilter .b_inactive').remove();
-
-        $('#showbudgets').click(function(){
-            if ($(this).is(":checked")) {
-                $('#budgetfilter').html(showallbudgets);
-            } else {
-                $('#budgetfilter .b_inactive').remove();
-            }
-        });
-    } );
-</script>
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_orders ) %] &rsaquo; <a href="/cgi-bin/koha/reports/orders_by_fund.pl">Orders by fund</a> &rsaquo; Results[% ELSE %] &rsaquo; Orders by fund[% END %]</div>
 
 <div id="doc3" class="yui-t2">
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript">
+        $(document).ready( function () {
+            $('#funds').DataTable($.extend(true, {}, dataTablesDefaults,{"sPaginationType": "full_numbers"}));
+
+            showallbudgets = $('#budgetfilter').html();
+            $('#budgetfilter .b_inactive').remove();
+
+            $('#showbudgets').click(function(){
+                if ($(this).is(":checked")) {
+                    $('#budgetfilter').html(showallbudgets);
+                } else {
+                    $('#budgetfilter .b_inactive').remove();
+                }
+            });
+        } );
+    </script>
+
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 9b6c77d..0a10c00 100644 (file)
@@ -1,84 +1,13 @@
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Holds statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-        $(document).ready(function() {
-            // http://jqueryui.com/demos/datepicker/#date-range
-            var dates = $( "#filter_reservedate_begin, #filter_reservedate_end" ).datepicker({
-                changeMonth: true,
-                numberOfMonths: 1,
-                onSelect: function( selectedDate ) {
-                    var option = this.id == "filter_reservedate_begin" ? "minDate" : "maxDate",
-                        instance = $( this ).data( "datepicker" );
-                        date = $.datepicker.parseDate(
-                            instance.settings.dateFormat ||
-                            $.datepicker._defaults.dateFormat,
-                            selectedDate, instance.settings );
-                    dates.not( this ).datepicker( "option", option, date );
-                }
-            });
-            var datesND = $( "#filter_notificationdate_begin, #filter_notificationdate_end" ).datepicker({
-                changeMonth: true,
-                numberOfMonths: 1,
-                onSelect: function( selectedDate ) {
-                    var option = this.id == "filter_notificationdate_begin" ? "minDate" : "maxDate",
-                        instance = $( this ).data( "datepicker" );
-                        date = $.datepicker.parseDate(
-                            instance.settings.dateFormat ||
-                            $.datepicker._defaults.dateFormat,
-                            selectedDate, instance.settings );
-                    datesND.not( this ).datepicker( "option", option, date );
-                }
-            });
-            var datesRD = $( "#filter_reminderdate_begin, #filter_reminderdate_end" ).datepicker({
-                changeMonth: true,
-                numberOfMonths: 1,
-                onSelect: function( selectedDate ) {
-                    var option = this.id == "filter_reminderdate_begin" ? "minDate" : "maxDate",
-                        instance = $( this ).data( "datepicker" );
-                        date = $.datepicker.parseDate(
-                            instance.settings.dateFormat ||
-                            $.datepicker._defaults.dateFormat,
-                            selectedDate, instance.settings );
-                    datesRD.not( this ).datepicker( "option", option, date );
-                }
-            });
-            var datesWD = $( "#filter_waitingdate_begin, #filter_waitingdate_end" ).datepicker({
-                changeMonth: true,
-                numberOfMonths: 1,
-                onSelect: function( selectedDate ) {
-                    var option = this.id == "filter_waitingdate_begin" ? "minDate" : "maxDate",
-                        instance = $( this ).data( "datepicker" );
-                        date = $.datepicker.parseDate(
-                            instance.settings.dateFormat ||
-                            $.datepicker._defaults.dateFormat,
-                            selectedDate, instance.settings );
-                    datesWD.not( this ).datepicker( "option", option, date );
-                }
-            });
-            var datesCD = $( "#filter_cancellationdate_begin, #filter_cancellationdate_end" ).datepicker({
-                changeMonth: true,
-                numberOfMonths: 1,
-                onSelect: function( selectedDate ) {
-                    var option = this.id == "filter_cancellationdate_begin" ? "minDate" : "maxDate",
-                        instance = $( this ).data( "datepicker" );
-                        date = $.datepicker.parseDate(
-                            instance.settings.dateFormat ||
-                            $.datepicker._defaults.dateFormat,
-                            selectedDate, instance.settings );
-                    datesCD.not( this ).datepicker( "option", option, date );
-                }
-            });
-        });
-//]]>
-</script>
 <style type="text/css">
        .sql {display:none;}
 </style>
 </head>
+
 <body id="rep_reserve_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
                                </td>
              </tr>
              <tr>
-                <td>Hold Date</td>
+                <td>Hold date</td>
                 <td><input type="radio" name="Line" value="reservedate" /></td>
                 <td><input type="radio" name="Column" value="reservedate" /></td>
                 <td><label for="filter_reservedate_begin">From</label> <input type="text"  size="10" id="filter_reservedate_begin" name="filter_reservedate_begin" />
                     </td>
                 </tr>
             <tr>
-                <td>Notification Date</td>
+                <td>Notification date</td>
                 <td><input type="radio" name="Line" value="notificationdate" /></td>
                 <td><input type="radio" name="Column" value="notificationdate" /></td>
                 <td><label for="filter_notificationdate_begin">From</label> <input type="text"  size="10" id="filter_notificationdate_begin" name="filter_notificationdate_begin" />
                     </td>
              </tr>
             <tr>
-                <td>Reminder Date</td>
+                <td>Reminder date</td>
                 <td><input type="radio" name="Line" value="reminderdate" /></td>
                 <td><input type="radio" name="Column" value="reminderdate" /></td>
                 <td><label for="filter_reminderdate_begin">From</label> <input type="text"  size="10" id="filter_reminderdate_begin" name="Filter" />
                     </td>
              </tr>
             <tr>
-                <td>Waiting Date</td>
+                <td>Waiting date</td>
                 <td><input type="radio" name="Line" value="waitingdate" /></td>
                 <td><input type="radio" name="Column" value="waitingdate" /></td>
                 <td><label for="filter_waitingdate_begin">From</label> <input type="text"  size="10" id="filter_waitingdate_begin" name="filter_waitingdate_begin" />
                     </td>
              </tr>
                         <tr>
-                <td>Cancellation Date</td>
+                <td>Cancellation date</td>
                 <td><input type="radio" name="Line" value="cancellationdate" /></td>
                 <td><input type="radio" name="Column" value="cancellationdate" /></td>
                 <td><label for="filter_cancellationdate_begin">From</label> <input type="text"  size="10" id="filter_cancellationdate_begin" name="filter_cancellationdate_begin" />
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            // http://jqueryui.com/demos/datepicker/#date-range
+            var dates = $( "#filter_reservedate_begin, #filter_reservedate_end" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "filter_reservedate_begin" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    dates.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesND = $( "#filter_notificationdate_begin, #filter_notificationdate_end" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "filter_notificationdate_begin" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesND.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesRD = $( "#filter_reminderdate_begin, #filter_reminderdate_end" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "filter_reminderdate_begin" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesRD.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesWD = $( "#filter_waitingdate_begin, #filter_waitingdate_end" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "filter_waitingdate_begin" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesWD.not( this ).datepicker( "option", option, date );
+                }
+            });
+            var datesCD = $( "#filter_cancellationdate_begin, #filter_cancellationdate_end" ).datepicker({
+                changeMonth: true,
+                numberOfMonths: 1,
+                onSelect: function( selectedDate ) {
+                    var option = this.id == "filter_cancellationdate_begin" ? "minDate" : "maxDate",
+                        instance = $( this ).data( "datepicker" );
+                        date = $.datepicker.parseDate(
+                            instance.settings.dateFormat ||
+                            $.datepicker._defaults.dateFormat,
+                            selectedDate, instance.settings );
+                    datesCD.not( this ).datepicker( "option", option, date );
+                }
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 3b9ac4c..0b9e0f4 100644 (file)
@@ -1,5 +1,6 @@
 [% USE KohaDates %]
 [% USE Branches %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports &rsaquo; Serials subscriptions stats</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -7,21 +8,8 @@
        .sql {display: none;}
 </style>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-       //<![CDATA[
-               $(document).ready(function() {
-            $("#resulttable").dataTable($.extend(true, {}, dataTablesDefaults, {
-                "sDom": 't',
-                "bPaginate": false,
-                "aoColumns": [
-                    null,{ "sType": "anti-the" },null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null
-                ],
-            }));
-       });
-       //]]>
-</script>
 </head>
+
 <body id="rep_serials_stats" class="rep">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 [% INCLUDE 'reports-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+[% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            $("#resulttable").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "sDom": 't',
+                "bPaginate": false,
+                "aoColumns": [
+                    null,{ "sType": "anti-the" },null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null
+                ],
+            }));
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 5373fc3..0043ec5 100644 (file)
@@ -1,3 +1,4 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Comments &rsaquo; [% IF ( status ) %] Approved comments[% ELSE %] Comments awaiting moderation[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -72,4 +73,9 @@
 [% INCLUDE 'tools-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]