2007-03-18 16:38:55 +01:00
|
|
|
function onPopupAttendeesWindow(event) {
|
|
|
|
if (event)
|
2007-06-06 23:27:44 +02:00
|
|
|
preventDefault(event);
|
2007-03-18 16:38:55 +01:00
|
|
|
window.open(ApplicationBaseURL + "editAttendees", null,
|
|
|
|
"width=803,height=573");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function onSelectPrivacy(event) {
|
|
|
|
popupToolbarMenu(event, "privacy-menu");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function onPopupUrlWindow(event) {
|
|
|
|
if (event)
|
2007-06-06 23:27:44 +02:00
|
|
|
preventDefault(event);
|
2007-03-18 16:38:55 +01:00
|
|
|
|
|
|
|
var urlInput = document.getElementById("url");
|
|
|
|
var newUrl = window.prompt(labels["Target:"].decodeEntities(), 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)
|
2007-05-25 17:43:49 +02:00
|
|
|
documentLabel.setStyle({ display: "block" });
|
2007-03-18 16:38:55 +01:00
|
|
|
else
|
2007-05-25 17:43:49 +02:00
|
|
|
documentLabel.setStyle({ display: "none" });
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
documentHref.appendChild(document.createTextNode(newUrl));
|
|
|
|
if (newUrl.length > 0)
|
2007-05-25 17:43:49 +02:00
|
|
|
documentLabel.setStyle({ display: "block" });
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
urlInput.value = newUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function onPopupDocumentWindow(event) {
|
|
|
|
var documentUrl = $("url");
|
|
|
|
|
2007-06-28 20:29:59 +02:00
|
|
|
preventDefault(event);
|
2007-03-18 16:38:55 +01:00
|
|
|
window.open(documentUrl.value, "SOGo_Document");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-04-27 21:41:04 +02:00
|
|
|
function onMenuSetClassification(event) {
|
2007-03-18 16:38:55 +01:00
|
|
|
event.cancelBubble = true;
|
|
|
|
|
2007-04-27 21:41:04 +02: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-05-11 23:45:38 +02:00
|
|
|
// log("classification: " + classification);
|
2007-03-18 16:38:55 +01:00
|
|
|
var privacyInput = document.getElementById("privacy");
|
|
|
|
privacyInput.value = classification;
|
|
|
|
}
|
|
|
|
|
2007-04-02 21:27:46 +02:00
|
|
|
function onChangeCalendar(event) {
|
|
|
|
var calendars = $("calendarFoldersList").value.split(",");
|
|
|
|
var form = document.forms["editform"];
|
|
|
|
var urlElems = form.getAttribute("action").split("/");
|
|
|
|
var choice = calendars[this.value];
|
|
|
|
var ownerLogin;
|
|
|
|
if (choice.indexOf(":") > -1)
|
|
|
|
ownerLogin = choice.split(":")[0];
|
|
|
|
else
|
|
|
|
ownerLogin = UserLogin;
|
|
|
|
urlElems[urlElems.length-4] = ownerLogin;
|
2007-04-26 03:15:26 +02:00
|
|
|
|
2007-04-02 21:27:46 +02:00
|
|
|
form.setAttribute("action", urlElems.join("/"));
|
|
|
|
}
|
|
|
|
|
2007-03-18 16:38:55 +01:00
|
|
|
function refreshAttendees() {
|
|
|
|
var attendeesLabel = $("attendeesLabel");
|
|
|
|
var attendeesNames = $("attendeesNames");
|
|
|
|
var attendeesHref = $("attendeesHref");
|
|
|
|
|
|
|
|
for (var i = 0; i < attendeesHref.childNodes.length; i++)
|
|
|
|
attendeesHref.removeChild(attendeesHref.childNodes[i]);
|
|
|
|
|
|
|
|
if (attendeesNames.value.length > 0) {
|
|
|
|
attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
|
2007-05-25 17:43:49 +02:00
|
|
|
attendeesLabel.setStyle({ display: "block" });
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
else
|
2007-05-25 17:43:49 +02:00
|
|
|
attendeesLabel.setStyle({ display: "none" });
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function initializeAttendeesHref() {
|
|
|
|
var attendeesHref = $("attendeesHref");
|
|
|
|
var attendeesLabel = $("attendeesLabel");
|
|
|
|
var attendeesNames = $("attendeesNames");
|
|
|
|
|
2007-06-06 23:27:44 +02:00
|
|
|
Event.observe(attendeesHref, "click", onPopupAttendeesWindow, false);
|
2007-03-18 16:38:55 +01:00
|
|
|
if (attendeesNames.value.length > 0) {
|
2007-05-25 17:43:49 +02:00
|
|
|
attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" });
|
2007-03-18 16:38:55 +01:00
|
|
|
attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
|
2007-05-25 17:43:49 +02:00
|
|
|
attendeesLabel.setStyle({ display: "block" });
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function initializeDocumentHref() {
|
|
|
|
var documentHref = $("documentHref");
|
|
|
|
var documentLabel = $("documentLabel");
|
|
|
|
var documentUrl = $("url");
|
|
|
|
|
2007-06-06 23:27:44 +02:00
|
|
|
Event.observe(documentHref, "click", onPopupDocumentWindow, false);
|
2007-05-25 17:43:49 +02:00
|
|
|
documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
|
2007-03-18 16:38:55 +01:00
|
|
|
if (documentUrl.value.length > 0) {
|
|
|
|
documentHref.appendChild(document.createTextNode(documentUrl.value));
|
2007-05-25 17:43:49 +02:00
|
|
|
documentLabel.setStyle({ display: "block" });
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var changeUrlButton = $("changeUrlButton");
|
2007-06-06 23:27:44 +02:00
|
|
|
Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function initializePrivacyMenu() {
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function onComponentEditorLoad(event) {
|
|
|
|
if (!$("statusPercent"))
|
|
|
|
initializeAttendeesHref();
|
|
|
|
initializeDocumentHref();
|
|
|
|
initializePrivacyMenu();
|
2007-04-26 03:15:26 +02:00
|
|
|
var list = $("calendarList");
|
2007-06-06 23:27:44 +02:00
|
|
|
Event.observe(list, "change", onChangeCalendar.bindAsEventListener(list), false);
|
|
|
|
if (document.createEvent) {
|
|
|
|
var onSelectionChangeEvent = document.createEvent("Event");
|
|
|
|
onSelectionChangeEvent.initEvent("change", false, false);
|
|
|
|
list.dispatchEvent(onSelectionChangeEvent);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
list.fireEvent("onchange"); // IE
|
|
|
|
}
|
2007-04-27 21:41:04 +02:00
|
|
|
|
|
|
|
var menuItems = $("itemPrivacyList").childNodesWithTag("li");
|
|
|
|
for (var i = 0; i < menuItems.length; i++)
|
2007-06-06 23:27:44 +02:00
|
|
|
Event.observe(menuItems[i], "mouseup", onMenuSetClassification.bindAsEventListener(menuItems[i]), false);
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
2007-04-27 21:41:04 +02:00
|
|
|
|
2007-06-02 00:35:36 +02:00
|
|
|
addEvent(window, 'load', onComponentEditorLoad);
|