2007-03-18 16:38:55 +01:00
|
|
|
function onPopupAttendeesWindow(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
window.open(ApplicationBaseURL + "/editAttendees", null,
|
|
|
|
"width=803,height=573");
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSelectPrivacy(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
if (event.button == 0 || (isSafari() && event.button == 1)) {
|
|
|
|
var node = getTarget(event);
|
|
|
|
if (node.tagName != 'BUTTON')
|
|
|
|
node = $(node).up("button");
|
|
|
|
popupToolbarMenu(node, "privacy-menu");
|
|
|
|
Event.stop(event);
|
|
|
|
// preventDefault(event);
|
|
|
|
}
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onPopupUrlWindow(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
|
|
|
|
var urlInput = document.getElementById("url");
|
|
|
|
var newUrl = window.prompt(labels["Target:"], urlInput.value);
|
|
|
|
if (newUrl != null) {
|
|
|
|
var documentHref = $("documentHref");
|
|
|
|
var documentLabel = $("documentLabel");
|
|
|
|
if (documentHref.childNodes.length > 0) {
|
|
|
|
documentHref.childNodes[0].nodeValue = newUrl;
|
|
|
|
if (newUrl.length > 0)
|
|
|
|
documentLabel.setStyle({ display: "block" });
|
|
|
|
else
|
|
|
|
documentLabel.setStyle({ display: "none" });
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
documentHref.appendChild(document.createTextNode(newUrl));
|
|
|
|
if (newUrl.length > 0)
|
|
|
|
documentLabel.setStyle({ display: "block" });
|
|
|
|
}
|
|
|
|
urlInput.value = newUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onPopupDocumentWindow(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
var documentUrl = $("url");
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
preventDefault(event);
|
|
|
|
window.open(documentUrl.value, "SOGo_Document");
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
2007-04-27 21:41:04 +02:00
|
|
|
function onMenuSetClassification(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
event.cancelBubble = true;
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
var classification = this.getAttribute("classification");
|
|
|
|
if (this.parentNode.chosenNode)
|
|
|
|
this.parentNode.chosenNode.removeClassName("_chosen");
|
|
|
|
this.addClassName("_chosen");
|
|
|
|
this.parentNode.chosenNode = this;
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
// log("classification: " + classification);
|
|
|
|
var privacyInput = document.getElementById("privacy");
|
|
|
|
privacyInput.value = classification;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
2007-04-02 21:27:46 +02:00
|
|
|
function onChangeCalendar(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
var calendars = $("calendarFoldersList").value.split(",");
|
|
|
|
var form = document.forms["editform"];
|
|
|
|
var urlElems = form.getAttribute("action").split("/");
|
|
|
|
var choice = calendars[this.value];
|
|
|
|
urlElems[urlElems.length-3] = choice;
|
|
|
|
form.setAttribute("action", urlElems.join("/"));
|
2007-04-02 21:27:46 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:38:55 +01:00
|
|
|
function initializeDocumentHref() {
|
2007-11-19 22:07:54 +01:00
|
|
|
var documentHref = $("documentHref");
|
|
|
|
var documentLabel = $("documentLabel");
|
|
|
|
var documentUrl = $("url");
|
|
|
|
|
2008-04-15 22:12:51 +02:00
|
|
|
documentHref.observe("click", onPopupDocumentWindow, false);
|
2007-11-19 22:07:54 +01:00
|
|
|
documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
|
|
|
|
if (documentUrl.value.length > 0) {
|
|
|
|
documentHref.appendChild(document.createTextNode(documentUrl.value));
|
|
|
|
documentLabel.setStyle({ display: "block" });
|
|
|
|
}
|
|
|
|
|
|
|
|
var changeUrlButton = $("changeUrlButton");
|
2008-04-15 22:12:51 +02:00
|
|
|
changeUrlButton.observe("click", onPopupUrlWindow, false);
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function initializePrivacyMenu() {
|
2007-11-19 22:07:54 +01:00
|
|
|
var privacy = $("privacy").value.toUpperCase();
|
|
|
|
if (privacy.length > 0) {
|
|
|
|
var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0];
|
|
|
|
var menuEntries = $(privacyMenu).childNodesWithTag("li");
|
|
|
|
var chosenNode;
|
|
|
|
if (privacy == "CONFIDENTIAL")
|
|
|
|
chosenNode = menuEntries[1];
|
|
|
|
else if (privacy == "PRIVATE")
|
|
|
|
chosenNode = menuEntries[2];
|
|
|
|
else
|
|
|
|
chosenNode = menuEntries[0];
|
|
|
|
privacyMenu.chosenNode = chosenNode;
|
|
|
|
$(chosenNode).addClassName("_chosen");
|
|
|
|
}
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onComponentEditorLoad(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
initializeDocumentHref();
|
|
|
|
initializePrivacyMenu();
|
|
|
|
var list = $("calendarList");
|
2008-04-15 22:12:51 +02:00
|
|
|
list.observe("mousedown",
|
2008-03-27 22:05:47 +01:00
|
|
|
onChangeCalendar.bindAsEventListener(list),
|
|
|
|
false);
|
2007-11-19 22:07:54 +01:00
|
|
|
list.fire("mousedown");
|
|
|
|
|
|
|
|
var menuItems = $("itemPrivacyList").childNodesWithTag("li");
|
|
|
|
for (var i = 0; i < menuItems.length; i++)
|
2008-04-15 22:12:51 +02:00
|
|
|
menuItems[i].observe("mousedown",
|
|
|
|
onMenuSetClassification.bindAsEventListener(menuItems[i]),
|
|
|
|
false);
|
2008-01-14 14:57:28 +01:00
|
|
|
|
2008-01-15 22:45:48 +01:00
|
|
|
$("repeatHref").observe("click", onPopupRecurrenceWindow);
|
2008-01-14 14:57:28 +01:00
|
|
|
$("repeatList").observe("change", onPopupRecurrenceWindow);
|
2008-01-15 22:45:48 +01:00
|
|
|
onPopupRecurrenceWindow(null);
|
2008-01-14 14:57:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onPopupRecurrenceWindow(event) {
|
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
|
2008-01-15 22:45:48 +01:00
|
|
|
var repeatHref = $("repeatHref");
|
|
|
|
|
|
|
|
if ($("repeatList").value == 7) {
|
|
|
|
repeatHref.show();
|
|
|
|
if (event)
|
|
|
|
window.open(ApplicationBaseURL + "editRecurrence", null,
|
|
|
|
"width=500,height=400");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
repeatHref.hide();
|
2008-01-14 14:57:28 +01:00
|
|
|
|
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
2007-04-27 21:41:04 +02:00
|
|
|
|
2007-11-15 20:02:23 +01:00
|
|
|
FastInit.addOnLoad(onComponentEditorLoad);
|