See Changelog.

Monotone-Parent: 61d77b3172c7a72376f9b867ab6d96136e763698
Monotone-Revision: c08e4921f6ce7d20b4c9532750d271ac4a7a3e5a

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2010-08-19T21:26:31
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2010-08-19 21:26:31 +00:00
parent 8698cb57c0
commit e947440953
5 changed files with 57 additions and 71 deletions

View File

@@ -1,5 +1,8 @@
2010-08-19 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/generic.js (showConfirmDialog): new
function to replace window.confirm().
* UI/WebServerResources/MailerUI.js (onMenuEmptyTrash): delete the
cache of the trash mailbox when called.

View File

@@ -9,8 +9,7 @@ var usersRightsWindowWidth = 450;
var Contact = {
currentAddressBook: null,
currentContact: null,
deleteContactsRequestCount: null,
dialogs: {}
deleteContactsRequestCount: null
};
function validateEditorInput(sender) {
@@ -433,29 +432,10 @@ function onToolbarDeleteSelectedContacts(event) {
var contactsList = $('contactsList');
var rows = contactsList.getSelectedRowsId();
if (rows.length) {
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"), disposeDialog));
var dialog = createDialog(dialogId,
_("Confirmation"),
label,
fields,
"none");
document.body.appendChild(dialog);
dialog.show();
Contact.dialogs[dialogId] = dialog;
}
return false;
}
if (rows.length)
showConfirmDialog(_("Confirmation"),
_("Are you sure you want to delete the selected contacts?"),
onToolbarDeleteSelectedContactsConfirm);
else
showAlertDialog(_("Please select a contact."));
@@ -807,45 +787,21 @@ function onAddressBookRemove(event) {
}
function deletePersonalAddressBook(folderId) {
if (folderId == "personal") {
if (folderId == "personal")
showAlertDialog(_("You cannot remove nor unsubscribe from your personal addressbook."));
}
else {
var dialogId = "deleteAddressBookDialog";
var dialog = Contact.dialogs[dialogId];
if (dialog) {
$("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)));
fields.appendChild(createButton(dialogId + "cancelBtn",
"No",
disposeDialog));
dialog = createDialog(dialogId,
_("Confirmation"),
label,
fields,
"none");
document.body.appendChild(dialog);
Contact.dialogs[dialogId] = dialog;
}
dialog.folderId = folderId;
dialog.show();
}
else
showConfirmDialog(_("Confirmation"),
_("Are you sure you want to delete the selected address book?"),
deletePersonalAddressBookConfirm.bind(this, folderId));
return false;
}
function deletePersonalAddressBookConfirm(event) {
function deletePersonalAddressBookConfirm(folderId) {
if (document.deletePersonalABAjaxRequest) {
document.deletePersonalABAjaxRequest.aborted = true;
document.deletePersonalABAjaxRequest.abort();
}
var dialog = $(this).up("DIV.dialog");
var folderId = dialog.folderId;
var url = ApplicationBaseURL + folderId + "/delete";
document.deletePersonalABAjaxRequest
= triggerAjaxRequest(url, deletePersonalAddressBookCallback,

View File

@@ -2044,13 +2044,17 @@ function onMenuRenameFolderConfirm() {
}
function onMenuDeleteFolder(event) {
var answer = window.confirm(_("Do you really want to move this folder into the trash ?"));
if (answer) {
var folderID = document.menuTarget.getAttribute("dataname");
var urlstr = URLForFolderID(folderID) + "/delete";
var errorLabel = _("The folder could not be deleted.");
triggerAjaxRequest(urlstr, folderOperationCallback, errorLabel);
}
showConfirmDialog(_("Confirmation"),
_("Do you really want to move this folder into the trash ?"),
onMenuDeleteFolderConfirm);
}
function onMenuDeleteFolderConfirm() {
var folderID = document.menuTarget.getAttribute("dataname");
var urlstr = URLForFolderID(folderID) + "/delete";
var errorLabel = _("The folder could not be deleted.");
triggerAjaxRequest(urlstr, folderOperationCallback, errorLabel);
disposeDialog();
}
function onMenuExpungeFolder(event) {

View File

@@ -2592,14 +2592,17 @@ function onCalendarRemove(event) {
}
function deletePersonalCalendar(folderElement) {
var folderId = folderElement.substr(1);
var label
= labels["Are you sure you want to delete the calendar \"%{0}\"?"].formatted($(folderElement).lastChild.nodeValue.strip());
if (window.confirm(label)) {
removeFolderRequestCount++;
var url = ApplicationBaseURL + "/" + folderId + "/delete";
triggerAjaxRequest(url, deletePersonalCalendarCallback, folderId);
}
showConfirmDialog(_("Confirmation"),
_("Are you sure you want to delete the calendar \"%{0}\"?").formatted($(folderElement).lastChild.nodeValue.strip()),
deletePersonalCalendarConfirm.bind(folderElement));
}
function deletePersonalCalendarConfirm() {
var folderId = this.substr(1);
removeFolderRequestCount++;
var url = ApplicationBaseURL + "/" + folderId + "/delete";
triggerAjaxRequest(url, deletePersonalCalendarCallback, folderId);
disposeDialog();
}
function deletePersonalCalendarCallback(http) {

View File

@@ -1801,6 +1801,26 @@ function _showAlertDialog(label) {
dialog.show();
}
function showConfirmDialog(title, label, callback) {
var dialog = dialogs[label];
if (dialog) {
$("bgDialogDiv").show();
}
else {
var fields = createElement("p");
fields.appendChild(createButton(null, _("Yes"), callback));
fields.appendChild(createButton(null, _("No"), disposeDialog));
dialog = createDialog(null,
title,
label,
fields,
"none");
document.body.appendChild(dialog);
dialogs[label] = dialog;
}
dialog.show();
}
function showPromptDialog(title, label, callback, defaultValue) {
var dialog = dialogs[label];
v = defaultValue?defaultValue:"";