4e85967f7b4e3c116bda4e99b298676b399a1d19
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / holidays.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Tools &rsaquo; Calendar</title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
5 <script language="JavaScript" type="text/javascript">
6 //<![CDATA[
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;
15         }
16
17         var mouseXMax = 0;
18         var mouseYMax = 0;
19         var mouseX = 0;
20         var mouseY = 0;
21
22         function captureMousePosition(e) {
23             if (document.layers) {
24                     mouseX = e.pageX;
25                         mouseY = e.pageY;
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) {
34                 mouseX = e.pageX;
35                     mouseY = e.pageY;
36                 mouseXMax = window.innerWidth + window.pageXOffset;
37                 mouseYMax = window.innerHeight + window.pageYOffset;
38             }
39         } 
40
41         function holidayOperation(formObject, opType) {
42                 var op = document.getElementsByName('operation');
43                 op[0].value = opType;
44                 formObject.submit();
45         }
46
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;
59                 
60                 if (exceptionPosibility == 1) {
61                         document.getElementById('exceptionPosibility').style.display = 'inline';
62                 } else {
63                         document.getElementById('exceptionPosibility').style.display = 'none';
64                 }
65         }
66
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);
77         }
78
79         function hidePanel(aPanelName) {
80                 $("#"+aPanelName).slideUp("fast");
81         }
82
83         function changeBranch () {
84                 var branch = $("#branch option:selected").val();
85                 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "<!-- TMPL_VAR NAME='calendardate' -->";
86         }
87
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);
97                 }
98                 paragraph.appendChild(info);
99         }
100
101         function Help() {
102                 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
103         }
104         $(document).ready(function() {
105                 $("#branch").change(function(){
106                         changeBranch();
107                 });
108                 $("#holidayexceptions").tablesorter({
109                   sortList: [[0,0]], widgets: ['zebra']
110                 });
111                 $("#holidayweeklyrepeatable").tablesorter({
112                   sortList: [[0,0]], widgets: ['zebra']
113                 });
114                 $("#holidaysyearlyrepeatable").tablesorter({
115                   sortList: [[0,0]], widgets: ['zebra']
116                 });
117                 $("#holidaysunique").tablesorter({
118                   sortList: [[0,0]], widgets: ['zebra']
119                 });
120         });
121 //]]>
122 </script>
123 <style type="text/css">
124 .normalday { background-color :  #EDEDED; color :  Black; border : 1px solid #000000; }
125 .exception { background-color :  #EDEDED; color :  Black; border : 1px solid #000000; }
126 .holiday {  background-color :  red; color :  Black;  border : 1px solid #000000; }
127 .repeatableday {  background-color :  yellow; color :  Black;  border : 1px solid #000000; }
128 .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; }
129 .panel { z-index : 1; width : 500px; display : none; border : 1px solid #000000; padding : 3px; /* position: absolute; */ background-color: #CCCCCC; }
130 div.dmy { display:inline; }
131 .blacklabel, div.dmy input { background-color:#FFFFFF; color:Black; font-size:10px; }
132 h1 select { width: 20em; }
133 </style>
134 </head>
135 <body>
136 <!-- TMPL_INCLUDE NAME="header.inc" -->
137 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
138
139 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Calendar</div>
140
141 <div id="doc3" class="yui-t2">
142    
143    <div id="bd">
144         <div id="yui-main">
145         <div class="yui-b">
146
147
148
149
150 <!-- *************************************************************************************** -->
151 <!-- ******                     START OF INFORMATION PANEL                            ****** -->
152 <!-- *************************************************************************************** -->
153
154 <div class="information" style="position:absolute" id="information" onclick=" hidePanel('information')">
155         <table>
156                 <tr>
157                         <td>
158                                 <p id="explanation" style="display:inline;align:justify"></p>
159                         </td>
160                 </tr>
161         </table>
162 </div>
163
164 <!-- ************************************************************************************** -->
165 <!-- ******                      END OF INFORMATION PANEL                            ****** -->
166 <!-- ************************************************************************************** -->
167
168 <h1>Define the holidays for :</h1>
169         <label for="branch">Select a library :</label>
170             <select id="branch" name="branch">
171                 <!-- TMPL_LOOP NAME="branchloop" -->
172                     <!-- TMPL_IF NAME="selected" -->
173                         <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
174                     <!-- TMPL_ELSE -->
175                         <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
176                     <!-- /TMPL_IF -->
177                 <!-- /TMPL_LOOP -->
178             </select>
179         <ul>
180                 <li>Search in the calendar the day you want to set as holiday.</li>
181                 <li>Complete the information in the right area.</li>
182                 <li>Once you finish the steps above, click Save.</li>
183         </ul>
184         <p>
185                 <span class="normalday">Working day</span>
186                 <span class="holiday">Unique holiday</span>
187                 <span class="repeatableday">Repeatable holiday</span>
188                 <span class="exception">Holiday exception</span>
189         </p>
190         
191         <!-- ******************************** FLAT PANELS ******************************************* -->
192         <!-- *****           Makes all the flat panel to deal with holidays                     ***** -->
193         <!-- **************************************************************************************** -->
194
195         <!-- ********************** Panel for showing already loaded holidays *********************** -->
196         <div class="panel" id="showHoliday">
197                 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
198                         <h2>Edit this holiday</h2>
199                         <p>
200                                 <label for="showBranchName">Library</label>
201                                 <input type="text" size="20" id="showBranchName" name="showBranchName" readonly="readonly" class="blacklabel" />
202                         </p>
203                         <p>
204                                 <label for="showDayname">Day name</label>
205                                 <input type="text" size="20" id="showDayname" name="showDayname" readonly="readonly" class="blacklabel" />
206                                 <input type="hidden" name="showWeekday" />
207                         </p>
208                         <div class="dmy">
209                                 <label for="showDay">Day</label> <input type="text" size="2" id="showDay" name="showDay" readonly="readonly" />
210                                 <label for="showMonth">Month</label> <input type="text" size="2" id="showMonth" name="showMonth" readonly="readonly" />
211                                 <label for="showYear">Year</label> <input type="text" size="4" id="showYear" name="showYear" readonly="readonly" />             
212                         </div>
213                     <p><label for="showDescription">Description:</label>
214                                 <br />
215                                 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>    
216                         </p>
217                         <div id="exceptionPosibility" style="position:static">
218                                 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception to this holiday.</label>
219                                 <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>
220                         </div>
221                         <input type="radio" name="showOperation" id="showOperationDel" value="delete" checked="checked" /> <label for="showOperationDel">Delete this holiday</label>.
222                         <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>
223                         <p>
224                                 <input type="submit" name="submit" value="Save" />
225                                 <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('showHoliday');hidePanel('information')" />
226                         </p>
227                 </form>
228         </div>
229
230         <!-- ***************************** Panel to deal with new holidays **********************  -->
231         <div class="panel" id="newHoliday">
232                 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
233                                 <input type="hidden" name="branchCodes" id="branchCodes" value="<!-- TMPL_VAR NAME="branchcodes" -->" /> 
234                         <h2>Add new holiday</h2>
235                         <p>
236                                 <label for="newBranchName">Library</label>
237                                 <input type="text" size="20" id="newBranchName" name="newBranchName" readonly="readonly" class="blacklabel" />
238                         </p>
239                         <p>
240                                 <label for="newDayname">Day name</label>
241                                 <input type="text" size="20" id="newDayname" name="newDayname" readonly="readonly" class="blacklabel" />
242                                 <input type="hidden" name="newWeekday" />
243                         </p>
244                         <div class="dmy">
245                                 <label for="newDay">Day</label> <input type="text" size="2" id="newDay" name="newDay" readonly="readonly" />
246                                 <label for="newMonth">Month</label> <input type="text" size="2" id="newMonth" name="newMonth"  readonly="readonly" />
247                                 <label for="newYear">Year</label> <input type="text" size="4" id="newYear" name="newYear" readonly="readonly" />
248                         </div>
249                         <p><label for="newDescription">Description:</label>
250                                 <br />
251                                 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
252                         </p>
253                                 <input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
254                                 <label for="newOperationOnce">Holiday only on this day</label>.
255                                 <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>
256                                 <br />
257                                 <input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
258                                 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
259                                 <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>
260                                 <br />
261                                 <input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
262                                 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
263                                 <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>
264                                 <p>
265                                 <input type="checkbox" name="allBranches" id="allBranches" />
266                                 <label for="allBranches">Copy to all locations</label>.
267                                 <a href="#" onclick=" additionalInformation('If checked, this holiday will be copied to all locations. If the holiday already exists for a location, no change is made.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
268                                 </p><p>
269                                         <input type="submit" name="submit" value="Save" />
270                                         <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('newHoliday');hidePanel('information')" />
271                                 </p>
272                 </form>
273         </div>
274
275         <!-- *************************************************************************************** -->
276         <!-- ******                          END OF FLAT PANELS                               ****** -->
277         <!-- *************************************************************************************** -->
278
279 <!-- ************************************************************************************** -->
280 <!-- ******                              MAIN SCREEN CODE                            ****** -->
281 <!-- ************************************************************************************** -->
282 <h2>Calendar information</h2>
283 <div id="calendar-container">
284 <script type="text/javascript">
285         /* Creates all the structures to deal with all diferents kinds of holidays */
286         var week_days = new Array();
287         var holidays = new Array();
288         var exception_holidays = new Array();
289         var day_month_holidays = new Array();
290         var hola= "<!-- TMPL_VAR NAME="code" -->";
291         <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
292         week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
293         <!-- /TMPL_LOOP -->
294         <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
295         holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
296         <!-- /TMPL_LOOP -->
297         <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
298         exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
299         <!-- /TMPL_LOOP -->
300         <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
301         day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
302         <!-- /TMPL_LOOP -->
303
304         /* This function gives css clases to each kind of day */
305         function dateStatusHandler(date) {
306                 var day = date.getDate();
307                 var month = date.getMonth() + 1;
308                 var year = date.getFullYear();
309                 var weekDay = date.getDay();
310                 var dayMonth = month + '/' + day;
311                 var dateString = year + '/' + month + '/' + day;
312                 if (exception_holidays[dateString] != null) {
313                         return 'exception';
314                 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
315                         return 'repeatableday';
316                 } else if (holidays[dateString] != null) {
317                         return 'holiday';
318                 } else {
319                         return 'normalday';
320                 }
321         }
322
323         /* This function is in charge of showing the correct panel considering the kind of holiday */
324         function dateChanged(calendar) {
325                 var day = calendar.date.getDate();
326                 var month = calendar.date.getMonth() + 1;
327                 var year = calendar.date.getFullYear();
328                 var weekDay = calendar.date.getDay();
329                 var dayName = calendar.date.print('%A');
330                 var dayMonth = month + '/' + day;
331                 var dateString = year + '/' + month + '/' + day;
332                 if (calendar.dateClicked) {
333                         if (holidays[dateString] != null) {
334                                 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title,  holidays[dateString].description);
335                         } else if (exception_holidays[dateString] != null) {
336                                 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description);
337                         } else if (week_days[weekDay] != null) {
338                                 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title,    week_days[weekDay].description);
339                         } else if (day_month_holidays[dayMonth] != null) {
340                                 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description);
341                         } else {
342                                 newHoliday(dayName, day, month, year, weekDay);
343                         }
344                 }
345         };
346         Calendar.setup(
347                 {
348                         flat : "calendar-container",
349                         flatCallback : dateChanged,
350                         date: "<!-- TMPL_VAR NAME='keydate' -->",
351                         dateStatusFunc : dateStatusHandler
352                 }
353         );
354 </script>
355
356 <div id="holiday-list">
357 <!-- Exceptions First -->
358 <!--   this will probably always have the least amount of data -->
359 <!-- TMPL_IF NAME="EXCEPTION_HOLIDAYS_LOOP" -->
360 <h3>Exceptions</h3>
361   <table id="holidayexceptions">
362 <thead><tr>
363   <th class="exception">Date</th>
364   <th class="exception">Title</th>
365   <th class="exception">Description</th>
366 </tr>
367 </thead>
368 <tbody>
369   <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
370   <tr>
371   <td><!-- TMPL_VAR NAME="DATE" --></td>
372   <td><!-- TMPL_VAR NAME="TITLE" --></td>
373   <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td> 
374   </tr>
375   <!-- /TMPL_LOOP --> 
376 </tbody>
377 </table>
378 <!-- /TMPL_IF -->
379
380 <!--TMPL_IF NAME="WEEK_DAYS_LOOP" -->
381 <h3>Weekly - Repeatable Holidays</h3>
382 <table id="holidayweeklyrepeatable">
383 <thead>
384 <tr>
385   <th class="repeatableday">Day of Week</th>
386   <th class="repeatableday">Title</th>
387   <th class="repeatableday">Description</th>
388 </tr>
389 </thead>
390 <tbody>
391   <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
392   <tr>
393   <td>
394 <script type="text/javascript">
395   document.write(weekdays[ <!-- TMPL_VAR NAME="KEY" -->]);
396 </script>
397   </td> 
398   <td><!-- TMPL_VAR NAME="TITLE" --></td> 
399   <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td> 
400   </tr>
401   <!-- /TMPL_LOOP --> 
402 </tbody>
403 </table>
404 <!-- /TMPL_IF -->
405
406 <!-- TMPL_IF NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
407 <h3>Yearly - Repeatable Holidays</h3>
408 <table id="holidaysyearlyrepeatable">
409 <thead>
410 <tr>
411   <!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
412   <th class="repeatableday">Day/Month</th>
413   <!-- TMPL_ELSE -->
414   <th class="repeatableday">Month/Day</th>
415   <!-- /TMPL_IF -->
416   <th class="repeatableday">Title</th>
417   <th class="repeatableday">Description</th>
418 </tr>
419 </thead>
420 <tbody>
421   <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
422   <tr>
423   <td><!-- TMPL_VAR NAME="DATE" --></td>
424   <td><!-- TMPL_VAR NAME="TITLE" --></td> 
425   <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td> 
426   </tr>
427   <!-- /TMPL_LOOP --> 
428 </tbody>
429 </table>
430 <!-- /TMPL_IF -->
431
432 <!-- TMPL_IF NAME="HOLIDAYS_LOOP" -->
433 <h3>Unique Holidays</h3>
434 <table id="holidaysunique">
435 <thead>
436 <tr>
437   <th class="holiday">Date</th>
438   <th class="holiday">Title</th>
439   <th class="holiday">Description</th>
440 </tr>
441 </thead>
442 <tbody>
443     <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
444 <tr>
445   <td><!-- TMPL_VAR NAME="DATE" --></td>
446   <td><!-- TMPL_VAR NAME="TITLE" --></td>
447   <td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
448 </tr>
449   <!-- /TMPL_LOOP --> 
450 </tbody>
451 </table>
452 <!-- /TMPL_IF -->
453 </div>
454 </div>
455 </div>
456 </div>
457 <div class="yui-b noprint">
458 <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
459 </div>
460 </div>
461 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->