Monotone-Parent: c0e690042905295d3b7946d9d917fcf8e91982ef

Monotone-Revision: f8b29d68c36441f92d7ffe8056a95fd25a2fd409

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-10-17T22:29:51
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-10-17 22:29:51 +00:00
parent fdf333c65c
commit 4e7ed2dab8
11 changed files with 126 additions and 29 deletions

View File

@ -1,5 +1,15 @@
2007-10-17 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2007-10-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailActions.m ([UIxMailActions -copyAction]):
implemented new web method.
* SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
-copyToFolderNamed:folderNameinContext:]): new method with the
code cut/pasted from -moveToFolderNamed:inContext:.
([SOGoMailObject -moveToFolderNamed:folderNameinContext:]):
modified to use the code from -copyToFolderNamed:inContext:, which
is common between the two actions.
* SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount -draftsFolderNameInContext:_ctx]) * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount -draftsFolderNameInContext:_ctx])
([SOGoMailAccount -sentFolderNameInContext:]) ([SOGoMailAccount -sentFolderNameInContext:])
([SOGoMailAccount -trashFolderNameInContext:]): modified to take ([SOGoMailAccount -trashFolderNameInContext:]): modified to take

1
NEWS
View File

@ -1,6 +1,7 @@
0.9.0-200710XX 0.9.0-200710XX
-------------- --------------
- the user can now configure his folders as drafts, trash or sent folder; - the user can now configure his folders as drafts, trash or sent folder;
- added the ability the move and copy message across mail folders;
0.9.0-200709XX 0.9.0-200709XX
-------------- --------------

View File

@ -89,6 +89,8 @@
- (BOOL)isDeletionAllowed; - (BOOL)isDeletionAllowed;
- (NSException *) trashInContext:(id)_ctx; - (NSException *) trashInContext:(id)_ctx;
- (NSException *) copyToFolderNamed: (NSString *) folderName
inContext: (id)_ctx;
- (NSException *) moveToFolderNamed: (NSString *) folderName - (NSException *) moveToFolderNamed: (NSString *) folderName
inContext: (id)_ctx; inContext: (id)_ctx;

View File

@ -888,13 +888,12 @@ static BOOL debugSoParts = NO;
return nil; return nil;
} }
- (NSException *) moveToFolderNamed: (NSString *) folderName - (NSException *) copyToFolderNamed: (NSString *) folderName
inContext: (id)_ctx inContext: (id)_ctx
{ {
SOGoMailAccounts *destFolder; SOGoMailAccounts *destFolder;
NSEnumerator *folders; NSEnumerator *folders;
NSString *currentFolderName, *reason; NSString *currentFolderName, *reason;
NSException *error;
// TODO: check for safe HTTP method // TODO: check for safe HTTP method
@ -924,18 +923,27 @@ static BOOL debugSoParts = NO;
[destFolder flushMailCaches]; [destFolder flushMailCaches];
/* a) copy */ /* a) copy */
error = [self davCopyToTargetObject: destFolder
newName: @"fakeNewUnusedByIMAP4" /* autoassigned */
inContext:_ctx];
if (error != nil) return error;
/* b) mark deleted */ return [self davCopyToTargetObject: destFolder
newName: @"fakeNewUnusedByIMAP4" /* autoassigned */
error = [[self imap4Connection] markURLDeleted: [self imap4URL]]; inContext:_ctx];
if (error != nil) return error; }
[self flushMailCaches]; - (NSException *) moveToFolderNamed: (NSString *) folderName
inContext: (id)_ctx
{
NSException *error;
if (![self copyToFolderNamed: folderName
inContext: _ctx])
{
/* b) mark deleted */
error = [[self imap4Connection] markURLDeleted: [self imap4URL]];
if (error != nil) return error;
[self flushMailCaches];
}
return nil; return nil;
} }

View File

@ -180,6 +180,8 @@
"Print..." = "Print..."; "Print..." = "Print...";
"Delete Message" = "Delete Message"; "Delete Message" = "Delete Message";
"This Folder" = "This Folder";
/* Label popup menu */ /* Label popup menu */
"None" = "None"; "None" = "None";
"Important" = "Important"; "Important" = "Important";
@ -214,3 +216,8 @@
"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!"; "You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!";
"You need to choose a root subfolder!" = "You need to choose a root subfolder!"; "You need to choose a root subfolder!" = "You need to choose a root subfolder!";
"Moving a message into its own folder is impossible!"
= "Moving a message into its own folder is impossible!";
"Copying a message into its own folder is impossible!"
= "Copying a message into its own folder is impossible!";

