Experimental XSLT-based display of results and details pages To enable, create two...
[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; Holidays</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                 
50                 var panel = document.getElementById('showHoliday');
51                 panel.style.display = 'inline';
52                 document.getElementById('newHoliday').style.display = 'none';
53                 panel.style.top = mouseYMax/2;
54                 panel.style.left = (mouseXMax/2) - 250;
55                 document.getElementById('showDayname').value = dayName;
56                 document.getElementById('showBranchName').value = document.getElementById('branch').value;
57                 document.getElementById('showDay').value = day;
58                 document.getElementById('showMonth').value = month;
59                 document.getElementById('showYear').value = year;
60                 document.getElementById('showDescription').value = description;
61                 document.getElementsByName('showWeekday')[0].value = weekDay;
62                 document.getElementById('showTitle').value = title;
63                 
64                 if (exceptionPosibility == 1) {
65                         document.getElementById('exceptionPosibility').style.display = 'inline';
66                 } else {
67                         document.getElementById('exceptionPosibility').style.display = 'none';
68                 }
69         }
70
71         // This function shows the "Add Holiday" panel //
72         function newHoliday (dayName, day, month, year, weekDay) {
73                 var panel = document.getElementById('newHoliday');
74                 panel.style.display = 'inline';
75                 document.getElementById('showHoliday').style.display = 'none';
76                 panel.style.top = mouseYMax/2;
77                 panel.style.left = (mouseXMax/2)  - 250;
78                 document.getElementById('newDayname').value = dayName;
79                 document.getElementById('newBranchName').value = document.getElementById('branch').value;
80                 document.getElementById('newDay').value = day;
81                 document.getElementById('newMonth').value = month;
82                 document.getElementById('newYear').value = year;
83                 document.getElementsByName('newWeekday')[0].value = weekDay;
84         }
85
86         function hidePanel(aPanelName) {
87                 document.getElementById(aPanelName).style.display = 'none';
88         }
89
90         function changeBranch () {
91                 var branch = $("#branch option:selected").val();
92                 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch;
93         }
94
95         function additionalInformation (anExplanation) {
96                 var panel = document.getElementById('information');
97                 var paragraph = document.getElementById('explanation');
98                 panel.style.display = 'inline'
99                 panel.style.top = mouseY;
100                 panel.style.left = mouseX;
101                 var info = document.createTextNode(anExplanation);
102                 if (paragraph.hasChildNodes()) {
103                         paragraph.removeChild(paragraph.lastChild);
104                 }
105                 paragraph.appendChild(info);
106         }
107
108         function Help() {
109                 newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
110         }
111         $(document).ready(function() {
112                 $("#branch").change(function(){
113                         changeBranch();
114                 });
115         });
116 //]]>
117 </script>
118
119 <style type="text/css">
120 .normalday { 
121         background-color :  #EDEDED;
122         color :  Black; 
123         border : 1px solid #000000;
124 }
125
126 .exception {
127         background-color :  #EDEDED;
128         color :  Black;                 
129         border : 1px solid #000000;
130 }
131
132 .holiday { 
133         background-color :  red;
134         color :  Black; 
135         border : 1px solid #000000;
136 }
137
138 .repeatableday { 
139         background-color :  yellow;
140         color :  Black; 
141         border : 1px solid #000000;
142 }
143
144 .information {
145         z-index : 1;
146         background-color :  #DCD2F1;
147         width : 300px;
148         display : none;
149         border : 1px solid #000000;
150         color :  #000000;
151         font-size :  8pt;
152         font-weight :  bold;
153     background-color :  #FFD700;
154         cursor :  pointer;
155         padding : 2px;
156 }
157
158 .panel {
159         z-index : 1;
160         width : 500px;
161         display : none;
162         border : 1px solid #000000;
163         padding : 3px;
164         position: absolute;
165         background-color: #CCCCCC;
166 }
167
168 div.dmy {
169         display:inline;
170 }
171
172 .blacklabel, div.dmy input {
173         background-color:#FFFFFF;
174         color:Black;
175         font-size:10px;
176 }
177
178 </style>
179 </head>
180 <body>
181 <!-- TMPL_INCLUDE NAME="header.inc" -->
182 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
183
184 <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; Holidays</div>
185
186 <div id="doc3" class="yui-t2">
187    
188    <div id="bd">
189         <div id="yui-main">
190         <div class="yui-b">
191
192
193 <!-- ******************************** FLAT PANELS ******************************************* -->
194 <!-- *****           Makes all the flat panel to deal with holidays                     ***** -->
195 <!-- **************************************************************************************** -->
196
197 <!-- ********************** Panel for showing already loaded holidays *********************** -->
198 <div class="panel" id="showHoliday">
199         <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
200                 <h2>Edit this holiday</h2>
201                 <p>
202                         <label for="showBranchName">Library</label>
203                         <input type="text" size="20" id="showBranchName" name="showBranchName" readonly="readonly" class="blacklabel" />
204                 </p>
205                 <p>
206                         <label for="showDayname">Day name</label>
207                         <input type="text" size="20" id="showDayname" name="showDayname" readonly="readonly" class="blacklabel" />
208                         <input type="hidden" name="showWeekday" />
209                 </p>
210                 <div class="dmy">
211                         <label for="showDay">Day</label> <input type="text" size="2" id="showDay" name="showDay" readonly="readonly" />
212                         <label for="showMonth">Month</label> <input type="text" size="2" id="showMonth" name="showMonth" readonly="readonly" />
213                         <label for="showYear">Year</label> <input type="text" size="4" id="showYear" name="showYear" readonly="readonly" />             
214                 </div>
215             <p><label for="showDescription">Description:</label>
216                         <br />
217                         <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>    
218                 </p>
219                 <div id="exceptionPosibility" style="position:static">
220                         <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception to this holiday.</label>
221                         <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>
222                 </div>
223                 <input type="radio" name="showOperation" id="showOperationDel" value="delete" checked="checked" /> <label for="showOperationDel">Delete this holiday</label>.
224                 <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>
225                 <p>
226                         <input type="submit" name="submit" value="Save" />
227                         <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('showHoliday');hidePanel('information')" />
228                 </p>
229         </form>
230 </div>
231
232 <!-- ***************************** Panel to deal with new holidays **********************  -->
233 <div class="panel" id="newHoliday">
234         <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
235                 <h2>Add new holiday</h2>
236                 <p>
237                         <label for="newBranchName">Library</label>
238                         <input type="text" size="20" id="newBranchName" name="newBranchName" readonly="readonly" class="blacklabel" />
239                 </p>
240                 <p>
241                         <label for="newDayname">Day name</label>
242                         <input type="text" size="20" id="newDayname" name="newDayname" readonly="readonly" class="blacklabel" />
243                         <input type="hidden" name="newWeekday" />
244                 </p>
245                 <div class="dmy">
246                         <label for="newDay">Day</label> <input type="text" size="2" id="newDay" name="newDay" readonly="readonly" />
247                         <label for="newMonth">Month</label> <input type="text" size="2" id="newMonth" name="newMonth"  readonly="readonly" />
248                         <label for="newYear">Year</label> <input type="text" size="4" id="newYear" name="newYear" readonly="readonly" />
249                 </div>
250                 <p><label for="newDescription">Description:</label>
251                         <br />
252                         <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
253                 </p>
254                         <input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
255                         <label for="newOperationOnce">Holiday only on this day</label>.
256                         <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>
257                         <br />
258                         <input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
259                         <label for="newOperationDay">Holiday repeated every same day of the week</label>.
260                         <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>
261                         <br />
262                         <input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
263                         <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
264                         <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>
265                         <p>
266                                 <input type="submit" name="submit" value="Save" />
267                                 <input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('newHoliday');hidePanel('information')" />
268                         </p>
269         </form>
270 </div>
271
272 <!-- *************************************************************************************** -->
273 <!-- ******                          END OF FLAT PANELS                               ****** -->
274 <!-- *************************************************************************************** -->
275
276 <!-- *************************************************************************************** -->
277 <!-- ******                     START OF INFORMATION PANEL                            ****** -->
278 <!-- *************************************************************************************** -->
279
280 <div class="information" style="position:absolute" id="information" onclick=" hidePanel('information')">
281         <table>
282                 <tr>
283                         <td>
284                                 <p id="explanation" style="display:inline;align:justify"></p>
285                         </td>
286                 </tr>
287         </table>
288 </div>
289
290 <!-- ************************************************************************************** -->
291 <!-- ******                      END OF INFORMATION PANEL                            ****** -->
292 <!-- ************************************************************************************** -->
293
294 <h1>Define the holidays for branch <!-- TMPL_VAR name="BRANCHES" --></h1>
295         <ul>
296                 <li>Search in the calendar the day you want to set as holiday.</li>
297                 <li>Complete the information in the right area.</li>
298                 <li>Once you finish the steps above, click Save.</li>
299         </ul>
300         <p>
301                 <span class="normalday">Working day</span>
302                 <span class="holiday">Unique holiday</span>
303                 <span class="repeatableday">Repeatable holiday</span>
304                 <span class="exception">Holiday exception</span>
305         </p>
306
307 <!-- ************************************************************************************** -->
308 <!-- ******                              MAIN SCREEN CODE                            ****** -->
309 <!-- ************************************************************************************** -->
310 <h2>Calendar information</h2>
311 <div id="calendar-container">
312 <script type="text/javascript">
313         /* Creates all the structures to deal with all diferents kinds of holidays */
314         var week_days = new Array();
315         var holidays = new Array();
316         var exception_holidays = new Array();
317         var day_month_holidays = new Array();
318         var hola= "<!-- TMPL_VAR NAME="code" -->";
319         <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
320         week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
321         <!-- /TMPL_LOOP -->
322         <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
323         holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
324         <!-- /TMPL_LOOP -->
325         <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
326         exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
327         <!-- /TMPL_LOOP -->
328         <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
329         day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
330         <!-- /TMPL_LOOP -->
331
332         /* This function gives css clases to each kind of day */
333         function dateStatusHandler(date) {
334                 var day = date.getDate();
335                 var month = date.getMonth() + 1;
336                 var year = date.getFullYear();
337                 var weekDay = date.getDay();
338                 var dayMonth = month + '/' + day;
339                 var dateString = year + '/' + month + '/' + day;
340                 if (exception_holidays[dateString] != null) {
341                         return 'exception';
342                 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
343                         return 'repeatableday';
344                 } else if (holidays[dateString] != null) {
345                         return 'holiday';
346                 } else {
347                         return 'normalday';
348                 }
349         }
350
351         /* This function is in charge of showing the correct panel considering the kind of holiday */
352         function dateChanged(calendar) {
353                 var day = calendar.date.getDate();
354                 var month = calendar.date.getMonth() + 1;
355                 var year = calendar.date.getFullYear();
356                 var weekDay = calendar.date.getDay();
357                 var dayName = calendar.date.print('%A');
358                 var dayMonth = month + '/' + day;
359                 var dateString = year + '/' + month + '/' + day;
360                 if (calendar.dateClicked) {
361                         if (holidays[dateString] != null) {
362                                 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title,  holidays[dateString].description);
363                         } else if (exception_holidays[dateString] != null) {
364                                 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description);
365                         } else if (week_days[weekDay] != null) {
366                                 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title,    week_days[weekDay].description);
367                         } else if (day_month_holidays[dayMonth] != null) {
368                                 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description);
369                         } else {
370                                 newHoliday(dayName, day, month, year, weekDay);
371                         }
372                 }
373         };
374         Calendar.setup(
375                 {
376                         flat : "calendar-container",
377                         flatCallback : dateChanged,
378                         dateStatusFunc : dateStatusHandler
379                 }
380         );
381 </script>
382 </div>
383 </div>
384 </div>
385 <div class="yui-b noprint">
386 <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
387 </div>
388 </div>
389 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->