2007-03-18 16:38:55 +01:00
|
|
|
function onPopupAttendeesWindow(event) {
|
|
|
|
if (event)
|
2007-06-06 23:27:44 +02:00
|
|
|
preventDefault(event);
|
2007-09-15 00:50:14 +02:00
|
|
|
window.open(ApplicationBaseURL + "/editAttendees", null,
|
2007-03-18 16:38:55 +01:00
|
|
|
"width=803,height=573");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function onSelectPrivacy(event) {
|
2007-07-31 23:14:14 +02:00
|
|
|
if (event.button == 0 || (isSafari() && event.button == 1)) {
|
|
|
|
var node = getTarget(event);
|
2007-07-05 21:13:59 +02:00
|
|
|
if (node.tagName != 'A')
|
2007-07-31 23:14:14 +02:00
|
|
|
node = $(node).getParentWithTagName("a");
|
|
|
|
node = $(node).childNodesWithTag("span")[0];
|
2007-07-05 21:13:59 +02:00
|
|
|
popupToolbarMenu(node, "privacy-menu");
|
|
|
|
Event.stop(event);
|
|
|
|
// preventDefault(event);
|
|
|
|
}
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
2007-09-14 23:54:19 +02:00
|
|
|
var newUrl = window.prompt(labels["Target:"], urlInput.value);
|
2007-03-18 16:38:55 +01:00
|
|
|
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];
|
2007-09-19 22:00:10 +02:00
|
|
|
urlElems[urlElems.length-3] = choice;
|
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];
|
2007-08-07 20:14:39 +02:00
|
|
|
var menuEntries = $(privacyMenu).childNodesWithTag("li");
|
2007-03-18 16:38:55 +01:00
|
|
|
var chosenNode;
|
|
|
|
if (privacy == "CONFIDENTIAL")
|
|
|
|
chosenNode = menuEntries[1];
|
|
|
|
else if (privacy == "PRIVATE")
|
|
|
|
chosenNode = menuEntries[2];
|
|
|
|
else
|
|
|
|
chosenNode = menuEntries[0];
|
|
|
|
privacyMenu.chosenNode = chosenNode;
|
2007-08-07 20:14:39 +02:00
|
|
|
$(chosenNode).addClassName("_chosen");
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function onComponentEditorLoad(event) {
|
|
|
|
if (!$("statusPercent"))
|
|
|
|
initializeAttendeesHref();
|
|
|
|
initializeDocumentHref();
|
|
|
|
initializePrivacyMenu();
|
2007-04-26 03:15:26 +02:00
|
|
|
var list = $("calendarList");
|
2007-07-10 20:52:32 +02:00
|
|
|
Event.observe(list, "mousedown",
|
2007-07-05 21:13:59 +02:00
|
|
|
onChangeCalendar.bindAsEventListener(list),
|
|
|
|
false);
|
2007-11-12 22:20:18 +01:00
|
|
|
list.fire("mousedown");
|
2007-04-27 21:41:04 +02:00
|
|
|
|
|
|
|
var menuItems = $("itemPrivacyList").childNodesWithTag("li");
|
|
|
|
for (var i = 0; i < menuItems.length; i++)
|
2007-09-14 20:20:51 +02:00
|
|
|
Event.observe(menuItems[i], "mousedown",
|
2007-07-05 21:13:59 +02:00
|
|
|
onMenuSetClassification.bindAsEventListener(menuItems[i]),
|
|
|
|
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);
|