|
Line 0
Link Here
|
|
|
1 |
[% INCLUDE 'doc-head-open.inc' %] |
| 2 |
<title>Koha › Tools › [% branchname %] calendar</title> |
| 3 |
[% INCLUDE 'doc-head-close.inc' %] |
| 4 |
[% INCLUDE 'calendar.inc' %] |
| 5 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
| 6 |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css"> |
| 7 |
<script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script> |
| 8 |
[% INCLUDE 'datatables.inc' %] |
| 9 |
<script type="text/javascript"> |
| 10 |
//<![CDATA[ |
| 11 |
var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays")); |
| 12 |
$("#jcalendar-container").datepicker({dateFormat:'mm/dd/yy', minDate: new Date(15,10,14) }); |
| 13 |
/* Creates all the structures to deal with all different kinds of holidays */ |
| 14 |
var week_days = new Array(); |
| 15 |
var holidays = new Array(); |
| 16 |
var day_month_holidays = new Array(); |
| 17 |
var datesInfos = new Array(); |
| 18 |
[% FOREACH WEEK_DAYS_LOO IN week_days %] |
| 19 |
week_days["[% WEEK_DAYS_LOO.weekday %]"] = {title:"[% WEEK_DAYS_LOO.note %]"}; |
| 20 |
[% END %] |
| 21 |
[% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] |
| 22 |
holidays["[% HOLIDAYS_LOO.date %]"] = {outputdate: "[% HOLIDAYS_LOOP.outputdate %]", title:"[% HOLIDAYS_LOO.note %]"}; |
| 23 |
[% END %] |
| 24 |
[% FOREACH DAY_MONTH_HOLIDAYS_LOO IN repeatable_holidays %] |
| 25 |
day_month_holidays["[%DAY_MONTH_HOLIDAYS_LOO.month%]/[% DAY_MONTH_HOLIDAYS_LOO.day %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.note %]"}; |
| 26 |
[% END %] |
| 27 |
[% FOREACH date IN datesInfos %] |
| 28 |
datesInfos["[% date.date %]"] = {title : "[% date.note %]", outputdate : "[% date.outputdate %]", holidaytype:"[% date.holidaytype %]", openhour: "[% date.openhour %]", closehour: "[% date.closehour %]"}; |
| 29 |
[% END %] |
| 30 |
|
| 31 |
function holidayOperation(formObject, opType) { |
| 32 |
var op = document.getElementsByName('operation'); |
| 33 |
op[0].value = opType; |
| 34 |
formObject.submit(); |
| 35 |
} |
| 36 |
|
| 37 |
// This function shows the "Show Holiday" panel // |
| 38 |
function showHoliday (dayName, day, month, year, weekDay, title, holidayType) { |
| 39 |
$("#newHoliday").slideUp("fast"); |
| 40 |
$("#showHoliday").slideDown("fast"); |
| 41 |
$("#copyHoliday").slideUp("fast"); |
| 42 |
$('#showDaynameOutput').html(dayName); |
| 43 |
$('#showDayname').val(dayName); |
| 44 |
$('#showBranchNameOutput').html($("#branch :selected").text()); |
| 45 |
$('.showHoliday #BranchName').val($("#branch").val()); |
| 46 |
$('#showDayOutput').html(day); |
| 47 |
$('.showHoliday #Day').val(day); |
| 48 |
$('.showHoliday #Month').val(month); |
| 49 |
$('.showHoliday #Year').val(year); |
| 50 |
$('#showMonthOutput').html(month); |
| 51 |
$('#showYearOutput').html(year); |
| 52 |
$('.showHoliday #Weekday').val(weekDay); |
| 53 |
$('.showHoliday #Title').val(title); |
| 54 |
$('#HolidayType').val(holidayType); |
| 55 |
|
| 56 |
if(holidayType == 'weekday') { |
| 57 |
$("#showOperationDelLabel").html(_("Delete this holiday.")); |
| 58 |
$("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly")); |
| 59 |
} else if(holidayType == 'daymonth') { |
| 60 |
$("#showOperationDelLabel").html(_("Delete this holiday.")); |
| 61 |
$("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly")); |
| 62 |
} else if(holidayType == 'float') { |
| 63 |
$("#showOperationDelLabel").html(_("Delete this holiday.")); |
| 64 |
$("#holtype").attr("class","key float").html(_("Floating holiday")); |
| 65 |
} else if(holidayType == 'N') { |
| 66 |
$("#showOperationDelLabel").html(_("Delete this holiday.")); |
| 67 |
$("#holtype").attr("class","key exception").html(_("Needs validation")); |
| 68 |
} else { |
| 69 |
$("#showOperationDelLabel").html(_("Delete this holiday.")); |
| 70 |
$("#holtype").attr("class","key holiday").html(_("Unique holiday")); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
// This function shows the "Add Holiday" panel // |
| 75 |
function newHoliday (dayName, day, month, year, weekDay) { |
| 76 |
$("#showHoliday").slideUp("fast"); |
| 77 |
$("#copyHoliday").slideUp("fast"); |
| 78 |
$("#newHoliday").slideDown("fast"); |
| 79 |
$("#newDaynameOutput").html(dayName); |
| 80 |
$("#newDayname").val(dayName); |
| 81 |
$("#newBranchNameOutput").html($('#branch :selected').text()); |
| 82 |
$(".newHoliday ,#BranchName").val($('#branch').val()); |
| 83 |
$("#newDayOutput").html(day); |
| 84 |
$(".newHoliday #Day").val(day); |
| 85 |
$(".newHoliday #Month").val(month); |
| 86 |
$(".newHoliday #Year").val(year); |
| 87 |
$("#newMonthOutput").html(month); |
| 88 |
$("#newYearOutput").html(year); |
| 89 |
$(".newHoliday, #Weekday").val(weekDay); |
| 90 |
} |
| 91 |
|
| 92 |
function copyHoliday() { |
| 93 |
$("#copyHoliday").slideDown("fast"); |
| 94 |
$("#newHoliday").slideUp("fast"); |
| 95 |
$("#showHoliday").slideUp("fast"); |
| 96 |
$(".copyHoliday #showBranchNameOutput").html($('#branch :selected').text()); |
| 97 |
$(".copyHoliday #newBranch").val($('#branch').val()); |
| 98 |
} |
| 99 |
|
| 100 |
function hidePanel(aPanelName) { |
| 101 |
$("#"+aPanelName).slideUp("fast"); |
| 102 |
} |
| 103 |
|
| 104 |
function changeBranch () { |
| 105 |
var branch = $("#branch option:selected").val(); |
| 106 |
location.href='/cgi-bin/koha/tools/discrete_calendar.pl?branch=' + branch + '&calendardate=' + "[% calendardate %]"; |
| 107 |
} |
| 108 |
|
| 109 |
function Help() { |
| 110 |
newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); |
| 111 |
} |
| 112 |
|
| 113 |
/* This function gives css clases to each kind of day */ |
| 114 |
function dateStatusHandler(date) { |
| 115 |
date = getSeparetedDate(date); |
| 116 |
var day = date.day; |
| 117 |
var month = date.month; |
| 118 |
var year = date.year; |
| 119 |
var weekDay = date.weekDay; |
| 120 |
var dayName = weekdays[weekDay]; |
| 121 |
var dayMonth = date.dayMonth; |
| 122 |
var dateString = date.dateString; |
| 123 |
|
| 124 |
if (datesInfos[dateString] && datesInfos[dateString].holidaytype =='W'){ |
| 125 |
return [true, "repeatableweekly", _("Weekly holiday: %s").format(datesInfos[dateString].title)]; |
| 126 |
} else if (datesInfos[dateString] && datesInfos[dateString].holidaytype == 'R') { |
| 127 |
return [true, "repeatableyearly", _("Yearly holiday: %s").format(datesInfos[dateString].title)]; |
| 128 |
} else if (datesInfos[dateString] && datesInfos[dateString].holidaytype == 'N') { |
| 129 |
return [true, "exception", _("Need validation: %s").format(datesInfos[dateString].title)]; |
| 130 |
} else if (datesInfos[dateString] && datesInfos[dateString].holidaytype == 'F') { |
| 131 |
return [true, "float", _("Floating holiday: %s").format(datesInfos[dateString].title)]; |
| 132 |
} else if (datesInfos[dateString] && datesInfos[dateString].holidaytype == 'E') { |
| 133 |
return [true, "holiday", _("Single holiday: %s").format(datesInfos[dateString].title)]; |
| 134 |
} else { |
| 135 |
return [true, "normalday", _("Normal day")]; |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
/* This function is in charge of showing the correct panel considering the kind of holiday */ |
| 140 |
function dateChanged(calendar) { |
| 141 |
calendar = getSeparetedDate(calendar); |
| 142 |
var day = calendar.day; |
| 143 |
var month = calendar.month; |
| 144 |
var year = calendar.year; |
| 145 |
var weekDay = calendar.weekDay; |
| 146 |
var dayName = weekdays[weekDay]; |
| 147 |
var dayMonth = calendar.dayMonth; |
| 148 |
var dateString = calendar.dateString; |
| 149 |
//set value of form hidden field fromDate |
| 150 |
document.getElementById('fromDate').value = dateString; |
| 151 |
if (datesInfos[dateString].holidaytype =='E') { |
| 152 |
showHoliday(dayName, day, month, year, weekDay, datesInfos[dateString].title,'ymd'); |
| 153 |
showDateInfo(dateString); |
| 154 |
} else if (datesInfos[dateString].holidaytype =='W') { |
| 155 |
showHoliday(dayName, day, month, year, weekDay, datesInfos[dateString].title, 'weekday'); |
| 156 |
showDateInfo(dateString); |
| 157 |
} else if (datesInfos[dateString].holidaytype =='R') { |
| 158 |
showHoliday(dayName, day, month, year, weekDay, datesInfos[dateString].title, 'daymonth'); |
| 159 |
showDateInfo(dateString); |
| 160 |
} else if (datesInfos[dateString].holidaytype =='F') { |
| 161 |
showHoliday(dayName, day, month, year, weekDay, datesInfos[dateString].title, 'float'); |
| 162 |
showDateInfo(dateString); |
| 163 |
} else if (datesInfos[dateString].holidaytype =='N') { |
| 164 |
showHoliday(dayName, day, month, year, weekDay, datesInfos[dateString].title, 'N'); |
| 165 |
showDateInfo(dateString); |
| 166 |
}else { |
| 167 |
newHoliday(dayName, day, month, year, weekDay); |
| 168 |
showDateInfo(dateString); |
| 169 |
} |
| 170 |
}; |
| 171 |
|
| 172 |
function showDateInfo (date){ |
| 173 |
$("#dateInfo").css('visibility', 'visible'); |
| 174 |
document.getElementById('openHour').value =datesInfos[date].openhour; |
| 175 |
document.getElementById('closeHour').value =datesInfos[date].closehour; |
| 176 |
$('#openHour').timepicker({ |
| 177 |
timeFormat: 'HH:mm:ss', |
| 178 |
interval: 15, |
| 179 |
minTime: '05', |
| 180 |
maxTime: '23:45', |
| 181 |
defaultTime: datesInfos[date].openhour, |
| 182 |
startTime: '05:00', |
| 183 |
dynamic: false, |
| 184 |
dropdown: true, |
| 185 |
scrollbar: true |
| 186 |
}); |
| 187 |
$('#closeHour').timepicker({ |
| 188 |
timeFormat: 'HH:mm:ss', |
| 189 |
interval: 15, |
| 190 |
minTime: '05', |
| 191 |
maxTime: '11:45pm', |
| 192 |
defaultTime: datesInfos[date].closehour, |
| 193 |
startTime: '05:00', |
| 194 |
dynamic: false, |
| 195 |
dropdown: true, |
| 196 |
scrollbar: true |
| 197 |
}); |
| 198 |
document.getElementById('closeHour').value =datesInfos[date].closehour; |
| 199 |
document.getElementById('date').innerHTML = datesInfos[date].outputdate; |
| 200 |
//FIXME |
| 201 |
if (datesInfos[date].holidaytype !=''){ |
| 202 |
var type = datesInfos[date].holidaytype; |
| 203 |
$('#holidayType option[value="'+ type +'"]').attr('selected', true) |
| 204 |
}else{ |
| 205 |
$('#holidayType option[value="none"]').attr('selected', true) |
| 206 |
} |
| 207 |
$(".dateDetailsPanel ,#BranchName").val($('#branch').val()); |
| 208 |
|
| 209 |
} |
| 210 |
function getSeparetedDate(date){ |
| 211 |
var mydate = new Array(); |
| 212 |
var day = (date.getDate() < 10 ? '0' : '') + date.getDate(); |
| 213 |
var month = ((date.getMonth()+1) < 10 ? '0' : '') + (date.getMonth() +1); |
| 214 |
var year = date.getFullYear(); |
| 215 |
var weekDay = date.getDay(); |
| 216 |
var dayMonth = (date.getMonth()+1) + '/' + date.getDate(); |
| 217 |
var dateString = year + '-' + month + '-' + day; |
| 218 |
mydate = {dateObj : date, date : date ,dateString : dateString, dayMonth: dayMonth, weekDay: weekDay, year: year, month: month, day: day}; |
| 219 |
|
| 220 |
return mydate; |
| 221 |
} |
| 222 |
|
| 223 |
function validateForm(form){ |
| 224 |
|
| 225 |
if(form =='copyHoliday' && document.getElementById('from_copyTo').value){ |
| 226 |
var from_DateFrom = new Date(document.getElementById('from_copyFrom').value); |
| 227 |
var from_DateTo = new Date(document.getElementById('from_copyTo').value); |
| 228 |
var to_DateFrom = new Date(document.getElementById('to_copyFrom').value); |
| 229 |
var to_DateTo = new Date(document.getElementById('to_copyTo').value); |
| 230 |
var from_start = Math.floor( from_DateFrom.getTime() / (3600*24*1000)); //days as integer from.. |
| 231 |
var from_end = Math.floor( from_DateTo.getTime() / (3600*24*1000)); //days as integer from.. |
| 232 |
var to_start = Math.floor( to_DateFrom.getTime() / (3600*24*1000)); //days as integer from.. |
| 233 |
var to_end = Math.floor( to_DateTo.getTime() / (3600*24*1000)); //days as integer from.. |
| 234 |
var from_daysDiff = from_end - from_start; |
| 235 |
var to_daysDiff = to_end - to_start; |
| 236 |
if(from_daysDiff == to_daysDiff || from_daysDiff ==1){ |
| 237 |
document.getElementById('daysnumber').value = to_daysDiff; |
| 238 |
return true; |
| 239 |
}else{ |
| 240 |
alert("You have to pick the same number of days if you choose 2 ranges"); |
| 241 |
return false; |
| 242 |
} |
| 243 |
}else if (form =='changeHours'){ |
| 244 |
var openhour = document.getElementById('openHour').value; |
| 245 |
var closehour = document.getElementById('closeHour').value;; |
| 246 |
var fromDate = document.getElementById('fromDate').value; |
| 247 |
var toDate = document.getElementById('toDate').value; |
| 248 |
var message = "You are changing the"; |
| 249 |
if (openhour) message = message +" open hour to " + openhour + ", "; |
| 250 |
if (closehour) message = message +" close hour to " + closehour + ", "; |
| 251 |
if (fromDate) message = message + "From " + fromDate; |
| 252 |
if (toDate) message = message + "To " + toDate; |
| 253 |
message+="\n Would you like to continue?"; |
| 254 |
return confirm(message); |
| 255 |
}else{ |
| 256 |
return 1; |
| 257 |
} |
| 258 |
} |
| 259 |
|
| 260 |
//Check if date range have the same opening, closing hours and holiday type if there's one. |
| 261 |
function checkRange(date){ |
| 262 |
date = new Date(date); |
| 263 |
document.getElementById('toDate').value = getSeparetedDate(date).dateString; |
| 264 |
var fromDate = new Date($("#jcalendar-container").datepicker("getDate")); |
| 265 |
var sameHoliday =true; |
| 266 |
var sameOpenHours =true; |
| 267 |
var sameCloseHours =true; |
| 268 |
for (var i = fromDate; i < date ; i.setDate(i.getDate() + 1)) { |
| 269 |
var myDate1 = getSeparetedDate(i); |
| 270 |
var date1 = myDate1.dateString; |
| 271 |
var holidayType1 = datesInfos[date1].holidaytype; |
| 272 |
var openhours1 = datesInfos[date1].openhour; |
| 273 |
var closehours1 = datesInfos[date1].closehour; |
| 274 |
for (var j = fromDate; j < date ; j.setDate(j.getDate() + 1)) { |
| 275 |
var myDate2 = getSeparetedDate(j); |
| 276 |
var date2 = myDate2.dateString; |
| 277 |
var holidayType2 = datesInfos[date2].holidaytype; |
| 278 |
var openhours2 = datesInfos[date2].openhour; |
| 279 |
var closehours2 = datesInfos[date2].closehour; |
| 280 |
|
| 281 |
if (sameHoliday && holidayType1 != holidayType2){ |
| 282 |
document.getElementById('holidayType').innerHTML = ''; |
| 283 |
sameHoliday=false; |
| 284 |
} |
| 285 |
if(sameOpenHours && (openhours1 != openhours2)){ |
| 286 |
document.getElementById('openHour').value =''; |
| 287 |
sameOpenHours=false; |
| 288 |
} |
| 289 |
if(sameCloseHours && (closehours1 != closehours2)){ |
| 290 |
document.getElementById('closeHour').value =''; |
| 291 |
sameCloseHours=false; |
| 292 |
} |
| 293 |
} |
| 294 |
if (!sameOpenHours && !sameCloseHours && !sameHoliday){ |
| 295 |
return false; |
| 296 |
} |
| 297 |
} |
| 298 |
return true; |
| 299 |
} |
| 300 |
$(document).ready(function() { |
| 301 |
$(".hint").hide(); |
| 302 |
$("#branch").change(function(){ |
| 303 |
changeBranch(); |
| 304 |
}); |
| 305 |
$("#holidayweeklyrepeatable>tbody>tr").each(function(){ |
| 306 |
var first_td = $(this).find('td').first(); |
| 307 |
first_td.html(weekdays[first_td.html()]); |
| 308 |
}); |
| 309 |
$("a.helptext").click(function(){ |
| 310 |
$(this).parent().find(".hint").toggle(); return false; |
| 311 |
}); |
| 312 |
$("#dateofrange").datepicker(); |
| 313 |
$("#datecancelrange").datepicker(); |
| 314 |
$("#dateofrange").each(function () { this.value = "" }); |
| 315 |
$("#datecancelrange").each(function () { this.value = "" }); |
| 316 |
//Copy holidays From |
| 317 |
$("#from_copyFromDp").datepicker(); |
| 318 |
$("#from.copyToDp").datepicker(); |
| 319 |
$("#from_copyFromDp").each(function () { this.value = "" }); |
| 320 |
$("#copyToDp").each(function () { this.value = "" }); |
| 321 |
//Copy holidays To |
| 322 |
$("#to_copyFromDp").datepicker(); |
| 323 |
$("#to_copyToDp").datepicker(); |
| 324 |
$("#to_copyFromDp").each(function () { this.value = "" }); |
| 325 |
$("#to_copyToDp").each(function () { this.value = "" }); |
| 326 |
$("#jcalendar-container").datepicker({ |
| 327 |
beforeShowDay: function(thedate) { |
| 328 |
return dateStatusHandler(thedate); |
| 329 |
}, |
| 330 |
onSelect: function(dateText, inst) { |
| 331 |
dateChanged($(this).datepicker("getDate")); |
| 332 |
}, |
| 333 |
defaultDate: new Date("[% keydate %]"), |
| 334 |
minDate: new Date("[% minDate %]"), |
| 335 |
maxDate: new Date("[% maxDate %]") |
| 336 |
}); |
| 337 |
$("#dateofrange, #datecancelrange").change(function(){ |
| 338 |
checkRange($(this).datepicker("getDate")); |
| 339 |
}); |
| 340 |
$("#from_copyFromDp").change(function(){ |
| 341 |
document.getElementById('from_copyFrom').value = getSeparetedDate($(this).datepicker("getDate")).dateString; |
| 342 |
}); |
| 343 |
$("#from_copyToDp").change(function(){ |
| 344 |
document.getElementById('from_copyTo').value = getSeparetedDate($(this).datepicker("getDate")).dateString; |
| 345 |
}); |
| 346 |
$("#to_copyFromDp").change(function(){ |
| 347 |
document.getElementById('to_copyFrom').value = getSeparetedDate($(this).datepicker("getDate")).dateString; |
| 348 |
}); |
| 349 |
$("#to_copyToDp").change(function(){ |
| 350 |
document.getElementById('to_copyTo').value = getSeparetedDate($(this).datepicker("getDate")).dateString; |
| 351 |
}); |
| 352 |
$(".hidePanel").on("click",function(){ |
| 353 |
if( $(this).hasClass("showHoliday") ){ |
| 354 |
hidePanel("showHoliday"); |
| 355 |
}if ($(this).hasClass('newHoliday')) { |
| 356 |
hidePanel("newHoliday"); |
| 357 |
}else { |
| 358 |
hidePanel("copyHoliday"); |
| 359 |
} |
| 360 |
}) |
| 361 |
}); |
| 362 |
//]]> |
| 363 |
</script> |
| 364 |
<!-- Datepicker colors --> |
| 365 |
<style type="text/css"> .key { padding : 3px; white-space:nowrap; line-height:230%; } |
| 366 |
.ui-datepicker { font-size : 150%; } |
| 367 |
.ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; } |
| 368 |
.ui-datepicker td a { padding : .5em; } |
| 369 |
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { font-size : 80%; } |
| 370 |
.key { padding : 3px; white-space:nowrap; line-height:230%; } |
| 371 |
.normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; } |
| 372 |
.ui-datepicker-unselectable { padding :.5em; white-space:nowrap;} |
| 373 |
.ui-state-disabled { padding :.5em; white-space:nowrap;} |
| 374 |
.exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; } |
| 375 |
.float { background-color : #66ff33; color : Black; border : 1px solid #BCBCBC; } |
| 376 |
.holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; } |
| 377 |
.repeatableweekly { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; } |
| 378 |
.repeatableyearly { background-color : #FFCC66; color : Black; border : 1px solid #BCBCBC; } |
| 379 |
td.exception a.ui-state-default { background: #b3d4ff none; color : Black; border : 1px solid #BCBCBC; } |
| 380 |
td.float a.ui-state-default { background: #66ff33 none; color : Black; border : 1px solid #BCBCBC; } |
| 381 |
td.holiday a.ui-state-default { background: #ffaeae none; color : Black; border : 1px solid #BCBCBC; } |
| 382 |
td.repeatableweekly a.ui-state-default { background: #FFFF99 none; color : Black; border : 1px solid #BCBCBC; } |
| 383 |
td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Black; border : 1px solid #BCBCBC; } |
| 384 |
.information { 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; } |
| 385 |
.panel { z-index : 1; display : none; border : 3px solid #CCC; padding : 3px; margin-top: .3em; background-color: #FEFEFE; } fieldset.brief { border : 0; margin-top: 0; } |
| 386 |
#showHoliday { margin : .5em 0; } h1 select { width: 20em; } div.yui-b fieldset.brief ol { font-size:100%; } div.yui-b fieldset.brief li, div.yui-b fieldset.brief li.radio { padding:0.2em 0; } .help { margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; } #holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { font-size : 90%; margin-bottom : 1em;} .calendar td, .calendar th, .calendar .button, .calendar tbody .day { padding : .7em; font-size: 110%; } .calendar { width: auto; border : 0; } |
| 387 |
.copyHoliday form li{ display:table-row } .copyHoliday form li b, .copyHoliday form li input{ display:table-cell; margin-bottom: 2px; } |
| 388 |
</style> |
| 389 |
</head> |
| 390 |
<body id="tools_holidays" class="tools"> |
| 391 |
[% INCLUDE 'header.inc' %] |
| 392 |
[% INCLUDE 'cat-search.inc' %] |
| 393 |
|
| 394 |
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% branchname %] calendar</div> |
| 395 |
|
| 396 |
<div id="doc3" class="yui-t1"> |
| 397 |
|
| 398 |
<div id="bd"> |
| 399 |
<div id="yui-main"> |
| 400 |
<div class="yui-b"> |
| 401 |
<h2>[% branchname %] calendar</h2> |
| 402 |
<div class="yui-g"> |
| 403 |
<div class="yui-u first"> |
| 404 |
<label for="branch">Define the holidays for:</label> |
| 405 |
<select id="branch" name="branch"> |
| 406 |
[% FOREACH branchloo IN branchloop %] |
| 407 |
[% IF ( branchloo.selected ) %] |
| 408 |
<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> |
| 409 |
[% ELSE %] |
| 410 |
<option value="[% branchloo.value %]">[% branchloo.branchname %]</option> |
| 411 |
[% END %] |
| 412 |
[% END %] |
| 413 |
</select> |
| 414 |
|
| 415 |
<h3>Calendar information</h3> |
| 416 |
<form style="display :flex" method="get" onsubmit="return validateForm('changeHours')"> |
| 417 |
<div id="jcalendar-container" style="display:inline-block"> |
| 418 |
</div> |
| 419 |
|
| 420 |
<div class="dateDetailsPanel" id="dateInfo" style="margin:0 auto;display:inline-block; visibility:hidden;"> |
| 421 |
<table style="display :flex"> |
| 422 |
<tr> |
| 423 |
<th>Date</th> |
| 424 |
<th id="date"></th> |
| 425 |
</tr> |
| 426 |
<tr> |
| 427 |
<th>Holiday type</th> |
| 428 |
<th id="holidayType"> |
| 429 |
<select name ='holidayType'> |
| 430 |
<option value="none">Not a holiday</option> |
| 431 |
<option value="R">Fixed</option> |
| 432 |
<option value="E">Exception</option> |
| 433 |
<option value="W">Weekly</option> |
| 434 |
<option value="F">Floating</option> |
| 435 |
<option value="N">Need validation</option> |
| 436 |
</select> |
| 437 |
</th> |
| 438 |
</tr> |
| 439 |
<tr> |
| 440 |
<th>Open hour</th> |
| 441 |
<th><input type="text" name="openHour" id='openHour' style="display :flex"></th> |
| 442 |
</tr> |
| 443 |
<tr> |
| 444 |
<th>Close hour</th> |
| 445 |
<th><input type="text" name="closeHour" id='closeHour' style="display :flex"></th> |
| 446 |
</tr> |
| 447 |
</table> |
| 448 |
<input type="hidden" name="action" value="hourschange"> |
| 449 |
<input type="hidden" name="branch" value="[%branch%]"> |
| 450 |
<input type="hidden" name="fromDate" id='fromDate'> |
| 451 |
<input type="hidden" name="toDate" id='toDate'> |
| 452 |
<input type="hidden" id="BranchName" name="BranchName" /> |
| 453 |
<input type="submit" name="submit" value="Update"> |
| 454 |
</div> |
| 455 |
</form> |
| 456 |
<input type="button" name="name" value="Copy holiday" onclick="copyHoliday()"/> |
| 457 |
<!-- ******************************** FLAT PANELS ******************************************* --> |
| 458 |
<!-- ***** Makes all the flat panel to deal with holidays ***** --> |
| 459 |
<!-- **************************************************************************************** --> |
| 460 |
|
| 461 |
<!-- ********************** Panel for showing already loaded holidays *********************** --> |
| 462 |
<div class="panel showHoliday" id="showHoliday"> |
| 463 |
<form method="post"> |
| 464 |
<input type="hidden" id="HolidayType" name="HolidayType" value="" /> |
| 465 |
<fieldset class="brief"> |
| 466 |
<h3>Edit this holiday</h3> |
| 467 |
<span id="holtype"></span> |
| 468 |
<ol> |
| 469 |
<li> |
| 470 |
<strong>Library:</strong> <span id="showBranchNameOutput"></span> |
| 471 |
<input type="hidden" id="BranchName" name="BranchName" /> |
| 472 |
</li> |
| 473 |
<li> |
| 474 |
<strong>From date:</strong> |
| 475 |
<span id="showDaynameOutput"></span>, |
| 476 |
|
| 477 |
[% IF ( dateformat == "us" ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "metric") %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "dmydot") %]<span id="showDayOutput"></span>.<span id="showMonthOutput"></span>.<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %] |
| 478 |
|
| 479 |
<input type="hidden" id="showDayname" name="showDayname" /> |
| 480 |
<input type="hidden" id="Weekday" name="Weekday" /> |
| 481 |
<input type="hidden" id="Day" name="Day" /> |
| 482 |
<input type="hidden" id="Month" name="Month" /> |
| 483 |
<input type="hidden" id="Year" name="Year" /> |
| 484 |
</li> |
| 485 |
<li class="dateinsert"> |
| 486 |
<b>To Date : </b> |
| 487 |
<input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange %]" class="datepicker"/> |
| 488 |
</li> |
| 489 |
<li><label for="Title">Title: </label><input type="text" name="Title" id="Title" size="35" /></li> |
| 490 |
<!-- Title is necessary for exception radio button to work properly --> |
| 491 |
<li class="radio"><input type="radio" name="Operation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label> |
| 492 |
<a href="#" class="helptext">[?]</a> |
| 493 |
<div class="hint">This will delete this holiday only.</div></li> |
| 494 |
<li class="radio"><input type="radio" name="Operation" id="showOperationDel" value="deleteType" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday type</label> |
| 495 |
<a href="#" class="helptext">[?]</a> |
| 496 |
<div class="hint">This will delete all the holidays of this type expect floats. If it's a weekly holiday on the Mondays, this will remove all the upcoming Mondays holidays. If it's a yearly holiday on 25 December, |
| 497 |
this will delete all the upcoming holidays on the 25 December</div></li> |
| 498 |
<li class="radio"><input type="radio" name="Operation" id="showOperationDelRange" value="deleterange" /> <label for="showOperationDelRange" id="showOperationDelLabelRange">Delete the single holidays on a range</label>. |
| 499 |
<a href="#" class="helptext">[?]</a> |
| 500 |
<div class="hint">This will delete all the holidays between two given dates.</div> |
| 501 |
</li> |
| 502 |
<li class="radio"><input type="radio" name="Operation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label> |
| 503 |
<a href="#" class="helptext">[?]</a> |
| 504 |
<div class="hint">This will save changes to the holiday's title and description. If the information for a repeatable holiday is modified, it affects all of the dates on which the holiday is repeated.</div></li> |
| 505 |
</ol> |
| 506 |
<fieldset class="action"> |
| 507 |
<input type="hidden" name="action" value="edit"> |
| 508 |
<input type="submit" name="submit" value="Save" /> |
| 509 |
<a href="#" class="cancel hidePanel showHoliday">Cancel</a> |
| 510 |
</fieldset> |
| 511 |
</fieldset> |
| 512 |
</form> |
| 513 |
</div> |
| 514 |
|
| 515 |
<div class="panel copyHoliday" id="copyHoliday"> |
| 516 |
<form method="post" onsubmit="return validateForm('copyHoliday')"> |
| 517 |
<input type="hidden" id="HolidayType" name="HolidayType" value="" /> |
| 518 |
<fieldset class="brief"> |
| 519 |
<h2>Copy holiday</h2> |
| 520 |
<span id="holtype"></span> |
| 521 |
<ol> |
| 522 |
<li> |
| 523 |
<strong>Library:</strong> <span id="showBranchNameOutput"></span> |
| 524 |
<input type="hidden" id="newBranch" name="newBranch" /> |
| 525 |
</li> |
| 526 |
<li> |
| 527 |
<h3>Copy from :</h3> |
| 528 |
</li> |
| 529 |
<li class="dateinsert"> |
| 530 |
<b>From Date : </b> |
| 531 |
<input type="text" id="from_copyFromDp" size="20" value="[% from_copyFrom %]" class="datepicker"/> |
| 532 |
<b>To Date : </b> |
| 533 |
<input type="text" id="from_copyToDp" size="20" value="[% from_copyTo %]" class="datepicker"/> |
| 534 |
</li> |
| 535 |
<li> |
| 536 |
<h3>Apply To : </h3> |
| 537 |
</li> |
| 538 |
<li class="dateinsert"> |
| 539 |
<b>From Date : </b> |
| 540 |
<input type="text" id="to_copyFromDp" size="20" value="[% to_copyFrom %]" class="datepicker"/> |
| 541 |
<b>To Date : </b> |
| 542 |
<input type="text" id="to_copyToDp" size="20" value="[% to_copyTo %]" class="datepicker"/> |
| 543 |
</li> |
| 544 |
|
| 545 |
</ol> |
| 546 |
<fieldset class="action"> |
| 547 |
<input type="hidden" name="from_copyFrom" id='from_copyFrom' value=""> |
| 548 |
<input type="hidden" name="from_copyTo" id='from_copyTo'value=""> |
| 549 |
<input type="hidden" name="to_copyFrom" id='to_copyFrom'value=""> |
| 550 |
<input type="hidden" name="to_copyTo" id='to_copyTo'value=""> |
| 551 |
<input type="hidden" name="daysnumber" id='daysnumber'value=""> |
| 552 |
<input type="hidden" name="branch" value="[%branch%]"> |
| 553 |
<input type="hidden" name="action" value="copy"> |
| 554 |
<input type="submit" name="submit" value="Save" /> |
| 555 |
<a href="#" class="cancel hidePanel copyHoliday">Cancel</a> |
| 556 |
</fieldset> |
| 557 |
</fieldset> |
| 558 |
</form> |
| 559 |
|
| 560 |
<form method="post"> |
| 561 |
<fieldset class="brief"> |
| 562 |
<h2>Copy entire calendar</h2> |
| 563 |
<input type="submit" name="name" value="Copy this calendar to"/> |
| 564 |
<select id="branchCopy" name="branchCopy"> |
| 565 |
[% FOREACH branchloo IN branchloop %] |
| 566 |
<option value="[% branchloo.value %]">[% branchloo.branchname %]</option> |
| 567 |
[% END %] |
| 568 |
</select> |
| 569 |
<input type="hidden" name="branch" value="[%branch%]"/> |
| 570 |
<input type="hidden" name="action" value="copy"/> |
| 571 |
<input type="hidden" name="operation" value="copyBranch"/> |
| 572 |
</fieldset> |
| 573 |
</form> |
| 574 |
</div> |
| 575 |
|
| 576 |
<!-- ***************************** Panel to deal with new holidays ********************** --> |
| 577 |
<div class="panel newHoliday" id="newHoliday"> |
| 578 |
<form method="post"> |
| 579 |
<input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" /> |
| 580 |
<fieldset class="brief"> |
| 581 |
<h3>Add new holiday</h3> |
| 582 |
<ol> |
| 583 |
<li> |
| 584 |
<strong>Library:</strong> |
| 585 |
<span id="newBranchNameOutput"></span> |
| 586 |
<input type="hidden" id="BranchName" name="BranchName" /> |
| 587 |
</li> |
| 588 |
<li> |
| 589 |
<strong>From date:</strong> |
| 590 |
<span id="newDaynameOutput"></span>, |
| 591 |
|
| 592 |
[% 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 %] |
| 593 |
|
| 594 |
<input type="hidden" id="newDayname" name="showDayname" /> |
| 595 |
<input type="hidden" id="Weekday" name="Weekday" /> |
| 596 |
<input type="hidden" id="Day" name="Day" /> |
| 597 |
<input type="hidden" id="Month" name="Month" /> |
| 598 |
<input type="hidden" id="Year" name="Year" /> |
| 599 |
</li> |
| 600 |
<li class="dateinsert"> |
| 601 |
<b>To date: </b> |
| 602 |
<input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange %]" class="datepicker" /> |
| 603 |
</li> |
| 604 |
<li><label for="title">Title: </label><input type="text" name="Title" id="title" size="35" /></li> |
| 605 |
<li class="radio"><input type="radio" name="Operation" id="newOperationOnce" value="holiday" checked="checked" /> |
| 606 |
<label for="newOperationOnce">Holiday only on this day</label>. |
| 607 |
<a href="#" class="helptext">[?]</a> |
| 608 |
<div class="hint">Make a single holiday. For example, selecting August 1, 2012 will make it a holiday, but will not affect August 1 in other years.</div> |
| 609 |
</li> |
| 610 |
<li class="radio"><input type="radio" name="Operation" id="newOperationDay" value="weekday" /> |
| 611 |
<label for="newOperationDay">Holiday repeated every same day of the week</label>. |
| 612 |
<a href="#" class="helptext">[?]</a> |
| 613 |
<div class="hint">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.</div> |
| 614 |
</li> |
| 615 |
<li class="radio"><input type="radio" name="Operation" id="newOperationYear" value="repeatable" /> |
| 616 |
<label for="newOperationYear">Holiday repeated yearly on the same date</label>. |
| 617 |
<a href="#" class="helptext">[?]</a> |
| 618 |
<div class="hint">This will take this day and month as a reference to make it a holiday. Through this option, you can repeat this rule for every year. For example, selecting August 1 will make August 1 a holiday every year.</div> |
| 619 |
</li> |
| 620 |
<li class="radio"><input type="radio" name="Operation" id="newOperationField" value="holidayrange" /> |
| 621 |
<label for="newOperationField">Holidays on a range</label>. |
| 622 |
<a href="#" class="helptext">[?]</a> |
| 623 |
<div class="hint">Make a single holiday on a range. For example, selecting August 1, 2012 and August 10, 2012 will make all days between August 1 and 10 a holiday, but will not affect August 1-10 in other years.</div> |
| 624 |
</li> |
| 625 |
<li class="radio"><input type="radio" name="Operation" id="newOperationFieldyear" value="holidayrangerepeat" /> |
| 626 |
<label for="newOperationFieldyear">Holidays repeated yearly on a range</label>. |
| 627 |
<a href="#" class="helptext">[?]</a> |
| 628 |
<div class="hint">Make a single holiday on a range repeated yearly. For example, selecting August 1, 2012 and August 10, 2012 will make all days between August 1 and 10 a holiday, and will affect August 1-10 in other years.</div> |
| 629 |
</li> |
| 630 |
<li class="radio"> |
| 631 |
<input type="checkbox" name="allBranches" id="allBranches" /> |
| 632 |
<label for="allBranches">Copy to all libraries</label>. |
| 633 |
<a href="#" class="helptext">[?]</a> |
| 634 |
<div class="hint">If checked, this holiday will be copied to all libraries. If the holiday already exists for a library, no change is made.</div> |
| 635 |
</li></ol> |
| 636 |
<fieldset class="action"> |
| 637 |
<input type="hidden" name="action" value="add"> |
| 638 |
<input type="submit" name="submit" value="Save" /> |
| 639 |
<a href="#" class="cancel hidePanel newHoliday">Cancel</a> |
| 640 |
</fieldset> |
| 641 |
</fieldset> |
| 642 |
</form> |
| 643 |
</div> |
| 644 |
|
| 645 |
<!-- *************************************************************************************** --> |
| 646 |
<!-- ****** END OF FLAT PANELS ****** --> |
| 647 |
<!-- *************************************************************************************** --> |
| 648 |
|
| 649 |
<!-- ************************************************************************************** --> |
| 650 |
<!-- ****** MAIN SCREEN CODE ****** --> |
| 651 |
<!-- ************************************************************************************** --> |
| 652 |
|
| 653 |
</div> |
| 654 |
<div class="yui-u"> |
| 655 |
<div class="help"> |
| 656 |
<h4>Hints</h4> |
| 657 |
<ul> |
| 658 |
<li>Search in the calendar the day you want to set as holiday.</li> |
| 659 |
<li>Click the date to add or edit a holiday.</li> |
| 660 |
<li>Specify how the holiday should repeat.</li> |
| 661 |
<li>Click Save to finish.</li> |
| 662 |
</ul> |
| 663 |
<h4>Key</h4> |
| 664 |
<p> |
| 665 |
<span class="key normalday">Working day</span> |
| 666 |
<span class="key holiday">Unique holiday</span> |
| 667 |
<span class="key repeatableweekly">Holiday repeating weekly</span> |
| 668 |
<span class="key repeatableyearly">Holiday repeating yearly</span> |
| 669 |
<span class="key exception">Need validation</span> |
| 670 |
<span class="key float">Floating holiday</span> |
| 671 |
</p> |
| 672 |
</div> |
| 673 |
<div id="holiday-list"> |
| 674 |
|
| 675 |
[% IF ( week_days ) %] |
| 676 |
<h3>Weekly - Repeatable holidays</h3> |
| 677 |
<table id="holidayweeklyrepeatable"> |
| 678 |
<thead> |
| 679 |
<tr> |
| 680 |
<th class="repeatableweekly">Day of week</th> |
| 681 |
<th class="repeatableweekly">Title</th> |
| 682 |
</tr> |
| 683 |
</thead> |
| 684 |
<tbody> |
| 685 |
[% FOREACH WEEK_DAYS_LOO IN week_days %] |
| 686 |
<tr> |
| 687 |
<td>[% WEEK_DAYS_LOO.weekday %]</td> |
| 688 |
</td> |
| 689 |
<td>[% WEEK_DAYS_LOO.note %]</td> |
| 690 |
</tr> |
| 691 |
[% END %] |
| 692 |
</tbody> |
| 693 |
</table> |
| 694 |
[% END %] |
| 695 |
|
| 696 |
[% IF ( repeatable_holidays ) %] |
| 697 |
<h3>Yearly - Repeatable holidays</h3> |
| 698 |
<table id="holidaysyearlyrepeatable"> |
| 699 |
<thead> |
| 700 |
<tr> |
| 701 |
[% IF ( dateformat == "metric" ) %] |
| 702 |
<th class="repeatableyearly">Day/month</th> |
| 703 |
[% ELSE %] |
| 704 |
<th class="repeatableyearly">Month/day</th> |
| 705 |
[% END %] |
| 706 |
<th class="repeatableyearly">Title</th> |
| 707 |
</tr> |
| 708 |
</thead> |
| 709 |
<tbody> |
| 710 |
[% FOREACH DAY_MONTH_HOLIDAYS_LOO IN repeatable_holidays %] |
| 711 |
<tr> |
| 712 |
<td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT %]">[%DAY_MONTH_HOLIDAYS_LOO.month%]/[% DAY_MONTH_HOLIDAYS_LOO.day %]</span></td> |
| 713 |
<td>[% DAY_MONTH_HOLIDAYS_LOO.note %]</td> |
| 714 |
</tr> |
| 715 |
[% END %] |
| 716 |
</tbody> |
| 717 |
</table> |
| 718 |
[% END %] |
| 719 |
|
| 720 |
[% IF ( HOLIDAYS_LOOP ) %] |
| 721 |
<h3>Unique upcoming holidays</h3> |
| 722 |
<table id="holidaysunique"> |
| 723 |
<thead> |
| 724 |
<tr> |
| 725 |
<th class="holiday">Date</th> |
| 726 |
<th class="holiday">Title</th> |
| 727 |
</tr> |
| 728 |
</thead> |
| 729 |
<tbody> |
| 730 |
[% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] |
| 731 |
<tr> |
| 732 |
<td><a href="/cgi-bin/koha/tools/discrete_calendarte_holiday.pl?branch=[% branch %]&calendardate=[% HOLIDAYS_LOO.date %]"><span title="[% HOLIDAYS_LOO.DATE_SORT %]">[% HOLIDAYS_LOO.outputdate %]</span></a></td> |
| 733 |
<td>[% HOLIDAYS_LOO.note %]</td> |
| 734 |
</tr> |
| 735 |
[% END %] |
| 736 |
</tbody> |
| 737 |
</table> |
| 738 |
[% END %] |
| 739 |
</div> |
| 740 |
</div> |
| 741 |
</div> |
| 742 |
</div> |
| 743 |
</div> |
| 744 |
|
| 745 |
<div class="yui-b noprint"> |
| 746 |
[% INCLUDE 'tools-menu.inc' %] |
| 747 |
</div> |
| 748 |
</div> |
| 749 |
[% INCLUDE 'intranet-bottom.inc' %] |