See Changelog.

Monotone-Parent: 434c3721a8dac924cce0531eebee09d9b27457ea
Monotone-Revision: 5004088698623bff1c51c9b3abb0d4085643d720

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2010-09-20T14:36:02
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle committed 2010-09-20 14:36:02 +00:00
1 parent 7c12cf72f6
commit eacb6d9942
7 files changed
+112 -55

No files matched your search

+18
View File
@@ -1,3 +1,21 @@
2010-09-20 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/MailerUI.js (deleteWithoutTrash): new
function used when the messages can't be copied to the trash
folder (usually because the user's mailbox is overquota).
* UI/WebServerResources/generic.js (showConfirmDialog): added new
argument variable to overwrite the default callback when user
clicks on the "No" button.
* SoObjects/Mailer/SOGoMailFolder.m
(-deleteUIDs:useTrashFolder:inContext:): new "useTrashFolder"
argument variable that avoids moving the messages to the trash is
set to YES.
* UI/MailerUI/UIxMailFolderActions.m (-batchDeleteAction): now
accepts a new form variable, "withoutTrash".
2010-09-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/LDAPSource.m (-_searchAttributes): added
+4 -1
View File
@@ -1,4 +1,5 @@
/*
Copyright (C) 2009-2010 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
@@ -48,7 +49,9 @@
- (NSString *) absoluteImap4Name;
/* messages */
- (NSException *) deleteUIDs: (NSArray *) uids inContext: (id) context;
- (NSException *) deleteUIDs: (NSArray *) uids
useTrashFolder: (BOOL) withTrash
inContext: (id) context;
- (WOResponse *) archiveUIDs: (NSArray *) uids
inArchiveNamed: (NSString *) archiveName
inContext: (id) context;
+63 -48
View File
@@ -1,4 +1,5 @@
/*
Copyright (C) 2009-2010 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
@@ -265,6 +266,7 @@ static NSString *defaultUserID = @"anyone";
/* messages */
- (NSException *) deleteUIDs: (NSArray *) uids
useTrashFolder: (BOOL) withTrash
inContext: (id) localContext
{
SOGoMailFolder *trashFolder;
@@ -274,62 +276,75 @@ static NSString *defaultUserID = @"anyone";
NSString *result;
BOOL b;
trashFolder = [[self mailAccountFolder] trashFolderInContext: localContext];
if ([trashFolder isNotNull])
client = nil;
trashFolder = nil;
b = YES;
if (withTrash)
{
if ([trashFolder isKindOfClass: [NSException class]])
error = (NSException *) trashFolder;
trashFolder = [[self mailAccountFolder] trashFolderInContext: localContext];
b = NO;
if ([trashFolder isNotNull])
{
if ([trashFolder isKindOfClass: [NSException class]])
error = (NSException *) trashFolder;
else
{
client = [[self imap4Connection] client];
[imap4 selectFolder: [self imap4URL]];
folderName = [imap4 imap4FolderNameForURL: [trashFolder imap4URL]];
b = YES;
// If we are deleting messages within the Trash folder itself, we
// do not, of course, try to move messages to the Trash folder.
if (![folderName isEqualToString: [self relativeImap4Name]])
{
// If our Trash folder doesn't exist when we try to copy messages
// to it, we create it.
result = [[client status: folderName flags: [NSArray arrayWithObject: @"UIDVALIDITY"]]
objectForKey: @"result"];
if (![result boolValue])
[[self imap4Connection] createMailbox: folderName
atURL: [[self mailAccountFolder] imap4URL]];
result = [[client copyUids: uids toFolder: folderName]
objectForKey: @"result"];
b = [result boolValue];
}
}
}
else
error = [NSException exceptionWithHTTPStatus: 500
reason: @"Did not find Trash folder!"];
}
if (b)
{
if (client == nil)
{
client = [[self imap4Connection] client];
[imap4 selectFolder: [self imap4URL]];
folderName = [imap4 imap4FolderNameForURL: [trashFolder imap4URL]];
b = YES;
// If we are deleting messages within the Trash folder itself, we
// do not, of course, try to move messages to the Trash folder.
if (![folderName isEqualToString: [self relativeImap4Name]])
{
// If our Trash folder doesn't exist when we try to copy messages
// to it, we create it.
result = [[client status: folderName flags: [NSArray arrayWithObject: @"UIDVALIDITY"]]
objectForKey: @"result"];
if (![result boolValue])
[[self imap4Connection] createMailbox: folderName
atURL: [[self mailAccountFolder] imap4URL]];
result = [[client copyUids: uids toFolder: folderName]
objectForKey: @"result"];
b = [result boolValue];
}
if (b)
{
result = [[client storeFlags: [NSArray arrayWithObject: @"Deleted"]
forUIDs: uids addOrRemove: YES]
objectForKey: @"result"];
if ([result boolValue])
{
[self markForExpunge];
[trashFolder flushMailCaches];
error = nil;
}
else
error
= [NSException exceptionWithHTTPStatus:500
reason: @"Could not mark UIDs as Deleted"];
}
else
error = [NSException exceptionWithHTTPStatus:500
reason: @"Could not copy UIDs"];
}
result = [[client storeFlags: [NSArray arrayWithObject: @"Deleted"]
forUIDs: uids addOrRemove: YES]
objectForKey: @"result"];
if ([result boolValue])
{
[self markForExpunge];
if (trashFolder)
[trashFolder flushMailCaches];
error = nil;
}
else
error
= [NSException exceptionWithHTTPStatus:500
reason: @"Could not mark UIDs as Deleted"];
}
else
error = [NSException exceptionWithHTTPStatus: 500
reason: @"Did not find Trash folder!"];
error = [NSException exceptionWithHTTPStatus:500
reason: @"Could not copy UIDs"];
return error;
}
@@ -272,6 +272,10 @@
"Copying a message into its own folder is impossible!"
= "Copying a message into its own folder is impossible!";
/* Message operations */
"The messages could not be moved to the trash folder. Would you like to delete them now?"
= "The messages could not be moved to the trash folder. Would you like to delete them now?";
/* Message editing */
"error_validationfailed" = "Validation failed";
"error_missingsubject" = "Subject is missing";
+3 -1
View File
@@ -240,15 +240,17 @@
WOResponse *response;
NSArray *uids;
NSString *value;
BOOL withoutTrash;
co = [self clientObject];
value = [[context request] formValueForKey: @"uid"];
withoutTrash = [[[context request] formValueForKey: @"withoutTrash"] boolValue];
response = nil;
if ([value length] > 0)
{
uids = [value componentsSeparatedByString: @","];
response = (WOResponse *) [co deleteUIDs: uids inContext: context];
response = (WOResponse *) [co deleteUIDs: uids useTrashFolder: !withoutTrash inContext: context];
if (!response)
response = [self responseWith204];
}
+16 -1
View File
@@ -454,12 +454,27 @@ function deleteSelectedMessagesCallback(http) {
if (data["refreshUnseenCount"])
getUnseenCountForFolder(data["mailbox"]);
}
else if (!http.callbackData["withoutTrash"]) {
showConfirmDialog(_("Warning"),
_("The messages could not be moved to the trash folder. Would you like to delete them now?"),
deleteMessagesWithoutTrash.bind(document, http.callbackData),
function() { refreshCurrentFolder(); disposeDialog(); });
}
else {
log ("deleteSelectedMessagesCallback: problem during ajax request " + http.status);
log ("deleteSelectedMessagesCallback: problem during ajax request " + http.status + " : " + http.responseText);
refreshCurrentFolder();
}
}
function deleteMessagesWithoutTrash(data) {
var url = ApplicationBaseURL + encodeURI(data["mailbox"]) + "/batchDelete";
var parameters = "uid=" + data["id"].join(",") + '&withoutTrash=1';
data["withoutTrash"] = true;
triggerAjaxRequest(url, deleteSelectedMessagesCallback, data, parameters,
{ "Content-type": "application/x-www-form-urlencoded" });
disposeDialog();
}
function onMenuDeleteMessage(event) {
deleteSelectedMessages();
preventDefault(event);
+4 -4
View File
@@ -1758,7 +1758,7 @@ function createDialog(id, title, legend, content, positionClass) {
else {
bgDiv = createElement("div", "bgDialogDiv", ["bgDialog"]);
document.body.appendChild(bgDiv);
bgDiv.observe("click", disposeDialog);
//bgDiv.observe("click", disposeDialog);
}
}
@@ -1822,15 +1822,15 @@ function _showAlertDialog(label) {
dialog.show();
}
function showConfirmDialog(title, label, callback) {
function showConfirmDialog(title, label, callbackYes, callbackNo) {
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));
fields.appendChild(createButton(null, _("Yes"), callbackYes));
fields.appendChild(createButton(null, _("No"), callbackNo || disposeDialog));
dialog = createDialog(null,
title,
label,