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 language="JavaScript" type="text/javascript">
7 // Captura el evento onmousemove para cualquier navegador
8 if (document.layers) { // Netscape
9 document.captureEvents(Event.MOUSEMOVE);
10 document.onmousemove = captureMousePosition;
11 } else if (document.all) { // Internet Explorer
12 document.onmousemove = captureMousePosition;
13 } else if (document.getElementById) { // Netcsape 6
14 document.onmousemove = captureMousePosition;
22 function captureMousePosition(e) {
23 if (document.layers) {
26 mouseXMax = window.innerWidth + window.pageXOffset;
27 mouseYMax = window.innerHeight + window.pageYOffset;
28 } else if (document.all) {
29 mouseX = window.event.x + document.body.scrollLeft;
30 mouseY = window.event.y + document.body.scrollTop;
31 mouseXMax = document.body.clientWidth + document.body.scrollLeft;
32 mouseYMax = document.body.clientHeight + document.body.scrollTop;
33 } else if (document.getElementById) {
36 mouseXMax = window.innerWidth + window.pageXOffset;
37 mouseYMax = window.innerHeight + window.pageYOffset;
41 function holidayOperation(formObject, opType) {
42 var op = document.getElementsByName('operation');
47 // This function shows the "Show Holiday" panel //
48 function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description) {
49 $("#newHoliday").slideUp("fast");
50 $("#showHoliday").slideDown("fast");
51 document.getElementById('showDayname').value = dayName;
52 document.getElementById('showBranchName').value = document.getElementById('branch').value;
53 document.getElementById('showDay').value = day;
54 document.getElementById('showMonth').value = month;
55 document.getElementById('showYear').value = year;
56 document.getElementById('showDescription').value = description;
57 document.getElementsByName('showWeekday')[0].value = weekDay;
58 document.getElementById('showTitle').value = title;
60 if (exceptionPosibility == 1) {
61 document.getElementById('exceptionPosibility').style.display = 'inline';
63 document.getElementById('exceptionPosibility').style.display = 'none';
67 // This function shows the "Add Holiday" panel //
68 function newHoliday (dayName, day, month, year, weekDay) {
69 $("#showHoliday").slideUp("fast");
70 $("#newHoliday").slideDown("fast");
71 $("#newDayname").val(dayName);
72 $("#newBranchName").val($('#branch').val());
73 $("#newDay").val(day);
74 $("#newMonth").val(month);
75 $("#newYear").val(year);
76 $("#newWeekday")[0].val(weekDay);
79 function hidePanel(aPanelName) {
80 $("#"+aPanelName).slideUp("fast");
83 function changeBranch () {
84 var branch = $("#branch option:selected").val();
85 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch;
88 function additionalInformation (anExplanation) {
89 var panel = document.getElementById('information');
90 var paragraph = document.getElementById('explanation');
91 panel.style.display = 'inline'
92 panel.style.top = mouseY;
93 panel.style.left = mouseX;
94 var info = document.createTextNode(anExplanation);
95 if (paragraph.hasChildNodes()) {
96 paragraph.removeChild(paragraph.lastChild);
98 paragraph.appendChild(info);
102 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
104 $(document).ready(function() {
105 $("#branch").change(function(){
111 <style type="text/css">
112 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #000000; }
113 .exception { background-color : #EDEDED; color : Black; border : 1px solid #000000; }
114 .holiday { background-color : red; color : Black; border : 1px solid #000000; }
115 .repeatableday { background-color : yellow; color : Black; border : 1px solid #000000; }
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; width : 500px; display : none; border : 1px solid #000000; padding : 3px; /* position: absolute; */ background-color: #CCCCCC; }
118 div.dmy { display:inline; }
119 .blacklabel, div.dmy input { background-color:#FFFFFF; color:Black; font-size:10px; }
120 h1 select { width: 20em; }
124 <!-- TMPL_INCLUDE NAME="header.inc" -->
125 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
127 <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>
129 <div id="doc3" class="yui-t2">
138 <!-- *************************************************************************************** -->
139 <!-- ****** START OF INFORMATION PANEL ****** -->
140 <!-- *************************************************************************************** -->
142 <div class="information" style="position:absolute" id="information" onclick=" hidePanel('information')">
146 <p id="explanation" style="display:inline;align:justify"></p>
152 <!-- ************************************************************************************** -->
153 <!-- ****** END OF INFORMATION PANEL ****** -->
154 <!-- ************************************************************************************** -->
156 <h1>Define the holidays for :</h1>
157 <label for="branch">Select a library :</label>
158 <select id="branch" name="branch">
159 <!-- TMPL_LOOP NAME="branchloop" -->
160 <!-- TMPL_IF NAME="selected" -->
161 <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
163 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
168 <li>Search in the calendar the day you want to set as holiday.</li>
169 <li>Complete the information in the right area.</li>
170 <li>Once you finish the steps above, click Save.</li>
173 <span class="normalday">Working day</span>
174 <span class="holiday">Unique holiday</span>
175 <span class="repeatableday">Repeatable holiday</span>
176 <span class="exception">Holiday exception</span>
179 <!-- ******************************** FLAT PANELS ******************************************* -->
180 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
181 <!-- **************************************************************************************** -->
183 <!-- ********************** Panel for showing already loaded holidays *********************** -->
184 <div class="panel" id="showHoliday">
185 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
186 <h2>Edit this holiday</h2>
188 <label for="showBranchName">Library</label>
189 <input type="text" size="20" id="showBranchName" name="showBranchName" readonly="readonly" class="blacklabel" />
192 <label for="showDayname">Day name</label>
193 <input type="text" size="20" id="showDayname" name="showDayname" readonly="readonly" class="blacklabel" />
194 <input type="hidden" name="showWeekday" />
197 <label for="showDay">Day</label> <input type="text" size="2" id="showDay" name="showDay" readonly="readonly" />
198 <label for="showMonth">Month</label> <input type="text" size="2" id="showMonth" name="showMonth" readonly="readonly" />
199 <label for="showYear">Year</label> <input type="text" size="4" id="showYear" name="showYear" readonly="readonly" />
201 <p><label for="showDescription">Description:</label>
203 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
205 <div id="exceptionPosibility" style="position:static">
206 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception to this holiday.</label>
207 <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>
209 <input type="radio" name="showOperation" id="showOperationDel" value="delete" checked="checked" /> <label for="showOperationDel">Delete this holiday</label>.
210 <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>
212 <input type="submit" name="submit" value="Save" />
213 <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('showHoliday');hidePanel('information')" />
218 <!-- ***************************** Panel to deal with new holidays ********************** -->
219 <div class="panel" id="newHoliday">
220 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
221 <h2>Add new holiday</h2>
223 <label for="newBranchName">Library</label>
224 <input type="text" size="20" id="newBranchName" name="newBranchName" readonly="readonly" class="blacklabel" />
227 <label for="newDayname">Day name</label>
228 <input type="text" size="20" id="newDayname" name="newDayname" readonly="readonly" class="blacklabel" />
229 <input type="hidden" name="newWeekday" />
232 <label for="newDay">Day</label> <input type="text" size="2" id="newDay" name="newDay" readonly="readonly" />
233 <label for="newMonth">Month</label> <input type="text" size="2" id="newMonth" name="newMonth" readonly="readonly" />
234 <label for="newYear">Year</label> <input type="text" size="4" id="newYear" name="newYear" readonly="readonly" />
236 <p><label for="newDescription">Description:</label>
238 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
240 <input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
241 <label for="newOperationOnce">Holiday only on this day</label>.
242 <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>
244 <input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
245 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
246 <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>
248 <input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
249 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
250 <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>
252 <input type="submit" name="submit" value="Save" />
253 <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('newHoliday');hidePanel('information')" />
258 <!-- *************************************************************************************** -->
259 <!-- ****** END OF FLAT PANELS ****** -->
260 <!-- *************************************************************************************** -->
262 <!-- ************************************************************************************** -->
263 <!-- ****** MAIN SCREEN CODE ****** -->
264 <!-- ************************************************************************************** -->
265 <h2>Calendar information</h2>
266 <div id="calendar-container">
267 <script type="text/javascript">
268 /* Creates all the structures to deal with all diferents kinds of holidays */
269 var week_days = new Array();
270 var holidays = new Array();
271 var exception_holidays = new Array();
272 var day_month_holidays = new Array();
273 var hola= "<!-- TMPL_VAR NAME="code" -->";
274 <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
275 week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
277 <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
278 holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
280 <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
281 exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
283 <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
284 day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
287 /* This function gives css clases to each kind of day */
288 function dateStatusHandler(date) {
289 var day = date.getDate();
290 var month = date.getMonth() + 1;
291 var year = date.getFullYear();
292 var weekDay = date.getDay();
293 var dayMonth = month + '/' + day;
294 var dateString = year + '/' + month + '/' + day;
295 if (exception_holidays[dateString] != null) {
297 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
298 return 'repeatableday';
299 } else if (holidays[dateString] != null) {
306 /* This function is in charge of showing the correct panel considering the kind of holiday */
307 function dateChanged(calendar) {
308 var day = calendar.date.getDate();
309 var month = calendar.date.getMonth() + 1;
310 var year = calendar.date.getFullYear();
311 var weekDay = calendar.date.getDay();
312 var dayName = calendar.date.print('%A');
313 var dayMonth = month + '/' + day;
314 var dateString = year + '/' + month + '/' + day;
315 if (calendar.dateClicked) {
316 if (holidays[dateString] != null) {
317 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description);
318 } else if (exception_holidays[dateString] != null) {
319 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description);
320 } else if (week_days[weekDay] != null) {
321 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description);
322 } else if (day_month_holidays[dayMonth] != null) {
323 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description);
325 newHoliday(dayName, day, month, year, weekDay);
331 flat : "calendar-container",
332 flatCallback : dateChanged,
333 dateStatusFunc : dateStatusHandler
340 <div class="yui-b noprint">
341 <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
344 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->