+2007-12-14 Ludovic Marcotte <ludovic@inverse.ca>
+
+ * 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 <flachapelle@inverse.ca>
+
+ * 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 <wsourdeau@inverse.ca>
* UI/MainUI/SOGoRootPage.m ([SOGoRootPage -crashAction]): new
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)
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)
* 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 */
* 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 %@",
"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" );
};
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"];
#import "../SOGoUI/UIxComponent.h"
@interface UIxMailMainFrame : UIxComponent
-
+{
+ NSUserDefaults *ud;
+ NSMutableDictionary *moduleSettings;
+}
@end
#endif /* UIXMAILMAINFRAME_H */
@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
{
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 */
compose = {
protectedBy = "View";
pageName = "UIxMailMainFrame";
- actionName = "compose";
+ actionName = "compose";
+ };
+ foldersState = {
+ protectedBy = "View";
+ pageName = "UIxMailMainFrame";
+ actionName = "getFoldersState";
+ };
+ saveFoldersState = {
+ protectedBy = "View";
+ pageName = "UIxMailMainFrame";
+ actionName = "saveFoldersState";
};
};
};
protectedBy = "<public>";
pageName = "SOGoRootPage";
};
- crash = {
+/* crash = {
protectedBy = "<public>";
pageName = "SOGoRootPage";
actionName = "crash";
protectedBy = "<public>";
pageName = "SOGoRootPage";
actionName = "raisedException";
- };
+ }; */
connect = {
protectedBy = "<public>";
pageName = "SOGoRootPage";
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);
currentMailboxType: "",
currentMessages: {},
maxCachedMessages: 20,
- cachedMessages: new Array()
+ cachedMessages: new Array(),
+ foldersStateTimer: false
};
var usersRightsWindowHeight = 320;
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);
}
}
initMailboxTree();
initMessageCheckTimer();
}
-
+
// Default sort options
sorting["attribute"] = "date";
sorting["ascending"] = false;
updateMailboxTreeInPage();
updateMailboxMenus();
checkAjaxRequestsState();
+ getFoldersState();
}
}
}
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) {
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);