mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-17 12:35:57 +00:00
Monotone-Parent: e106db45c78c4bc089e9c4348441237ddb2314ff
Monotone-Revision: 8fccddf38bc9cb7dd2163fc1aff911115481bfb5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-18T15:38:55 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
140
UI/WebServerResources/UIxComponentEditor.js
Normal file
140
UI/WebServerResources/UIxComponentEditor.js
Normal file
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user