From fe4d20a3dcac4a79211e31a0509705940063fbe8 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Fri, 14 Dec 2007 22:07:31 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1302 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 15 ++++++ SOPE/sope-patchset-r1557.diff | 44 +++++++++++++++ .../Appointments/SOGoCalendarComponent.m | 12 ++--- SoObjects/Appointments/product.plist | 1 + SoObjects/Mailer/SOGoDraftObject.m | 4 +- UI/MailerUI/UIxMailMainFrame.h | 5 +- UI/MailerUI/UIxMailMainFrame.m | 49 +++++++++++++++++ UI/MailerUI/product.plist | 12 ++++- UI/MainUI/product.plist | 4 +- UI/WebServerResources/MailerUI+dTree.js | 27 +++++++++- UI/WebServerResources/MailerUI.js | 53 +++++++++++++++++-- UI/WebServerResources/SchedulerUI.js | 4 +- 12 files changed, 208 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index debdfec7..4757ac4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-12-14 Ludovic Marcotte + + * SoObjects/Appointments/SOGoCalendarComponent.m + We set headers in lowercase so that they get properly + encoded by SOPE. + + * SoObjects/Mailer/SOGoDraftObject.m + Minor cleanups. + +2007-12-13 Francis Lachapelle + + * UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame -saveFoldersStateAction]) + ([UIxMailMainFrame -getFoldersStateAction]): new methods to get + and set the folders state of the user's web view. + 2007-12-13 Wolfgang Sourdeau * UI/MainUI/SOGoRootPage.m ([SOGoRootPage -crashAction]): new diff --git a/SOPE/sope-patchset-r1557.diff b/SOPE/sope-patchset-r1557.diff index ca62e7bd..85c2064b 100644 --- a/SOPE/sope-patchset-r1557.diff +++ b/SOPE/sope-patchset-r1557.diff @@ -874,6 +874,19 @@ Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m if (date == nil) goto failed; #if 0 +Index: sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m +=================================================================== +--- sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m (révision 1557) ++++ sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m (copie de travail) +@@ -70,6 +70,8 @@ + [rfc822Set setGenerator:gen forField:Fields->cc]; + [rfc822Set setGenerator:gen forField:@"bcc"]; + [rfc822Set setGenerator:gen forField:Fields->from]; ++ [rfc822Set setGenerator:gen forField:@"reply-to"]; ++ [rfc822Set setGenerator:gen forField:@"in-reply-to"]; + } + + if ((gen = [NGMimeStringHeaderFieldGenerator headerFieldGenerator])) Index: sope-mime/NGMime/NGMimeBodyPart.m =================================================================== --- sope-mime/NGMime/NGMimeBodyPart.m (révision 1557) @@ -975,6 +988,37 @@ Index: sope-mime/NGMime/NGMimePartParser.m contentType = ([ctype isKindOfClass:[NGMimeType class]]) ? ctype : [NGMimeType mimeType:[ctype stringValue]]; +Index: sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m +=================================================================== +--- sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m (révision 1557) ++++ sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m (copie de travail) +@@ -122,8 +122,13 @@ + } + + if (doEnc) { ++#if NeXT_Foundation_LIBRARY + unsigned char iso[] = "=?iso-8859-15?q?"; + unsigned isoLen = 16; ++#else ++ unsigned char iso[] = "=?utf-8?q?"; ++ unsigned isoLen = 10; ++#endif + unsigned char isoEnd[] = "?="; + unsigned isoEndLen = 2; + unsigned desLen; +@@ -133,10 +138,10 @@ + { + NSData *data; + +-#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY ++#if NeXT_Foundation_LIBRARY + data = [tmp dataUsingEncoding:NSISOLatin1StringEncoding]; + #else +- data = [tmp dataUsingEncoding:NSISOLatin9StringEncoding]; ++ data = [tmp dataUsingEncoding:NSUTF8StringEncoding]; + #endif + + bufLen = [data length]; Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m =================================================================== --- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m (révision 1557) diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 8411b794..c8ed4eb3 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -316,11 +316,11 @@ static BOOL sendEMailNotifications = NO; * so we'll stick with multipart/mixed for the time being. */ [headerMap setObject: @"multipart/mixed" forKey: @"content-type"]; - [headerMap setObject: sender forKey: @"From"]; - [headerMap setObject: recipient forKey: @"To"]; + [headerMap setObject: sender forKey: @"from"]; + [headerMap setObject: recipient forKey: @"to"]; mailDate = [[NSCalendarDate date] rfc822DateString]; [headerMap setObject: mailDate forKey: @"date"]; - [headerMap setObject: subject forKey: @"Subject"]; + [headerMap setObject: subject forKey: @"subject"]; msg = [NGMimeMessage messageWithHeader: headerMap]; /* multipart body */ @@ -407,11 +407,11 @@ static BOOL sendEMailNotifications = NO; * so we'll stick with multipart/mixed for the time being. */ [headerMap setObject: @"multipart/mixed" forKey: @"content-type"]; - [headerMap setObject: [attendee mailAddress] forKey: @"From"]; - [headerMap setObject: [organizer mailAddress] forKey: @"To"]; + [headerMap setObject: [attendee mailAddress] forKey: @"from"]; + [headerMap setObject: [organizer mailAddress] forKey: @"to"]; mailDate = [[NSCalendarDate date] rfc822DateString]; [headerMap setObject: mailDate forKey: @"date"]; - [headerMap setObject: [p getSubject] forKey: @"Subject"]; + [headerMap setObject: [p getSubject] forKey: @"subject"]; msg = [NGMimeMessage messageWithHeader: headerMap]; NSLog (@"sending 'REPLY' from %@ to %@", diff --git a/SoObjects/Appointments/product.plist b/SoObjects/Appointments/product.plist index 297b9b23..af1952f6 100644 --- a/SoObjects/Appointments/product.plist +++ b/SoObjects/Appointments/product.plist @@ -41,6 +41,7 @@ "ModifyComponent" = ( "Owner", "Organizer" ); "RespondToComponent" = ( "Participant", "ComponentModifier", "ComponentResponder" ); "Access Object" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" ); + "Change Images and Files" = ( "Owner", "Organizer", "ComponentModifier" ); "Access Contents Information" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" ); "WebDAV Access" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" ); }; diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index fd3ac531..8a921562 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -1164,20 +1164,18 @@ static BOOL showTextAttachmentsInline = NO; else if (![self isEmptyValue:from]) [map setObjects:[map objectsForKey: @"from"] forKey: @"reply-to"]; - /* add subject */ if (inReplyTo) [map setObject: inReplyTo forKey: @"in-reply-to"]; + /* add subject */ if ([(s = [headers objectForKey: @"subject"]) length] > 0) [map setObject: [s asQPSubjectString: @"utf-8"] forKey: @"subject"]; -// [map setObject: [s asQPSubjectString: @"utf-8"] forKey: @"subject"]; [map setObject: [headers objectForKey: @"message-id"] forKey: @"message-id"]; /* add standard headers */ - dateString = [[NSCalendarDate date] rfc822DateString]; [map addObject: dateString forKey: @"date"]; [map addObject: @"1.0" forKey: @"MIME-Version"]; diff --git a/UI/MailerUI/UIxMailMainFrame.h b/UI/MailerUI/UIxMailMainFrame.h index 70bf0198..1e4ecd55 100644 --- a/UI/MailerUI/UIxMailMainFrame.h +++ b/UI/MailerUI/UIxMailMainFrame.h @@ -26,7 +26,10 @@ #import "../SOGoUI/UIxComponent.h" @interface UIxMailMainFrame : UIxComponent - +{ + NSUserDefaults *ud; + NSMutableDictionary *moduleSettings; +} @end #endif /* UIXMAILMAINFRAME_H */ diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index 94842a19..b0967759 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -36,6 +36,28 @@ @implementation UIxMailMainFrame +- (void) _setupContext +{ + SOGoUser *activeUser; + NSString *login, *module; + SOGoMailAccounts *clientObject; + + activeUser = [context activeUser]; + login = [activeUser login]; + clientObject = [self clientObject]; + + module = [clientObject nameInContainer]; + + ud = [activeUser userSettings]; + moduleSettings = [ud objectForKey: module]; + if (!moduleSettings) + { + moduleSettings = [NSMutableDictionary new]; + [moduleSettings autorelease]; + } + [ud setObject: moduleSettings forKey: module]; +} + /* accessors */ - (NSString *) mailAccounts { @@ -111,4 +133,31 @@ return [self redirectToLocation: newLocation]; } +- (WOResponse *) getFoldersStateAction +{ + NSString *expandedFolders; + + [self _setupContext]; + expandedFolders = [moduleSettings objectForKey: @"ExpandedFolders"]; + + return [self responseWithStatus: 200 andString: expandedFolders]; +} + +- (WOResponse *) saveFoldersStateAction +{ + WORequest *request; + NSString *expandedFolders; + + [self _setupContext]; + request = [context request]; + expandedFolders = [request formValueForKey: @"expandedFolders"]; + + [moduleSettings setObject: expandedFolders + forKey: @"ExpandedFolders"]; + + [ud synchronize]; + + return [self responseWithStatus: 204]; +} + @end /* UIxMailMainFrame */ diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index 0c024e62..61714cd2 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -328,7 +328,17 @@ compose = { protectedBy = "View"; pageName = "UIxMailMainFrame"; - actionName = "compose"; + actionName = "compose"; + }; + foldersState = { + protectedBy = "View"; + pageName = "UIxMailMainFrame"; + actionName = "getFoldersState"; + }; + saveFoldersState = { + protectedBy = "View"; + pageName = "UIxMailMainFrame"; + actionName = "saveFoldersState"; }; }; }; diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index 83342e46..af40eccd 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -89,7 +89,7 @@ protectedBy = ""; pageName = "SOGoRootPage"; }; - crash = { +/* crash = { protectedBy = ""; pageName = "SOGoRootPage"; actionName = "crash"; @@ -103,7 +103,7 @@ protectedBy = ""; pageName = "SOGoRootPage"; actionName = "raisedException"; - }; + }; */ connect = { protectedBy = ""; pageName = "SOGoRootPage"; diff --git a/UI/WebServerResources/MailerUI+dTree.js b/UI/WebServerResources/MailerUI+dTree.js index 42e60b4f..a0805e5b 100644 --- a/UI/WebServerResources/MailerUI+dTree.js +++ b/UI/WebServerResources/MailerUI+dTree.js @@ -29,8 +29,31 @@ var MailerUIdTreeExtension = { this._addFolder(thisCounter, folder.children[i]); }, addMailAccount: function (mailAccount) { - this._addFolder(0, mailAccount); - } + this._addFolder(0, mailAccount); + }, + setCookie: function(cookieName, cookieValue, expires, path, domain, secure) { + + }, + getCookie: function(cookieName) { + return (""); + }, + updateCookie: function () { + if (Mailer.foldersStateTimer) + clearTimeout(Mailer.foldersStateTimer); + Mailer.foldersStateTimer = setTimeout('saveFoldersState()', 3000); // 3 seconds + }, + getFoldersState: function () { + var expandedFolders = new Array(); + for (var n = 0; n < this.aNodes.length; n++) { + if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) { + expandedFolders.push(this.aNodes[n].dataname); + } + } + return expandedFolders.toJSON(); + }, + autoSync: function() { + this.config.useCookies = true; + } }; Object.extend(dTree.prototype, MailerUIdTreeExtension); diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 97a2a289..9e46418e 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -14,7 +14,8 @@ var Mailer = { currentMailboxType: "", currentMessages: {}, maxCachedMessages: 20, - cachedMessages: new Array() + cachedMessages: new Array(), + foldersStateTimer: false }; var usersRightsWindowHeight = 320; @@ -450,18 +451,20 @@ function openMailbox(mailbox, reload, idx) { Mailer.currentMailbox = mailbox; var url = ApplicationBaseURL + encodeURI(mailbox) + "/view?noframe=1"; - if (!reload) { + if (!reload || idx) { var messageContent = $("messageContent"); messageContent.update(); lastClickedRow = -1; // from generic.js } var currentMessage; - if (!idx && !reload) { + + if (!idx) { currentMessage = Mailer.currentMessages[mailbox]; if (currentMessage) { - loadMessage(currentMessage); url += '&pageforuid=' + currentMessage; + if (!reload) + loadMessage(currentMessage); } } @@ -1254,7 +1257,7 @@ function initMailer(event) { initMailboxTree(); initMessageCheckTimer(); } - + // Default sort options sorting["attribute"] = "date"; sorting["ascending"] = false; @@ -1434,6 +1437,7 @@ function onLoadMailboxesCallback(http) { updateMailboxTreeInPage(); updateMailboxMenus(); checkAjaxRequestsState(); + getFoldersState(); } } } @@ -1482,6 +1486,45 @@ function buildMailboxes(accountName, encoded) { return account; } +function getFoldersState() { + if (mailAccounts.length > 0) { + var urlstr = ApplicationBaseURL + "foldersState"; + triggerAjaxRequest(urlstr, getFoldersStateCallback); + } +} + +function getFoldersStateCallback(http) { + if (http.readyState == 4 + && http.status == 200) { + if (http.responseText.length > 0) { + // The response text is a JSOn representation + // of the folders that were left opened. + var data = http.responseText.evalJSON(true); + for (var i = 1; i < mailboxTree.aNodes.length; i++) { + if ($(data).indexOf(mailboxTree.aNodes[i].dataname) > 0) + // If the folder is found, open it + mailboxTree.o(i); + } + } + } + mailboxTree.autoSync(); +} + +function saveFoldersState() { + if (mailAccounts.length > 0) { + var foldersState = mailboxTree.getFoldersState(); + var urlstr = ApplicationBaseURL + "saveFoldersState" + "?expandedFolders=" + foldersState; + triggerAjaxRequest(urlstr, saveFoldersStateCallback); + } +} + +function saveFoldersStateCallback(http) { + if (http.readyState == 4 + && isHttpStatus204(http.status)) { + log ("folders state saved"); + } +} + function onMenuCreateFolder(event) { var name = window.prompt(labels["Name :"], ""); if (name && name.length > 0) { diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 273a21e5..3ac2a758 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -357,12 +357,12 @@ function eventsListCallback(http) { td = document.createElement("td"); row.appendChild(td); Event.observe(td, "mousedown", listRowMouseDownHandler, true); - td.appendChild(document.createTextNode(data[i][9])); + td.appendChild(document.createTextNode(data[i][10])); td = document.createElement("td"); row.appendChild(td); Event.observe(td, "mousedown", listRowMouseDownHandler, true); - td.appendChild(document.createTextNode(data[i][10])); + td.appendChild(document.createTextNode(data[i][11])); td = document.createElement("td"); row.appendChild(td); -- 2.39.5