Monotone-Parent: 88aa0604fa28680daef426d3364f7f10665edb11
Monotone-Revision: 917c16cbc72247a3b9d3bc68547572f93349255c Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2007-12-13T21:07:09 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
6b5da3c2ea
commit
438e9bb635
|
@ -1,3 +1,9 @@
|
||||||
|
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>
|
2007-12-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* UI/MainUI/SOGoRootPage.m ([SOGoRootPage -crashAction]): new
|
* UI/MainUI/SOGoRootPage.m ([SOGoRootPage -crashAction]): new
|
||||||
|
|
|
@ -26,7 +26,10 @@
|
||||||
#import "../SOGoUI/UIxComponent.h"
|
#import "../SOGoUI/UIxComponent.h"
|
||||||
|
|
||||||
@interface UIxMailMainFrame : UIxComponent
|
@interface UIxMailMainFrame : UIxComponent
|
||||||
|
{
|
||||||
|
NSUserDefaults *ud;
|
||||||
|
NSMutableDictionary *moduleSettings;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* UIXMAILMAINFRAME_H */
|
#endif /* UIXMAILMAINFRAME_H */
|
||||||
|
|
|
@ -36,6 +36,28 @@
|
||||||
|
|
||||||
@implementation UIxMailMainFrame
|
@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 */
|
/* accessors */
|
||||||
- (NSString *) mailAccounts
|
- (NSString *) mailAccounts
|
||||||
{
|
{
|
||||||
|
@ -111,4 +133,31 @@
|
||||||
return [self redirectToLocation: newLocation];
|
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 */
|
@end /* UIxMailMainFrame */
|
||||||
|
|
|
@ -330,6 +330,16 @@
|
||||||
pageName = "UIxMailMainFrame";
|
pageName = "UIxMailMainFrame";
|
||||||
actionName = "compose";
|
actionName = "compose";
|
||||||
};
|
};
|
||||||
|
foldersState = {
|
||||||
|
protectedBy = "View";
|
||||||
|
pageName = "UIxMailMainFrame";
|
||||||
|
actionName = "getFoldersState";
|
||||||
|
};
|
||||||
|
saveFoldersState = {
|
||||||
|
protectedBy = "View";
|
||||||
|
pageName = "UIxMailMainFrame";
|
||||||
|
actionName = "saveFoldersState";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,29 @@ var MailerUIdTreeExtension = {
|
||||||
},
|
},
|
||||||
addMailAccount: function (mailAccount) {
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ var Mailer = {
|
||||||
currentMailboxType: "",
|
currentMailboxType: "",
|
||||||
currentMessages: {},
|
currentMessages: {},
|
||||||
maxCachedMessages: 20,
|
maxCachedMessages: 20,
|
||||||
cachedMessages: new Array()
|
cachedMessages: new Array(),
|
||||||
|
foldersStateTimer: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var usersRightsWindowHeight = 320;
|
var usersRightsWindowHeight = 320;
|
||||||
|
@ -1434,6 +1435,7 @@ function onLoadMailboxesCallback(http) {
|
||||||
updateMailboxTreeInPage();
|
updateMailboxTreeInPage();
|
||||||
updateMailboxMenus();
|
updateMailboxMenus();
|
||||||
checkAjaxRequestsState();
|
checkAjaxRequestsState();
|
||||||
|
getFoldersState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1482,6 +1484,45 @@ function buildMailboxes(accountName, encoded) {
|
||||||
return account;
|
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) {
|
function onMenuCreateFolder(event) {
|
||||||
var name = window.prompt(labels["Name :"], "");
|
var name = window.prompt(labels["Name :"], "");
|
||||||
if (name && name.length > 0) {
|
if (name && name.length > 0) {
|
||||||
|
|
Loading…
Reference in a new issue