View File

@ -181,6 +181,8 @@
"Print..." = "Imprimer..."; "Print..." = "Imprimer...";
"Delete Message" = "Supprimer le message"; "Delete Message" = "Supprimer le message";
"This Folder" = "Ce dossier-ci";
/* Label popup menu */ /* Label popup menu */
"None" = "Aucune"; "None" = "Aucune";
"Important" = "Important"; "Important" = "Important";
@ -215,3 +217,8 @@
"You need to choose a non-virtual folder!" = "Vous devez choisir un dossier non-virtuel."; "You need to choose a non-virtual folder!" = "Vous devez choisir un dossier non-virtuel.";
"You need to choose a root subfolder!" = "Vous devez choisir un sous-dossier de la racine."; "You need to choose a root subfolder!" = "Vous devez choisir un sous-dossier de la racine.";
"Moving a message into its own folder is impossible!"
= "Le déplacement d'un message dans son propre dossier est impossible.";
"Copying a message into its own folder is impossible!"
= "La copie d'un message dans son propre dossier est impossible.";

View File

@ -164,6 +164,8 @@
"Print..." = "Drucken..."; "Print..." = "Drucken...";
"Delete Message" = "Lõschen"; "Delete Message" = "Lõschen";
"This Folder" = "This Folder";
/* Label popup menu */ /* Label popup menu */
"None" = "Aucune"; "None" = "Aucune";
"Important" = "Important"; "Important" = "Important";
@ -198,3 +200,8 @@
"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!"; "You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!";
"You need to choose a root subfolder!" = "You need to choose a root subfolder!"; "You need to choose a root subfolder!" = "You need to choose a root subfolder!";
"Moving a message into its own folder is impossible!"
= "Moving a message into its own folder is impossible!";
"Copying a message into its own folder is impossible!"
= "Copying a message into its own folder is impossible!";

View File

