Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tt
index a140ebb..d25a515 100644 (file)
+[% USE raw %]
+[% USE Asset %]
+[% USE AuthorisedValues %]
 [% USE Branches %]
-
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-[% USE AuthorisedValues %]
     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
     [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-    var sTable;
-        $(document).ready(function() {
-         sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
-            "sDom": 't',
-                "aoColumnDefs": [
-                    { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
-                    { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] },
-                    { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
-                ],
-            "bPaginate": false
-        }));
-        sTable.fnAddFilters("filter", "200");
-           $('#supplierid').change(function() {
-           $('#claims').submit();
-           });
-
-           // Checkboxes : Select All / None
-           $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
-
-        $("#CheckAll").click(function() {
-            $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked'));
-        });
-
-        // Generates a dynamic link for exporting the selections data as CSV
-           $("#ExportSelected").click(function() {
-               // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
-             var selected = $("input[name=serialid]:checked");
-
-        if (selected.length == 0) {
-            alert(_("Please select at least one item to export."));
-            return false;
-        }
-
-        // Building the url from currently checked boxes
-        var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
-        for (var i = 0; i < selected.length; i++) {
-            url += '&amp;serialid=' + selected[i].value;
-        }
-        url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
-        // And redirecting to the CSV page
-        location.href = url;
-        return false;
-        });
-        $("#filterByDate").on("click",function(e){
-            e.preventDefault();
-            filterByDate();
-        });
-        $("#clearfilter").on("click",function(e){
-            e.preventDefault();
-            $("#from,#to").val("");
-            $("table#claimst tbody tr").show();
-        });
-        $("#claims_form").on("submit",function(){
-             return checkForm();
-        });
-        $("#filter_claims_form").on("submit",function(){
-            return false;
-        });
-        });
-
-       // Checks if the form can be sent (at least one checkbox must be checked)
-       function checkForm() {
-           if ($("input:checked").length == 0) {
-        alert(_("Please select at least one issue."));
-               return false;
-           }
-       }
-
-       // Filter by date
-       function filterByDate() {
-        var beginDate = Date_from_syspref($("#from").val()).getTime();
-        var endDate   = Date_from_syspref($("#to").val()).getTime();
-           
-           // Checks if the beginning date is valid
-           if (!parseInt(beginDate)) {
-               alert(_("The beginning date is missing or invalid."));
-               return false;
-           }
-
-           // Checks if the ending date is valid
-           if (!parseInt(endDate)) {
-               alert(_("The ending date is missing or invalid."));
-               return false;
-           }
-
-           // Checks if beginning date is before ending date
-           if (beginDate > endDate) {
-               // If not, we swap them
-               var tmpDate = endDate;
-               endDate = beginDate;
-               beginDate = tmpDate;
-           }
-          
-           // We hide everything
-           $("table#claimst tbody tr").hide();
-
-           // For each date in the table
-           $(".planneddate").each(function() {
-
-               // We make a JS Date Object, according to the locale
-               var pdate = Date_from_syspref($(this).text()).getTime();
-
-               // And checks if the date is between the beginning and ending dates
-               if (pdate > beginDate && 
-                   pdate < endDate) {
-                       // If so, we can show the row
-                       $(this).parent().show();
-                   }
-
-           });
-       }
-
-
-//]]>
-</script>
 </head>
+
 <body id="ser_claims" class="ser">
     [% INCLUDE 'header.inc' %]
     [% INCLUDE 'serials-search.inc' %]
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Claims</div>
 
-<div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
 
     <h1>Claims</h1>
 
         [% ELSIF error_claim == 'bad_or_missing_sender' %]
             <div class="dialog alert">Bad or missing sender address; check your branch email address or preference KohaAdminEmailAddress.</div>
         [% ELSE %]
-            <div class="dialog alert">[% error_claim %]</div>
+            <div class="dialog alert">[% error_claim | html %]</div>
         [% END %]
     [% END %]
     [% IF info_claim %]
            <select id="supplierid" name="supplierid">
                [% FOREACH suploo IN suploop %]
                    [% IF ( suploo.selected ) %]
-                   <option value="[% suploo.id %]" selected="selected" >
+                   <option value="[% suploo.id | html %]" selected="selected" >
                    [% ELSE %]
