f4e1c305e5
Monotone-Parent: f204b5cbae9f137b40fe156567df21dd058ef0fd Monotone-Revision: 4eec48b0737f46c7d29a611b8aacf7df08d809fb Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-08-19T00:26:55 Monotone-Branch: ca.inverse.sogo
82 lines
2.4 KiB
JavaScript
82 lines
2.4 KiB
JavaScript
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
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");
|
|
var save = true;
|
|
var tag = $("calendarSyncTag");
|
|
var originalTag = $("originalCalendarSyncTag");
|
|
var allTags = $("allCalendarSyncTags");
|
|
|
|
if (allTags)
|
|
allTags = allTags.value.split(",");
|
|
|
|
if (tag
|
|
&& $("synchronizeCalendar").checked) {
|
|
if (tag.value.blank()) {
|
|
alert(labels["tagNotDefined"]);
|
|
save = false;
|
|
}
|
|
else if (allTags
|
|
&& allTags.indexOf(tag.value) > -1) {
|
|
alert(labels["tagAlreadyExists"]);
|
|
save = false;
|
|
}
|
|
else if (originalTag
|
|
&& !originalTag.value.blank()) {
|
|
if (tag.value != originalTag.value)
|
|
save = confirm(labels["tagHasChanged"]);
|
|
}
|
|
else
|
|
save = confirm(labels["tagWasAdded"]);
|
|
}
|
|
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);
|
|
}
|
|
|
|
function onColorClick(event) {
|
|
var cPicker = window.open(ApplicationBaseURL + "colorPicker", "colorPicker",
|
|
"width=250,height=200,resizable=0,scrollbars=0"
|
|
+ "toolbar=0,location=0,directories=0,status=0,"
|
|
+ "menubar=0,copyhistory=0", "test"
|
|
);
|
|
cPicker.focus();
|
|
|
|
preventDefault(event);
|
|
}
|
|
|
|
function onColorPickerChoice(newColor) {
|
|
var colorButton = $("colorButton");
|
|
colorButton.setStyle({ "backgroundColor": newColor });
|
|
var calendarColor = $("calendarColor");
|
|
calendarColor.value = newColor;
|
|
}
|
|
|
|
document.observe("dom:loaded", onLoadCalendarProperties);
|