From 7dfa60660bd75f84fa92b5d3a946209eff16f209 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sun, 18 Mar 2007 15:38:55 +0000 Subject: [PATCH] Monotone-Parent: e106db45c78c4bc089e9c4348441237ddb2314ff Monotone-Revision: 8fccddf38bc9cb7dd2163fc1aff911115481bfb5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-18T15:38:55 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxComponentEditor.css | 0 UI/WebServerResources/UIxComponentEditor.js | 140 +++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 UI/WebServerResources/UIxComponentEditor.css create mode 100644 UI/WebServerResources/UIxComponentEditor.js diff --git a/UI/WebServerResources/UIxComponentEditor.css b/UI/WebServerResources/UIxComponentEditor.css new file mode 100644 index 000000000..e69de29bb diff --git a/UI/WebServerResources/UIxComponentEditor.js b/UI/WebServerResources/UIxComponentEditor.js new file mode 100644 index 000000000..eb1f6d6df --- /dev/null +++ b/UI/WebServerResources/UIxComponentEditor.js @@ -0,0 +1,140 @@ +window.addEventListener("load", onComponentEditorLoad, false); + +function onPopupAttendeesWindow(event) { + if (event) + event.preventDefault(); + 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) + event.preventDefault(); + + 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) + documentLabel.style.display = "block;"; + else + documentLabel.style.display = "none;"; + } + else { + documentHref.appendChild(document.createTextNode(newUrl)); + if (newUrl.length > 0) + documentLabel.style.display = "block;"; + } + urlInput.value = newUrl; + } + + return false; +} + +function onPopupDocumentWindow(event) { + var documentUrl = $("url"); + + event.preventDefault(); + window.open(documentUrl.value, "SOGo_Document"); + + return false; +} + +function onMenuSetClassification(event, classification) { + event.cancelBubble = true; + + var node = event.target; + if (node.tagName != "LI") + node = node.getParentWithTagName("li"); + if (node.parentNode.chosenNode) + node.parentNode.chosenNode.removeClassName("_chosen"); + node.addClassName("_chosen"); + node.parentNode.chosenNode = node; + + log("classification: " + classification); + var privacyInput = document.getElementById("privacy"); + privacyInput.value = classification; +} + +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)); + attendeesLabel.style.display = "block;"; + } + else + attendeesLabel.style.display = "none;"; +} + +function initializeAttendeesHref() { + var attendeesHref = $("attendeesHref"); + var attendeesLabel = $("attendeesLabel"); + var attendeesNames = $("attendeesNames"); + + attendeesHref.addEventListener("click", onPopupAttendeesWindow, false); + if (attendeesNames.value.length > 0) { + attendeesHref.style.textDecoration = "underline;"; + attendeesHref.style.color = "#00f;"; + attendeesHref.appendChild(document.createTextNode(attendeesNames.value)); + attendeesLabel.style.display = "block;"; + } +} + +function initializeDocumentHref() { + var documentHref = $("documentHref"); + var documentLabel = $("documentLabel"); + var documentUrl = $("url"); + + documentHref.addEventListener("click", onPopupDocumentWindow, false); + documentHref.style.textDecoration = "underline;"; + documentHref.style.color = "#00f;"; + if (documentUrl.value.length > 0) { + documentHref.appendChild(document.createTextNode(documentUrl.value)); + documentLabel.style.display = "block;"; + } + + var changeUrlButton = $("changeUrlButton"); + changeUrlButton.addEventListener("click", onPopupUrlWindow, false); +} + +function initializePrivacyMenu() { + var privacy = $("privacy").value.toUpperCase(); + log("privacy: " + privacy); + 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(); +}