Moving inline script blocks to <head> where possible
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / holidays.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <!-- TMPL_INCLUDE NAME="holidays-top.inc" -->
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 </head>
5 <body>
6 <!-- TMPL_INCLUDE NAME="menus.inc" -->
7 <!-- TMPL_INCLUDE NAME="menu-tools.inc" -->
8
9 <!-- ******************************** FLAT PANELS ******************************************* -->
10 <!-- *****           Makes all the flat panel to deal with holidays                     ***** -->
11 <!-- **************************************************************************************** -->
12
13 <!-- ********************** Panel for showing already loaded holidays *********************** -->
14 <div class="panel" style="position:absolute;background-color:#CCCCCC" id="showHoliday">
15         <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post" style="display:inline">
16                 <p onclick=" hidePanel('showHoliday');hidePanel('information')" style="cursor:pointer">
17                         Hide Details
18                         <img src="<!-- TMPL_VAR NAME="themelang" -->/images/signClose.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle">
19                 </p>
20                 <p>
21                         <label>Day name</label>
22                         <input type="text" size="20" id="showDayname" name="showDayname" readonly
23                                                    style="background-color:#FFFFFF;color:Black;font-size:10px;" />
24                         <input type="hidden" name="showWeekday" />
25                 </p>
26                 <p>
27                         <label>Library</label>
28                         <input type="text" size="20" id="showBranchName" name="showBranchName" readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
29                 </p>
30                 <div style="display:inline">
31                         Day <input type="text" size="2" id="showDay" name="showDay" readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
32                         Month <input type="text" size="2" id="showMonth" name="showMonth" readonly
33                                                         style="background-color:#FFFFFF;color:Black;font-size:10px;" />
34                         Year <input type="text" size="4" id="showYear" name="showYear" readonly
35                                                        style="background-color:#FFFFFF;color:Black;font-size:10px;" />          
36                 </div>
37             <p>Add a description to holiday day.</p>
38                 <p>
39                         <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>    
40                 </p>
41                 <div id="exceptionPosibility" style="position:static">
42                         <input type="radio" name="showOperation" value="exception"> Generate an exception to this holiday
43                         <img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0"   style="vertical-align:middle;cursor:pointer"
44                                         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.')">
45                         <br />
46                 </div>
47                 <input type="radio" name="showOperation" value="delete" checked="checked"> Delete this holiday.
48                 <img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer"
49                         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.')">
50                 <p>
51                         <input type="submit" name="submit" id="submit" value="Save">
52                         <input type="button" name="cancel2" id="cancel2" value="Cancel" onclick=" hidePanel('showHoliday');hidePanel('information')">
53                 </p>
54         </form>
55 </div>
56
57 <!-- ***************************** Panel to deal with new holidays **********************  -->
58 <div class="panel" style="position:absolute;background-color:#CCCCCC" id="newHoliday">
59         <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post" style="display:inline">
60                 <h2>
61                         Add new holiday
62                 </h2>
63                 <p>
64                         <label>Day name</label>
65                         <input type="text" size="20" id="newDayname" name="newDayname" readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
66                         <input type="hidden" name="newWeekday" />
67                 </p>
68                 <p>
69                         <label>Library</label>
70                         <input type="text" size="20" id="newBranchName" name="newBranchName" readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
71                 </p>
72                 <div style="display:inline">
73                         Day <input type="text" size="2" id="newDay" name="newDay" readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
74                         Month <input type="text" size="2" id="newMonth" name="newMonth"  readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
75                         Year <input type="text" size="4" id="newYear" name="newYear" readonly="readonly" style="background-color:#FFFFFF;color:Black;font-size:10px;" />
76                 </div>
77                 <p>
78                         <label>Add a description to holiday day</label>
79                         <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
80                 </p>
81                         <input type="radio" name="newOperation" value="holiday" checked="checked"> Holiday only on this day.
82                         <img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer"
83                         onclick=" additionalInformation('This will take this date to make it holiday just for this time. Through this option, you can set a single holiday. For example, suppose you are in August 1st, and only for this year you want to make it holiday.')">
84                         <br />
85                         <input type="radio" name="newOperation" value="weekday"> Holiday repeated every same day of the week
86                         <img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer" onclick=" additionalInformation('This will take this week day and make it holiday. No matter what date it is, this option will repeat this rule for every week. For example, if this date correspond to a saturday, every saturdays will be holidays.')">
87                         <br />
88                         <input type="radio" name="newOperation" value="repeatable">Holiday repeated yearly on the same date.
89                         <img src="<!-- TMPL_VAR NAME="themelang" -->/images/more.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle;cursor:pointer" 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, if this date correspond to a August 1st, every August 1st will be holiday, no matter what year you are.')">
90                         <p>
91                                 <input type="submit" name="submit" id="submit" value="Save" />
92                                 <input type="button" name="cancel2" id="cancel2" value="Cancel" onclick=" hidePanel('newHoliday');hidePanel('information')">
93                         </p>
94         </form>
95 </div>
96
97
98 <!-- *************************************************************************************** -->
99 <!-- ******                          END OF FLAT PANELS                               ****** -->
100 <!-- *************************************************************************************** -->
101
102
103
104 <!-- *************************************************************************************** -->
105 <!-- ******                     START OF INFORMATION PANEL                            ****** -->
106 <!-- *************************************************************************************** -->
107
108 <div class="information" style="position:absolute" id="information" onclick=" hidePanel('information')" onblur="javascript: hidePanel('information')">
109         <table>
110                 <tr>
111                         <td valign="top">
112                                 <img src="<!-- TMPL_VAR NAME="themelang" -->/images/info.gif" hspace="0" vspace="0" border="0" style="vertical-align:middle">
113                         </td>
114                         <td valign="top">
115                                 <p id="explanation" style="display:inline;align:justify"></p>
116                         </td>
117                 </tr>
118         </table>
119 </div>
120
121 <!-- ************************************************************************************** -->
122 <!-- ******                      END OF INFORMATION PANEL                            ****** -->
123 <!-- ************************************************************************************** -->
124
125
126
127 <h1>Define the holidays for branch <!-- TMPL_VAR name="BRANCHES" --></h1>
128         <ul>
129                 <li>Search in the calendar the day you want to set as holiday.</li>
130                 <li>Complete the information in the right area.</li>
131                 <li>Once you finish the steps above, click Save.</li>
132         </ul>
133         <p>
134                 <span class="normalday">Working day</span>
135                 <span class="holiday">Unique holiday</span>
136                 <span class="repeatableday">Repeatable holiday</span>
137                 <span class="exception">Holiday exception</span>
138         </p>
139
140 <!-- ************************************************************************************** -->
141 <!-- ******                              MAIN SCREEN CODE                            ****** -->
142 <!-- ************************************************************************************** -->
143 <h2>Calendar information</h2>
144 <div id="calendar-container">
145 <script type="text/javascript">
146         /* Creates all the structures to deal with all diferents kinds of holidays */
147         var week_days = new Array();
148         var holidays = new Array();
149         var exception_holidays = new Array();
150         var day_month_holidays = new Array();
151         var hola= "<!-- TMPL_VAR NAME="code" -->";
152         <!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
153         week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
154         <!-- /TMPL_LOOP -->
155         <!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
156         holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
157         <!-- /TMPL_LOOP -->
158         <!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
159         exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
160         <!-- /TMPL_LOOP -->
161         <!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
162         day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
163         <!-- /TMPL_LOOP -->
164
165         /* This function gives css clases to each kind of day */
166         function dateStatusHandler(date) {
167                 var day = date.getDate();
168                 var month = date.getMonth() + 1;
169                 var year = date.getFullYear();
170                 var weekDay = date.getDay();
171                 var dayMonth = month + '/' + day;
172                 var dateString = year + '/' + month + '/' + day;
173                 if (exception_holidays[dateString] != null) {
174                         return 'exception';
175                 } else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
176                         return 'repeatableday';
177                 } else if (holidays[dateString] != null) {
178                         return 'holiday';
179                 } else {
180                         return 'normalday';
181                 }
182         }
183
184         /* This function is in charge of showing the correct panel considering the kind of holiday */
185         function dateChanged(calendar) {
186                 var day = calendar.date.getDate();
187                 var month = calendar.date.getMonth() + 1;
188                 var year = calendar.date.getFullYear();
189                 var weekDay = calendar.date.getDay();
190                 var dayName = calendar.date.print('%A');
191                 var dayMonth = month + '/' + day;
192                 var dateString = year + '/' + month + '/' + day;
193                 if (calendar.dateClicked) {
194                         if (holidays[dateString] != null) {
195                                 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title,  holidays[dateString].description);
196                         } else if (exception_holidays[dateString] != null) {
197                                 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description);
198                         } else if (week_days[weekDay] != null) {
199                                 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title,    week_days[weekDay].description);
200                         } else if (day_month_holidays[dayMonth] != null) {
201                                 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description);
202                         } else {
203                                 newHoliday(dayName, day, month, year, weekDay);
204                         }
205                 }
206         };
207         Calendar.setup(
208                 {
209                         flat : "calendar-container",
210                         flatCallback : dateChanged,
211                         dateStatusFunc : dateStatusHandler
212                 }
213         );
214 </script>
215 </div>
216 <!-- TMPL_INCLUDE NAME="holidays-bottom.inc" -->