1 function onPopupAttendeesWindow(event) {
4 window.open(ApplicationBaseURL + "/editAttendees", null,
5 "width=803,height=573");
10 function onSelectPrivacy(event) {
11 if (event.button == 0 || (isSafari() && event.button == 1)) {
12 var node = getTarget(event);
13 if (node.tagName != 'A')
14 node = $(node).getParentWithTagName("a");
15 node = $(node).childNodesWithTag("span")[0];
16 popupToolbarMenu(node, "privacy-menu");
18 // preventDefault(event);
22 function onPopupUrlWindow(event) {
24 preventDefault(event);
26 var urlInput = document.getElementById("url");
27 var newUrl = window.prompt(labels["Target:"], urlInput.value);
29 var documentHref = $("documentHref");
30 var documentLabel = $("documentLabel");
31 if (documentHref.childNodes.length > 0) {
32 documentHref.childNodes[0].nodeValue = newUrl;
33 if (newUrl.length > 0)
34 documentLabel.setStyle({ display: "block" });
36 documentLabel.setStyle({ display: "none" });
39 documentHref.appendChild(document.createTextNode(newUrl));
40 if (newUrl.length > 0)
41 documentLabel.setStyle({ display: "block" });
43 urlInput.value = newUrl;
49 function onPopupDocumentWindow(event) {
50 var documentUrl = $("url");
52 preventDefault(event);
53 window.open(documentUrl.value, "SOGo_Document");
58 function onMenuSetClassification(event) {
59 event.cancelBubble = true;
61 var classification = this.getAttribute("classification");
62 if (this.parentNode.chosenNode)
63 this.parentNode.chosenNode.removeClassName("_chosen");
64 this.addClassName("_chosen");
65 this.parentNode.chosenNode = this;
67 // log("classification: " + classification);
68 var privacyInput = document.getElementById("privacy");
69 privacyInput.value = classification;
72 function onChangeCalendar(event) {
73 var calendars = $("calendarFoldersList").value.split(",");
74 var form = document.forms["editform"];
75 var urlElems = form.getAttribute("action").split("/");
76 var choice = calendars[this.value];
77 urlElems[urlElems.length-3] = choice;
78 form.setAttribute("action", urlElems.join("/"));
81 function refreshAttendees() {
82 var attendeesLabel = $("attendeesLabel");
83 var attendeesNames = $("attendeesNames");
84 var attendeesHref = $("attendeesHref");
86 for (var i = 0; i < attendeesHref.childNodes.length; i++)
87 attendeesHref.removeChild(attendeesHref.childNodes[i]);
89 if (attendeesNames.value.length > 0) {
90 attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
91 attendeesLabel.setStyle({ display: "block" });
94 attendeesLabel.setStyle({ display: "none" });
97 function initializeAttendeesHref() {
98 var attendeesHref = $("attendeesHref");
99 var attendeesLabel = $("attendeesLabel");
100 var attendeesNames = $("attendeesNames");
102 Event.observe(attendeesHref, "click", onPopupAttendeesWindow, false);
103 if (attendeesNames.value.length > 0) {
104 attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" });
105 attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
106 attendeesLabel.setStyle({ display: "block" });
110 function initializeDocumentHref() {
111 var documentHref = $("documentHref");
112 var documentLabel = $("documentLabel");
113 var documentUrl = $("url");
115 Event.observe(documentHref, "click", onPopupDocumentWindow, false);
116 documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
117 if (documentUrl.value.length > 0) {
118 documentHref.appendChild(document.createTextNode(documentUrl.value));
119 documentLabel.setStyle({ display: "block" });
122 var changeUrlButton = $("changeUrlButton");
123 Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
126 function initializePrivacyMenu() {
127 var privacy = $("privacy").value.toUpperCase();
128 if (privacy.length > 0) {
129 var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0];
130 var menuEntries = $(privacyMenu).childNodesWithTag("li");
132 if (privacy == "CONFIDENTIAL")
133 chosenNode = menuEntries[1];
134 else if (privacy == "PRIVATE")
135 chosenNode = menuEntries[2];
137 chosenNode = menuEntries[0];
138 privacyMenu.chosenNode = chosenNode;
139 $(chosenNode).addClassName("_chosen");
143 function onComponentEditorLoad(event) {
144 if (!$("statusPercent"))
145 initializeAttendeesHref();
146 initializeDocumentHref();
147 initializePrivacyMenu();
148 var list = $("calendarList");
149 Event.observe(list, "mousedown",
150 onChangeCalendar.bindAsEventListener(list),
152 list.fire("mousedown");
154 var menuItems = $("itemPrivacyList").childNodesWithTag("li");
155 for (var i = 0; i < menuItems.length; i++)
156 Event.observe(menuItems[i], "mousedown",
157 onMenuSetClassification.bindAsEventListener(menuItems[i]),
161 addEvent(window, 'load', onComponentEditorLoad);