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];
78 if (choice.indexOf(":") > -1)
79 ownerLogin = choice.split(":")[0];
81 ownerLogin = UserLogin;
82 urlElems[urlElems.length-4] = ownerLogin;
84 form.setAttribute("action", urlElems.join("/"));
87 function refreshAttendees() {
88 var attendeesLabel = $("attendeesLabel");
89 var attendeesNames = $("attendeesNames");
90 var attendeesHref = $("attendeesHref");
92 for (var i = 0; i < attendeesHref.childNodes.length; i++)
93 attendeesHref.removeChild(attendeesHref.childNodes[i]);
95 if (attendeesNames.value.length > 0) {
96 attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
97 attendeesLabel.setStyle({ display: "block" });
100 attendeesLabel.setStyle({ display: "none" });
103 function initializeAttendeesHref() {
104 var attendeesHref = $("attendeesHref");
105 var attendeesLabel = $("attendeesLabel");
106 var attendeesNames = $("attendeesNames");
108 Event.observe(attendeesHref, "click", onPopupAttendeesWindow, false);
109 if (attendeesNames.value.length > 0) {
110 attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" });
111 attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
112 attendeesLabel.setStyle({ display: "block" });
116 function initializeDocumentHref() {
117 var documentHref = $("documentHref");
118 var documentLabel = $("documentLabel");
119 var documentUrl = $("url");
121 Event.observe(documentHref, "click", onPopupDocumentWindow, false);
122 documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
123 if (documentUrl.value.length > 0) {
124 documentHref.appendChild(document.createTextNode(documentUrl.value));
125 documentLabel.setStyle({ display: "block" });
128 var changeUrlButton = $("changeUrlButton");
129 Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
132 function initializePrivacyMenu() {
133 var privacy = $("privacy").value.toUpperCase();
134 if (privacy.length > 0) {
135 var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0];
136 var menuEntries = $(privacyMenu).childNodesWithTag("li");
138 if (privacy == "CONFIDENTIAL")
139 chosenNode = menuEntries[1];
140 else if (privacy == "PRIVATE")
141 chosenNode = menuEntries[2];
143 chosenNode = menuEntries[0];
144 privacyMenu.chosenNode = chosenNode;
145 $(chosenNode).addClassName("_chosen");
149 function onComponentEditorLoad(event) {
150 if (!$("statusPercent"))
151 initializeAttendeesHref();
152 initializeDocumentHref();
153 initializePrivacyMenu();
154 var list = $("calendarList");
155 Event.observe(list, "mousedown",
156 onChangeCalendar.bindAsEventListener(list),
158 if (document.createEvent) {
159 var onSelectionChangeEvent;
161 onSelectionChangeEvent = document.createEvent("UIEvents");
163 onSelectionChangeEvent = document.createEvent("Events");
164 onSelectionChangeEvent.initEvent("mousedown", false, false);
165 list.dispatchEvent(onSelectionChangeEvent);
168 list.fireEvent("onmousedown"); // IE
171 var menuItems = $("itemPrivacyList").childNodesWithTag("li");
172 for (var i = 0; i < menuItems.length; i++)
173 Event.observe(menuItems[i], "mousedown",
174 onMenuSetClassification.bindAsEventListener(menuItems[i]),
178 addEvent(window, 'load', onComponentEditorLoad);