Bug 24163: Allow to define CSV profile for late orders export
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / holidays.tt
index 89db4cf..f7771c0 100644 (file)
@@ -1,10 +1,11 @@
+[% USE raw %]
+[% USE Asset %]
 [% USE Branches %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Tools &rsaquo; [% Branches.GetName( branch ) %] calendar</title>
+<title>Koha &rsaquo; Tools &rsaquo; [% Branches.GetName( branch ) | html %] calendar</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
-<style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; }
+<style> .key { padding : 3px; white-space:nowrap; line-height:230%; }
 .ui-datepicker { font-size : 150%; }
 .ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; }
 .ui-datepicker td a { padding : .5em; }
@@ -21,23 +22,24 @@ td.repeatableweekly a.ui-state-default {  background:  #FFFF99 none; color :  Bl
 td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Black;  border : 1px solid #BCBCBC; }
 .information { z-index : 1; background-color :  #DCD2F1; width : 300px; display : none; border : 1px solid #000000; color :  #000000; font-size :  8pt; font-weight :  bold; background-color :  #FFD700; cursor :  pointer; padding : 2px; }
 .panel { z-index : 1; display : none; border : 3px solid #CCC; padding : 3px; margin-top: .3em;  background-color: #FEFEFE; } fieldset.brief { border : 0; margin-top: 0; }
-#showHoliday { margin : .5em 0; } h1 select { width: 20em; } div.yui-b fieldset.brief ol { font-size:100%; } div.yui-b fieldset.brief li, div.yui-b fieldset.brief li.radio  { padding:0.2em 0; } .help { margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; } #holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { font-size : 90%; margin-bottom : 1em;} .calendar td, .calendar th, .calendar .button, .calendar tbody .day { padding : .7em; font-size: 110%; } .calendar { width: auto; border : 0; }
+#showHoliday { margin : .5em 0; } h1 select { width: 20em; } fieldset.brief ol { font-size:100%; } fieldset.brief li, fieldset.brief li.radio  { padding:0.2em 0; } .help { margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; } #holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { font-size : 90%; margin-bottom : 1em;} .calendar td, .calendar th, .calendar .button, .calendar tbody .day { padding : .7em; font-size: 110%; } .calendar { width: auto; border : 0; }
 </style>
 </head>
 <body id="tools_holidays" class="tools">
 [% 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/tools/tools-home.pl">Tools</a> &rsaquo; [% Branches.GetName( branch ) %] calendar</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% Branches.GetName( branch ) | html %] calendar</div>
 
-<div id="doc3" class="yui-t1">
-   
-   <div id="bd">
-    <div id="yui-main">
-    <div class="yui-b">
-    <h2>[% Branches.GetName( branch ) %] calendar</h2>
-    <div class="yui-g">
-    <div class="yui-u first">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
+
+    <h2>[% Branches.GetName( branch ) | html %] calendar</h2>
+
+    <div class="row">
+    <div class="col-sm-6">
         <label for="branch">Define the holidays for:</label>
             <select id="branch" name="branch">
                 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
@@ -73,7 +75,7 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
             </li>
             <li class="dateinsert">
                 <b>To Date : </b>
-                <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange %]" class="datepicker"/>
+                <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange | html %]" class="datepicker"/>
             </li>
             <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
             <!-- showTitle is necessary for exception radio button to work properly -->
@@ -143,7 +145,7 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
             </li>
             <li class="dateinsert">
                 <b>To date: </b>
-                <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" class="datepicker" />
+                <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange | html %]" class="datepicker" />
             </li>
             <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
             <li><label for="newDescription">Description:</label>
@@ -200,12 +202,12 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 
 <div style="margin-top: 2em;">
 <form action="copy-holidays.pl" method="post">
-    <input type="hidden" name="from_branchcode" value="[% branch %]" />
+    <input type="hidden" name="from_branchcode" value="[% branch | html %]" />
   <label for="branchcode">Copy holidays to:</label>
   <select id="branchcode" name="branchcode">
     <option value=""></option>
     [% FOREACH l IN Branches.all() %]
-    <option value="[% l.branchcode %]">[% l.branchname %]</option>
+    <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
     [% END %]
   </select>
     <input type="submit" value="Copy" />
@@ -213,7 +215,7 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 </div>
 
 </div>
-<div class="yui-u">
+<div class="col-sm-6">
 <div class="help">
 <h4>Hints</h4>
     <ul>
@@ -247,9 +249,9 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 <tbody>
   [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
   <tr>
-  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch %]&amp;calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE %]"><span title="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT %]">[% EXCEPTION_HOLIDAYS_LOO.DATE %]</span></a></td>
-  <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE |html %]</td>
-  <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION |html %]</td>
+  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&amp;calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]"><span title="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">[% EXCEPTION_HOLIDAYS_LOO.DATE | html %]</span></a></td>
+  <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE | html %]</td>
+  <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
   </tr>
   [% END %] 
 </tbody>
@@ -269,10 +271,10 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 <tbody>
   [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
   <tr>
-  <td>[% WEEK_DAYS_LOO.KEY %]</td>
+  <td>[% WEEK_DAYS_LOO.KEY | html %]</td>
   </td> 
-  <td>[% WEEK_DAYS_LOO.TITLE |html %]</td>
-  <td>[% WEEK_DAYS_LOO.DESCRIPTION |html %]</td>
+  <td>[% WEEK_DAYS_LOO.TITLE | html %]</td>
+  <td>[% WEEK_DAYS_LOO.DESCRIPTION | html %]</td>
   </tr>
   [% END %] 
 </tbody>
@@ -296,9 +298,9 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 <tbody>
   [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
   <tr>
-  <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[% DAY_MONTH_HOLIDAYS_LOO.DATE %]</span></td>
-  <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE |html %]</td>
-  <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION |html %]</td>
+  <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.DATE | html %]</span></td>
+  <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE | html %]</td>
+  <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
   </tr>
   [% END %] 
 </tbody>
