/usr/share/pyshared/zc/datetimewidget/resources/datetimewidget.js is in python-zc.datetimewidget 0.7.0-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | var dtwLanguageLoaded = false;
function dateTimeWidgetLoadLanguageFile(url){
// this method loads a languagefile for the datetimewidget
// TODO: move this functionality into zc.resourcelibrary
if (dtwLanguageLoaded==true){
return;
}
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
dtwLanguageLoaded = true;
}
function dateSelected(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.dateClicked && !cal.multiple)
// if we add this call we close the calendar on single-click.
// just to exemplify both cases, we are using this only for the 1st
// and the 3rd field, while 2nd and 4th will still require double-click.
cal.callCloseHandler();
}
function getMultipleDateClosedHandler(input_id, MA) {
return function(cal) {
var el = document.getElementById(input_id);
// reset initial content.
el.value = "";
MA.length = 0;
// sort dates in ascending order
var date_keys = new Array();
for (var i in cal.multiple)
date_keys.push(i);
date_keys.sort()
// walk the calendar's multiple dates selection hash
for (var j in date_keys) {
i = date_keys[j];
var d = cal.multiple[i];
if (d) {
el.value += d.print("%Y-%m-%d ");
MA[MA.length] = d;
}
}
cal.hide();
return true;
}
}
function enabledWeekdays(enabled_weekdays) {
return function(date) {
// Return true if the selected day should be disabled.
weekday = date.getDay();
for (var enabled_wd in enabled_weekdays) {
if (weekday == enabled_weekdays[enabled_wd])
return false;
}
return true;
}
}
|