Lines 1-115
Link Here
|
1 |
[% USE Branches %] |
1 |
[% USE Branches %] |
|
|
2 |
[% SET footerjs = 1 %] |
2 |
[% INCLUDE 'doc-head-open.inc' %] |
3 |
[% INCLUDE 'doc-head-open.inc' %] |
3 |
<title>Koha › Tools › [% Branches.GetName( branch ) %] calendar</title> |
4 |
<title>Koha › Tools › [% Branches.GetName( branch ) %] calendar</title> |
4 |
[% INCLUDE 'doc-head-close.inc' %] |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
5 |
[% INCLUDE 'calendar.inc' %] |
6 |
[% INCLUDE 'calendar.inc' %] |
6 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
7 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" /> |
7 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min.js"></script> |
8 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/discretecalendar_[% KOHA_VERSION %].css" /> |
8 |
[% INCLUDE 'datatables.inc' %] |
9 |
[% INCLUDE 'datatables.inc' %] |
9 |
<script type="text/javascript"> |
10 |
</head> |
10 |
//<![CDATA[ |
|
|
11 |
var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays")); |
12 |
// Array containing all the information about each date in the calendar. |
13 |
var datesInfos = new Array(); |
14 |
[% FOREACH date IN datesInfos %] |
15 |
datesInfos["[% date.date %]"] = { |
16 |
title : "[% date.note %]", |
17 |
outputdate : "[% date.outputdate %]", |
18 |
holiday_type:"[% date.holiday_type %]", |
19 |
open_hour: "[% date.open_hour %]", |
20 |
close_hour: "[% date.close_hour %]" |
21 |
}; |
22 |
[% END %] |
23 |
|
11 |
|
24 |
/** |
12 |
<body id="tools_holidays" class="tools"> |
25 |
* Displays the details of the selected date on a side panel |
13 |
[% INCLUDE 'header.inc' %] |
26 |
*/ |
14 |
[% INCLUDE 'cat-search.inc' %] |
27 |
function showHoliday (date_obj, dateString, dayName, day, month, year, weekDay, title, holidayType) { |
|
|
28 |
$("#newHoliday").slideDown("fast"); |
29 |
$("#copyHoliday").slideUp("fast"); |
30 |
$('#newDaynameOutput').html(dayName); |
31 |
$('#newDayname').val(dayName); |
32 |
$('#newBranchNameOutput').html($("#branch :selected").text()); |
33 |
$(".newHoliday ,#branch").val($('#branch').val()); |
34 |
$('#newDayOutput').html(day); |
35 |
$(".newHoliday #Day").val(day); |
36 |
$(".newHoliday #Month").val(month); |
37 |
$(".newHoliday #Year").val(year); |
38 |
$("#newMonthOutput").html(month); |
39 |
$("#newYearOutput").html(year); |
40 |
$(".newHoliday, #Weekday").val(weekDay); |
41 |
|
15 |
|
42 |
$('.newHoliday #title').val(title); |
16 |
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% Branches.GetName( branch ) %] calendar</div> |
43 |
$('#HolidayType').val(holidayType); |
|
|
44 |
$('#days_of_week option[value="'+ (weekDay + 1) +'"]').attr('selected', true); |
45 |
$('#openHour').val(datesInfos[dateString].open_hour); |
46 |
$('#closeHour').val(datesInfos[dateString].close_hour); |
47 |
$('#local_today').val(getSeparetedDate(new Date()).dateString); |
48 |
|
17 |
|
49 |
//This changes the label of the date type on the edit panel |
18 |
<div id="doc3" class="yui-t1"> |
50 |
if(holidayType == 'W') { |
|
|
51 |
$("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly")); |
52 |
} else if(holidayType == 'R') { |
53 |
$("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly")); |
54 |
} else if(holidayType == 'F') { |
55 |
$("#holtype").attr("class","key float").html(_("Floating holiday")); |
56 |
} else if(holidayType == 'N') { |
57 |
$("#holtype").attr("class","key exception").html(_("Needs validation")); |
58 |
} else if(holidayType == 'E') { |
59 |
$("#holtype").attr("class","key holiday").html(_("Unique holiday")); |
60 |
} else{ |
61 |
$("#holtype").attr("class","key normalday").html(_("Working day ")); |
62 |
} |
63 |
|
19 |
|
64 |
//Select the correct holiday type on the dropdown menu |
20 |
<div id="bd"> |
65 |
if (datesInfos[dateString].holiday_type !=''){ |
21 |
<div id="yui-main"> |
66 |
var type = datesInfos[dateString].holiday_type; |
22 |
<div class="yui-b"> |
67 |
$('#holidayType option[value="'+ type +'"]').attr('selected', true) |
23 |
<h2>[% Branches.GetName( branch ) %] calendar</h2> |
68 |
}else{ |
24 |
<div class="yui-g"> |
69 |
$('#holidayType option[value="none"]').attr('selected', true) |
25 |
<div class="yui-u first" style="width:60%"> |
70 |
} |
26 |
<label for="branch">Define the holidays for:</label> |
|
|
27 |
<form method="post" onsubmit="return validateForm('CopyCalendar')"> |
28 |
<select id="branch" name="branch"> |
29 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
30 |
</select> |
31 |
Copy calendar to |
32 |
<select id='newBranch' name ='newBranch'> |
33 |
<option value=""></option> |
34 |
[% FOREACH l IN Branches.all() %] |
35 |
[% UNLESS branch == l.branchcode %] |
36 |
<option value="[% l.branchcode %]">[% l.branchname %]</option> |
37 |
[% END %] |
38 |
[% END %] |
39 |
</select> |
40 |
<input type="hidden" name="action" value="copyBranch" /> |
41 |
<input type="submit" value="Clone"> |
42 |
</form> |
43 |
<h3>Calendar information</h3> |
44 |
<div id="jcalendar-container" style="float: left"></div> |
45 |
<!-- ***************************** Panel to deal with new holidays ********************** --> |
46 |
[% UNLESS datesInfos %] |
47 |
<div class="alert alert-danger" style="float: left; margin-left:15px"> |
48 |
<strong>Error!</strong> You have to run generate_discrete_calendar.pl in order to use Discrete Calendar. |
49 |
</div> |
50 |
[% END %] |
71 |
|
51 |
|
72 |
//If it is a weekly or repeatable holiday show the option to delete the type |
52 |
[% IF no_branch_selected %] |
73 |
if(datesInfos[dateString].holiday_type == 'W' || datesInfos[dateString].holiday_type == 'R'){ |
53 |
<div class="alert alert-danger" style="float: left; margin-left:15px"> |
74 |
$('#deleteType').show("fast"); |
54 |
<strong>No library set!</strong> You are using the default calendar. |
75 |
}else{ |
55 |
</div> |
76 |
$('#deleteType').hide("fast"); |
56 |
[% END %] |
77 |
} |
|
|
78 |
|
57 |
|
79 |
//This value is to disable and hide input when the date is in the past, because you can't edit it. |
58 |
<div class="panel newHoliday" id="newHoliday" style="float: left; margin-left:15px"> |
80 |
var value = false; |
59 |
<form method="post" onsubmit="return validateForm('newHoliday')"> |
81 |
var today = new Date(); |
60 |
<fieldset class="brief"> |
82 |
today.setHours(0,0,0,0); |
61 |
<h3>Edit date details</h3> |
83 |
if(date_obj < today ){ |
62 |
<span id="holtype"></span> |
84 |
$("#holtype").attr("class","key past-date").html(_("Past date")); |
63 |
<ol> |
85 |
$("#CopyRadioButton").attr("checked", "checked"); |
64 |
<li> |
86 |
value = true; |
65 |
<strong>Library:</strong> |
87 |
$(".CopyDatePanel").toggle(value); |
66 |
<span id="newBranchNameOutput"></span> |
88 |
} |
67 |
<input type="hidden" id="branch" name="branch" /> |
89 |
$("#title").prop('disabled', value); |
68 |
</li> |
90 |
$("#holidayType select").prop('disabled', value); |
69 |
<li> |
91 |
$("#openHour").prop('disabled', value); |
70 |
<strong>From date:</strong> |
92 |
$("#closeHour").prop('disabled', value); |
71 |
<span id="newDaynameOutput"></span>, |
93 |
$("#EditRadioButton").parent().toggle(!value); |
|
|
94 |
|
72 |
|
95 |
} |
73 |
[% IF ( dateformat == "us" ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "dmydot" ) %]<span id="newDayOutput"></span>.<span id="newMonthOutput"></span>.<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %] |
96 |
|
74 |
|
97 |
function hidePanel(aPanelName) { |
75 |
<input type="hidden" id="newDayname" name="showDayname" /> |
98 |
$("#"+aPanelName).slideUp("fast"); |
76 |
<input type="hidden" id="Day" name="Day" /> |
99 |
} |
77 |
<input type="hidden" id="Month" name="Month" /> |
|
|
78 |
<input type="hidden" id="Year" name="Year" /> |
79 |
</li> |
80 |
<li class="dateinsert"> |
81 |
<b>To date: </b> |
82 |
<input type="text" id="from_copyToDatePicker" name="toDate" size="20" class="datepicker" /> |
83 |
</li> |
84 |
<li> |
85 |
<label for="title">Title: </label><input type="text" name="Title" id="title" size="35" /> |
86 |
</li> |
87 |
<li id="holidayType"> |
88 |
<label for="holidayType">Date type</label> |
89 |
<select name ='holidayType'> |
90 |
<option value="empty"></option> |
91 |
<option value="none">Working day</option> |
92 |
<option value="E">Unique holiday</option> |
93 |
<option value="W">Weekly holiday</option> |
94 |
<option value="R">Repeatable holiday</option> |
95 |
<option value="F">Floating holiday</option> |
96 |
<option value="N" disabled>Need validation</option> |
97 |
</select> |
98 |
</li> |
99 |
<li id="days_of_week" style="display :none"> |
100 |
<label for="day_of_week">Week day</label> |
101 |
<select name ='day_of_week'> |
102 |
<option value="everyday">Everyday</option> |
103 |
<option value="1">Sundays</option> |
104 |
<option value="2">Mondays</option> |
105 |
<option value="3">Tuesdays</option> |
106 |
<option value="4">Wednesdays</option> |
107 |
<option value="5">Thursdays</option> |
108 |
<option value="6">Fridays</option> |
109 |
<option value="7">Saturdays</option> |
110 |
</select> |
111 |
</li> |
112 |
<li class="radio" id="deleteType" style="display : none;" > |
113 |
<input type="checkbox" name="deleteType" id="deleteType_checkbox" value="1" ><label for="deleteType_checkbox"> Delete this type</label> |
114 |
<a href="#" class="helptext">[?]</a> |
115 |
<div class="hint">Remove all repeated or weekly holidays of the selected date or week day <br> if working day is selected.</div> |
116 |
</li> |
117 |
<li> |
118 |
<label for="openHour">Open hours: </label><input type="text" name="openHour" id='openHour' style="display :flex" > |
119 |
</li> |
120 |
<li> |
121 |
<label for="closeHour">Close hours: </label><input type="text" name="closeHour" id='closeHour' style="display :flex" > |
122 |
</li> |
123 |
<li class="radio"> |
124 |
<input type="radio" name="action" id="EditRadioButton" value="edit" checked/> |
125 |
<label for="EditRadioButton">Edit selected dates</label> |
126 |
</li> |
127 |
<li class="radio"> |
128 |
<input type="radio" name="action" id="CopyRadioButton" value="copyDates" /> |
129 |
<label for="CopyRadioButton">Copy to different dates</label> |
130 |
<div class="CopyDatePanel" style="display:none; padding-left:15px"> |
131 |
<b>From : </b> |
132 |
<input type="text" id="to_copyFromDatePicker" size="20" class="datepicker"/> |
133 |
<b>To : </b> |
134 |
<input type="text" id="to_copyToDatePicker" size="20" class="datepicker"/> |
135 |
</div> |
136 |
<input type="hidden" name="daysnumber" id='daysnumber'> |
137 |
<!-- These yyyy-mm-dd --> |
138 |
<input type="hidden" name="from_copyFrom" id='from_copyFrom'> |
139 |
<input type="hidden" name="from_copyTo" id='from_copyTo'> |
140 |
<input type="hidden" name="to_copyFrom" id='to_copyFrom'> |
141 |
<input type="hidden" name="to_copyTo" id='to_copyTo'> |
142 |
<input type="hidden" name="local_today" id='local_today'> |
143 |
</li> |
144 |
</ol> |
145 |
<fieldset class="action"> |
146 |
<input type="submit" name="submit" value="Save" /> |
147 |
<a href="#" class="cancel hidePanel newHoliday">Cancel</a> |
148 |
</fieldset> |
149 |
</fieldset> |
150 |
</form> |
151 |
</div> |
100 |
|
152 |
|
101 |
function changeBranch () { |
153 |
<!-- ************************************************************************************** --> |
102 |
var branch = $("#branch option:selected").val(); |
154 |
<!-- ****** MAIN SCREEN CODE ****** --> |
103 |
location.href='/cgi-bin/koha/tools/discrete_calendar.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]"; |
155 |
<!-- ************************************************************************************** --> |
104 |
} |
|
|
105 |
|
156 |
|
106 |
function Help() { |
157 |
</div> |
107 |
newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); |
158 |
<div class="yui-u" style="width : 40%"> |
108 |
} |
159 |
<div class="help"> |
|
|
160 |
<h4>Hints</h4> |
161 |
<ul> |
162 |
<li>Search in the calendar the day you want to set as holiday.</li> |
163 |
<li>Click the date to add or edit a holiday.</li> |
164 |
<li>Specify how the holiday should repeat.</li> |
165 |
<li>Click Save to finish.</li> |
166 |
<li>PS: |
167 |
<ul> |
168 |
<li>You can't edit passed dates</li> |
169 |
<li>Weekly holidays change open/close hours for all the days affected unless inputs are empty</li> |
170 |
</ul> |
171 |
</li> |
172 |
</ul> |
173 |
<h4>Key</h4> |
174 |
<p> |
175 |
<span class="key normalday">Working day </span> |
176 |
<span class="key holiday">Unique holiday</span> |
177 |
<span class="key repeatableweekly">Holiday repeating weekly</span> |
178 |
<span class="key repeatableyearly">Holiday repeating yearly</span> |
179 |
<span class="key float">Floating holiday</span> |
180 |
<span class="key exception">Need validation</span> |
181 |
</p> |
182 |
</div> |
183 |
<div id="holiday-list"> |
109 |
|
184 |
|
110 |
// This function gives css clases to each kind of day |
185 |
[% IF ( NEED_VALIDATION_HOLIDAYS ) %] |
111 |
function dateStatusHandler(date) { |
186 |
<h3>Need validation holidays</h3> |
112 |
date = getSeparetedDate(date); |
187 |
<table id="holidaysunique"> |
|
|
188 |
<thead> |
189 |
<tr> |
190 |
<th class="exception">Date</th> |
191 |
<th class="exception">Title</th> |
192 |
</tr> |
193 |
</thead> |
194 |
<tbody> |
195 |
[% FOREACH need_validation_holiday IN NEED_VALIDATION_HOLIDAYS %] |
196 |
<tr> |
197 |
<td><a href="#doc3" onclick="go_to_date('[% need_validation_holiday.date %]')"><span title="[% need_validation_holiday.DATE_SORT %]">[% need_validation_holiday.outputdate %]</span></a></td> |
198 |
<td>[% need_validation_holiday.note %]</td> |
199 |
</tr> |
200 |
[% END %] |
201 |
</tbody> |
202 |
</table> |
203 |
[% END %] |
204 |
|
205 |
[% IF ( WEEKLY_HOLIDAYS ) %] |
206 |
<h3>Weekly - Repeatable holidays</h3> |
207 |
<table id="holidayweeklyrepeatable"> |
208 |
<thead> |
209 |
<tr> |
210 |
<th class="repeatableweekly">Day of week</th> |
211 |
<th class="repeatableweekly">Title</th> |
212 |
</tr> |
213 |
</thead> |
214 |
<tbody> |
215 |
[% FOREACH WEEK_DAYS_LOO IN WEEKLY_HOLIDAYS %] |
216 |
<tr> |
217 |
<td>[% WEEK_DAYS_LOO.weekday %]</td> |
218 |
</td> |
219 |
<td>[% WEEK_DAYS_LOO.note %]</td> |
220 |
</tr> |
221 |
[% END %] |
222 |
</tbody> |
223 |
</table> |
224 |
[% END %] |
225 |
|
226 |
[% IF ( REPEATABLE_HOLIDAYS ) %] |
227 |
<h3>Yearly - Repeatable holidays</h3> |
228 |
<table id="holidaysyearlyrepeatable"> |
229 |
<thead> |
230 |
<tr> |
231 |
[% IF ( dateformat == "metric" ) %] |
232 |
<th class="repeatableyearly">Day/month</th> |
233 |
[% ELSE %] |
234 |
<th class="repeatableyearly">Month/day</th> |
235 |
[% END %] |
236 |
<th class="repeatableyearly">Title</th> |
237 |
</tr> |
238 |
</thead> |
239 |
<tbody> |
240 |
[% FOREACH DAY_MONTH_HOLIDAYS_LOO IN REPEATABLE_HOLIDAYS %] |
241 |
<tr> |
242 |
[% IF ( dateformat == "metric" ) %] |
243 |
<td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[% DAY_MONTH_HOLIDAYS_LOO.day %]/[% DAY_MONTH_HOLIDAYS_LOO.month %]</span></td> |
244 |
[% ELSE %] |
245 |
<td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[% DAY_MONTH_HOLIDAYS_LOO.month %]/[% DAY_MONTH_HOLIDAYS_LOO.day %]</span></td> |
246 |
[% END %] |
247 |
<td>[% DAY_MONTH_HOLIDAYS_LOO.note %]</td> |
248 |
</tr> |
249 |
[% END %] |
250 |
</tbody> |
251 |
</table> |
252 |
[% END %] |
253 |
|
254 |
[% IF ( UNIQUE_HOLIDAYS ) %] |
255 |
<h3>Unique holidays</h3> |
256 |
<table id="holidaysunique"> |
257 |
<thead> |
258 |
<tr> |
259 |
<th class="holiday">Date</th> |
260 |
<th class="holiday">Title</th> |
261 |
</tr> |
262 |
</thead> |
263 |
<tbody> |
264 |
[% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %] |
265 |
<tr> |
266 |
<td><a href="#doc3" onclick="go_to_date('[% HOLIDAYS_LOO.date %]')"><span title="[% HOLIDAYS_LOO.DATE_SORT %]">[% HOLIDAYS_LOO.outputdate %]</span></a></td> |
267 |
<td>[% HOLIDAYS_LOO.note %]</td> |
268 |
</tr> |
269 |
[% END %] |
270 |
</tbody> |
271 |
</table> |
272 |
[% END %] |
273 |
|
274 |
[% IF ( FLOAT_HOLIDAYS ) %] |
275 |
<h3>Floating holidays</h3> |
276 |
<table id="holidaysunique"> |
277 |
<thead> |
278 |
<tr> |
279 |
<th class="float">Date</th> |
280 |
<th class="float">Title</th> |
281 |
</tr> |
282 |
</thead> |
283 |
<tbody> |
284 |
[% FOREACH float_holiday IN FLOAT_HOLIDAYS %] |
285 |
<tr> |
286 |
<td><a href="#doc3" onclick="go_to_date('[% float_holiday.date %]')"><span title="[% float_holiday.DATE_SORT %]">[% float_holiday.outputdate %]</span></a></td> |
287 |
<td>[% float_holiday.note %]</td> |
288 |
</tr> |
289 |
[% END %] |
290 |
</tbody> |
291 |
</table> |
292 |
[% END %] |
293 |
</div> |
294 |
</div> |
295 |
</div> |
296 |
</div> |
297 |
</div> |
298 |
|
299 |
<div class="yui-b noprint"> |
300 |
[% INCLUDE 'tools-menu.inc' %] |
301 |
</div> |
302 |
</div> |
303 |
[% MACRO jsinclude BLOCK %] |
304 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min_[% KOHA_VERSION %].js"></script> |
305 |
<script type="text/javascript"> |
306 |
//<![CDATA[ |
307 |
var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays")); |
308 |
// Array containing all the information about each date in the calendar. |
309 |
var datesInfos = new Array(); |
310 |
[% FOREACH date IN datesInfos %] |
311 |
datesInfos["[% date.date %]"] = { |
312 |
title : "[% date.note %]", |
313 |
outputdate : "[% date.outputdate %]", |
314 |
holiday_type:"[% date.holiday_type %]", |
315 |
open_hour: "[% date.open_hour %]", |
316 |
close_hour: "[% date.close_hour %]" |
317 |
}; |
318 |
[% END %] |
319 |
|
320 |
/** |
321 |
* Displays the details of the selected date on a side panel |
322 |
*/ |
323 |
function showHoliday (date_obj, dateString, dayName, day, month, year, weekDay, title, holidayType) { |
324 |
$("#newHoliday").slideDown("fast"); |
325 |
$("#copyHoliday").slideUp("fast"); |
326 |
$('#newDaynameOutput').html(dayName); |
327 |
$('#newDayname').val(dayName); |
328 |
$('#newBranchNameOutput').html($("#branch :selected").text()); |
329 |
$(".newHoliday ,#branch").val($('#branch').val()); |
330 |
$('#newDayOutput').html(day); |
331 |
$(".newHoliday #Day").val(day); |
332 |
$(".newHoliday #Month").val(month); |
333 |
$(".newHoliday #Year").val(year); |
334 |
$("#newMonthOutput").html(month); |
335 |
$("#newYearOutput").html(year); |
336 |
$(".newHoliday, #Weekday").val(weekDay); |
337 |
|
338 |
$('.newHoliday #title').val(title); |
339 |
$('#HolidayType').val(holidayType); |
340 |
$('#days_of_week option[value="'+ (weekDay + 1) +'"]').attr('selected', true); |
341 |
$('#openHour').val(datesInfos[dateString].open_hour); |
342 |
$('#closeHour').val(datesInfos[dateString].close_hour); |
343 |
$('#local_today').val(getSeparetedDate(new Date()).dateString); |
344 |
|
345 |
//This changes the label of the date type on the edit panel |
346 |
if(holidayType == 'W') { |
347 |
$("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly")); |
348 |
} else if(holidayType == 'R') { |
349 |
$("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly")); |
350 |
} else if(holidayType == 'F') { |
351 |
$("#holtype").attr("class","key float").html(_("Floating holiday")); |
352 |
} else if(holidayType == 'N') { |
353 |
$("#holtype").attr("class","key exception").html(_("Needs validation")); |
354 |
} else if(holidayType == 'E') { |
355 |
$("#holtype").attr("class","key holiday").html(_("Unique holiday")); |
356 |
} else{ |
357 |
$("#holtype").attr("class","key normalday").html(_("Working day ")); |
358 |
} |
359 |
|
360 |
//Select the correct holiday type on the dropdown menu |
361 |
if (datesInfos[dateString].holiday_type !=''){ |
362 |
var type = datesInfos[dateString].holiday_type; |
363 |
$('#holidayType option[value="'+ type +'"]').attr('selected', true) |
364 |
}else{ |
365 |
$('#holidayType option[value="none"]').attr('selected', true) |
366 |
} |
367 |
|
368 |
//If it is a weekly or repeatable holiday show the option to delete the type |
369 |
if(datesInfos[dateString].holiday_type == 'W' || datesInfos[dateString].holiday_type == 'R'){ |
370 |
$('#deleteType').show("fast"); |
371 |
}else{ |
372 |
$('#deleteType').hide("fast"); |
373 |
} |
374 |
|
375 |
//This value is to disable and hide input when the date is in the past, because you can't edit it. |
376 |
var value = false; |
377 |
var today = new Date(); |
378 |
today.setHours(0,0,0,0); |
379 |
if(date_obj < today ){ |
380 |
$("#holtype").attr("class","key past-date").html(_("Past date")); |
381 |
$("#CopyRadioButton").attr("checked", "checked"); |
382 |
value = true; |
383 |
$(".CopyDatePanel").toggle(value); |
384 |
} |
385 |
$("#title").prop('disabled', value); |
386 |
$("#holidayType select").prop('disabled', value); |
387 |
$("#openHour").prop('disabled', value); |
388 |
$("#closeHour").prop('disabled', value); |
389 |
$("#EditRadioButton").parent().toggle(!value); |
390 |
|
391 |
} |
392 |
|
393 |
function hidePanel(aPanelName) { |
394 |
$("#"+aPanelName).slideUp("fast"); |
395 |
} |
396 |
|
397 |
function changeBranch () { |
398 |
var branch = $("#branch option:selected").val(); |
399 |
location.href='/cgi-bin/koha/tools/discrete_calendar.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]"; |
400 |
} |
401 |
|
402 |
function Help() { |
403 |
newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); |
404 |
} |
405 |
|
406 |
// This function gives css clases to each kind of day |
407 |
function dateStatusHandler(date) { |
408 |
date = getSeparetedDate(date); |
113 |
var day = date.day; |
409 |
var day = date.day; |
114 |
var month = date.month; |
410 |
var month = date.month; |
115 |
var year = date.year; |
411 |
var year = date.year; |
Lines 297-303
Link Here
|
297 |
}, |
593 |
}, |
298 |
defaultDate: new Date("[% keydate %]"), |
594 |
defaultDate: new Date("[% keydate %]"), |
299 |
minDate: new Date("[% minDate %]"), |
595 |
minDate: new Date("[% minDate %]"), |
300 |
maxDate: new Date("[% maxDate %]") |
596 |
maxDate: new Date("[% maxDate %]"), |
|
|
597 |
dateFormat: "yy-mm-dd" |
301 |
}); |
598 |
}); |
302 |
//Main datepicker |
599 |
//Main datepicker |
303 |
$("#jcalendar-container").datepicker({ |
600 |
$("#jcalendar-container").datepicker({ |
Lines 375-787
Link Here
|
375 |
}); |
672 |
}); |
376 |
}); |
673 |
}); |
377 |
//]]> |
674 |
//]]> |
378 |
</script> |
675 |
</script> |
379 |
<!-- Datepicker colors --> |
|
|
380 |
<style type="text/css"> |
381 |
#jcalendar-container .ui-datepicker { |
382 |
font-size : 185%; |
383 |
} |
384 |
#holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { |
385 |
font-size : 90%; margin-bottom : 1em; |
386 |
} |
387 |
#showHoliday { |
388 |
margin : .5em 0; |
389 |
} |
390 |
.key { |
391 |
padding : 3px; |
392 |
white-space:nowrap; |
393 |
line-height:230%; |
394 |
} |
395 |
.ui-datepicker { |
396 |
font-size : 150%; |
397 |
} |
398 |
.ui-datepicker th, .ui-datepicker .ui-datepicker-title select { |
399 |
font-size : 80%; |
400 |
} |
401 |
.ui-datepicker td a { |
402 |
padding : .5em; |
403 |
} |
404 |
.ui-datepicker td span { |
405 |
padding : .5em; |
406 |
border : 1px solid #BCBCBC; |
407 |
} |
408 |
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { |
409 |
font-size : 80%; |
410 |
} |
411 |
.key { |
412 |
padding : 3px; white-space:nowrap; line-height:230%; |
413 |
} |
414 |
.normalday { |
415 |
background-color : #EDEDED; |
416 |
color : Black; |
417 |
border : 1px solid #BCBCBC; |
418 |
} |
419 |
.ui-datepicker-unselectable { |
420 |
padding :.5em; white-space:nowrap; |
421 |
} |
422 |
.ui-state-disabled { |
423 |
padding :.5em; white-space:nowrap; |
424 |
} |
425 |
.exception { |
426 |
background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; |
427 |
} |
428 |
.past-date { |
429 |
background-color : #e6e6e6; color : #555555; border : 1px solid #BCBCBC; |
430 |
} |
431 |
td.past-date a.ui-state-default { |
432 |
background : #e6e6e6 ; color : #555555; |
433 |
} |
434 |
.float { |
435 |
background-color : #66ff33; color : Black; border : 1px solid #BCBCBC; |
436 |
} |
437 |
.holiday { |
438 |
background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; |
439 |
} |
440 |
.repeatableweekly { |
441 |
background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; |
442 |
} |
443 |
.repeatableyearly { |
444 |
background-color : #FFCC66; color : Black; border : 1px solid #BCBCBC; |
445 |
} |
446 |
td.exception a.ui-state-default { |
447 |
background: #b3d4ff none; color : Black; border : 1px solid #BCBCBC; |
448 |
} |
449 |
td.float a.ui-state-default { |
450 |
background: #66ff33 none; color : Black; border : 1px solid #BCBCBC; |
451 |
} |
452 |
td.holiday a.ui-state-default { |
453 |
background: #ffaeae none; color : Black; border : 1px solid #BCBCBC; |
454 |
} |
455 |
td.repeatableweekly a.ui-state-default { |
456 |
background: #FFFF99 none; color : Black; border : 1px solid #BCBCBC; |
457 |
} |
458 |
td.repeatableyearly a.ui-state-default { |
459 |
background: #FFCC66 none; color : Black; border : 1px solid #BCBCBC; |
460 |
} |
461 |
.information { |
462 |
z-index : ; 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; |
463 |
} |
464 |
.panel { |
465 |
z-index : 1; display : none; border : 3px solid #CCC; padding : 3px; margin-top: .3em; background-color: #FEFEFE; |
466 |
} |
467 |
fieldset.brief { |
468 |
border : 0; margin-top: 0; |
469 |
} |
470 |
h1 select { |
471 |
width: 20em; |
472 |
} |
473 |
div.yui-b fieldset.brief ol { |
474 |
font-size:100%; |
475 |
} |
476 |
div.yui-b fieldset.brief li, div.yui-b fieldset.brief li.radio { |
477 |
padding:0.2em 0; |
478 |
} |
479 |
.help { |
480 |
margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; |
481 |
} |
482 |
.calendar td, .calendar th, .calendar .button, .calendar tbody .day { |
483 |
padding : .7em; font-size: 110%; |
484 |
} |
485 |
.calendar { width: auto; border : 0; |
486 |
} |
487 |
.copyHoliday form li{ |
488 |
display:table-row |
489 |
} |
490 |
.copyHoliday form li b, .copyHoliday form li input{ |
491 |
display:table-cell; margin-bottom: 2px; |
492 |
} |
493 |
</style> |
494 |
</head> |
495 |
|
496 |
<body id="tools_holidays" class="tools"> |
497 |
[% INCLUDE 'header.inc' %] |
498 |
[% INCLUDE 'cat-search.inc' %] |
499 |
|
500 |
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% Branches.GetName( branch ) %] calendar</div> |
501 |
|
502 |
<div id="doc3" class="yui-t1"> |
503 |
|
504 |
<div id="bd"> |
505 |
<div id="yui-main"> |
506 |
<div class="yui-b"> |
507 |
<h2>[% Branches.GetName( branch ) %] calendar</h2> |
508 |
<div class="yui-g"> |
509 |
<div class="yui-u first" style="width:60%"> |
510 |
<label for="branch">Define the holidays for:</label> |
511 |
<form method="post" onsubmit="return validateForm('CopyCalendar')"> |
512 |
<select id="branch" name="branch"> |
513 |
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] |
514 |
</select> |
515 |
Copy calendar to |
516 |
<select id='newBranch' name ='newBranch'> |
517 |
<option value=""></option> |
518 |
[% FOREACH l IN Branches.all() %] |
519 |
[% UNLESS branch == l.branchcode %] |
520 |
<option value="[% l.branchcode %]">[% l.branchname %]</option> |
521 |
[% END %] |
522 |
[% END %] |
523 |
</select> |
524 |
<input type="hidden" name="action" value="copyBranch" /> |
525 |
<input type="submit" value="Clone"> |
526 |
</form> |
527 |
<h3>Calendar information</h3> |
528 |
<div id="jcalendar-container" style="float: left"></div> |
529 |
<!-- ***************************** Panel to deal with new holidays ********************** --> |
530 |
[% UNLESS datesInfos %] |
531 |
<div class="alert alert-danger" style="float: left; margin-left:15px"> |
532 |
<strong>Error!</strong> You have to run generate_discrete_calendar.pl in order to use Discrete Calendar. |
533 |
</div> |
534 |
[% END %] |
535 |
|
536 |
[% IF no_branch_selected %] |
537 |
<div class="alert alert-danger" style="float: left; margin-left:15px"> |
538 |
<strong>No library set!</strong> You are using the default calendar. |
539 |
</div> |
540 |
[% END %] |
541 |
|
542 |
<div class="panel newHoliday" id="newHoliday" style="float: left; margin-left:15px"> |
543 |
<form method="post" onsubmit="return validateForm('newHoliday')"> |
544 |
<fieldset class="brief"> |
545 |
<h3>Edit date details</h3> |
546 |
<span id="holtype"></span> |
547 |
<ol> |
548 |
<li> |
549 |
<strong>Library:</strong> |
550 |
<span id="newBranchNameOutput"></span> |
551 |
<input type="hidden" id="branch" name="branch" /> |
552 |
</li> |
553 |
<li> |
554 |
<strong>From date:</strong> |
555 |
<span id="newDaynameOutput"></span>, |
556 |
|
557 |
[% IF ( dateformat == "us" ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "dmydot" ) %]<span id="newDayOutput"></span>.<span id="newMonthOutput"></span>.<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %] |
558 |
|
559 |
<input type="hidden" id="newDayname" name="showDayname" /> |
560 |
<input type="hidden" id="Day" name="Day" /> |
561 |
<input type="hidden" id="Month" name="Month" /> |
562 |
<input type="hidden" id="Year" name="Year" /> |
563 |
</li> |
564 |
<li class="dateinsert"> |
565 |
<b>To date: </b> |
566 |
<input type="text" id="from_copyToDatePicker" name="toDate" size="20" class="datepicker" /> |
567 |
</li> |
568 |
<li> |
569 |
<label for="title">Title: </label><input type="text" name="Title" id="title" size="35" /> |
570 |
</li> |
571 |
<li id="holidayType"> |
572 |
<label for="holidayType">Date type</label> |
573 |
<select name ='holidayType'> |
574 |
<option value="empty"></option> |
575 |
<option value="none">Working day</option> |
576 |
<option value="E">Unique holiday</option> |
577 |
<option value="W">Weekly holiday</option> |
578 |
<option value="R">Repeatable holiday</option> |
579 |
<option value="F">Floating holiday</option> |
580 |
<option value="N" disabled>Need validation</option> |
581 |
</select> |
582 |
</li> |
583 |
<li id="days_of_week" style="display :none"> |
584 |
<label for="day_of_week">Week day</label> |
585 |
<select name ='day_of_week'> |
586 |
<option value="everyday">Everyday</option> |
587 |
<option value="1">Sundays</option> |
588 |
<option value="2">Mondays</option> |
589 |
<option value="3">Tuesdays</option> |
590 |
<option value="4">Wednesdays</option> |
591 |
<option value="5">Thursdays</option> |
592 |
<option value="6">Fridays</option> |
593 |
<option value="7">Saturdays</option> |
594 |
</select> |
595 |
</li> |
596 |
<li class="radio" id="deleteType" style="display : none;" > |
597 |
<input type="checkbox" name="deleteType" id="deleteType_checkbox" value="1" ><label for="deleteType_checkbox"> Delete this type</label> |
598 |
<a href="#" class="helptext">[?]</a> |
599 |
<div class="hint">Remove all repeated or weekly holidays of the selected date or week day <br> if working day is selected.</div> |
600 |
</li> |
601 |
<li> |
602 |
<label for="openHour">Open hours: </label><input type="text" name="openHour" id='openHour' style="display :flex" > |
603 |
</li> |
604 |
<li> |
605 |
<label for="closeHour">Close hours: </label><input type="text" name="closeHour" id='closeHour' style="display :flex" > |
606 |
</li> |
607 |
<li class="radio"> |
608 |
<input type="radio" name="action" id="EditRadioButton" value="edit" checked/> |
609 |
<label for="EditRadioButton">Edit selected dates</label> |
610 |
</li> |
611 |
<li class="radio"> |
612 |
<input type="radio" name="action" id="CopyRadioButton" value="copyDates" /> |
613 |
<label for="CopyRadioButton">Copy to different dates</label> |
614 |
<div class="CopyDatePanel" style="display:none; padding-left:15px"> |
615 |
<b>From : </b> |
616 |
<input type="text" id="to_copyFromDatePicker" size="20" class="datepicker"/> |
617 |
<b>To : </b> |
618 |
<input type="text" id="to_copyToDatePicker" size="20" class="datepicker"/> |
619 |
</div> |
620 |
<input type="hidden" name="daysnumber" id='daysnumber'> |
621 |
<!-- These yyyy-mm-dd --> |
622 |
<input type="hidden" name="from_copyFrom" id='from_copyFrom'> |
623 |
<input type="hidden" name="from_copyTo" id='from_copyTo'> |
624 |
<input type="hidden" name="to_copyFrom" id='to_copyFrom'> |
625 |
<input type="hidden" name="to_copyTo" id='to_copyTo'> |
626 |
<input type="hidden" name="local_today" id='local_today'> |
627 |
</li> |
628 |
</ol> |
629 |
<fieldset class="action"> |
630 |
<input type="submit" name="submit" value="Save" /> |
631 |
<a href="#" class="cancel hidePanel newHoliday">Cancel</a> |
632 |
</fieldset> |
633 |
</fieldset> |
634 |
</form> |
635 |
</div> |
636 |
|
637 |
<!-- ************************************************************************************** --> |
638 |
<!-- ****** MAIN SCREEN CODE ****** --> |
639 |
<!-- ************************************************************************************** --> |
640 |
|
641 |
</div> |
642 |
<div class="yui-u" style="width : 40%"> |
643 |
<div class="help"> |
644 |
<h4>Hints</h4> |
645 |
<ul> |
646 |
<li>Search in the calendar the day you want to set as holiday.</li> |
647 |
<li>Click the date to add or edit a holiday.</li> |
648 |
<li>Specify how the holiday should repeat.</li> |
649 |
<li>Click Save to finish.</li> |
650 |
<li>PS: |
651 |
<ul> |
652 |
<li>You can't edit passed dates</li> |
653 |
<li>Weekly holidays change open/close hours for all the days affected unless inputs are empty</li> |
654 |
</ul> |
655 |
</li> |
656 |
</ul> |
657 |
<h4>Key</h4> |
658 |
<p> |
659 |
<span class="key normalday">Working day </span> |
660 |
<span class="key holiday">Unique holiday</span> |
661 |
<span class="key repeatableweekly">Holiday repeating weekly</span> |
662 |
<span class="key repeatableyearly">Holiday repeating yearly</span> |
663 |
<span class="key float">Floating holiday</span> |
664 |
<span class="key exception">Need validation</span> |
665 |
</p> |
666 |
</div> |
667 |
<div id="holiday-list"> |
668 |
|
669 |
[% IF ( NEED_VALIDATION_HOLIDAYS ) %] |
670 |
<h3>Need validation holidays</h3> |
671 |
<table id="holidaysunique"> |
672 |
<thead> |
673 |
<tr> |
674 |
<th class="exception">Date</th> |
675 |
<th class="exception">Title</th> |
676 |
</tr> |
677 |
</thead> |
678 |
<tbody> |
679 |
[% FOREACH need_validation_holiday IN NEED_VALIDATION_HOLIDAYS %] |
680 |
<tr> |
681 |
<td><a href="#doc3" onclick="go_to_date('[% need_validation_holiday.date %]')"><span title="[% need_validation_holiday.DATE_SORT %]">[% need_validation_holiday.outputdate %]</span></a></td> |
682 |
<td>[% need_validation_holiday.note %]</td> |
683 |
</tr> |
684 |
[% END %] |
685 |
</tbody> |
686 |
</table> |
687 |
[% END %] |
688 |
|
689 |
[% IF ( WEEKLY_HOLIDAYS ) %] |
690 |
<h3>Weekly - Repeatable holidays</h3> |
691 |
<table id="holidayweeklyrepeatable"> |
692 |
<thead> |
693 |
<tr> |
694 |
<th class="repeatableweekly">Day of week</th> |
695 |
<th class="repeatableweekly">Title</th> |
696 |
</tr> |
697 |
</thead> |
698 |
<tbody> |
699 |
[% FOREACH WEEK_DAYS_LOO IN WEEKLY_HOLIDAYS %] |
700 |
<tr> |
701 |
<td>[% WEEK_DAYS_LOO.weekday %]</td> |
702 |
</td> |
703 |
<td>[% WEEK_DAYS_LOO.note %]</td> |
704 |
</tr> |
705 |
[% END %] |
706 |
</tbody> |
707 |
</table> |
708 |
[% END %] |
709 |
|
710 |
[% IF ( REPEATABLE_HOLIDAYS ) %] |
711 |
<h3>Yearly - Repeatable holidays</h3> |
712 |
<table id="holidaysyearlyrepeatable"> |
713 |
<thead> |
714 |
<tr> |
715 |
[% IF ( dateformat == "metric" ) %] |
716 |
<th class="repeatableyearly">Day/month</th> |
717 |
[% ELSE %] |
718 |
<th class="repeatableyearly">Month/day</th> |
719 |
[% END %] |
720 |
<th class="repeatableyearly">Title</th> |
721 |
</tr> |
722 |
</thead> |
723 |
<tbody> |
724 |
[% FOREACH DAY_MONTH_HOLIDAYS_LOO IN REPEATABLE_HOLIDAYS %] |
725 |
<tr> |
726 |
[% IF ( dateformat == "metric" ) %] |
727 |
<td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[% DAY_MONTH_HOLIDAYS_LOO.day %]/[% DAY_MONTH_HOLIDAYS_LOO.month %]</span></td> |
728 |
[% ELSE %] |
729 |
<td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[% DAY_MONTH_HOLIDAYS_LOO.month %]/[% DAY_MONTH_HOLIDAYS_LOO.day %]</span></td> |
730 |
[% END %] |
731 |
<td>[% DAY_MONTH_HOLIDAYS_LOO.note %]</td> |
732 |
</tr> |
733 |
[% END %] |
734 |
</tbody> |
735 |
</table> |
736 |
[% END %] |
676 |
[% END %] |
737 |
|
|
|
738 |
[% IF ( UNIQUE_HOLIDAYS ) %] |
739 |
<h3>Unique holidays</h3> |
740 |
<table id="holidaysunique"> |
741 |
<thead> |
742 |
<tr> |
743 |
<th class="holiday">Date</th> |
744 |
<th class="holiday">Title</th> |
745 |
</tr> |
746 |
</thead> |
747 |
<tbody> |
748 |
[% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %] |
749 |
<tr> |
750 |
<td><a href="#doc3" onclick="go_to_date('[% HOLIDAYS_LOO.date %]')"><span title="[% HOLIDAYS_LOO.DATE_SORT %]">[% HOLIDAYS_LOO.outputdate %]</span></a></td> |
751 |
<td>[% HOLIDAYS_LOO.note %]</td> |
752 |
</tr> |
753 |
[% END %] |
754 |
</tbody> |
755 |
</table> |
756 |
[% END %] |
757 |
|
758 |
[% IF ( FLOAT_HOLIDAYS ) %] |
759 |
<h3>Floating holidays</h3> |
760 |
<table id="holidaysunique"> |
761 |
<thead> |
762 |
<tr> |
763 |
<th class="float">Date</th> |
764 |
<th class="float">Title</th> |
765 |
</tr> |
766 |
</thead> |
767 |
<tbody> |
768 |
[% FOREACH float_holiday IN FLOAT_HOLIDAYS %] |
769 |
<tr> |
770 |
<td><a href="#doc3" onclick="go_to_date('[% float_holiday.date %]')"><span title="[% float_holiday.DATE_SORT %]">[% float_holiday.outputdate %]</span></a></td> |
771 |
<td>[% float_holiday.note %]</td> |
772 |
</tr> |
773 |
[% END %] |
774 |
</tbody> |
775 |
</table> |
776 |
[% END %] |
777 |
</div> |
778 |
</div> |
779 |
</div> |
780 |
</div> |
781 |
</div> |
782 |
|
783 |
<div class="yui-b noprint"> |
784 |
[% INCLUDE 'tools-menu.inc' %] |
785 |
</div> |
786 |
</div> |
787 |
[% INCLUDE 'intranet-bottom.inc' %] |
677 |
[% INCLUDE 'intranet-bottom.inc' %] |