2009-07-19 18:41:42 +02:00
|
|
|
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2008-08-28 16:48:45 +02:00
|
|
|
|
2007-03-18 16:38:55 +01:00
|
|
|
function onPopupAttendeesWindow(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
window.open(ApplicationBaseURL + "/editAttendees", null,
|
2008-08-28 16:48:45 +02:00
|
|
|
"width=803,height=573");
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSelectPrivacy(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
if (event.button == 0 || (isSafari() && event.button == 1)) {
|
|
|
|
var node = getTarget(event);
|
|
|
|
if (node.tagName != 'BUTTON')
|
|
|
|
node = $(node).up("button");
|
|
|
|
popupToolbarMenu(node, "privacy-menu");
|
|
|
|
Event.stop(event);
|
|
|
|
// preventDefault(event);
|
|
|
|
}
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
2009-07-07 23:17:43 +02:00
|
|
|
function onPopupAttachWindow(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
|
2009-07-07 23:17:43 +02:00
|
|
|
var attachInput = document.getElementById("attach");
|
|
|
|
var newAttach = window.prompt(labels["Target:"], attachInput.value || "http://");
|
|
|
|
if (newAttach != null) {
|
2007-11-19 22:07:54 +01:00
|
|
|
var documentHref = $("documentHref");
|
|
|
|
var documentLabel = $("documentLabel");
|
|
|
|
if (documentHref.childNodes.length > 0) {
|
2009-07-07 23:17:43 +02:00
|
|
|
documentHref.childNodes[0].nodeValue = newAttach;
|
|
|
|
if (newAttach.length > 0)
|
2008-08-28 16:48:45 +02:00
|
|
|
documentLabel.setStyle({ display: "block" });
|
2007-11-19 22:07:54 +01:00
|
|
|
else
|
2008-08-28 16:48:45 +02:00
|
|
|
documentLabel.setStyle({ display: "none" });
|
2007-11-19 22:07:54 +01:00
|
|
|
}
|
|
|
|
else {
|
2009-07-07 23:17:43 +02:00
|
|
|
documentHref.appendChild(document.createTextNode(newAttach));
|
|
|
|
if (newAttach.length > 0)
|
2008-08-28 16:48:45 +02:00
|
|
|
documentLabel.setStyle({ display: "block" });
|
2007-11-19 22:07:54 +01:00
|
|
|
}
|
2009-07-07 23:17:43 +02:00
|
|
|
attachInput.value = newAttach;
|
2007-11-19 22:07:54 +01:00
|
|
|
}
|
2009-06-30 03:41:27 +02:00
|
|
|
onWindowResize(event);
|
2007-11-19 22:07:54 +01:00
|
|
|
|
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onPopupDocumentWindow(event) {
|
2009-07-07 23:17:43 +02:00
|
|
|
var documentUrl = $("attach");
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
preventDefault(event);
|
|
|
|
window.open(documentUrl.value, "SOGo_Document");
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
2007-04-27 21:41:04 +02:00
|
|
|
function onMenuSetClassification(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
event.cancelBubble = true;
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2007-11-19 22:07:54 +01:00
|
|
|
var classification = this.getAttribute("classification");
|
|
|
|
if (this.parentNode.chosenNode)
|
|
|
|
this.parentNode.chosenNode.removeClassName("_chosen");
|
|
|
|
this.addClassName("_chosen");
|
|
|
|
this.parentNode.chosenNode = this;
|
2007-03-18 16:38:55 +01:00
|
|
|
|
2008-06-30 22:34:51 +02:00
|
|
|
var privacyInput = $("privacy");
|
2007-11-19 22:07:54 +01:00
|
|
|
privacyInput.value = classification;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
2007-04-02 21:27:46 +02:00
|
|
|
function onChangeCalendar(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
var calendars = $("calendarFoldersList").value.split(",");
|
|
|
|
var form = document.forms["editform"];
|
2008-08-10 23:44:25 +02:00
|
|
|
var urlElems = form.getAttribute("action").split("?");
|
2007-11-19 22:07:54 +01:00
|
|
|
var choice = calendars[this.value];
|
2008-08-10 23:44:25 +02:00
|
|
|
var urlParam = "moveToCalendar=" + choice;
|
|
|
|
if (urlElems.length == 1)
|
|
|
|
urlElems.push(urlParam);
|
|
|
|
else
|
|
|
|
urlElems[2] = urlParam;
|
|
|
|
|
|
|
|
while (urlElems.length > 2)
|
|
|
|
urlElems.pop();
|
|
|
|
|
|
|
|
form.setAttribute("action", urlElems.join("?"));
|
2007-04-02 21:27:46 +02:00
|
|
|
}
|
|
|
|
|
2007-03-18 16:38:55 +01:00
|
|
|
function initializeDocumentHref() {
|
2007-11-19 22:07:54 +01:00
|
|
|
var documentHref = $("documentHref");
|
|
|
|
var documentLabel = $("documentLabel");
|
2009-07-07 23:17:43 +02:00
|
|
|
var documentUrl = $("attach");
|
2007-11-19 22:07:54 +01:00
|
|
|
|
2008-04-15 22:12:51 +02:00
|
|
|
documentHref.observe("click", onPopupDocumentWindow, false);
|
2007-11-19 22:07:54 +01:00
|
|
|
documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
|
|
|
|
if (documentUrl.value.length > 0) {
|
|
|
|
documentHref.appendChild(document.createTextNode(documentUrl.value));
|
|
|
|
documentLabel.setStyle({ display: "block" });
|
|
|
|
}
|
|
|
|
|
2009-07-07 23:17:43 +02:00
|
|
|
var changeUrlButton = $("changeAttachButton");
|
|
|
|
changeUrlButton.observe("click", onPopupAttachWindow, false);
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function initializePrivacyMenu() {
|
2007-11-19 22:07:54 +01:00
|
|
|
var privacy = $("privacy").value.toUpperCase();
|
2008-06-30 22:34:51 +02:00
|
|
|
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");
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function onComponentEditorLoad(event) {
|
2007-11-19 22:07:54 +01:00
|
|
|
initializeDocumentHref();
|
|
|
|
initializePrivacyMenu();
|
|
|
|
var list = $("calendarList");
|
2008-08-10 23:44:25 +02:00
|
|
|
list.observe("change", onChangeCalendar, false);
|
2007-11-19 22:07:54 +01:00
|
|
|
list.fire("mousedown");
|
|
|
|
|
|
|
|
var menuItems = $("itemPrivacyList").childNodesWithTag("li");
|
|
|
|
for (var i = 0; i < menuItems.length; i++)
|
2008-08-28 16:48:45 +02:00
|
|
|
menuItems[i].observe("mousedown",
|
|
|
|
onMenuSetClassification.bindAsEventListener(menuItems[i]),
|
|
|
|
false);
|
2008-01-14 14:57:28 +01:00
|
|
|
|
2008-01-15 22:45:48 +01:00
|
|
|
$("repeatHref").observe("click", onPopupRecurrenceWindow);
|
2008-01-14 14:57:28 +01:00
|
|
|
$("repeatList").observe("change", onPopupRecurrenceWindow);
|
2009-04-21 16:34:22 +02:00
|
|
|
$("reminderHref").observe("click", onPopupReminderWindow);
|
|
|
|
$("reminderList").observe("change", onPopupReminderWindow);
|
2009-07-14 20:04:50 +02:00
|
|
|
$("summary").observe("keyup", onSummaryChange);
|
2009-06-30 03:41:27 +02:00
|
|
|
|
|
|
|
Event.observe(window, "resize", onWindowResize);
|
|
|
|
|
2008-01-15 22:45:48 +01:00
|
|
|
onPopupRecurrenceWindow(null);
|
2009-04-21 16:34:22 +02:00
|
|
|
onPopupReminderWindow(null);
|
2009-07-14 20:04:50 +02:00
|
|
|
onSummaryChange (null);
|
2009-07-17 19:33:32 +02:00
|
|
|
|
|
|
|
var summary = $("summary");
|
|
|
|
summary.focus();
|
|
|
|
summary.selectText(0, summary.value.length);
|
2009-07-14 20:04:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSummaryChange (e) {
|
|
|
|
document.title = $("summary").value;
|
2008-01-14 14:57:28 +01:00
|
|
|
}
|
|
|
|
|
2009-06-30 03:41:27 +02:00
|
|
|
function onWindowResize(event) {
|
|
|
|
var document = $("documentLabel");
|
|
|
|
var comment = $("commentArea");
|
|
|
|
var area = comment.select("textarea").first();
|
|
|
|
var offset = 6;
|
|
|
|
var height;
|
|
|
|
|
|
|
|
height = window.height() - comment.cumulativeOffset().top - offset;
|
|
|
|
|
|
|
|
if (document.visible())
|
2009-07-07 23:17:43 +02:00
|
|
|
height -= $("changeAttachButton").getHeight();
|
2009-06-30 03:41:27 +02:00
|
|
|
|
|
|
|
area.setStyle({ height: (height - offset*2) + "px" });
|
|
|
|
comment.setStyle({ height: (height - offset) + "px" });
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-01-14 14:57:28 +01:00
|
|
|
function onPopupRecurrenceWindow(event) {
|
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
|
2008-01-15 22:45:48 +01:00
|
|
|
var repeatHref = $("repeatHref");
|
|
|
|
|
|
|
|
if ($("repeatList").value == 7) {
|
|
|
|
repeatHref.show();
|
|
|
|
if (event)
|
|
|
|
window.open(ApplicationBaseURL + "editRecurrence", null,
|
2008-08-28 16:48:45 +02:00
|
|
|
"width=500,height=400");
|
2008-01-15 22:45:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
repeatHref.hide();
|
2008-01-14 14:57:28 +01:00
|
|
|
|
|
|
|
return false;
|
2007-03-18 16:38:55 +01:00
|
|
|
}
|
2007-04-27 21:41:04 +02:00
|
|
|
|
2009-04-21 16:34:22 +02:00
|
|
|
function onPopupReminderWindow(event) {
|
|
|
|
if (event)
|
|
|
|
preventDefault(event);
|
|
|
|
|
|
|
|
var reminderHref = $("reminderHref");
|
|
|
|
|
|
|
|
if ($("reminderList").value == 15) {
|
|
|
|
reminderHref.show();
|
|
|
|
if (event)
|
|
|
|
window.open(ApplicationBaseURL + "editReminder", null,
|
|
|
|
"width=250,height=150");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
reminderHref.hide();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-03-12 22:09:14 +01:00
|
|
|
document.observe("dom:loaded", onComponentEditorLoad);
|