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"),_("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 repeatableday").html(_("Repeatable holiday"));
43 $("#showOperationDelLabel").html(_('Delete this holiday.'));
44 $("#holtype").attr("class","key holiday").html(_("Unique holiday"));
47 if (exceptionPosibility == 1) {
48 $("#exceptionPosibility").parent().show();
50 $("#exceptionPosibility").parent().hide();
54 // This function shows the "Add Holiday" panel //
55 function newHoliday (dayName, day, month, year, weekDay) {
56 $("#showHoliday").slideUp("fast");
57 $("#newHoliday").slideDown("fast");
58 $("#newDaynameOutput").html(dayName);
59 $("#newDayname").val(dayName);
60 $("#newBranchNameOutput").html($('#branch :selected').text());
61 $("#newBranchName").val($('#branch').val());
62 $("#newDayOutput").html(day);
63 $("#newDay").val(day);
64 $("#newMonthOutput").html(month);
65 $("#newMonth").val(month);
66 $("#newYearOutput").html(year);
67 $("#newYear").val(year);
68 $("#newWeekday:first").val(weekDay);
71 function hidePanel(aPanelName) {
72 $("#"+aPanelName).slideUp("fast");
75 function changeBranch () {
76 var branch = $("#branch option:selected").val();
77 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "<!-- TMPL_VAR NAME='calendardate' -->";
81 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
83 $(document).ready(function() {
85 $("#branch").change(function(){
88 $("#holidayexceptions").tablesorter({
89 sortList: [[0,0]], widgets: ['zebra']
91 $("#holidayweeklyrepeatable").tablesorter({
92 sortList: [[0,0]], widgets: ['zebra']
94 $("#holidaysyearlyrepeatable").tablesorter({
95 sortList: [[0,0]], widgets: ['zebra']
97 $("#holidaysunique").tablesorter({
98 sortList: [[0,0]], widgets: ['zebra']
100 $("a.helptext").click(function(){
101 $(this).parent().find(".hint").toggle(); return false;
106 <style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; }
107 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; }
108 .exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; }
109 .holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; }
110 .repeatableday { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; }
111 .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; }
112 .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; }
113 #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; }
117 <!-- TMPL_INCLUDE NAME="header.inc" -->
118 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
120 <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>
122 <div id="doc3" class="yui-t1">
127 <h2><!-- TMPL_VAR NAME="branchname" --> Calendar</h2>
129 <div class="yui-u first">
130 <label for="branch">Define the holidays for:</label>
131 <select id="branch" name="branch">
132 <!-- TMPL_LOOP NAME="branchloop" -->
133 <!-- TMPL_IF NAME="selected" -->
134 <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
136 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
141 <!-- ******************************** FLAT PANELS ******************************************* -->
142 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
143 <!-- **************************************************************************************** -->
145 <!-- ********************** Panel for showing already loaded holidays *********************** -->
146 <div class="panel" id="showHoliday">
147 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
148 <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
149 <fieldset class="brief">
150 <h3>Edit this holiday</h3>
151 <span id="holtype"></span>
154 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
155 <input type="hidden" id="showBranchName" name="showBranchName" />
158 <strong>Date:</strong>
159 <span id="showDaynameOutput"></span>,
161 <!-- 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 -->
163 <input type="hidden" id="showDayname" name="showDayname" />
164 <input type="hidden" id="showWeekday" name="showWeekday" />
165 <input type="hidden" id="showDay" name="showDay" />
166 <input type="hidden" id="showMonth" name="showMonth" />
167 <input type="hidden" id="showYear" name="showYear" />
169 <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
170 <!-- showTitle is necessary for exception radio button to work properly -->
171 <label for="showDescription">Description:</label>
172 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
174 <li class="radio"><div id="exceptionPosibility" style="position:static">
175 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
176 <a href="#" class="helptext">[?]</a>
177 <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>
179 <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
180 <a href="#" class="helptext">[?]</a>
181 <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>
182 <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
183 <a href="#" class="helptext">[?]</a>
184 <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>
187 <fieldset class="action">
188 <input type="submit" name="submit" value="Save" />
189 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('showHoliday');">Cancel</a>
195 <!-- ***************************** Panel to deal with new holidays ********************** -->
196 <div class="panel" id="newHoliday">
197 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
198 <input type="hidden" name="branchCodes" id="branchCodes" value="<!-- TMPL_VAR NAME="branchcodes" -->" />
199 <fieldset class="brief">
200 <h3>Add new holiday</h3>
203 <strong>Library:</strong>
204 <span id="newBranchNameOutput"></span>
205 <input type="hidden" id="newBranchName" name="newBranchName" />
208 <strong>Date:</strong>
209 <span id="newDaynameOutput"></span>,
211 <!-- 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 -->
213 <input type="hidden" id="newDayname" name="showDayname" />
214 <input type="hidden" id="newWeekday" name="newWeekday" />
215 <input type="hidden" id="newDay" name="newDay" />
216 <input type="hidden" id="newMonth" name="newMonth" />
217 <input type="hidden" id="newYear" name="newYear" />
219 <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
220 <li><label for="newDescription">Description:</label>
221 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
223 <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
224 <label for="newOperationOnce">Holiday only on this day</label>.
225 <a href="#" class="helptext">[?]</a>
226 <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>
228 <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
229 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
230 <a href="#" class="helptext">[?]</a>
231 <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>
233 <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
234 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
235 <a href="#" class="helptext">[?]</a>
236 <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>
239 <input type="checkbox" name="allBranches" id="allBranches" />
240 <label for="allBranches">Copy to all libraries</label>.
241 <a href="#" class="helptext">[?]</a>
242 <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>
244 <fieldset class="action">
245 <input type="submit" name="submit" value="Save" />
246 <a href="#" class="cancel" name="cancel2" onclick=" hidePanel('newHoliday');">Cancel</a>
252 <!-- *************************************************************************************** -->
253 <!-- ****** END OF FLAT PANELS ****** -->
254 <!-- *************************************************************************************** -->
256 <!-- ************************************************************************************** -->
257 <!-- ****** MAIN SCREEN CODE ****** -->
258 <!-- ************************************************************************************** -->
259 <h3>Calendar information</h3>
260 <div id="calendar-container">
261 <script type="text/javascript">
262 /* Creates all the structures to deal with all diferents kinds of holidays */
263 var week_days = new Array();
264 var holidays = new Array();
265 var exception_holidays = new Array();
266 var day_month_holidays = new Array();
267 var hola= "<!-- TMPL_VAR NAME="code" -->";
268 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
269 week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
271 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
272 holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
274 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
275 exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
277 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
278 day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
281 /* This function gives css clases to each kind of day */
282 function dateStatusHandler(date) {
283 var day = date.getDate();
284 var month = date.getMonth() + 1;
285 var year = date.getFullYear();
286 var weekDay = date.getDay();
287 var dayMonth = month + '/' + day;
288 var dateString = year + '/' + month + '/' + day;
289 if (exception_holidays[dateString] != null) {
291 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
292 return 'repeatableday';
293 } else if (holidays[dateString] != null) {
300 /* This function is in charge of showing the correct panel considering the kind of holiday */
301 function dateChanged(calendar) {
302 var day = calendar.date.getDate();
303 var month = calendar.date.getMonth() + 1;
304 var year = calendar.date.getFullYear();
305 var weekDay = calendar.date.getDay();
306 var dayName = calendar.date.print('%A');
307 var dayMonth = month + '/' + day;
308 var dateString = year + '/' + month + '/' + day;
309 if (calendar.dateClicked) {
310 if (holidays[dateString] != null) {
311 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
312 } else if (exception_holidays[dateString] != null) {
313 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
314 } else if (week_days[weekDay] != null) {
315 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
316 } else if (day_month_holidays[dayMonth] != null) {
317 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
319 newHoliday(dayName, day, month, year, weekDay);
325 flat : "calendar-container",
326 flatCallback : dateChanged,
327 date: "<!-- TMPL_VAR NAME='keydate' -->",
328 dateStatusFunc : dateStatusHandler
340 <li>Search in the calendar the day you want to set as holiday.</li>
341 <li>Click the date to add or edit a holiday.</li>
342 <li>Enter a title and description for the holdiay.</li>
343 <li>Specify how the holiday should repeat.</li>
344 <li>Click Save to finish.</li>
348 <span class="key normalday">Working day</span>
349 <span class="key holiday">Unique holiday</span>
350 <span class="key repeatableday">Repeatable holiday</span>
351 <span class="key exception">Holiday exception</span>
354 <div id="holiday-list">
355 <!-- Exceptions First -->
356 <!-- this will probably always have the least amount of data -->
357 <!-- TMPL_IF NAME="EXCEPTION_HOLIDAYS_LOOP" -->
359 <table id="holidayexceptions">
361 <th class="exception">Date</th>
362 <th class="exception">Title</th>
363 <th class="exception">Description</th>
367 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
369 <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>
370 <td><!-- TMPL_VAR NAME="TITLE" --></td>
371 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
378 <!--TMPL_IF NAME="WEEK_DAYS_LOOP" -->
379 <h3>Weekly - Repeatable Holidays</h3>
380 <table id="holidayweeklyrepeatable">
383 <th class="repeatableday">Day of Week</th>
384 <th class="repeatableday">Title</th>
385 <th class="repeatableday">Description</th>
389 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
392 <script type="text/javascript">
393 document.write(weekdays[ <!-- TMPL_VAR NAME="KEY" -->]);
396 <td><!-- TMPL_VAR NAME="TITLE" --></td>
397 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
404 <!-- TMPL_IF NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
405 <h3>Yearly - Repeatable Holidays</h3>
406 <table id="holidaysyearlyrepeatable">
409 <!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
410 <th class="repeatableday">Day/Month</th>
412 <th class="repeatableday">Month/Day</th>
414 <th class="repeatableday">Title</th>
415 <th class="repeatableday">Description</th>
419 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
421 <td><!-- TMPL_VAR NAME="DATE" --></td>
422 <td><!-- TMPL_VAR NAME="TITLE" --></td>
423 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
430 <!-- TMPL_IF NAME="HOLIDAYS_LOOP" -->
431 <h3>Unique Holidays</h3>
432 <table id="holidaysunique">
435 <th class="holiday">Date</th>
436 <th class="holiday">Title</th>
437 <th class="holiday">Description</th>
441 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
443 <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>
444 <td><!-- TMPL_VAR NAME="TITLE" --></td>
445 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
457 <div class="yui-b noprint">
458 <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
461 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->