1 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/lib/calendar/calendar-system.css"/>
2 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/calendar/calendar.js"></script>
3 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/calendar/calendar-en.js"></script>
4 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/calendar/calendar-setup.js"></script>
5 <script type="text/javascript">
7 var debug = "<!-- TMPL_VAR Name="debug" -->";
8 var dformat = "<!-- TMPL_VAR Name="dateformat" -->";
10 if (debug > 0) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
12 function Date_from_syspref(dstring) {
13 var dateX = dstring.split(/[-/]/);
14 if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
15 if (dformat === "iso") {
16 return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d)
17 } else if (dformat === "us") {
18 return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d)
19 } else if (dformat === "metric") {
20 return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d)
22 if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
27 function get_Calendar_limit (date,did) {
28 // this function could be moved to a static calendar-extras.js file
29 var dvalue = document.getElementById(did).value;
30 if (dvalue == "") { return false; }
31 var limitDate = Date_from_syspref(dvalue);
32 if (debug && debug > 5) {
33 var month = date.getMonth() + 1;
34 var dateString = date.getFullYear() + '-' + month + '-' + date.getDate();
35 alert("Comparing incoming (" + dateString + ") vs "
36 + "'" + did + "' limit\n"
37 + "\n thisdate: " + date
38 + "\nlimitdate: " + limitDate
39 + "\nlimit > thisdate : " + (limitDate > date)
40 + "\nlimit < thisdate : " + (limitDate < date)