@@ -318,9 +320,9 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 <tbody>
     [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
 <tr>
-  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch %]&amp;calendardate=[% HOLIDAYS_LOO.DATE %]"><span title="[% HOLIDAYS_LOO.DATE_SORT %]">[% HOLIDAYS_LOO.DATE %]</span></a></td>
-  <td>[% HOLIDAYS_LOO.TITLE |html %]</td>
-  <td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') |html %]</td>
+  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&amp;calendardate=[% HOLIDAYS_LOO.DATE | uri %]"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.DATE | html %]</span></a></td>
+  <td>[% HOLIDAYS_LOO.TITLE | html %]</td>
+  <td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') | html %]</td>
 </tr>
   [% END %] 
 </tbody>
@@ -329,19 +331,22 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 </div>
 </div>
 </div>
-</div>
-</div>
 
-<div class="yui-b noprint">
-[% INCLUDE 'tools-menu.inc' %]
-</div>
-</div>
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+                [% INCLUDE 'tools-menu.inc' %]
+            </aside>
+        </div> <!-- .col-sm-2.col-sm-pull-10 -->
+     </div> <!-- /.row -->
 
 [% MACRO jsinclude BLOCK %]
     [% INCLUDE 'calendar.inc' %]
     [% INCLUDE 'datatables.inc' %]
-    <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu_[% KOHA_VERSION %].js"></script>
-    <script type="text/javascript">
+    [% Asset.js("js/tools-menu.js") | $raw %]
+    <script>
         var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays"));
 
         /* Creates all the structures to deal with all different kinds of holidays */
@@ -350,19 +355,19 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
         var holidates = new Array();
         var exception_holidays = new Array();
         var day_month_holidays = new Array();
-        var hola= "[% code %]";
+        var hola= "[% code | html %]";
         [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
-        week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"};
+        week_days["[% WEEK_DAYS_LOO.KEY | html %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
         [% END %]
         [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
-        holidates.push("[% HOLIDAYS_LOO.KEY %]");
-        holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"};
+        holidates.push("[% HOLIDAYS_LOO.KEY | html %]");
+        holidays["[% HOLIDAYS_LOO.KEY | html %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
         [% END %]
         [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
-        exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"};
+        exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY | html %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
         [% END %]
         [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
-        day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') |html %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') |html %]"};
+        day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY | html %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
         [% END %]
 
         function holidayOperation(formObject, opType) {
@@ -434,7 +439,7 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
 
         function changeBranch () {
             var branch = $("#branch option:selected").val();
-            location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]";
+            location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate | html %]";
         }
 
         function Help() {
@@ -510,22 +515,45 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
             $("a.helptext").click(function(){
                 $(this).parent().find(".hint").toggle(); return false;
             });
-            $("#dateofrange").datepicker();
+            $("#dateofrange").datepicker({
+                beforeShow: function() {
+                    var startdate = $("#jcalendar-container").datepicker("getDate");
+                    if (startdate !== null) {
+                        var sd = new Date(startdate);
+                        var ed = new Date($(this).datepicker("getDate"));
+                        if (ed < sd) {
+                            $(this).datepicker("setDate", startdate);
+                            $(this).datepicker("option", "defaultDate", startdate);
+                        }
+                    }
+                }
+            });
             $("#datecancelrange").datepicker();
             $("#dateofrange").each(function () { this.value = "" });
             $("#datecancelrange").each(function () { this.value = "" });
             $("#jcalendar-container").datepicker({
-              beforeShowDay: function(thedate) {
-                var day = thedate.getDate();
-                var month = thedate.getMonth() + 1;
-                var year = thedate.getFullYear();
-                var dateString = year + '/' + month + '/' + day;
-                return dateStatusHandler(dateString);
+                beforeShowDay: function(thedate) {
+                    var day = thedate.getDate();
+                    var month = thedate.getMonth() + 1;
+                    var year = thedate.getFullYear();
+                    var dateString = year + '/' + month + '/' + day;
+                    return dateStatusHandler(dateString);
+                },
+                onSelect: function(dateText, inst) {
+                    dateChanged($(this).datepicker("getDate"));
+                    var enddate = $("#dateofrange").datepicker("getDate");
+                    $("#dateofrange").datepicker("option", "defaultDate", $(this).datepicker("getDate"));
+                    $("#dateofrange").datepicker( "option", "minDate", $(this).datepicker("getDate")); //ensure end date can't be before start date
+                    if (enddate !== null) {
+                        var ed = new Date(enddate);
+                        var sd = new Date($(this).datepicker("getDate"));
+                        if (ed < sd) {
+                            $("#dateofrange").datepicker("setDate", $(this).datepicker("getDate"));
+                            $("#dateofrange").datepicker("option", "defaultDate", enddate);
+                        }
+                    }
                 },
-            onSelect: function(dateText, inst) {
-                dateChanged($(this).datepicker("getDate"));
-            },
-            defaultDate: new Date("[% keydate %]")
+                defaultDate: new Date("[% keydate | html %]")
             });
             $(".hidePanel").on("click",function(){
                 if( $(this).hasClass("showHoliday") ){