Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tmpl
Garry Collum e3eeda2fb1 Bug 3268: Adds the ability to edit the description of a holiday.
Adds another radio button to the edit holiday form. This is a partial fix, because you cannot make an edit to a single holiday for multiple branches.

Also fixed a small XHTML error and a wording error from my previous patch on holidays.tmpl (bug 3274).

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-03 13:26:40 -05:00

477 lines
21 KiB
Cheetah

<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Tools &rsaquo; Calendar</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
<script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script language="JavaScript" type="text/javascript">
//<![CDATA[
// Captura el evento onmousemove para cualquier navegador
if (document.layers) { // Netscape
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
document.onmousemove = captureMousePosition;
}
var mouseXMax = 0;
var mouseYMax = 0;
var mouseX = 0;
var mouseY = 0;
var weekdays = new Array("Sundays", "Mondays", "Tuesdays",
"Wednesdays", "Thursdays", "Fridays", "Saturdays");
function captureMousePosition(e) {
if (document.layers) {
mouseX = e.pageX;
mouseY = e.pageY;
mouseXMax = window.innerWidth + window.pageXOffset;
mouseYMax = window.innerHeight + window.pageYOffset;
} else if (document.all) {
mouseX = window.event.x + document.body.scrollLeft;
mouseY = window.event.y + document.body.scrollTop;
mouseXMax = document.body.clientWidth + document.body.scrollLeft;
mouseYMax = document.body.clientHeight + document.body.scrollTop;
} else if (document.getElementById) {
mouseX = e.pageX;
mouseY = e.pageY;
mouseXMax = window.innerWidth + window.pageXOffset;
mouseYMax = window.innerHeight + window.pageYOffset;
}
}
function holidayOperation(formObject, opType) {
var op = document.getElementsByName('operation');
op[0].value = opType;
formObject.submit();
}
// This function shows the "Show Holiday" panel //
function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) {
$("#newHoliday").slideUp("fast");
$("#showHoliday").slideDown("fast");
document.getElementById('showDayname').value = dayName;
document.getElementById('showBranchName').value = document.getElementById('branch').value;
document.getElementById('showDay').value = day;
document.getElementById('showMonth').value = month;
document.getElementById('showYear').value = year;
document.getElementById('showDescription').value = description;
document.getElementsByName('showWeekday')[0].value = weekDay;
document.getElementById('showTitle').value = title;
document.getElementById('showHolidayType').value = holidayType;
if (holidayType == 'exception') {
document.getElementById('showOperationDelLabel').innerHTML = 'Delete this exception.';
} else {
document.getElementById('showOperationDelLabel').innerHTML = 'Delete this holiday.';
}
if (exceptionPosibility == 1) {
document.getElementById('exceptionPosibility').style.display = 'inline';
} else {
document.getElementById('exceptionPosibility').style.display = 'none';
}
}
// This function shows the "Add Holiday" panel //
function newHoliday (dayName, day, month, year, weekDay) {
$("#showHoliday").slideUp("fast");
$("#newHoliday").slideDown("fast");
$("#newDayname").val(dayName);
$("#newBranchName").val($('#branch').val());
$("#newDay").val(day);
$("#newMonth").val(month);
$("#newYear").val(year);
$("#newWeekday")[0].val(weekDay);
}
function hidePanel(aPanelName) {
$("#"+aPanelName).slideUp("fast");
}
function changeBranch () {
var branch = $("#branch option:selected").val();
location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "<!-- TMPL_VAR NAME='calendardate' -->";
}
function additionalInformation (anExplanation) {
var panel = document.getElementById('information');
var paragraph = document.getElementById('explanation');
panel.style.display = 'inline'
panel.style.top = mouseY;
panel.style.left = mouseX;
var info = document.createTextNode(anExplanation);
if (paragraph.hasChildNodes()) {
paragraph.removeChild(paragraph.lastChild);
}
paragraph.appendChild(info);
}
function Help() {
newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
}
$(document).ready(function() {
$("#branch").change(function(){
changeBranch();
});
$("#holidayexceptions").tablesorter({
sortList: [[0,0]], widgets: ['zebra']
});
$("#holidayweeklyrepeatable").tablesorter({
sortList: [[0,0]], widgets: ['zebra']
});
$("#holidaysyearlyrepeatable").tablesorter({
sortList: [[0,0]], widgets: ['zebra']
});
$("#holidaysunique").tablesorter({
sortList: [[0,0]], widgets: ['zebra']
});
});
//]]>
</script>
<style type="text/css">
.normalday { background-color : #EDEDED; color : Black; border : 1px solid #000000; }
.exception { background-color : #EDEDED; color : Black; border : 1px solid #000000; }
.holiday { background-color : red; color : Black; border : 1px solid #000000; }
.repeatableday { background-color : yellow; color : Black; border : 1px solid #000000; }
.information { z-index : 1; 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; }
.panel { z-index : 1; width : 500px; display : none; border : 1px solid #000000; padding : 3px; /* position: absolute; */ background-color: #CCCCCC; }
div.dmy { display:inline; }
.blacklabel, div.dmy input { background-color:#FFFFFF; color:Black; font-size:10px; }
h1 select { width: 20em; }
</style>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->
<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Calendar</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<!-- *************************************************************************************** -->
<!-- ****** START OF INFORMATION PANEL ****** -->
<!-- *************************************************************************************** -->
<div class="information" style="position:absolute" id="information" onclick=" hidePanel('information')">
<table>
<tr>
<td>
<p id="explanation" style="display:inline;align:justify"></p>
</td>
</tr>
</table>
</div>
<!-- ************************************************************************************** -->
<!-- ****** END OF INFORMATION PANEL ****** -->
<!-- ************************************************************************************** -->
<h1>Define the holidays for :</h1>
<label for="branch">Select a library :</label>
<select id="branch" name="branch">
<!-- TMPL_LOOP NAME="branchloop" -->
<!-- TMPL_IF NAME="selected" -->
<option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
<!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
<ul>
<li>Search in the calendar the day you want to set as holiday.</li>
<li>Complete the information in the right area.</li>
<li>Once you finish the steps above, click Save.</li>
</ul>
<p>
<span class="normalday">Working day</span>
<span class="holiday">Unique holiday</span>
<span class="repeatableday">Repeatable holiday</span>
<span class="exception">Holiday exception</span>
</p>
<!-- ******************************** FLAT PANELS ******************************************* -->
<!-- ***** Makes all the flat panel to deal with holidays ***** -->
<!-- **************************************************************************************** -->
<!-- ********************** Panel for showing already loaded holidays *********************** -->
<div class="panel" id="showHoliday">
<form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
<input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
<h2>Edit this holiday</h2>
<p>
<label for="showBranchName">Library</label>
<input type="text" size="20" id="showBranchName" name="showBranchName" readonly="readonly" class="blacklabel" />
</p>
<p>
<label for="showDayname">Day name</label>
<input type="text" size="20" id="showDayname" name="showDayname" readonly="readonly" class="blacklabel" />
<input type="hidden" name="showWeekday" />
</p>
<div class="dmy">
<label for="showDay">Day</label> <input type="text" size="2" id="showDay" name="showDay" readonly="readonly" />
<label for="showMonth">Month</label> <input type="text" size="2" id="showMonth" name="showMonth" readonly="readonly" />
<label for="showYear">Year</label> <input type="text" size="4" id="showYear" name="showYear" readonly="readonly" />
</div>
<!-- showTitle is necessary for exception radio button to work properly -->
<input type="hidden" id="showTitle" name="showTitle" value="" />
<p><label for="showDescription">Description:</label>
<br />
<textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
</p>
<div id="exceptionPosibility" style="position:static">
<input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception to this holiday.</label>
<a href="#" onclick=" additionalInformation('You can make an exception for this holiday rule. This means that you will be able to say for a repeatable holiday, that there is one of those days that is going to be an exception.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a><br />
</div>
<input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
<a href="#" onclick=" additionalInformation('This will delete this holiday rule. If it is a repeatable holiday, this option checks for posible exceptions. If an exception exists, this option will remove the exception and set the date to a regular holiday.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a><br />
<input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
<a href="#" onclick=" additionalInformation('This will save changes to the holiday\'s description. If the description for a repeatable holiday is modified, it affects all of the dates that the holiday is repeated.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
<p>
<input type="submit" name="submit" value="Save" />
<input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('showHoliday');hidePanel('information')" />
</p>
</form>
</div>
<!-- ***************************** Panel to deal with new holidays ********************** -->
<div class="panel" id="newHoliday">
<form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
<input type="hidden" name="branchCodes" id="branchCodes" value="<!-- TMPL_VAR NAME="branchcodes" -->" />
<h2>Add new holiday</h2>
<p>
<label for="newBranchName">Library</label>
<input type="text" size="20" id="newBranchName" name="newBranchName" readonly="readonly" class="blacklabel" />
</p>
<p>
<label for="newDayname">Day name</label>
<input type="text" size="20" id="newDayname" name="newDayname" readonly="readonly" class="blacklabel" />
<input type="hidden" name="newWeekday" />
</p>
<div class="dmy">
<label for="newDay">Day</label> <input type="text" size="2" id="newDay" name="newDay" readonly="readonly" />
<label for="newMonth">Month</label> <input type="text" size="2" id="newMonth" name="newMonth" readonly="readonly" />
<label for="newYear">Year</label> <input type="text" size="4" id="newYear" name="newYear" readonly="readonly" />
</div>
<p><label for="newDescription">Description:</label>
<br />
<textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
</p>
<input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
<label for="newOperationOnce">Holiday only on this day</label>.
<a href="#" onclick=" additionalInformation('Make a single holiday. For example, selecting August 1st, 2012 will make it holiday, but will not affect August 1st in other years.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
<br />
<input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
<label for="newOperationDay">Holiday repeated every same day of the week</label>.
<a href="#" onclick=" additionalInformation('Make this weekday a holiday, every week. For example, if your library is closed on Saturdays, use this option to make every Saturday a holiday.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
<br />
<input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
<label for="newOperationYear">Holiday repeated yearly on the same date</label>.
<a href="#" onclick=" additionalInformation('This will take this day and month as a reference to make it holiday. Through this option, you can repeat this rule for every year. For example, selecting August 1st will make August 1st a holiday every year.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
<p>
<input type="checkbox" name="allBranches" id="allBranches" />
<label for="allBranches">Copy to all locations</label>.
<a href="#" onclick=" additionalInformation('If checked, this holiday will be copied to all locations. If the holiday already exists for a location, no change is made.')"><img src="<!-- TMPL_VAR NAME="themelang" -->/../img/more.gif" border="0" alt="More information" /></a>
</p><p>
<input type="submit" name="submit" value="Save" />
<input type="button" name="cancel2" value="Cancel" onclick=" hidePanel('newHoliday');hidePanel('information')" />
</p>
</form>
</div>
<!-- *************************************************************************************** -->
<!-- ****** END OF FLAT PANELS ****** -->
<!-- *************************************************************************************** -->
<!-- ************************************************************************************** -->
<!-- ****** MAIN SCREEN CODE ****** -->
<!-- ************************************************************************************** -->
<h2>Calendar information</h2>
<div id="calendar-container">
<script type="text/javascript">
/* Creates all the structures to deal with all diferents kinds of holidays */
var week_days = new Array();
var holidays = new Array();
var exception_holidays = new Array();
var day_month_holidays = new Array();
var hola= "<!-- TMPL_VAR NAME="code" -->";
<!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
week_days["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
<!-- /TMPL_LOOP -->
<!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
<!-- /TMPL_LOOP -->
<!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
exception_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
<!-- /TMPL_LOOP -->
<!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
day_month_holidays["<!-- TMPL_VAR NAME="KEY" -->"] = {title:"<!-- TMPL_VAR NAME="TITLE" -->", description:"<!-- TMPL_VAR NAME="DESCRIPTION" -->"};
<!-- /TMPL_LOOP -->
/* This function gives css clases to each kind of day */
function dateStatusHandler(date) {
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
var weekDay = date.getDay();
var dayMonth = month + '/' + day;
var dateString = year + '/' + month + '/' + day;
if (exception_holidays[dateString] != null) {
return 'exception';
} else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
return 'repeatableday';
} else if (holidays[dateString] != null) {
return 'holiday';
} else {
return 'normalday';
}
}
/* This function is in charge of showing the correct panel considering the kind of holiday */
function dateChanged(calendar) {
var day = calendar.date.getDate();
var month = calendar.date.getMonth() + 1;
var year = calendar.date.getFullYear();
var weekDay = calendar.date.getDay();
var dayName = calendar.date.print('%A');
var dayMonth = month + '/' + day;
var dateString = year + '/' + month + '/' + day;
if (calendar.dateClicked) {
if (holidays[dateString] != null) {
showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
} else if (exception_holidays[dateString] != null) {
showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
} else if (week_days[weekDay] != null) {
showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
} else if (day_month_holidays[dayMonth] != null) {
showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
} else {
newHoliday(dayName, day, month, year, weekDay);
}
}
};
Calendar.setup(
{
flat : "calendar-container",
flatCallback : dateChanged,
date: "<!-- TMPL_VAR NAME='keydate' -->",
dateStatusFunc : dateStatusHandler
}
);
</script>
<div id="holiday-list">
<!-- Exceptions First -->
<!-- this will probably always have the least amount of data -->
<!-- TMPL_IF NAME="EXCEPTION_HOLIDAYS_LOOP" -->
<h3>Exceptions</h3>
<table id="holidayexceptions">
<thead><tr>
<th class="exception">Date</th>
<th class="exception">Title</th>
<th class="exception">Description</th>
</tr>
</thead>
<tbody>
<!-- TMPL_LOOP NAME="EXCEPTION_HOLIDAYS_LOOP" -->
<tr>
<td><!-- TMPL_VAR NAME="DATE" --></td>
<td><!-- TMPL_VAR NAME="TITLE" --></td>
<td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
</tr>
<!-- /TMPL_LOOP -->
</tbody>
</table>
<!-- /TMPL_IF -->
<!--TMPL_IF NAME="WEEK_DAYS_LOOP" -->
<h3>Weekly - Repeatable Holidays</h3>
<table id="holidayweeklyrepeatable">
<thead>
<tr>
<th class="repeatableday">Day of Week</th>
<th class="repeatableday">Title</th>
<th class="repeatableday">Description</th>
</tr>
</thead>
<tbody>
<!-- TMPL_LOOP NAME="WEEK_DAYS_LOOP" -->
<tr>
<td>
<script type="text/javascript">
document.write(weekdays[ <!-- TMPL_VAR NAME="KEY" -->]);
</script>
</td>
<td><!-- TMPL_VAR NAME="TITLE" --></td>
<td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
</tr>
<!-- /TMPL_LOOP -->
</tbody>
</table>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
<h3>Yearly - Repeatable Holidays</h3>
<table id="holidaysyearlyrepeatable">
<thead>
<tr>
<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
<th class="repeatableday">Day/Month</th>
<!-- TMPL_ELSE -->
<th class="repeatableday">Month/Day</th>
<!-- /TMPL_IF -->
<th class="repeatableday">Title</th>
<th class="repeatableday">Description</th>
</tr>
</thead>
<tbody>
<!-- TMPL_LOOP NAME="DAY_MONTH_HOLIDAYS_LOOP" -->
<tr>
<td><!-- TMPL_VAR NAME="DATE" --></td>
<td><!-- TMPL_VAR NAME="TITLE" --></td>
<td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
</tr>
<!-- /TMPL_LOOP -->
</tbody>
</table>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="HOLIDAYS_LOOP" -->
<h3>Unique Holidays</h3>
<table id="holidaysunique">
<thead>
<tr>
<th class="holiday">Date</th>
<th class="holiday">Title</th>
<th class="holiday">Description</th>
</tr>
</thead>
<tbody>
<!-- TMPL_LOOP NAME="HOLIDAYS_LOOP" -->
<tr>
<td><!-- TMPL_VAR NAME="DATE" --></td>
<td><!-- TMPL_VAR NAME="TITLE" --></td>
<td><!-- TMPL_VAR NAME="DESCRIPTION" --></td>
</tr>
<!-- /TMPL_LOOP -->
</tbody>
</table>
<!-- /TMPL_IF -->
</div>
</div>
</div>
</div>
<div class="yui-b noprint">
<!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
</div>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->