1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha › Tools › 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">
8 // Captura el evento onmousemove para cualquier navegador
9 if (document.layers) { // Netscape
10 document.captureEvents(Event.MOUSEMOVE);
11 document.onmousemove = captureMousePosition;
12 } else if (document.all) { // Internet Explorer
13 document.onmousemove = captureMousePosition;
14 } else if (document.getElementById) { // Netcsape 6
15 document.onmousemove = captureMousePosition;
22 var weekdays = new Array("Sundays", "Mondays", "Tuesdays",
23 "Wednesdays", "Thursdays", "Fridays", "Saturdays");
25 function captureMousePosition(e) {
26 if (document.layers) {
29 mouseXMax = window.innerWidth + window.pageXOffset;
30 mouseYMax = window.innerHeight + window.pageYOffset;
31 } else if (document.all) {
32 mouseX = window.event.x + document.body.scrollLeft;
33 mouseY = window.event.y + document.body.scrollTop;
34 mouseXMax = document.body.clientWidth + document.body.scrollLeft;
35 mouseYMax = document.body.clientHeight + document.body.scrollTop;
36 } else if (document.getElementById) {
39 mouseXMax = window.innerWidth + window.pageXOffset;
40 mouseYMax = window.innerHeight + window.pageYOffset;
44 function holidayOperation(formObject, opType) {
45 var op = document.getElementsByName('operation');
50 // This function shows the "Show Holiday" panel //
51 function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description) {
52 $("#newHoliday").slideUp("fast");
53 $("#showHoliday").slideDown("fast");
54 document.getElementById('showDayname').value = dayName;
55 document.getElementById('showBranchName').value = document.getElementById('branch').value;
56 document.getElementById('showDay').value = day;
57 document.getElementById('showMonth').value = month;
58 document.getElementById('showYear').value = year;
59 document.getElementById('showDescription').value = description;
60 document.getElementsByName('showWeekday')[0].value = weekDay;
61 document.getElementById('showTitle').value = title;
63 if (exceptionPosibility == 1) {
64 document.getElementById('exceptionPosibility').style.display = 'inline';
66 document.getElementById('exceptionPosibility').style.display = 'none';
70 // This function shows the "Add Holiday" panel //
71 function newHoliday (dayName, day, month, year, weekDay) {
72 $("#showHoliday").slideUp("fast");
73 $("#newHoliday").slideDown("fast");
74 $("#newDayname").val(dayName);
75 $("#newBranchName").val($('#branch').val());
76 $("#newDay").val(day);
77 $("#newMonth").val(month);
78 $("#newYear").val(year);
79 $("#newWeekday")[0].val(weekDay);
82 function hidePanel(aPanelName) {
83 $("#"+aPanelName).slideUp("fast");
86 function changeBranch () {
87 var branch = $("#branch option:selected").val();
88 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch;
91 function additionalInformation (anExplanation) {
92 var panel = document.getElementById('information');
93 var paragraph = document.getElementById('explanation');
94 panel.style.display = 'inline'
95 panel.style.top = mouseY;
96 panel.style.left = mouseX;
97 var info = document.createTextNode(anExplanation);
98 if (paragraph.hasChildNodes()) {
99 paragraph.removeChild(paragraph.lastChild);
101 paragraph.appendChild(info);
105 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
107 $(document).ready(function() {
108 $("#branch").change(function(){
111 $("#holidayexceptions").tablesorter({
112 sortList: [[0,0]], widgets: ['zebra']
114 $("#holidayweeklyrepeatable").tablesorter({
115 sortList: [[0,0]], widgets: ['zebra']
117 $("#holidaysyearlyrepeatable").tablesorter({
118 sortList: [[0,0]], widgets: ['zebra']
120 $("#holidaysunique").tablesorter({
121 sortList: [[0,0]], widgets: ['zebra']
126 <style type="text/css">
127 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #000000; }
128 .exception { background-color : #EDEDED; color : Black; border : 1px solid #000000; }
129 .holiday { background-color : red; color : Black; border : 1px solid #000000; }
130 .repeatableday { background-color : yellow; color : Black; border : 1px solid #000000; }
131 .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; }
132 .panel { z-index : 1; width : 500px; display : none; border : 1px solid #000000; padding : 3px; /* position: absolute; */ background-color: #CCCCCC; }
133 div.dmy { display:inline; }
134 .blacklabel, div.dmy input { background-color:#FFFFFF; color:Black; font-size:10px; }
135 h1 select { width: 20em; }
139 <!-- TMPL_INCLUDE NAME="header.inc" -->
140 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
142 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Calendar</div>
144 <div id="doc3" class="yui-t2">
153 <!-- *************************************************************************************** -->
154 <!-- ****** START OF INFORMATION PANEL ****** -->
155 <!-- *************************************************************************************** -->
157 <div class="information" style="position:absolute" id="information" onclick=" hidePanel('information')">
161 <p id="explanation" style="display:inline;align:justify"></p>
167 <!-- ************************************************************************************** -->
168 <!-- ****** END OF INFORMATION PANEL ****** -->
169 <!-- ************************************************************************************** -->
171 <h1>Define the holidays for :</h1>
172 <label for="branch">Select a library :</label>
173 <select id="branch" name="branch">
174 <!-- TMPL_LOOP NAME="branchloop" -->
175 <!-- TMPL_IF NAME="selected" -->
176 <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
178 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
183 <li>Search in the calendar the day you want to set as holiday.</li>
184 <li>Complete the information in the right area.</li>
185 <li>Once you finish the steps above, click Save.</li>
188 <span class="normalday">Working day</span>
189 <span class="holiday">Unique holiday</span>
190 <span class="repeatableday">Repeatable holiday</span>
191 <span class="exception">Holiday exception</span>
194 <!-- ******************************** FLAT PANELS ******************************************* -->
195 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
196 <!-- **************************************************************************************** -->
198 <!-- ********************** Panel for showing already loaded holidays *********************** -->
199 <div class="panel" id="showHoliday">
200 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
201 <h2>Edit this holiday</h2>
203 <label for="showBranchName">Library</label>
204 <input type="text" size="20" id="showBranchName" name="showBranchName" readonly="readonly" class="blacklabel" />
207 <label for="showDayname">Day name</label>
208 <input type="text" size="20" id="showDayname" name="showDayname" readonly="readonly" class="blacklabel" />
209 <input type="hidden" name="showWeekday" />
212 <label for="showDay">Day</label> <input type="text" size="2" id="showDay" name="showDay" readonly="readonly" />
213 <label for="showMonth">Month</label> <input type="text" size="2" id="showMonth" name="showMonth" readonly="readonly" />
214 <label for="showYear">Year</label> <input type="text" size="4" id="showYear" name="showYear" readonly="readonly" />
216 <p><label for="showDescription">Description:</label>
218 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
220 <div id="exceptionPosibility" style="position:static">
221 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception to this holiday.</label>
222 <a href="#" onclick=" additionalInformation('You can make an exception for this holiday rule. This means that you will be able to say for a repeatable holiday, that there is one of those days that is going to be an exception.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
224 <input type="radio" name="showOperation" id="showOperationDel" value="delete" checked="checked" /> <label for="showOperationDel">Delete this holiday</label>.
225 <a href="#" onclick=" additionalInformation('This will delete this holiday rule. In case it is a repeatable holiday, this option checks for posible exceptions. In case those exists, this option take care of set this exceptions to regular holidays.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
227 <input type="submit" name="submit" value="Save" />
228 <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('showHoliday');hidePanel('information')" />
233 <!-- ***************************** Panel to deal with new holidays ********************** -->
234 <div class="panel" id="newHoliday">
235 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
236 <h2>Add new holiday</h2>
238 <label for="newBranchName">Library</label>
239 <input type="text" size="20" id="newBranchName" name="newBranchName" readonly="readonly" class="blacklabel" />
242 <label for="newDayname">Day name</label>
243 <input type="text" size="20" id="newDayname" name="newDayname" readonly="readonly" class="blacklabel" />
244 <input type="hidden" name="newWeekday" />
247 <label for="newDay">Day</label> <input type="text" size="2" id="newDay" name="newDay" readonly="readonly" />
248 <label for="newMonth">Month</label> <input type="text" size="2" id="newMonth" name="newMonth" readonly="readonly" />
249 <label for="newYear">Year</label> <input type="text" size="4" id="newYear" name="newYear" readonly="readonly" />
251 <p><label for="newDescription">Description:</label>
253 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
255 <input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
256 <label for="newOperationOnce">Holiday only on this day</label>.
257 <a href="#" onclick=" additionalInformation('Make a single holiday. For example, selecting August 1st, 2012 will make it holiday, but will not affect August 1st in other years.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
259 <input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
260 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
261 <a href="#" onclick=" additionalInformation('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.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
263 <input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
264 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
265 <a href="#" onclick=" additionalInformation('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.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
267 <input type="submit" name="submit" value="Save" />
268 <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('newHoliday');hidePanel('information')" />
273 <!-- *************************************************************************************** -->
274 <!-- ****** END OF FLAT PANELS ****** -->
275 <!-- *************************************************************************************** -->
277 <!-- ************************************************************************************** -->
278 <!-- ****** MAIN SCREEN CODE ****** -->
279 <!-- ************************************************************************************** -->
280 <h2>Calendar information</h2>
281 <div id="calendar-container">
282 <script type="text/javascript">
283 /* Creates all the structures to deal with all diferents kinds of holidays */
284 var week_days = new Array();
285 var holidays = new Array();
286 var exception_holidays = new Array();
287 var day_month_holidays = new Array();
288 var hola= "<!-- TMPL_VAR NAME="code" -->";
289 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
290 week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
292 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
293 holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
295 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
296 exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
298 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
299 day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
302 /* This function gives css clases to each kind of day */
303 function dateStatusHandler(date) {
304 var day = date.getDate();
305 var month = date.getMonth() + 1;
306 var year = date.getFullYear();
307 var weekDay = date.getDay();
308 var dayMonth = month + '/' + day;
309 var dateString = year + '/' + month + '/' + day;
310 if (exception_holidays[dateString] != null) {
312 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
313 return 'repeatableday';
314 } else if (holidays[dateString] != null) {
321 /* This function is in charge of showing the correct panel considering the kind of holiday */
322 function dateChanged(calendar) {
323 var day = calendar.date.getDate();
324 var month = calendar.date.getMonth() + 1;
325 var year = calendar.date.getFullYear();
326 var weekDay = calendar.date.getDay();
327 var dayName = calendar.date.print('%A');
328 var dayMonth = month + '/' + day;
329 var dateString = year + '/' + month + '/' + day;
330 if (calendar.dateClicked) {
331 if (holidays[dateString] != null) {
332 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description);
333 } else if (exception_holidays[dateString] != null) {
334 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description);
335 } else if (week_days[weekDay] != null) {
336 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description);
337 } else if (day_month_holidays[dayMonth] != null) {
338 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description);
340 newHoliday(dayName, day, month, year, weekDay);
346 flat : "calendar-container",
347 flatCallback : dateChanged,
348 dateStatusFunc : dateStatusHandler
353 <div id="holiday-list">
354 <!-- Exceptions First -->
355 <!-- this will probably always have the least amount of data -->
356 <!-- TMPL_IF NAME="EXCEPTION_HOLIDAYS_LOOP" -->
358 <table id="holidayexceptions">
360 <th class="exception">Date</th>
361 <th class="exception">Title</th>
362 <th class="exception">Description</th>
366 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
368 <td><!-- TMPL_VAR NAME="DATE" --></td>
369 <td><!-- TMPL_VAR NAME="TITLE" --></td>
370 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
377 <!--TMPL_IF NAME="WEEK_DAYS_LOOP" -->
378 <h3>Weekly - Repeatable Holidays</h3>
379 <table id="holidayweeklyrepeatable">
382 <th class="repeatableday">Day of Week</th>
383 <th class="repeatableday">Title</th>
384 <th class="repeatableday">Description</th>
388 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
391 <script type="text/javascript">
392 document.write(weekdays[ <!-- TMPL_VAR NAME="KEY" -->]);
395 <td><!-- TMPL_VAR NAME="TITLE" --></td>
396 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
403 <!-- TMPL_IF NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
404 <h3>Yearly - Repeatable Holidays</h3>
405 <table id="holidaysyearlyrepeatable">
408 <!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
409 <th class="repeatableday">Day/Month</th>
411 <th class="repeatableday">Month/Day</th>
413 <th class="repeatableday">Title</th>
414 <th class="repeatableday">Description</th>
418 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
420 <td><!-- TMPL_VAR NAME="DATE" --></td>
421 <td><!-- TMPL_VAR NAME="TITLE" --></td>
422 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
429 <!-- TMPL_IF NAME="HOLIDAYS_LOOP" -->
430 <h3>Unique Holidays</h3>
431 <table id="holidaysunique">
434 <th class="holiday">Date</th>
435 <th class="holiday">Title</th>
436 <th class="holiday">Description</th>
440 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
442 <td><!-- TMPL_VAR NAME="DATE" --></td>
443 <td><!-- TMPL_VAR NAME="TITLE" --></td>
444 <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
455 <div class="yui-b noprint">
456 <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
459 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->