-                   <option value="[% suploo.id %]">
+                   <option value="[% suploo.id | html %]">
                    [% END %]
-                       [% suploo.name %]
-                       ([% suploo.count %])
+                       [% suploo.name | html %]
+                       ([% suploo.count | html %])
                    </option>
                [% END %]
            </select>
        <ol>
        <li>
         <label for="from">From:</label>
-        <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
+        <input type="text" name="begindate" id="from" value="[% begindate | html %]" size="10" maxlength="10" class="datepickerfrom" />
         <label for="to" style="float:none;">To:</label>
-        <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
+        <input type="text" name="enddate" id="to" value="[% enddate | html %]" size="10" maxlength="10" class="datepickerto" />
         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
         <input id="filterByDate" type="button" value="OK" />
         <a href="#" id="clearfilter"><i class="fa fa-remove"></i> Clear filter</a>
                         <th>Claims count</th>
                         <th class="title-string">Claim date</th>
                         [% FOR field IN additional_fields_for_subscription %]
-                          <th>[% field.name %]</th>
+                          <th>[% field.name | html %]</th>
                         [% END %]
                     </tr>
                 </thead>
                     <td><input type="text" class="filter" data-column_num="8" placeholder="Search claim count" /></td>
                     <td><input type="text" class="filter" data-column_num="9" placeholder="Search claim date" /></td>
                     [% FOR field IN additional_fields_for_subscription %]
-                      <td><input type="text" class="filter" data-column_num="[% loop.count + 9 %]" placeholder="Search [% field.name %]" /></td>
+                      <td><input type="text" class="filter" data-column_num="[% loop.count + 9 | html %]" placeholder="Search [% field.name | html %]" /></td>
                     [% END %]
                   </tr>
                 </tfoot>
                     <tr>
                         <td>
                           [% UNLESS missingissue.cannot_claim %]
-                            <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
+                            <input type="checkbox" name="serialid" value="[% missingissue.serialid | html %]" />
                           [% END %]
                         </td>
-                        <td>[% missingissue.name %]</td>
+                        <td>[% missingissue.name | html %]</td>
                         <td>
-                            <span class="branch-[% missingissue.branchcode %]">[% Branches.GetName( missingissue.branchcode ) %]</span>
+                            <span class="branch-[% missingissue.branchcode | html %]">[% Branches.GetName( missingissue.branchcode ) | html %]</span>
                         </td>
                         <td>
-                        <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
+                        <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid | uri %]">[% missingissue.title | html %]</a>
                         </td>
-                        <td>[% missingissue.issn %]</td>
-                        <td>[% missingissue.serialseq %]</td>
+                        <td>[% missingissue.issn | html %]</td>
+                        <td>[% missingissue.serialseq | html %]</td>
                         <td>
                             [% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
                             [% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
                         </td>
                         <td class="planneddate">
                             [% IF ( missingissue.planneddate ) %]
-                                <span title="[% missingissue.planneddateISO %]">[% missingissue.planneddate %]</span>
+                                <span title="[% missingissue.planneddateISO | html %]">[% missingissue.planneddate | html %]</span>
                             [% ELSE %]
                                 <span title="0000-00-00"></span>
                             [% END %]
                         </td>
-                        <td>[% missingissue.claims_count %]</td>
+                        <td>[% missingissue.claims_count | html %]</td>
                         <td>
                             [% IF ( missingissue.claimdate ) %]
-                                <span title="[% missingissue.claimdateISO %]">[% missingissue.claimdate %]</span>
+                                <span title="[% missingissue.claimdateISO | html %]">[% missingissue.claimdate | html %]</span>
                             [% ELSE %]
                                 <span title="0000-00-00"></span>
                             [% END %]
                         </td>
                         [% FOR field IN additional_fields_for_subscription %]
                           [% IF field.authorised_value_category %]
-                            <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) %]</td>
+                            <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) | html %]</td>
                           [% ELSE %]
-                            <td>[% missingissue.additional_fields.${field.name} %]</td>
+                            <td>[% missingissue.additional_fields.${field.name} | html %]</td>
                           [% END %]
                         [% END %]
                     </tr>
                 <label for="csv_code">Select CSV profile:</label>
                 <select id="csv_profile_for_export">
                   [% FOR csv IN csv_profiles %]
