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 $("#branch").change(function(){
91 $("#holidayexceptions").tablesorter({
92 sortList: [[0,0]], widgets: ['zebra']
94 $("#holidayweeklyrepeatable").tablesorter({
95 sortList: [[0,0]], widgets: ['zebra']
97 $("#holidaysyearlyrepeatable").tablesorter({
98 sortList: [[0,0]], widgets: ['zebra']
100 $("#holidaysunique").tablesorter({
101 sortList: [[0,0]], widgets: ['zebra']
103 $("a.helptext").click(function(){
104 $(this).parent().find(".hint").toggle(); return false;
106 $("#dateofrange").each(function () { this.value = "" });
110 <style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; }
111 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; }
112 .exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; }
113 .holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; }
114 .repeatableweekly { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; }
115 .repeatableyearly { background-color : #FFCC66; color : Black; border : 1px solid #BCBCBC; }
116 .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; }
117 .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; }
118 #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; }
122 [% INCLUDE 'header.inc' %]
123 [% INCLUDE 'cat-search.inc' %]
125 <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>
127 <div id="doc3" class="yui-t1">
132 <h2>[% branchname %] Calendar</h2>
134 <div class="yui-u first">
135 <label for="branch">Define the holidays for:</label>
136 <select id="branch" name="branch">
137 [% FOREACH branchloo IN branchloop %]
138 [% IF ( branchloo.selected ) %]
139 <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
141 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
146 <!-- ******************************** FLAT PANELS ******************************************* -->
147 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
148 <!-- **************************************************************************************** -->
150 <!-- ********************** Panel for showing already loaded holidays *********************** -->
151 <div class="panel" id="showHoliday">
152 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
153 <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
154 <fieldset class="brief">
155 <h3>Edit this holiday</h3>
156 <span id="holtype"></span>
159 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
160 <input type="hidden" id="showBranchName" name="showBranchName" />
163 <strong>Date:</strong>
164 <span id="showDaynameOutput"></span>,
166 [% 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 %]
168 <input type="hidden" id="showDayname" name="showDayname" />
169 <input type="hidden" id="showWeekday" name="showWeekday" />
170 <input type="hidden" id="showDay" name="showDay" />
171 <input type="hidden" id="showMonth" name="showMonth" />
172 <input type="hidden" id="showYear" name="showYear" />
174 <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
175 <!-- showTitle is necessary for exception radio button to work properly -->
176 <label for="showDescription">Description:</label>
177 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
179 <li class="radio"><div id="exceptionPosibility" style="position:static">
180 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
181 <a href="#" class="helptext">[?]</a>
182 <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>
184 <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
185 <a href="#" class="helptext">[?]</a>
186 <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>
187 <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
188 <a href="#" class="helptext">[?]</a>
189 <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>
192 <fieldset class="action">
193 <input type="submit" name="submit" value="Save" />
194 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('showHoliday');">Cancel</a>
200 <!-- ***************************** Panel to deal with new holidays ********************** -->
201 <div class="panel" id="newHoliday">
202 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
203 <input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" />
204 <fieldset class="brief">
205 <h3>Add new holiday</h3>
208 <strong>Library:</strong>
209 <span id="newBranchNameOutput"></span>
210 <input type="hidden" id="newBranchName" name="newBranchName" />
213 <strong>From Date:</strong>
214 <span id="newDaynameOutput"></span>,
216 [% 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 %]
218 <input type="hidden" id="newDayname" name="showDayname" />
219 <input type="hidden" id="newWeekday" name="newWeekday" />
220 <input type="hidden" id="newDay" name="newDay" />
221 <input type="hidden" id="newMonth" name="newMonth" />
222 <input type="hidden" id="newYear" name="newYear" />
224 <li class="dateinsert">
226 <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" />
227 <img src="[% themelang %]/lib/calendar/cal.gif" id="dateofrange_button" alt="Show Calendar" />
228 <script language="JavaScript" type="text/javascript">
231 inputField : "dateofrange",
232 ifFormat : "[% DHTMLcalendar_dateformat %]",
233 button : "dateofrange_button"
238 <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
239 <li><label for="newDescription">Description:</label>
240 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
242 <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
243 <label for="newOperationOnce">Holiday only on this day</label>.
244 <a href="#" class="helptext">[?]</a>
245 <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>
247 <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
248 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
249 <a href="#" class="helptext">[?]</a>
250 <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>
252 <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
253 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
254 <a href="#" class="helptext">[?]</a>
255 <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>
257 <li class="radio"><input type="radio" name="newOperation" id="newOperationField" value="holidayrange" />
258 <label for="newOperationField">Holidays on a range</label>.
259 <a href="#" class="helptext">[?]</a>
260 <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>
262 <li class="radio"><input type="radio" name="newOperation" id="newOperationFieldyear" value="holidayrangerepeat" />
263 <label for="newOperationFieldyear">Holidays repeated yearly on a range</label>.
264 <a href="#" class="helptext">[?]</a>
265 <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>
268 <input type="checkbox" name="allBranches" id="allBranches" />
269 <label for="allBranches">Copy to all libraries</label>.
270 <a href="#" class="helptext">[?]</a>
271 <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>
273 <fieldset class="action">
274 <input type="submit" name="submit" value="Save" />
275 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('newHoliday');">Cancel</a>
281 <!-- *************************************************************************************** -->
282 <!-- ****** END OF FLAT PANELS ****** -->
283 <!-- *************************************************************************************** -->
285 <!-- ************************************************************************************** -->
286 <!-- ****** MAIN SCREEN CODE ****** -->
287 <!-- ************************************************************************************** -->
288 <h3>Calendar information</h3>
289 <div id="calendar-container">
290 <script type="text/javascript">
291 /* Creates all the structures to deal with all diferents kinds of holidays */
292 var week_days = new Array();
293 var holidays = new Array();
294 var exception_holidays = new Array();
295 var day_month_holidays = new Array();
296 var hola= "[% code %]";
297 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
298 week_days["[% WEEK_DAYS_LOO.KEY %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
300 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
301 holidays["[% HOLIDAYS_LOO.KEY %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
303 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
304 exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
306 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
307 day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') %]"};
310 /* This function gives css clases to each kind of day */
311 function dateStatusHandler(date) {
312 var day = date.getDate();
313 var month = date.getMonth() + 1;
314 var year = date.getFullYear();
315 var weekDay = date.getDay();
316 var dayMonth = month + '/' + day;
317 var dateString = year + '/' + month + '/' + day;
318 if (exception_holidays[dateString] != null) {
320 } else if ( week_days[weekDay] != null ){
321 return 'repeatableweekly';
322 } else if ( day_month_holidays[dayMonth] != null ) {
323 return 'repeatableyearly';
324 } else if (holidays[dateString] != null) {
331 /* This function is in charge of showing the correct panel considering the kind of holiday */
332 function dateChanged(calendar) {
333 var day = calendar.date.getDate();
334 var month = calendar.date.getMonth() + 1;
335 var year = calendar.date.getFullYear();
336 var weekDay = calendar.date.getDay();
337 var dayName = calendar.date.print('%A');
338 var dayMonth = month + '/' + day;
339 var dateString = year + '/' + month + '/' + day;
340 if (calendar.dateClicked) {
341 if (holidays[dateString] != null) {
342 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
343 } else if (exception_holidays[dateString] != null) {
344 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
345 } else if (week_days[weekDay] != null) {
346 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
347 } else if (day_month_holidays[dayMonth] != null) {
348 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
350 newHoliday(dayName, day, month, year, weekDay);
356 flat : "calendar-container",
357 flatCallback : dateChanged,
358 date: "[% keydate %]",
359 dateStatusFunc : dateStatusHandler
371 <li>Search in the calendar the day you want to set as holiday.</li>
372 <li>Click the date to add or edit a holiday.</li>
373 <li>Enter a title and description for the holdiay.</li>
374 <li>Specify how the holiday should repeat.</li>
375 <li>Click Save to finish.</li>
379 <span class="key normalday">Working day</span>
380 <span class="key holiday">Unique holiday</span>
381 <span class="key repeatableweekly">Holiday repeating weekly</span>
382 <span class="key repeatableyearly">Holiday repeating yearly</span>
383 <span class="key exception">Holiday exception</span>
386 <div id="holiday-list">
387 <!-- Exceptions First -->
388 <!-- this will probably always have the least amount of data -->
389 [% IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
391 <table id="holidayexceptions">
393 <th class="exception">Date</th>
394 <th class="exception">Title</th>
395 <th class="exception">Description</th>
399 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
401 <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>
402 <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE %]</td>
403 <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION %]</td>
410 [% IF ( WEEK_DAYS_LOOP ) %]
411 <h3>Weekly - Repeatable Holidays</h3>
412 <table id="holidayweeklyrepeatable">
415 <th class="repeatableweekly">Day of Week</th>
416 <th class="repeatableweekly">Title</th>
417 <th class="repeatableweekly">Description</th>
421 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
424 <script type="text/javascript">
425 document.write(weekdays[ [% WEEK_DAYS_LOO.KEY %]]);
428 <td>[% WEEK_DAYS_LOO.TITLE %]</td>
429 <td>[% WEEK_DAYS_LOO.DESCRIPTION %]</td>
436 [% IF ( DAY_MONTH_HOLIDAYS_LOOP ) %]
437 <h3>Yearly - Repeatable Holidays</h3>
438 <table id="holidaysyearlyrepeatable">
441 [% IF ( dateformat == 'metric' ) %]
442 <th class="repeatableyearly">Day/Month</th>
444 <th class="repeatableyearly">Month/Day</th>
446 <th class="repeatableyearly">Title</th>
447 <th class="repeatableyearly">Description</th>
451 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
453 <td>[% DAY_MONTH_HOLIDAYS_LOO.DATE %]</td>
454 <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE %]</td>
455 <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION %]</td>
462 [% IF ( HOLIDAYS_LOOP ) %]
463 <h3>Unique Holidays</h3>
464 <table id="holidaysunique">
467 <th class="holiday">Date</th>
468 <th class="holiday">Title</th>
469 <th class="holiday">Description</th>
473 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
475 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% HOLIDAYS_LOO.branch %]&calendardate=[% HOLIDAYS_LOO.DATE %]">[% HOLIDAYS_LOO.DATE %]</a></td>
476 <td>[% HOLIDAYS_LOO.TITLE %]</td>
477 <td>[% HOLIDAYS_LOO.DESCRIPTION %]</td>
489 <div class="yui-b noprint">
490 [% INCLUDE 'tools-menu.inc' %]
493 [% INCLUDE 'intranet-bottom.inc' %]