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 != 'BUTTON')
14 node = $(node).up("button");
15 popupToolbarMenu(node, "privacy-menu");
17 // preventDefault(event);
21 function onPopupUrlWindow(event) {
23 preventDefault(event);
25 var urlInput = document.getElementById("url");
26 var newUrl = window.prompt(labels["Target:"], urlInput.value);
28 var documentHref = $("documentHref");
29 var documentLabel = $("documentLabel");
30 if (documentHref.childNodes.length > 0) {
31 documentHref.childNodes[0].nodeValue = newUrl;
32 if (newUrl.length > 0)
33 documentLabel.setStyle({ display: "block" });
35 documentLabel.setStyle({ display: "none" });
38 documentHref.appendChild(document.createTextNode(newUrl));
39 if (newUrl.length > 0)
40 documentLabel.setStyle({ display: "block" });
42 urlInput.value = newUrl;
48 function onPopupDocumentWindow(event) {
49 var documentUrl = $("url");
51 preventDefault(event);
52 window.open(documentUrl.value, "SOGo_Document");
57 function onMenuSetClassification(event) {
58 event.cancelBubble = true;
60 var classification = this.getAttribute("classification");
61 if (this.parentNode.chosenNode)
62 this.parentNode.chosenNode.removeClassName("_chosen");
63 this.addClassName("_chosen");
64 this.parentNode.chosenNode = this;
66 // log("classification: " + classification);
67 var privacyInput = document.getElementById("privacy");
68 privacyInput.value = classification;
71 function onChangeCalendar(event) {
72 var calendars = $("calendarFoldersList").value.split(",");
73 var form = document.forms["editform"];
74 var urlElems = form.getAttribute("action").split("/");
75 var choice = calendars[this.value];
76 urlElems[urlElems.length-3] = choice;
77 form.setAttribute("action", urlElems.join("/"));
80 function refreshAttendees() {
81 var attendeesLabel = $("attendeesLabel");
82 var attendeesNames = $("attendeesNames");
83 var attendeesHref = $("attendeesHref");
85 for (var i = 0; i < attendeesHref.childNodes.length; i++)
86 attendeesHref.removeChild(attendeesHref.childNodes[i]);
88 if (attendeesNames.value.length > 0) {
89 attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
90 attendeesLabel.setStyle({ display: "block" });
93 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 FastInit.addOnLoad(onComponentEditorLoad);