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