1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha › Tools › <!-- TMPL_VAR NAME="branchname" --> Calendar</title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
5 <script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6 <script language="JavaScript" type="text/javascript">
9 var weekdays = new Array("Sundays", "Mondays", "Tuesdays",
10 "Wednesdays", "Thursdays", "Fridays", "Saturdays");
12 function holidayOperation(formObject, opType) {
13 var op = document.getElementsByName('operation');
18 // This function shows the "Show Holiday" panel //
19 function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) {
20 $("#newHoliday").slideUp("fast");
21 $("#showHoliday").slideDown("fast");
22 $('#showDaynameOutput').html(dayName);
23 $('#showDayname').val(dayName);
24 $('#showBranchNameOutput').html($("#branch").val());
25 $('#showBranchName').val($("#branch").val());
26 $('#showDayOutput').html(day);
27 $('#showDay').val(day);
28 $('#showMonthOutput').html(month);
29 $('#showMonth').val(month);
30 $('#showYearOutput').html(year);
31 $('#showYear').val(year);
32 $('#showDescription').val(description);
33 $('#showWeekday:first').val(weekDay);
34 $('#showTitle').val(title);
35 $('#showHolidayType').val(holidayType);
37 if (holidayType == 'exception') {
38 $("#showOperationDelLabel").html('Delete this exception.');
39 $("#holtype").attr("class","key exception").html("Holiday exception");
40 } else if(holidayType == 'weekday') {
41 $("#showOperationDelLabel").html('Delete this holiday.');
42 $("#holtype").attr("class","key repeatableday").html("Repeatable holiday");
44 $("#showOperationDelLabel").html('Delete this holiday.');
45 $("#holtype").attr("class","key holiday").html("Unique holiday");
48 if (exceptionPosibility == 1) {
49 $("#exceptionPosibility").parent().show();
51 $("#exceptionPosibility").parent().hide();
55 // This function shows the "Add Holiday" panel //
56 function newHoliday (dayName, day, month, year, weekDay) {
57 $("#showHoliday").slideUp("fast");
58 $("#newHoliday").slideDown("fast");
59 $("#newDaynameOutput").html(dayName);
60 $("#newDayname").val(dayName);
61 $("#newBranchNameOutput").html($('#branch').val());
62 $("#newBranchName").val($('#branch').val());
63 $("#newDayOutput").html(day);
64 $("#newDay").val(day);
65 $("#newMonthOutput").html(month);
66 $("#newMonth").val(month);
67 $("#newYearOutput").html(year);
68 $("#newYear").val(year);
69 $("#newWeekday:first").val(weekDay);
72 function hidePanel(aPanelName) {
73 $("#"+aPanelName).slideUp("fast");
76 function changeBranch () {
77 var branch = $("#branch option:selected").val();
78 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "<!-- TMPL_VAR NAME='calendardate' -->";
82 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
84 $(document).ready(function() {
86 $("#branch").change(function(){
89 $("#holidayexceptions").tablesorter({
90 sortList: [[0,0]], widgets: ['zebra']
92 $("#holidayweeklyrepeatable").tablesorter({
93 sortList: [[0,0]], widgets: ['zebra']
95 $("#holidaysyearlyrepeatable").tablesorter({
96 sortList: [[0,0]], widgets: ['zebra']
98 $("#holidaysunique").tablesorter({
99 sortList: [[0,0]], widgets: ['zebra']
101 $("a.helptext").click(function(){
102 $(this).parent().find(".hint").toggle(); return false;
107 <style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; }
108 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; }
109 .exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; }
110 .holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; }
111 .repeatableday { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; }
112 .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; }
113 .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; }
114 #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; }
118 <!-- TMPL_INCLUDE NAME="header.inc" -->
119 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
121 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <!-- TMPL_VAR NAME="branchname" --> Calendar</div>
123 <div id="doc3" class="yui-t1">
128 <h2><!-- TMPL_VAR NAME="branchname" --> Calendar</h2>
130 <div class="yui-u first">
131 <label for="branch">Define the holidays for:</label>
132 <select id="branch" name="branch">
133 <!-- TMPL_LOOP NAME="branchloop" -->
134 <!-- TMPL_IF NAME="selected" -->
135 <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
137 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
142 <!-- ******************************** FLAT PANELS ******************************************* -->
143 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
144 <!-- **************************************************************************************** -->
146 <!-- ********************** Panel for showing already loaded holidays *********************** -->
147 <div class="panel" id="showHoliday">
148 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
149 <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
150 <fieldset class="brief">
151 <h3>Edit this holiday</h3>
152 <span id="holtype"></span>
155 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
156 <input type="hidden" id="showBranchName" name="showBranchName" />
159 <strong>Date:</strong>
160 <span id="showDaynameOutput"></span>,
162 <!-- TMPL_IF NAME="dateformat_us" --><span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span><!-- TMPL_ELSIF NAME="dateformat_metric" --><span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span><!-- TMPL_ELSE --><span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span><!-- /TMPL_IF -->
164 <input type="hidden" id="showDayname" name="showDayname" />
165 <input type="hidden" id="showWeekday" name="showWeekday" />
166 <input type="hidden" id="showDay" name="showDay" />
167 <input type="hidden" id="showMonth" name="showMonth" />
168 <input type="hidden" id="showYear" name="showYear" />
170 <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
171 <!-- showTitle is necessary for exception radio button to work properly -->
172 <label for="showDescription">Description:</label>
173 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
175 <li class="radio"><div id="exceptionPosibility" style="position:static">
176 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
177 <a href="#" class="helptext">[?]</a>
178 <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>
180 <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
181 <a href="#" class="helptext">[?]</a>
182 <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>
183 <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
184 <a href="#" class="helptext">[?]</a>
185 <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>
188 <fieldset class="action">
189 <input type="submit" name="submit" value="Save" />
190 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('showHoliday');">Cancel</a>
196 <!-- ***************************** Panel to deal with new holidays ********************** -->
197 <div class="panel" id="newHoliday">
198 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
199 <input type="hidden" name="branchCodes" id="branchCodes" value="<!-- TMPL_VAR NAME="branchcodes" -->" />
200 <fieldset class="brief">
201 <h3>Add new holiday</h3>
204 <strong>Library</strong>
205 <span id="newBranchNameOutput"></span>
206 <input type="hidden" id="newBranchName" name="newBranchName" />
209 <strong>Date:</strong>
210 <span id="newDaynameOutput"></span>,
212 <!-- TMPL_IF NAME="dateformat_us" --><span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span><!-- TMPL_ELSIF NAME="dateformat_metric" --><span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span><!-- TMPL_ELSE --><span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span><!-- /TMPL_IF -->
214 <input type="hidden" id="newDayname" name="showDayname" />
215 <input type="hidden" id="newWeekday" name="newWeekday" />
216 <input type="hidden" id="newDay" name="newDay" />
217 <input type="hidden" id="newMonth" name="newMonth" />
218 <input type="hidden" id="newYear" name="newYear" />
220 <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
221 <li><label for="newDescription">Description:</label>
222 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
224 <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
225 <label for="newOperationOnce">Holiday only on this day</label>.
226 <a href="#" class="helptext">[?]</a>
227 <div class="hint">Make a single holiday. For example, selecting August 1st, 2012 will make it holiday, but will not affect August 1st in other years.</div>
229 <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
230 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
231 <a href="#" class="helptext">[?]</a>
232 <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>
234 <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
235 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
236 <a href="#" class="helptext">[?]</a>
237 <div class="hint">This will take this day and month as a reference to make it 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>
240 <input type="checkbox" name="allBranches" id="allBranches" />
241 <label for="allBranches">Copy to all libraries</label>.
242 <a href="#" class="helptext">[?]</a>
243 <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>
245 <fieldset class="action">
246 <input type="submit" name="submit" value="Save" />
247 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('newHoliday');">Cancel</a>
253 <!-- *************************************************************************************** -->
254 <!-- ****** END OF FLAT PANELS ****** -->
255 <!-- *************************************************************************************** -->
257 <!-- ************************************************************************************** -->
258 <!-- ****** MAIN SCREEN CODE ****** -->
259 <!-- ************************************************************************************** -->
260 <h3>Calendar information</h3>
261 <div id="calendar-container">
262 <script type="text/javascript">
263 /* Creates all the structures to deal with all diferents kinds of holidays */
264 var week_days = new Array();
265 var holidays = new Array();
266 var exception_holidays = new Array();
267 var day_month_holidays = new Array();
268 var hola= "<!-- TMPL_VAR NAME="code" -->";
269 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
270 week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
272 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
273 holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
275 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
276 exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
278 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
279 day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
282 /* This function gives css clases to each kind of day */
283 function dateStatusHandler(date) {
284 var day = date.getDate();
285 var month = date.getMonth() + 1;
286 var year = date.getFullYear();
287 var weekDay = date.getDay();
288 var dayMonth = month + '/' + day;
289 var dateString = year + '/' + month + '/' + day;
290 if (exception_holidays[dateString] != null) {
292 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
293 return 'repeatableday';
294 } else if (holidays[dateString] != null) {
301 /* This function is in charge of showing the correct panel considering the kind of holiday */
302 function dateChanged(calendar) {
303 var day = calendar.date.getDate();
304 var month = calendar.date.getMonth() + 1;
305 var year = calendar.date.getFullYear();
306 var weekDay = calendar.date.getDay();
307 var dayName = calendar.date.print('%A');
308 var dayMonth = month + '/' + day;
309 var dateString = year + '/' + month + '/' + day;
310 if (calendar.dateClicked) {
311 if (holidays[dateString] != null) {
312 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
313 } else if (exception_holidays[dateString] != null) {
314 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
315 } else if (week_days[weekDay] != null) {
316 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
317 } else if (day_month_holidays[dayMonth] != null) {
318 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
320 newHoliday(dayName, day, month, year, weekDay);
326 flat : "calendar-container",
327 flatCallback : dateChanged,
328 date: "<!-- TMPL_VAR NAME='keydate' -->",
329 dateStatusFunc : dateStatusHandler
341 <li>Search in the calendar the day you want to set as holiday.</li>
342 <li>Click the date to add or edit a holiday.</li>
343 <li>Enter a title and description for the holdiay.</li>
344 <li>Specify how the holiday should repeat.</li>
345 <li>Click Save to finish.</li>
349 <span class="key normalday">Working day</span>
350 <span class="key holiday">Unique holiday</span>
351 <span class="key repeatableday">Repeatable holiday</span>
352 <span class="key exception">Holiday exception</span>
355 <div id="holiday-list">
356 <!-- Exceptions First -->
357 <!-- this will probably always have the least amount of data -->
358 <!-- TMPL_IF NAME="EXCEPTION_HOLIDAYS_LOOP" -->
360 <table id="holidayexceptions">
362 <th class="exception">Date</th>
363 <th class="exception">Title</th>
364 <th class="exception">Description</th>
368 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
370 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=<!-- TMPL_VAR NAME="branch" -->&calendardate=<!-- TMPL_VAR NAME="DATE" -->"><!-- TMPL_VAR NAME="DATE" --></a></td>
371 <td><!-- TMPL_VAR NAME="TITLE" --></td>
372 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
379 <!--TMPL_IF NAME="WEEK_DAYS_LOOP" -->
380 <h3>Weekly - Repeatable Holidays</h3>
381 <table id="holidayweeklyrepeatable">
384 <th class="repeatableday">Day of Week</th>
385 <th class="repeatableday">Title</th>
386 <th class="repeatableday">Description</th>
390 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
393 <script type="text/javascript">
394 document.write(weekdays[ <!-- TMPL_VAR NAME="KEY" -->]);
397 <td><!-- TMPL_VAR NAME="TITLE" --></td>
398 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
405 <!-- TMPL_IF NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
406 <h3>Yearly - Repeatable Holidays</h3>
407 <table id="holidaysyearlyrepeatable">
410 <!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
411 <th class="repeatableday">Day/Month</th>
413 <th class="repeatableday">Month/Day</th>
415 <th class="repeatableday">Title</th>
416 <th class="repeatableday">Description</th>
420 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
422 <td><!-- TMPL_VAR NAME="DATE" --></td>
423 <td><!-- TMPL_VAR NAME="TITLE" --></td>
424 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
431 <!-- TMPL_IF NAME="HOLIDAYS_LOOP" -->
432 <h3>Unique Holidays</h3>
433 <table id="holidaysunique">
436 <th class="holiday">Date</th>
437 <th class="holiday">Title</th>
438 <th class="holiday">Description</th>
442 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
444 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=<!-- TMPL_VAR NAME="branch" -->&calendardate=<!-- TMPL_VAR NAME="DATE" -->"><!-- TMPL_VAR NAME="DATE" --></a></td>
445 <td><!-- TMPL_VAR NAME="TITLE" --></td>
446 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
458 <div class="yui-b noprint">
459 <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
462 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->