1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Tools › [% branchname %] Calendar</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'calendar.inc' %]
5 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6 <script language="JavaScript" type="text/javascript">
9 var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays"));
11 function holidayOperation(formObject, opType) {
12 var op = document.getElementsByName('operation');
17 // This function shows the "Show Holiday" panel //
18 function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) {
19 $("#newHoliday").slideUp("fast");
20 $("#showHoliday").slideDown("fast");
21 $('#showDaynameOutput').html(dayName);
22 $('#showDayname').val(dayName);
23 $('#showBranchNameOutput').html($("#branch :selected").text());
24 $('#showBranchName').val($("#branch").val());
25 $('#showDayOutput').html(day);
26 $('#showDay').val(day);
27 $('#showMonthOutput').html(month);
28 $('#showMonth').val(month);
29 $('#showYearOutput').html(year);
30 $('#showYear').val(year);
31 $('#showDescription').val(description);
32 $('#showWeekday:first').val(weekDay);
33 $('#showTitle').val(title);
34 $('#showHolidayType').val(holidayType);
36 if (holidayType == 'exception') {
37 $("#showOperationDelLabel").html(_('Delete this exception.'));
38 $("#holtype").attr("class","key exception").html(_("Holiday exception"));
39 } else if(holidayType == 'weekday') {
40 $("#showOperationDelLabel").html(_('Delete this holiday.'));
41 $("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly"));
42 } else if(holidayType == 'daymonth') {
43 $("#showOperationDelLabel").html(_('Delete this holiday.'));
44 $("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly"));
46 $("#showOperationDelLabel").html(_('Delete this holiday.'));
47 $("#holtype").attr("class","key holiday").html(_("Unique holiday"));
50 if (exceptionPosibility == 1) {
51 $("#exceptionPosibility").parent().show();
53 $("#exceptionPosibility").parent().hide();
57 // This function shows the "Add Holiday" panel //
58 function newHoliday (dayName, day, month, year, weekDay) {
59 $("#showHoliday").slideUp("fast");
60 $("#newHoliday").slideDown("fast");
61 $("#newDaynameOutput").html(dayName);
62 $("#newDayname").val(dayName);
63 $("#newBranchNameOutput").html($('#branch :selected').text());
64 $("#newBranchName").val($('#branch').val());
65 $("#newDayOutput").html(day);
66 $("#newDay").val(day);
67 $("#newMonthOutput").html(month);
68 $("#newMonth").val(month);
69 $("#newYearOutput").html(year);
70 $("#newYear").val(year);
71 $("#newWeekday:first").val(weekDay);
74 function hidePanel(aPanelName) {
75 $("#"+aPanelName).slideUp("fast");
78 function changeBranch () {
79 var branch = $("#branch option:selected").val();
80 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]";
84 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
86 $(document).ready(function() {
88 [% IF ( dateformat_metric ) %] $.tablesorter.addParser({ // http://tablesorter.com/docs/example-parsers.html
94 var datepattern = new RegExp("[0-9]\/[0-9]");
95 if( datepattern.test(s)){ // sorting a date without a year: "01/12"
96 var dateparts = s.split("/").reverse().join("-"); // build an ISO date to be sorted as text
97 s = "2000-" + dateparts; // use 2000 as the default year
105 $("#branch").change(function(){
108 $("#holidayexceptions").tablesorter({[% IF ( dateformat_metric ) %]
109 dateFormat: 'uk',[% END %]
110 sortList: [[0,0]], widgets: ['zebra']
112 $("#holidayweeklyrepeatable").tablesorter({[% IF ( dateformat_metric ) %]
113 dateFormat: 'uk',[% END %]
114 sortList: [[0,0]], widgets: ['zebra']
116 $("#holidaysyearlyrepeatable").tablesorter({[% IF ( dateformat_metric ) %]
119 sorter : 'shortDates'
122 sortList: [[0,0]], widgets: ['zebra']
124 $("#holidaysunique").tablesorter({[% IF ( dateformat_metric ) %]
125 dateFormat: 'uk',[% END %]
126 sortList: [[0,0]], widgets: ['zebra']
128 $("a.helptext").click(function(){
129 $(this).parent().find(".hint").toggle(); return false;
131 $("#dateofrange").each(function () { this.value = "" });
135 <style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; }
136 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; }
137 .exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; }
138 .holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; }
139 .repeatableweekly { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; }
140 .repeatableyearly { background-color : #FFCC66; color : Black; border : 1px solid #BCBCBC; }
141 .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; }
142 .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; }
143 #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; }
146 <body id="tools_holidays" class="tools">
147 [% INCLUDE 'header.inc' %]
148 [% INCLUDE 'cat-search.inc' %]
150 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% branchname %] Calendar</div>
152 <div id="doc3" class="yui-t1">
157 <h2>[% branchname %] Calendar</h2>
159 <div class="yui-u first">
160 <label for="branch">Define the holidays for:</label>
161 <select id="branch" name="branch">
162 [% FOREACH branchloo IN branchloop %]
163 [% IF ( branchloo.selected ) %]
164 <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
166 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
171 <!-- ******************************** FLAT PANELS ******************************************* -->
172 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
173 <!-- **************************************************************************************** -->
175 <!-- ********************** Panel for showing already loaded holidays *********************** -->
176 <div class="panel" id="showHoliday">
177 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
178 <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
179 <fieldset class="brief">
180 <h3>Edit this holiday</h3>
181 <span id="holtype"></span>
184 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
185 <input type="hidden" id="showBranchName" name="showBranchName" />
188 <strong>Date:</strong>
189 <span id="showDaynameOutput"></span>,
191 [% 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>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %]
193 <input type="hidden" id="showDayname" name="showDayname" />
194 <input type="hidden" id="showWeekday" name="showWeekday" />
195 <input type="hidden" id="showDay" name="showDay" />
196 <input type="hidden" id="showMonth" name="showMonth" />
197 <input type="hidden" id="showYear" name="showYear" />
199 <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
200 <!-- showTitle is necessary for exception radio button to work properly -->
201 <label for="showDescription">Description:</label>
202 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
204 <li class="radio"><div id="exceptionPosibility" style="position:static">
205 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
206 <a href="#" class="helptext">[?]</a>
207 <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>
209 <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
210 <a href="#" class="helptext">[?]</a>
211 <div class="hint">This will delete this holiday rule. If it is a repeatable holiday, this option checks for posible exceptions. If an exception exists, this option will remove the exception and set the date to a regular holiday.</div></li>
212 <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
213 <a href="#" class="helptext">[?]</a>
214 <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>
217 <fieldset class="action">
218 <input type="submit" name="submit" value="Save" />
219 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('showHoliday');">Cancel</a>
225 <!-- ***************************** Panel to deal with new holidays ********************** -->
226 <div class="panel" id="newHoliday">
227 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
228 <input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" />
229 <fieldset class="brief">
230 <h3>Add new holiday</h3>
233 <strong>Library:</strong>
234 <span id="newBranchNameOutput"></span>
235 <input type="hidden" id="newBranchName" name="newBranchName" />
238 <strong>From date:</strong>
239 <span id="newDaynameOutput"></span>,
241 [% 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 %]
243 <input type="hidden" id="newDayname" name="showDayname" />
244 <input type="hidden" id="newWeekday" name="newWeekday" />
245 <input type="hidden" id="newDay" name="newDay" />
246 <input type="hidden" id="newMonth" name="newMonth" />
247 <input type="hidden" id="newYear" name="newYear" />
249 <li class="dateinsert">
251 <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" />
252 <img src="[% themelang %]/lib/calendar/cal.gif" id="dateofrange_button" alt="Show calendar" />
253 <script language="JavaScript" type="text/javascript">
256 inputField : "dateofrange",
257 ifFormat : "[% DHTMLcalendar_dateformat %]",
258 button : "dateofrange_button"
263 <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
264 <li><label for="newDescription">Description:</label>
265 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
267 <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
268 <label for="newOperationOnce">Holiday only on this day</label>.
269 <a href="#" class="helptext">[?]</a>
270 <div class="hint">Make a single holiday. For example, selecting August 1st, 2012 will make it a holiday, but will not affect August 1st in other years.</div>
272 <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
273 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
274 <a href="#" class="helptext">[?]</a>
275 <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>
277 <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
278 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
279 <a href="#" class="helptext">[?]</a>
280 <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 1st will make August 1st a holiday every year.</div>
282 <li class="radio"><input type="radio" name="newOperation" id="newOperationField" value="holidayrange" />
283 <label for="newOperationField">Holidays on a range</label>.
284 <a href="#" class="helptext">[?]</a>
285 <div class="hint">Make a single holiday on a range. For example, selecting August 1st, 2012 and August 10st, 2012 will make all days between 1st and 10st holiday, but will not affect August 1st-10st in other years.</div>
287 <li class="radio"><input type="radio" name="newOperation" id="newOperationFieldyear" value="holidayrangerepeat" />
288 <label for="newOperationFieldyear">Holidays repeated yearly on a range</label>.
289 <a href="#" class="helptext">[?]</a>
290 <div class="hint">Make a single holiday on a range repeated yearly. For example, selecting August 1st, 2012 and August 10st, 2012 will make all days between 1st and 10st holiday, and will affect August 1st-10st in other years.</div>
293 <input type="checkbox" name="allBranches" id="allBranches" />
294 <label for="allBranches">Copy to all libraries</label>.
295 <a href="#" class="helptext">[?]</a>
296 <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>
298 <fieldset class="action">
299 <input type="submit" name="submit" value="Save" />
300 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('newHoliday');">Cancel</a>
306 <!-- *************************************************************************************** -->
307 <!-- ****** END OF FLAT PANELS ****** -->
308 <!-- *************************************************************************************** -->
310 <!-- ************************************************************************************** -->
311 <!-- ****** MAIN SCREEN CODE ****** -->
312 <!-- ************************************************************************************** -->
313 <h3>Calendar information</h3>
314 <div id="calendar-container">
315 <script type="text/javascript">
316 /* Creates all the structures to deal with all diferents kinds of holidays */
317 var week_days = new Array();
318 var holidays = new Array();
319 var exception_holidays = new Array();
320 var day_month_holidays = new Array();
321 var hola= "[% code %]";
322 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
323 week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
325 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
326 holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
328 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
329 exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
331 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
332 day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
335 /* This function gives css clases to each kind of day */
336 function dateStatusHandler(date) {
337 var day = date.getDate();
338 var month = date.getMonth() + 1;
339 var year = date.getFullYear();
340 var weekDay = date.getDay();
341 var dayMonth = month + '/' + day;
342 var dateString = year + '/' + month + '/' + day;
343 if (exception_holidays[dateString] != null) {
345 } else if ( week_days[weekDay] != null ){
346 return 'repeatableweekly';
347 } else if ( day_month_holidays[dayMonth] != null ) {
348 return 'repeatableyearly';
349 } else if (holidays[dateString] != null) {
356 /* This function is in charge of showing the correct panel considering the kind of holiday */
357 function dateChanged(calendar) {
358 var day = calendar.date.getDate();
359 var month = calendar.date.getMonth() + 1;
360 var year = calendar.date.getFullYear();
361 var weekDay = calendar.date.getDay();
362 var dayName = calendar.date.print('%A');
363 var dayMonth = month + '/' + day;
364 var dateString = year + '/' + month + '/' + day;
365 if (calendar.dateClicked) {
366 if (holidays[dateString] != null) {
367 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
368 } else if (exception_holidays[dateString] != null) {
369 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
370 } else if (week_days[weekDay] != null) {
371 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
372 } else if (day_month_holidays[dayMonth] != null) {
373 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
375 newHoliday(dayName, day, month, year, weekDay);
381 flat : "calendar-container",
382 flatCallback : dateChanged,
383 date: "[% keydate %]",
384 dateStatusFunc : dateStatusHandler
392 <div style="margin-top: 2em;">
393 <form action="copy-holidays.pl" method="post">
394 <input type="hidden" name="from_branchcode" value="[% branch %]" />
395 <label for="branchcode">Copy holidays to:</label>
396 <select id="branchcode" name="branchcode">
397 <option value=""></option>
398 [% FOREACH branchloo IN branchloop %]
399 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
402 <input type="submit" value="Copy" />
411 <li>Search in the calendar the day you want to set as holiday.</li>
412 <li>Click the date to add or edit a holiday.</li>
413 <li>Enter a title and description for the holdiay.</li>
414 <li>Specify how the holiday should repeat.</li>
415 <li>Click Save to finish.</li>
419 <span class="key normalday">Working day</span>
420 <span class="key holiday">Unique holiday</span>
421 <span class="key repeatableweekly">Holiday repeating weekly</span>
422 <span class="key repeatableyearly">Holiday repeating yearly</span>
423 <span class="key exception">Holiday exception</span>
426 <div id="holiday-list">
427 <!-- Exceptions First -->
428 <!-- this will probably always have the least amount of data -->
429 [% IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
431 <table id="holidayexceptions">
433 <th class="exception">Date</th>
434 <th class="exception">Title</th>
435 <th class="exception">Description</th>
439 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
441 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% EXCEPTION_HOLIDAYS_LOO.branch %]&calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE %]">[% EXCEPTION_HOLIDAYS_LOO.DATE %]</a></td>
442 <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE %]</td>
443 <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION %]</td>
450 [% IF ( WEEK_DAYS_LOOP ) %]
451 <h3>Weekly - Repeatable Holidays</h3>
452 <table id="holidayweeklyrepeatable">
455 <th class="repeatableweekly">Day of week</th>
456 <th class="repeatableweekly">Title</th>
457 <th class="repeatableweekly">Description</th>
461 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
464 <script type="text/javascript">
465 document.write(weekdays[ [% WEEK_DAYS_LOO.KEY %]]);
468 <td>[% WEEK_DAYS_LOO.TITLE %]</td>
469 <td>[% WEEK_DAYS_LOO.DESCRIPTION %]</td>
476 [% IF ( DAY_MONTH_HOLIDAYS_LOOP ) %]
477 <h3>Yearly - Repeatable Holidays</h3>
478 <table id="holidaysyearlyrepeatable">
481 [% IF ( dateformat_metric ) %]
482 <th class="repeatableyearly">Day/Month</th>
484 <th class="repeatableyearly">Month/Day</th>
486 <th class="repeatableyearly">Title</th>
487 <th class="repeatableyearly">Description</th>
491 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
493 <td>[% DAY_MONTH_HOLIDAYS_LOO.DATE %]</td>
494 <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE %]</td>
495 <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION %]</td>
502 [% IF ( HOLIDAYS_LOOP ) %]
503 <h3>Unique Holidays</h3>
504 <table id="holidaysunique">
507 <th class="holiday">Date</th>
508 <th class="holiday">Title</th>
509 <th class="holiday">Description</th>
513 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
515 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% HOLIDAYS_LOO.branch %]&calendardate=[% HOLIDAYS_LOO.DATE %]">[% HOLIDAYS_LOO.DATE %]</a></td>
516 <td>[% HOLIDAYS_LOO.TITLE %]</td>
517 <td>[% HOLIDAYS_LOO.DESCRIPTION %]</td>
529 <div class="yui-b noprint">
530 [% INCLUDE 'tools-menu.inc' %]
533 [% INCLUDE 'intranet-bottom.inc' %]