mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-08 00:11:22 +00:00
Created a window for address book properties and add the cardDav URL
This commit is contained in:
71
UI/WebServerResources/UIxContactFolderProperties.js
Normal file
71
UI/WebServerResources/UIxContactFolderProperties.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
function onLoadContactFolderProperties() {
|
||||
var tabsContainer = $("propertiesTabs");
|
||||
var controller = new SOGoTabsController();
|
||||
controller.attachToTabsContainer(tabsContainer);
|
||||
|
||||
var okButton = $("okButton");
|
||||
okButton.observe("click", onOKClick);
|
||||
|
||||
var cancelButton = $("cancelButton");
|
||||
cancelButton.observe("click", onCancelClick);
|
||||
|
||||
Event.observe(document, "keydown", onDocumentKeydown);
|
||||
}
|
||||
|
||||
function onOKClick(event) {
|
||||
var AddressBookName = $("addressBookName");
|
||||
var folders = parent$("contactFolders");
|
||||
var selected = folders.getSelectedNodes()[0];
|
||||
|
||||
if (!AddressBookName.value.blank()) {
|
||||
var newName = AddressBookName.value;
|
||||
var currentName = AddressBookName.defaultValue;
|
||||
if (newName && newName.length > 0 && newName != currentName) {
|
||||
if (selected.getAttribute("owner") != "nobody") {
|
||||
var url = (URLForFolderID(selected.getAttribute("id")) + "/renameFolder?name=" + escape(newName.utf8encode()));
|
||||
triggerAjaxRequest(url, folderRenameCallback, {node: selected, name: newName});
|
||||
|
||||
}
|
||||
else {
|
||||
alert_("You do not own this address book");
|
||||
}
|
||||
}
|
||||
else
|
||||
window.close();
|
||||
}
|
||||
else
|
||||
alert(_("Please specify an address book name."));
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
function folderRenameCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var dict = http.callbackData;
|
||||
dict["node"].innerHTML = dict["name"];
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onCancelClick(event) {
|
||||
window.close();
|
||||
}
|
||||
|
||||
function onDocumentKeydown(event) {
|
||||
var target = Event.element(event);
|
||||
if (target.tagName == "INPUT" || target.tagName == "SELECT") {
|
||||
if (event.keyCode == Event.KEY_RETURN) {
|
||||
onOKClick(event);
|
||||
}
|
||||
}
|
||||
if (event.keyCode == Event.KEY_ESC) {
|
||||
onCancelClick();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.observe("dom:loaded", onLoadContactFolderProperties);
|
||||
Reference in New Issue
Block a user