mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-11 22:45:26 +00:00
See ChangeLog
Monotone-Parent: e9ca26d51aa3d10c2258ad11e5ed08cf1cdc234c Monotone-Revision: 7e80d62d21237dc99d74c702f53f591b1fd10acc Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2010-08-04T17:59:43 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -9,7 +9,8 @@ var usersRightsWindowWidth = 450;
|
||||
var Contact = {
|
||||
currentAddressBook: null,
|
||||
currentContact: null,
|
||||
deleteContactsRequestCount: null
|
||||
deleteContactsRequestCount: null,
|
||||
dialogs: {}
|
||||
};
|
||||
|
||||
function validateEditorInput(sender) {
|
||||
@@ -433,17 +434,27 @@ function onToolbarDeleteSelectedContacts(event) {
|
||||
var rows = contactsList.getSelectedRowsId();
|
||||
|
||||
if (rows.length) {
|
||||
var label = _("Are you sure you want to delete the selected contacts?");
|
||||
if (window.confirm(label)) {
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
delete cachedContacts[Contact.currentAddressBook + "/" + rows[i]];
|
||||
var urlstr = (URLForFolderID(Contact.currentAddressBook) + "/"
|
||||
+ rows[i] + "/delete");
|
||||
Contact.deleteContactsRequestCount++;
|
||||
triggerAjaxRequest(urlstr, onContactDeleteEventCallback,
|
||||
rows[i]);
|
||||
}
|
||||
var dialogId = "deleteContactsDialog";
|
||||
var dialog = Contact.dialogs[dialogId];
|
||||
if (dialog) {
|
||||
dialog.show();
|
||||
$("bgDialogDiv").show();
|
||||
}
|
||||
else {
|
||||
var label = _("Are you sure you want to delete the selected contacts?");
|
||||
var fields = createElement("p");
|
||||
fields.appendChild(createButton("confirmBtn", "Yes", onToolbarDeleteSelectedContactsConfirm.bind(fields, dialogId)));
|
||||
fields.appendChild(createButton("cancelBtn", "No", onBodyClickDialogHandler.bind(document.body, dialogId)));
|
||||
var dialog = createDialog(dialogId,
|
||||
_("Confirmation"),
|
||||
label,
|
||||
fields,
|
||||
"none");
|
||||
document.body.appendChild(dialog);
|
||||
dialog.show();
|
||||
Contact.dialogs[dialogId] = dialog;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
window.alert(_("Please select a contact."));
|
||||
@@ -452,6 +463,21 @@ function onToolbarDeleteSelectedContacts(event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function onToolbarDeleteSelectedContactsConfirm(dialogId) {
|
||||
var contactsList = $('contactsList');
|
||||
var rows = contactsList.getSelectedRowsId();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
delete cachedContacts[Contact.currentAddressBook + "/" + rows[i]];
|
||||
var urlstr = (URLForFolderID(Contact.currentAddressBook) + "/"
|
||||
+ rows[i] + "/delete");
|
||||
Contact.deleteContactsRequestCount++;
|
||||
triggerAjaxRequest(urlstr, onContactDeleteEventCallback,
|
||||
rows[i]);
|
||||
}
|
||||
|
||||
onBodyClickDialogHandler(dialogId);
|
||||
}
|
||||
|
||||
function onContactDeleteEventCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
@@ -774,25 +800,71 @@ function onAddressBookRemove(event) {
|
||||
|
||||
function deletePersonalAddressBook(folderId) {
|
||||
if (folderId == "personal") {
|
||||
var label = _("You cannot remove nor unsubscribe from your personal addressbook.");
|
||||
window.alert(label);
|
||||
}
|
||||
else {
|
||||
var label
|
||||
= _("Are you sure you want to delete the selected address book?");
|
||||
if (window.confirm(label)) {
|
||||
if (document.deletePersonalABAjaxRequest) {
|
||||
document.deletePersonalABAjaxRequest.aborted = true;
|
||||
document.deletePersonalABAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + folderId + "/delete";
|
||||
document.deletePersonalABAjaxRequest
|
||||
= triggerAjaxRequest(url, deletePersonalAddressBookCallback,
|
||||
folderId);
|
||||
var dialogId = "deletePersonalAddressBook";
|
||||
var dialog = Contact.dialogs[dialogId];
|
||||
if (dialog) {
|
||||
dialog.show();
|
||||
$("bgDialogDiv").show();
|
||||
}
|
||||
else {
|
||||
var label = _("You cannot remove nor unsubscribe from your personal addressbook.");
|
||||
var fields = createElement("p");
|
||||
fields.appendChild(createButton(dialogId + "ContinueBtn",
|
||||
"Continue",
|
||||
onBodyClickDialogHandler.bind(document.body, dialogId)));
|
||||
var dialog = createDialog(dialogId,
|
||||
_("Warning"),
|
||||
label,
|
||||
fields,
|
||||
"none");
|
||||
document.body.appendChild(dialog);
|
||||
dialog.show();
|
||||
Contact.dialogs[dialogId] = dialog;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var dialogId = "deleteAddressBook";
|
||||
var dialog = Contact.dialogs[dialogId];
|
||||
if (dialog) {
|
||||
dialog.show();
|
||||
$("bgDialogDiv").show();
|
||||
}
|
||||
else {
|
||||
var label = _("Are you sure you want to delete the selected address book?");
|
||||
var fields = createElement("p");
|
||||
fields.appendChild(createButton(dialogId + "confirmBtn",
|
||||
"Yes",
|
||||
deletePersonalAddressBookConfirm.bind(fields, folderId, dialogId)));
|
||||
fields.appendChild(createButton(dialogId + "cancelBtn",
|
||||
"No",
|
||||
onBodyClickDialogHandler.bind(document.body, dialogId)));
|
||||
var dialog = createDialog(dialogId,
|
||||
_("Confirmation"),
|
||||
label,
|
||||
fields,
|
||||
"none");
|
||||
document.body.appendChild(dialog);
|
||||
dialog.show();
|
||||
Contact.dialogs[dialogId] = dialog;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function deletePersonalAddressBookConfirm(folderId, dialogId) {
|
||||
if (document.deletePersonalABAjaxRequest) {
|
||||
document.deletePersonalABAjaxRequest.aborted = true;
|
||||
document.deletePersonalABAjaxRequest.abort();
|
||||
}
|
||||
var url = ApplicationBaseURL + folderId + "/delete";
|
||||
document.deletePersonalABAjaxRequest
|
||||
= triggerAjaxRequest(url, deletePersonalAddressBookCallback,
|
||||
folderId);
|
||||
|
||||
onBodyClickDialogHandler(dialogId);
|
||||
}
|
||||
|
||||
|
||||
function deletePersonalAddressBookCallback(http) {
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
|
||||
Reference in New Issue
Block a user