2009-07-19 18:41:42 +02:00
|
|
|
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2008-08-28 16:48:45 +02:00
|
|
|
|
2008-04-22 01:04:26 +02:00
|
|
|
function onLoadCalendarProperties() {
|
|
|
|
var colorButton = $("colorButton");
|
|
|
|
var calendarColor = $("calendarColor");
|
|
|
|
colorButton.setStyle({ "backgroundColor": calendarColor.value, display: "inline" });
|
|
|
|
colorButton.observe("click", onColorClick);
|
|
|
|
|
|
|
|
var cancelButton = $("cancelButton");
|
|
|
|
cancelButton.observe("click", onCancelClick);
|
|
|
|
|
|
|
|
var okButton = $("okButton");
|
|
|
|
okButton.observe("click", onOKClick);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onCancelClick(event) {
|
|
|
|
window.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
function onOKClick(event) {
|
|
|
|
var calendarName = $("calendarName");
|
|
|
|
var calendarColor = $("calendarColor");
|
|
|
|
var calendarID = $("calendarID");
|
2009-08-18 03:03:05 +02:00
|
|
|
var save = true;
|
|
|
|
var tag = $("calendarSyncTag").value;
|
|
|
|
var originalTag = $("originalCalendarSyncTag");
|
|
|
|
var allTags = $("allCalendarSyncTags");
|
2008-04-22 01:04:26 +02:00
|
|
|
|
2009-08-18 03:03:05 +02:00
|
|
|
if (allTags)
|
|
|
|
allTags = allTags.value.split(",");
|
|
|
|
|
|
|
|
if ($("synchronizeCalendar").checked) {
|
|
|
|
if (tag.blank()) {
|
|
|
|
alert(labels["tagNotDefined"]);
|
|
|
|
save = false;
|
|
|
|
}
|
|
|
|
else if (allTags
|
|
|
|
&& allTags.indexOf(tag) > -1) {
|
|
|
|
alert(labels["tagAlreadyExists"]);
|
|
|
|
save = false;
|
|
|
|
}
|
|
|
|
else if (originalTag
|
2009-08-18 03:55:49 +02:00
|
|
|
&& !originalTag.value.blank()) {
|
|
|
|
if (tag != originalTag.value)
|
|
|
|
save = confirm(labels["tagHasChanged"]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
save = confirm(labels["tagWasAdded"]);
|
2009-08-18 03:03:05 +02:00
|
|
|
}
|
|
|
|
else if (originalTag
|
|
|
|
&& !originalTag.value.blank())
|
|
|
|
save = confirm(labels["tagWasRemoved"]);
|
|
|
|
|
|
|
|
if (save)
|
|
|
|
window.opener.updateCalendarProperties(calendarID.value,
|
|
|
|
calendarName.value,
|
|
|
|
calendarColor.value);
|
|
|
|
else
|
|
|
|
Event.stop(event);
|
2008-04-22 01:04:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onColorClick(event) {
|
|
|
|
var cPicker = window.open(ApplicationBaseURL + "colorPicker", "colorPicker",
|
2009-07-29 20:29:02 +02:00
|
|
|
"width=250,height=200,resizable=0,scrollbars=0"
|
|
|
|
+ "toolbar=0,location=0,directories=0,status=0,"
|
|
|
|
+ "menubar=0,copyhistory=0", "test"
|
|
|
|
);
|
2008-04-22 01:04:26 +02:00
|
|
|
cPicker.focus();
|
2009-07-29 20:29:02 +02:00
|
|
|
|
2008-04-22 01:04:26 +02:00
|
|
|
preventDefault(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onColorPickerChoice(newColor) {
|
|
|
|
var colorButton = $("colorButton");
|
|
|
|
colorButton.setStyle({ "backgroundColor": newColor });
|
|
|
|
var calendarColor = $("calendarColor");
|
|
|
|
calendarColor.value = newColor;
|
|
|
|
}
|
|
|
|
|
2009-03-12 22:09:14 +01:00
|
|
|
document.observe("dom:loaded", onLoadCalendarProperties);
|