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" });
96 function initializeAttendeesHref() {
97 var attendeesHref = $("attendeesHref");
98 var attendeesLabel = $("attendeesLabel");
99 var attendeesNames = $("attendeesNames");
101 Event.observe(attendeesHref, "click", onPopupAttendeesWindow, false);
102 if (attendeesNames.value.length > 0) {
103 attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" });
104 attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
105 attendeesLabel.setStyle({ display: "block" });
109 function initializeDocumentHref() {
110 var documentHref = $("documentHref");
111 var documentLabel = $("documentLabel");
112 var documentUrl = $("url");
114 Event.observe(documentHref, "click", onPopupDocumentWindow, false);
115 documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
116 if (documentUrl.value.length > 0) {
117 documentHref.appendChild(document.createTextNode(documentUrl.value));
118 documentLabel.setStyle({ display: "block" });
121 var changeUrlButton = $("changeUrlButton");
122 Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
125 function initializePrivacyMenu() {
126 var privacy = $("privacy").value.toUpperCase();
127 if (privacy.length > 0) {
128 var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0];
129 var menuEntries = $(privacyMenu).childNodesWithTag("li");
131 if (privacy == "CONFIDENTIAL")
132 chosenNode = menuEntries[1];
133 else if (privacy == "PRIVATE")
134 chosenNode = menuEntries[2];
136 chosenNode = menuEntries[0];
137 privacyMenu.chosenNode = chosenNode;
138 $(chosenNode).addClassName("_chosen");
142 function onComponentEditorLoad(event) {
143 if (!$("statusPercent"))
144 initializeAttendeesHref();
145 initializeDocumentHref();
146 initializePrivacyMenu();
147 var list = $("calendarList");
148 Event.observe(list, "mousedown",
149 onChangeCalendar.bindAsEventListener(list),
151 list.fire("mousedown");
153 var menuItems = $("itemPrivacyList").childNodesWithTag("li");
154 for (var i = 0; i < menuItems.length; i++)
155 Event.observe(menuItems[i], "mousedown",
156 onMenuSetClassification.bindAsEventListener(menuItems[i]),
160 FastInit.addOnLoad(onComponentEditorLoad);