-                    <option value="[% csv.export_format_id %]">[% csv.profile %]</option>
+                    <option value="[% csv.export_format_id | html %]">[% csv.profile | html %]</option>
                    [% END %]
                 </select>
                 <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
                     <label for="letter_code">Select notice:</label>
                     <select name="letter_code" id="letter_code">
                         [% FOREACH letter IN letters %]
-                            <option value="[% letter.code %]">[% letter.name %]</option>
+                            <option value="[% letter.code | html %]">[% letter.name | html %]</option>
                         [% END %]
                     </select>
                     <input type="hidden" name="op" value="send_alert" />
-                    <input type="hidden" name="supplierid" value="[% supplierid %]" />
+                    <input type="hidden" name="supplierid" value="[% supplierid | html %]" />
                     <input type="submit" name="submit" class="button" value="Send notification" />
                 </fieldset>
             [% END %]
     </fieldset>
 [% END %]
 
-</div>
-</div>
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+                [% INCLUDE 'serials-menu.inc' %]
+            </aside>
+        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+     </div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+    [% INCLUDE 'datatables.inc' %]
+    <script>
+        var sTable;
+        $(document).ready(function() {
+            sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "sDom": 't',
+                    "aoColumnDefs": [
+                        { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
+                        { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] },
+                        { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
+                    ],
+                "bPaginate": false
+            }));
+            sTable.fnAddFilters("filter", "200");
+            $('#supplierid').change(function() {
+                $('#claims').submit();
+            });
+
+            // Checkboxes : Select All / None
+            $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
+
+            $("#CheckAll").click(function() {
+                $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked'));
+            });
+
+            // Generates a dynamic link for exporting the selections data as CSV
+            $("#ExportSelected").click(function() {
+                // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
+                var selected = $("input[name=serialid]:checked");
+
+            if (selected.length == 0) {
+                alert(_("Please select at least one item to export."));
+                return false;
+            }
+
+            // Building the url from currently checked boxes
+            var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
+            for (var i = 0; i < selected.length; i++) {
+                url += '&amp;serialid=' + selected[i].value;
+            }
+            url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
+            // And redirecting to the CSV page
+            location.href = url;
+            return false;
+            });
+            $("#filterByDate").on("click",function(e){
+                e.preventDefault();
+                filterByDate();
+            });
+            $("#clearfilter").on("click",function(e){
+                e.preventDefault();
+                $("#from,#to").val("");
+                $("table#claimst tbody tr").show();
+            });
+            $("#claims_form").on("submit",function(){
+                return checkForm();
+            });
+            $("#filter_claims_form").on("submit",function(){
+                return false;
+            });
+         });
+
+        // Checks if the form can be sent (at least one checkbox must be checked)
+        function checkForm() {
+            if ($("input:checked").length == 0) {
+            alert(_("Please select at least one issue."));
+            return false;
+            }
+        }
+
+        // Filter by date
+        function filterByDate() {
+            var beginDate = Date_from_syspref($("#from").val()).getTime();
+            var endDate   = Date_from_syspref($("#to").val()).getTime();
+
+            // Checks if the beginning date is valid
+            if (!parseInt(beginDate)) {
+                alert(_("The beginning date is missing or invalid."));
+                return false;
+            }
+
+            // Checks if the ending date is valid
+            if (!parseInt(endDate)) {
+                alert(_("The ending date is missing or invalid."));
+                return false;
+            }
+
+            // Checks if beginning date is before ending date
+            if (beginDate > endDate) {
+                // If not, we swap them
+                var tmpDate = endDate;
+                endDate = beginDate;
+                beginDate = tmpDate;
+            }
+
+            // We hide everything
+            $("table#claimst tbody tr").hide();
+
+            // For each date in the table
+            $(".planneddate").each(function() {
+
+            // We make a JS Date Object, according to the locale
+            var pdate = Date_from_syspref($(this).text()).getTime();
+
+            // And checks if the date is between the beginning and ending dates
+            if (pdate > beginDate &&
+                pdate < endDate) {
+                // If so, we can show the row
+                $(this).parent().show();
+                }
+            });
+        }
+    </script>
+[% END %]
 
-<div class="yui-b">
-[% INCLUDE 'serials-menu.inc' %]
-</div>
-</div>
 [% INCLUDE 'intranet-bottom.inc' %]