Bug 18689: calendar error with double quotes in title or description of holiday
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / holidays.tt
1 [% USE Branches %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Tools &rsaquo; [% Branches.GetName( branch ) %] calendar</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'calendar.inc' %]
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript">
9 //<![CDATA[
10     var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays"));
11
12     /* Creates all the structures to deal with all different kinds of holidays */
13     var week_days = new Array();
14     var holidays = new Array();
15     var holidates = new Array();
16     var exception_holidays = new Array();
17     var day_month_holidays = new Array();
18     var hola= "[% code %]";
19     [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
20     week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
21     [% END %]
22     [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
23     holidates.push("[% HOLIDAYS_LOO.KEY %]");
24     holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
25     [% END %]
26     [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
27     exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
28     [% END %]
29     [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
30     day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
31     [% END %]
32
33     function holidayOperation(formObject, opType) {
34         var op = document.getElementsByName('operation');
35         op[0].value = opType;
36         formObject.submit();
37     }
38
39     // This function shows the "Show Holiday" panel //
40     function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) {
41         $("#newHoliday").slideUp("fast");
42         $("#showHoliday").slideDown("fast");
43         $('#showDaynameOutput').html(dayName);
44         $('#showDayname').val(dayName);
45         $('#showBranchNameOutput').html($("#branch :selected").text());
46         $('#showBranchName').val($("#branch").val());
47         $('#showDayOutput').html(day);
48         $('#showDay').val(day);
49         $('#showMonthOutput').html(month);
50         $('#showMonth').val(month);
51         $('#showYearOutput').html(year);
52         $('#showYear').val(year);
53         $('#showDescription').val(description);
54         $('#showWeekday:first').val(weekDay);
55         $('#showTitle').val(title);
56         $('#showHolidayType').val(holidayType);
57
58         if (holidayType == 'exception') {
59             $("#showOperationDelLabel").html(_("Delete this exception."));
60             $("#holtype").attr("class","key exception").html(_("Holiday exception"));
61         } else if(holidayType == 'weekday') {
62             $("#showOperationDelLabel").html(_("Delete this holiday."));
63             $("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly"));
64         } else if(holidayType == 'daymonth') {
65             $("#showOperationDelLabel").html(_("Delete this holiday."));
66             $("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly"));
67         } else {
68             $("#showOperationDelLabel").html(_("Delete this holiday."));
69             $("#holtype").attr("class","key holiday").html(_("Unique holiday"));
70         }
71         
72         if (exceptionPosibility == 1) {
73             $("#exceptionPosibility").parent().show();
74         } else {
75             $("#exceptionPosibility").parent().hide();
76         }
77     }
78
79     // This function shows the "Add Holiday" panel //
80     function newHoliday (dayName, day, month, year, weekDay) {
81         $("#showHoliday").slideUp("fast");
82         $("#newHoliday").slideDown("fast");
83         $("#newDaynameOutput").html(dayName);
84         $("#newDayname").val(dayName);
85         $("#newBranchNameOutput").html($('#branch :selected').text());
86         $("#newBranchName").val($('#branch').val());
87         $("#newDayOutput").html(day);
88         $("#newDay").val(day);
89         $("#newMonthOutput").html(month);
90         $("#newMonth").val(month);
91         $("#newYearOutput").html(year);
92         $("#newYear").val(year);
93         $("#newWeekday:first").val(weekDay);
94     }
95
96     function hidePanel(aPanelName) {
97         $("#"+aPanelName).slideUp("fast");
98     }
99
100     function changeBranch () {
101         var branch = $("#branch option:selected").val();
102         location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]";
103     }
104
105     function Help() {
106         newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
107     }
108
109     /* This function gives css clases to each kind of day */
110     function dateStatusHandler(date) {
111         date = new Date(date);
112         var day = date.getDate();
113         var month = date.getMonth() + 1;
114         var year = date.getFullYear();
115         var weekDay = date.getDay();
116         var dayMonth = month + '/' + day;
117         var dateString = year + '/' + month + '/' + day;
118         if (exception_holidays[dateString] != null) {
119             return [true, "exception", _("Exception: %s").format(exception_holidays[dateString].title)];
120         } else if ( week_days[weekDay] != null ){
121             return [true, "repeatableweekly", _("Weekly holiday: %s").format(week_days[weekDay].title)];
122         } else if ( day_month_holidays[dayMonth] != null ) {
123             return [true, "repeatableyearly", _("Yearly holiday: %s").format(day_month_holidays[dayMonth].title)];
124         } else if (holidays[dateString] != null) {
125             return [true, "holiday", _("Single holiday: %s").format(holidays[dateString].title)];
126         } else {
127             return [true, "normalday", _("Normal day")];
128         }
129     }
130
131     /* This function is in charge of showing the correct panel considering the kind of holiday */
132     function dateChanged(calendar) {
133         calendar = new Date(calendar);
134         var day = calendar.getDate();
135         var month = calendar.getMonth() + 1;
136         var year = calendar.getFullYear();
137         var weekDay = calendar.getDay();
138         var dayName = weekdays[weekDay];
139         var dayMonth = month + '/' + day;
140         var dateString = year + '/' + month + '/' + day;
141             if (holidays[dateString] != null) {
142                 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title,     holidays[dateString].description, 'ymd');
143             } else if (exception_holidays[dateString] != null) {
144                 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
145             } else if (week_days[weekDay] != null) {
146                 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title,     week_days[weekDay].description, 'weekday');
147             } else if (day_month_holidays[dayMonth] != null) {
148                 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
149             } else {
150                 newHoliday(dayName, day, month, year, weekDay);
151             }
152     };
153
154     $(document).ready(function() {
155
156         $(".hint").hide();
157         $("#branch").change(function(){
158             changeBranch();
159         });
160         $("#holidayweeklyrepeatable>tbody>tr").each(function(){
161             var first_td = $(this).find('td').first();
162             first_td.html(weekdays[first_td.html()]);
163         });
164         $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, {
165             "sDom": 't',
166             "bPaginate": false
167         }));
168         $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, {
169             "sDom": 't',
170             "aoColumns": [
171                 { "sType": "title-string" },null,null
172             ],
173             "bPaginate": false
174         }));
175         $("a.helptext").click(function(){
176             $(this).parent().find(".hint").toggle(); return false;
177         });
178         $("#dateofrange").datepicker();
179         $("#datecancelrange").datepicker();
180         $("#dateofrange").each(function () { this.value = "" });
181         $("#datecancelrange").each(function () { this.value = "" });
182         $("#jcalendar-container").datepicker({
183           beforeShowDay: function(thedate) {
184             var day = thedate.getDate();
185             var month = thedate.getMonth() + 1;
186             var year = thedate.getFullYear();
187             var dateString = year + '/' + month + '/' + day;
188             return dateStatusHandler(dateString);
189             },
190         onSelect: function(dateText, inst) {
191             dateChanged($(this).datepicker("getDate"));
192         },
193         defaultDate: new Date("[% keydate %]")
194         });
195         $(".hidePanel").on("click",function(){
196             if( $(this).hasClass("showHoliday") ){
197                 hidePanel("showHoliday");
198             } else {
199                 hidePanel("newHoliday");
200             }
201         })
202     });
203 //]]>
204 </script>
205 <style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; }
206 .ui-datepicker { font-size : 150%; }
207 .ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; }
208 .ui-datepicker td a { padding : .5em; }
209 .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { font-size : 80%; }
210 .key { padding : 3px; white-space:nowrap; line-height:230%; }
211 .normalday { background-color :  #EDEDED; color :  Black; border : 1px solid #BCBCBC; }
212 .exception { background-color :  #b3d4ff; color :  Black; border : 1px solid #BCBCBC; }
213 .holiday {  background-color :  #ffaeae; color :  Black;  border : 1px solid #BCBCBC; }
214 .repeatableweekly {  background-color :  #FFFF99; color :  Black;  border : 1px solid #BCBCBC; }
215 .repeatableyearly {  background-color :  #FFCC66; color :  Black;  border : 1px solid #BCBCBC; }
216 td.exception a.ui-state-default { background:  #b3d4ff none; color :  Black; border : 1px solid #BCBCBC; }
217 td.holiday a.ui-state-default {  background:  #ffaeae none; color :  Black;  border : 1px solid #BCBCBC; }
218 td.repeatableweekly a.ui-state-default {  background:  #FFFF99 none; color :  Black;  border : 1px solid #BCBCBC; }
219 td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Black;  border : 1px solid #BCBCBC; }
220 .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; }
221 .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; }
222 #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; }
223 </style>
224 </head>
225 <body id="tools_holidays" class="tools">
226 [% INCLUDE 'header.inc' %]
227 [% INCLUDE 'cat-search.inc' %]
228
229 <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>
230
231 <div id="doc3" class="yui-t1">
232    
233    <div id="bd">
234     <div id="yui-main">
235     <div class="yui-b">
236     <h2>[% Branches.GetName( branch ) %] calendar</h2>
237     <div class="yui-g">
238     <div class="yui-u first">
239         <label for="branch">Define the holidays for:</label>
240             <select id="branch" name="branch">
241                 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
242             </select>
243     
244     <!-- ******************************** FLAT PANELS ******************************************* -->
245     <!-- *****           Makes all the flat panel to deal with holidays                     ***** -->
246     <!-- **************************************************************************************** -->
247
248     <!-- ********************** Panel for showing already loaded holidays *********************** -->
249     <div class="panel" id="showHoliday">
250          <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
251              <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
252             <fieldset class="brief">
253             <h3>Edit this holiday</h3>
254             <span id="holtype"></span>
255             <ol>
256             <li>
257                 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
258                 <input type="hidden" id="showBranchName" name="showBranchName" />
259             </li>
260             <li>
261                 <strong>From date:</strong>
262                 <span id="showDaynameOutput"></span>, 
263                 
264                                 [% IF ( dateformat == "us" ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "metric") %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "dmydot") %]<span id="showDayOutput"></span>.<span id="showMonthOutput"></span>.<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %]
265
266                 <input type="hidden" id="showDayname" name="showDayname" />
267                 <input type="hidden" id="showWeekday" name="showWeekday" />
268                 <input type="hidden" id="showDay" name="showDay" />
269                 <input type="hidden" id="showMonth" name="showMonth" />
270                 <input type="hidden" id="showYear" name="showYear" />
271             </li>
272             <li class="dateinsert">
273                 <b>To Date : </b>
274                 <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange %]" class="datepicker"/>
275             </li>
276             <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
277             <!-- showTitle is necessary for exception radio button to work properly -->
278             <li>
279                 <label for="showDescription">Description:</label>
280                 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
281             </li>
282             <li class="radio"><div id="exceptionPosibility" style="position:static">
283                 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
284                 <a href="#" class="helptext">[?]</a>
285                 <div class="hint">You can make an exception for this holiday rule. This means that you will be able to say that for a repeatable holiday there is one day which is going to be an exception.</div>
286             </div></li>
287             <li class="radio"><input type="radio" name="showOperation" id="showOperationExcRange" value="exceptionrange" />
288                 <label for="showOperationExcRange">Generate exceptions on a range of dates.</label>
289                 <a href="#" class="helptext">[?]</a>
290                 <div class="hint">You can make an exception on a range of dates repeated yearly.</div>
291             </li>
292             <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
293                 <a href="#" class="helptext">[?]</a>
294                 <div class="hint">This will delete this holiday rule. If it is a repeatable holiday, this option checks for possible exceptions. If an exception exists, this option will remove the exception and set the date to a regular holiday.</div></li>
295             <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRange" value="deleterange" /> <label for="showOperationDelRange" id="showOperationDelLabelRange">Delete the single holidays on a range</label>.
296                 <a href="#" class="helptext">[?]</a>
297                 <div class="hint">This will delete the single holidays rules only. The repeatable holidays and exceptions will not be deleted.</div>
298             </li>
299             <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRangeRepeat" value="deleterangerepeat" /> <label for="showOperationDelRangeRepeat" id="showOperationDelLabelRangeRepeat">Delete the repeated holidays on a range</label>.
300                 <a href="#" class="helptext">[?]</a>
301                 <div class="hint">This will delete the repeated holidays rules only. The repeatable holidays will be deleted but not the exceptions.</div>
302             </li>
303             <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRangeRepeatExcept" value="deleterangerepeatexcept" /> <label for="showOperationDelRangeRepeatExcept" id="showOperationDelLabelRangeRepeatExcept">Delete the exceptions on a range</label>.
304                 <a href="#" class="helptext">[?]</a>
305                 <div class="hint">This will delete the exceptions inside a given range. Be careful about your scope range; if it is oversized you could slow down Koha.</div>
306             </li>
307             <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
308                 <a href="#" class="helptext">[?]</a>
309                 <div class="hint">This will save changes to the holiday's title and description. If the information for a repeatable holiday is modified, it affects all of the dates on which the holiday is repeated.</div></li>
310             </ol>
311             <fieldset class="action">
312                 <input type="submit" name="submit" value="Save" />
313                 <a href="#" class="cancel hidePanel showHoliday">Cancel</a>
314             </fieldset>
315             </fieldset>
316         </form>
317     </div>
318
319     <!-- ***************************** Panel to deal with new holidays **********************  -->
320     <div class="panel" id="newHoliday">
321          <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
322             <fieldset class="brief">
323             <h3>Add new holiday</h3>
324             <ol>
325             <li>
326                 <strong>Library:</strong>
327                 <span id="newBranchNameOutput"></span>
328                 <input type="hidden" id="newBranchName" name="newBranchName" />
329             </li>
330             <li>
331                 <strong>From date:</strong>
332                 <span id="newDaynameOutput"></span>, 
333
334                          [% 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>[% ELSIF ( dateformat == "dmydot" ) %]<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 %]
335
336                 <input type="hidden" id="newDayname" name="showDayname" />
337                 <input type="hidden" id="newWeekday" name="newWeekday" />
338                 <input type="hidden" id="newDay" name="newDay" />
339                 <input type="hidden" id="newMonth" name="newMonth" />
340                 <input type="hidden" id="newYear" name="newYear" />
341             </li>
342             <li class="dateinsert">
343                 <b>To date: </b>
344                 <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" class="datepicker" />
345             </li>
346             <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
347             <li><label for="newDescription">Description:</label>
348                 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
349             </li>
350             <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
351             <label for="newOperationOnce">Holiday only on this day</label>.
352             <a href="#" class="helptext">[?]</a>
353             <div class="hint">Make a single holiday. For example, selecting August 1, 2012 will make it a holiday, but will not affect August 1 in other years.</div>
354             </li>
355             <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
356                             <label for="newOperationDay">Holiday repeated every same day of the week</label>.
357                             <a href="#" class="helptext">[?]</a>
358                             <div class="hint">Make this weekday a holiday, every week. For example, if your library is closed on Saturdays, use this option to make every Saturday a holiday.</div>
359                             </li>
360             <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
361                             <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
362                             <a href="#" class="helptext">[?]</a>
363                             <div class="hint">This will take this day and month as a reference to make it a holiday. Through this option, you can repeat this rule for every year. For example, selecting August 1 will make August 1 a holiday every year.</div>
364                             </li>
365             <li class="radio"><input type="radio" name="newOperation" id="newOperationField" value="holidayrange" />
366                             <label for="newOperationField">Holidays on a range</label>.
367                             <a href="#" class="helptext">[?]</a>
368                             <div class="hint">Make a single holiday on a range. For example, selecting August 1, 2012  and August 10, 2012 will make all days between August 1 and 10 a holiday, but will not affect August 1-10 in other years.</div>
369                             </li>
370             <li class="radio"><input type="radio" name="newOperation" id="newOperationFieldyear" value="holidayrangerepeat" />
371                             <label for="newOperationFieldyear">Holidays repeated yearly on a range</label>.
372                             <a href="#" class="helptext">[?]</a>
373                             <div class="hint">Make a single holiday on a range repeated yearly. For example, selecting August 1, 2012  and August 10, 2012 will make all days between August 1 and 10 a holiday, and will affect August 1-10 in other years.</div>
374                             </li>
375                 <li class="checkbox">
376                 <input type="checkbox" name="allBranches" id="allBranches" />
377                 <label for="allBranches">Copy to all libraries</label>.
378                 <a href="#" class="helptext">[?]</a>
379                 <div class="hint">If checked, this holiday will be copied to all libraries. If the holiday already exists for a library, no change is made.</div>
380                 </li></ol>
381                 <fieldset class="action">
382                     <input type="submit" name="submit" value="Save" />
383                     <a href="#" class="cancel hidePanel newHoliday">Cancel</a>
384                 </fieldset>
385                 </fieldset>
386          </form>
387     </div>
388
389     <!-- *************************************************************************************** -->
390     <!-- ******                          END OF FLAT PANELS                               ****** -->
391     <!-- *************************************************************************************** -->
392
393 <!-- ************************************************************************************** -->
394 <!-- ******                              MAIN SCREEN CODE                            ****** -->
395 <!-- ************************************************************************************** -->
396 <h3>Calendar information</h3>
397 <div id="jcalendar-container"></div>
398
399 <div style="margin-top: 2em;">
400 <form action="copy-holidays.pl" method="post">
401     <input type="hidden" name="from_branchcode" value="[% branch %]" />
402   <label for="branchcode">Copy holidays to:</label>
403   <select id="branchcode" name="branchcode">
404     <option value=""></option>
405     [% FOREACH l IN Branches.all() %]
406     <option value="[% l.branchcode %]">[% l.branchname %]</option>
407     [% END %]
408   </select>
409     <input type="submit" value="Copy" />
410 </form>
411 </div>
412
413 </div>
414 <div class="yui-u">
415 <div class="help">
416 <h4>Hints</h4>
417     <ul>
418         <li>Search in the calendar the day you want to set as holiday.</li>
419         <li>Click the date to add or edit a holiday.</li>
420         <li>Enter a title and description for the holiday.</li>
421         <li>Specify how the holiday should repeat.</li>
422         <li>Click Save to finish.</li>
423     </ul>
424 <h4>Key</h4>
425     <p>
426         <span class="key normalday">Working day</span>
427         <span class="key holiday">Unique holiday</span>
428         <span class="key repeatableweekly">Holiday repeating weekly</span>
429         <span class="key repeatableyearly">Holiday repeating yearly</span>
430         <span class="key exception">Holiday exception</span>
431     </p>
432 </div>
433 <div id="holiday-list">
434 <!-- Exceptions First -->
435 <!--   this will probably always have the least amount of data -->
436 [% IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
437 <h3>Exceptions</h3>
438   <table id="holidayexceptions">
439 <thead><tr>
440   <th class="exception">Date</th>
441   <th class="exception">Title</th>
442   <th class="exception">Description</th>
443 </tr>
444 </thead>
445 <tbody>
446   [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
447   <tr>
448   <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>
449   <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE %]</td>
450   <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION %]</td> 
451   </tr>
452   [% END %] 
453 </tbody>
454 </table>
455 [% END %]
456
457 [% IF ( WEEK_DAYS_LOOP ) %]
458 <h3>Weekly - Repeatable holidays</h3>
459 <table id="holidayweeklyrepeatable">
460 <thead>
461 <tr>
462   <th class="repeatableweekly">Day of week</th>
463   <th class="repeatableweekly">Title</th>
464   <th class="repeatableweekly">Description</th>
465 </tr>
466 </thead>
467 <tbody>
468   [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
469   <tr>
470   <td>[% WEEK_DAYS_LOO.KEY %]</td>
471   </td> 
472   <td>[% WEEK_DAYS_LOO.TITLE %]</td> 
473   <td>[% WEEK_DAYS_LOO.DESCRIPTION %]</td> 
474   </tr>
475   [% END %] 
476 </tbody>
477 </table>
478 [% END %]
479
480 [% IF ( DAY_MONTH_HOLIDAYS_LOOP ) %]
481 <h3>Yearly - Repeatable holidays</h3>
482 <table id="holidaysyearlyrepeatable">
483 <thead>
484 <tr>
485   [% IF ( dateformat == "metric" ) %]
486   <th class="repeatableyearly">Day/month</th>
487   [% ELSE %]
488   <th class="repeatableyearly">Month/day</th>
489   [% END %]
490   <th class="repeatableyearly">Title</th>
491   <th class="repeatableyearly">Description</th>
492 </tr>
493 </thead>
494 <tbody>
495   [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
496   <tr>
497   <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[% DAY_MONTH_HOLIDAYS_LOO.DATE %]</span></td>
498   <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE %]</td> 
499   <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION %]</td> 
500   </tr>
501   [% END %] 
502 </tbody>
503 </table>
504 [% END %]
505
506 [% IF ( HOLIDAYS_LOOP ) %]
507 <h3>Unique holidays</h3>
508 <table id="holidaysunique">
509 <thead>
510 <tr>
511   <th class="holiday">Date</th>
512   <th class="holiday">Title</th>
513   <th class="holiday">Description</th>
514 </tr>
515 </thead>
516 <tbody>
517     [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
518 <tr>
519   <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>
520   <td>[% HOLIDAYS_LOO.TITLE %]</td>
521   <td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') %]</td>
522 </tr>
523   [% END %] 
524 </tbody>
525 </table>
526 [% END %]
527 </div>
528 </div>
529 </div>
530 </div>
531 </div>
532
533 <div class="yui-b noprint">
534 [% INCLUDE 'tools-menu.inc' %]
535 </div>
536 </div>
537 [% INCLUDE 'intranet-bottom.inc' %]