Bug 7833 - unique holiday link broken
[koha_gimpoz] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / holidays.tt
index 19b2309..6e50425 100644 (file)
                newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
        }
        $(document).ready(function() {
+
+[% IF ( dateformat_metric ) %]         $.tablesorter.addParser({ // http://tablesorter.com/docs/example-parsers.html
+                       id: 'shortDates',
+                       is: function(s){
+                               return false;
+                       },
+                       format: function(s){
+                               var datepattern = new RegExp("[0-9]\/[0-9]");
+                               if( datepattern.test(s)){ // sorting a date without a year: "01/12"
+                                       var dateparts = s.split("/").reverse().join("-"); // build an ISO date to be sorted as text
+                                       s = "2000-" + dateparts; // use 2000 as the default year
+                               }
+                               return s;
+                       },
+                       type: 'text'
+               });
+[% END %]
                $(".hint").hide();
                $("#branch").change(function(){
                        changeBranch();
                });
-               $("#holidayexceptions").tablesorter({
+               $("#holidayexceptions").tablesorter({[% IF ( dateformat_metric ) %]
+                 dateFormat: 'uk',[% END %]
                  sortList: [[0,0]], widgets: ['zebra']
                });
-               $("#holidayweeklyrepeatable").tablesorter({
+               $("#holidayweeklyrepeatable").tablesorter({[% IF ( dateformat_metric ) %]
+                 dateFormat: 'uk',[% END %]
                  sortList: [[0,0]], widgets: ['zebra']
                });
-               $("#holidaysyearlyrepeatable").tablesorter({
-                 sortList: [[0,0]], widgets: ['zebra']
+               $("#holidaysyearlyrepeatable").tablesorter({[% IF ( dateformat_metric ) %]
+                       headers : {
+                               0: {
+                                       sorter : 'shortDates'
+                               }
+                       },[% END %]
+                       sortList: [[0,0]], widgets: ['zebra']
                });
-               $("#holidaysunique").tablesorter({
+               $("#holidaysunique").tablesorter({[% IF ( dateformat_metric ) %]
+                 dateFormat: 'uk',[% END %]
                  sortList: [[0,0]], widgets: ['zebra']
                });
                $("a.helptext").click(function(){
 #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; }
 </style>
 </head>
-<body>
+<body id="tools_holidays" class="tools">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
                                <input type="hidden" id="newBranchName" name="newBranchName" />
                        </li>
                        <li>
-                               <strong>From Date:</strong>
+                <strong>From date:</strong>
                                <span id="newDaynameOutput"></span>, 
 
                                [% IF ( dateformat_us ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat_metric ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %]
                                <input type="hidden" id="newYear" name="newYear" />
                        </li>
                        <li class="dateinsert">
-                               <b>To Date : </b>
+                <b>To date : </b>
                                <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" />
-                               <img src="[% themelang %]/lib/calendar/cal.gif" id="dateofrange_button" alt="Show Calendar" />
+                <img src="[% themelang %]/lib/calendar/cal.gif" id="dateofrange_button" alt="Show calendar" />
                                <script language="JavaScript" type="text/javascript">
                                Calendar.setup(
                                        {
 
 
 </div>
+
+<div style="margin-top: 2em;">
+<form action="copy-holidays.pl" method="post">
+       <input type="hidden" name="from_branchcode" value="[% branch %]" />
+  <label for="branchcode">Copy holidays to:</label>
+  <select id="branchcode" name="branchcode">
+    <option value=""></option>
+    [% FOREACH branchloo IN branchloop %]
+    <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
+    [% END %]
+  </select>
+       <input type="submit" value="Copy" />
+</form>
+</div>
+
 </div>
 <div class="yui-u">
 <div class="help">
 <tbody>
   [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
   <tr>
-  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% EXCEPTION_HOLIDAYS_LOO.branch %]&amp;calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE %]">[% EXCEPTION_HOLIDAYS_LOO.DATE %]</a></td>
+  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch %]&amp;calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE %]">[% EXCEPTION_HOLIDAYS_LOO.DATE %]</a></td>
   <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE %]</td>
   <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION %]</td> 
   </tr>
 <table id="holidayweeklyrepeatable">
 <thead>
 <tr>
-  <th class="repeatableweekly">Day of Week</th>
+  <th class="repeatableweekly">Day of week</th>
   <th class="repeatableweekly">Title</th>
   <th class="repeatableweekly">Description</th>
 </tr>
 <table id="holidaysyearlyrepeatable">
 <thead>
 <tr>
-  [% IF ( dateformat == 'metric' ) %]
+  [% IF ( dateformat_metric ) %]
   <th class="repeatableyearly">Day/Month</th>
   [% ELSE %]
   <th class="repeatableyearly">Month/Day</th>
 <tbody>
     [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
 <tr>
-  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% HOLIDAYS_LOO.branch %]&amp;calendardate=[% HOLIDAYS_LOO.DATE %]">[% HOLIDAYS_LOO.DATE %]</a></td>
+  <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch %]&amp;calendardate=[% HOLIDAYS_LOO.DATE %]">[% HOLIDAYS_LOO.DATE %]</a></td>
   <td>[% HOLIDAYS_LOO.TITLE %]</td>
   <td>[% HOLIDAYS_LOO.DESCRIPTION %]</td>
 </tr>