@ -104,7 +104,7 @@
NSString *destinationFolder; NSString *destinationFolder;
id response; id response;
destinationFolder = [[context request] formValueForKey: @"tofolder"]; destinationFolder = [[context request] formValueForKey: @"folder"];
if ([destinationFolder length] > 0) if ([destinationFolder length] > 0)
{ {
response = [[self clientObject] moveToFolderNamed: destinationFolder response = [[self clientObject] moveToFolderNamed: destinationFolder
@ -119,6 +119,26 @@
return response; return response;
} }
- (id) copyAction
{
NSString *destinationFolder;
id response;
destinationFolder = [[context request] formValueForKey: @"folder"];
if ([destinationFolder length] > 0)
{
response = [[self clientObject] copyToFolderNamed: destinationFolder
inContext: context];
if (!response)
response = [self responseWith204];
}
else
response = [NSException exceptionWithHTTPStatus: 500 /* Server Error */
reason: @"No destination folder given"];
return response;
}
/* active message */ /* active message */
- (id) markMessageUnreadAction - (id) markMessageUnreadAction

View File

@ -210,6 +210,11 @@
actionClass = "UIxMailActions"; actionClass = "UIxMailActions";
actionName = "move"; actionName = "move";
}; };
copy = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "copy";
};
trash = { trash = {
protectedBy = "View"; protectedBy = "View";
actionClass = "UIxMailActions"; actionClass = "UIxMailActions";

View File

@ -24,14 +24,7 @@ var MailerUIdTreeExtension = {
}, },
_addFolder: function (parent, folder) { _addFolder: function (parent, folder) {
var thisCounter = this.elementCounter; var thisCounter = this.elementCounter;
var fullName = ""; this._addFolderNode(parent, folder.name, folder.fullName(), folder.type);
var currentFolder = folder;
while (currentFolder.parentFolder) {
fullName = "/folder" + currentFolder.name + fullName;
currentFolder = currentFolder.parentFolder;
}
fullName = "/" + currentFolder.name + fullName;
this._addFolderNode(parent, folder.name, fullName, folder.type);
for (var i = 0; i < folder.children.length; i++) for (var i = 0; i < folder.children.length; i++)
this._addFolder(thisCounter, folder.children[i]); this._addFolder(thisCounter, folder.children[i]);
}, },

View File

@ -11,6 +11,8 @@ var currentMailboxType = "";
var usersRightsWindowHeight = 320; var usersRightsWindowHeight = 320;
var usersRightsWindowWidth = 400; var usersRightsWindowWidth = 400;
var pageContent;
/* mail list */ /* mail list */
function openMessageWindow(msguid, url) { function openMessageWindow(msguid, url) {
@ -330,12 +332,34 @@ function onMailboxTreeItemClick(event) {
Event.stop(event); Event.stop(event);
} }
function onMailboxMenuMove() { function _onMailboxMenuAction(menuEntry, error, actionName) {
window.alert("unimplemented"); var targetMailbox = menuEntry.mailbox.fullName();
if (targetMailbox == currentMailbox)
window.alert(labels[error]);
else {
var message;
if (document.menuTarget instanceof HTMLDivElement)
message = currentMessages[currentMailbox];
else
message = document.menuTarget.getAttribute("id").substr(4);
var urlstr = (URLForFolderID(currentMailbox) + "/" + message
+ "/" + actionName + "?folder=" + targetMailbox);
triggerAjaxRequest(urlstr, folderRefreshCallback, currentMailbox);
}
} }
function onMailboxMenuCopy() { function onMailboxMenuMove(event) {
window.alert("unimplemented"); _onMailboxMenuAction(this,
"Moving a message into its own folder is impossible!",
"move");
}
function onMailboxMenuCopy(event) {
_onMailboxMenuAction(this,
"Copying a message into its own folder is impossible!",
"copy");
} }
function refreshMailbox() { function refreshMailbox() {
@ -1141,13 +1165,13 @@ function generateMenuForMailbox(mailbox, prefix, callback) {
menuDIV.setAttribute("id", prefix + "Submenu"); menuDIV.setAttribute("id", prefix + "Submenu");
var menu = document.createElement("ul"); var menu = document.createElement("ul");
menuDIV.appendChild(menu); menuDIV.appendChild(menu);
document.body.appendChild(menuDIV); pageContent.appendChild(menuDIV);
var callbacks = new Array(); var callbacks = new Array();
if (mailbox.type != "account") { if (mailbox.type != "account") {
var newNode = document.createElement("li"); var newNode = document.createElement("li");
newNode.mailbox = mailbox; newNode.mailbox = mailbox;
newNode.appendChild(document.createTextNode("coucou")); newNode.appendChild(document.createTextNode(labels["This Folder"]));
menu.appendChild(newNode); menu.appendChild(newNode);
menu.appendChild(document.createElement("li")); menu.appendChild(document.createElement("li"));
callbacks.push(callback); callbacks.push(callback);
@ -1186,14 +1210,15 @@ function updateMailboxMenus() {
menuDIV.parentNode.removeChild(menuDIV); menuDIV.parentNode.removeChild(menuDIV);
menuDIV = document.createElement("div"); menuDIV = document.createElement("div");
document.body.appendChild(menuDIV); pageContent = $("pageContent");
pageContent.appendChild(menuDIV);
var menu = document.createElement("ul"); var menu = document.createElement("ul");
menuDIV.appendChild(menu); menuDIV.appendChild(menu);
$(menuDIV).addClassName("menu"); $(menuDIV).addClassName("menu");
menuDIV.setAttribute("id", menuId); menuDIV.setAttribute("id", menuId);
var submenuIds = new Array(); var submenuIds = new Array();
for (var i = 0; i < mailAccounts.length; i++) { for (var i = 0; i < mailAccounts.length; i++) {
var menuEntry = mailboxMenuNode("account", mailAccounts[i]); var menuEntry = mailboxMenuNode("account", mailAccounts[i]);
@ -1441,6 +1466,18 @@ Mailbox.prototype.dump = function(indent) {
} }
} }
Mailbox.prototype.fullName = function() {
var fullName = "";
var currentFolder = this;
while (currentFolder.parentFolder) {
fullName = "/folder" + currentFolder.name + fullName;
currentFolder = currentFolder.parentFolder;
}
return "/" + currentFolder.name + fullName;
}
Mailbox.prototype.findMailboxByName = function(name) { Mailbox.prototype.findMailboxByName = function(name) {
var mailbox = null; var mailbox = null;