diff --git a/ChangeLog b/ChangeLog index 4eca5bfbd..3be02f72c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,28 @@ 2010-08-12 Wolfgang Sourdeau + * UI/WebServerResources/MailerUIdTree.js: (getMailboxNode): fixed + method to return unfolded nodes too. + + * UI/WebServerResources/MailerUI.js: (updateUnseenCount): renamed + from "updateStatusFolders" and improved to use DOM methods. + + * UI/WebServerResources/dtree.js: (Node): removed the "hasUnseen" + parameter. + + * UI/MailerUI/UIxMailAccountActions.m (-listMailboxes): make use + of the "application/json" content type in the response. + + * UI/MailerUI/UIxMailFolderActions.m: (-unseenCount): renamed and + moved implementation of the -[UIxMailAccountActions statusFolders] + method, splitted thereof since we now execute the method on all + mail folders. + + * UI/MailerUI/UIxMailMainFrame.m (-defaultColumnsOrder): removed + accessor, made obsolete by the new propagation mechanism of user + defaults. + (-getUnseenCountForAllFolders): new accessor that returns the + value below as a string value. + * SoObjects/SOGo/SOGoDomainDefaults.m (-mailCheckAllUnseenCounts): new method returning whether the unseen count of all mailboxes should be checked. @@ -15,7 +38,7 @@ memcached. In FF 3.5 and above, a bug prevents the initial cookie from being given back to the reauthentication redirect from an AJAX request. Therefore we open a window that will do this for us - and will close one the authentication has succeeded again. + and will close one the authentication has succeeded again. * UI/MainUI/SOGoRootPage.m (-revoverAction): new fake action that perform the CAS redirection and then trigger the respawn of the diff --git a/UI/MailerUI/UIxMailAccountActions.h b/UI/MailerUI/UIxMailAccountActions.h index 72ccf6b6d..9e98ae5fb 100644 --- a/UI/MailerUI/UIxMailAccountActions.h +++ b/UI/MailerUI/UIxMailAccountActions.h @@ -35,7 +35,6 @@ NSString *trashFolderName; } -- (WOResponse *) statusFoldersAction; - (WOResponse *) listMailboxesAction; @end diff --git a/UI/MailerUI/UIxMailAccountActions.m b/UI/MailerUI/UIxMailAccountActions.m index a26443fbd..c62275bcc 100644 --- a/UI/MailerUI/UIxMailAccountActions.m +++ b/UI/MailerUI/UIxMailAccountActions.m @@ -31,8 +31,6 @@ #import #import -#import - #import #import #import @@ -124,50 +122,6 @@ return folders; } -- (NSDictionary *) _statusFolders -{ - EOQualifier *searchQualifier; - NSArray *searchResult; - NSDictionary *imapResult; - NGImap4Client *client; - NSNumber *unseen; - SOGoMailFolder *inbox; - SOGoMailAccount *co; - - co = [self clientObject]; - inbox = [co inboxFolderInContext: context]; - client = [[inbox imap4Connection] client]; - unseen = nil; - - if ([client select: [inbox relativeImap4Name]]) - { - searchQualifier = [EOQualifier qualifierWithQualifierFormat: @"flags = %@ AND not flags = %@", @"unseen", @"deleted"]; - imapResult = [client searchWithQualifier: searchQualifier]; - searchResult = [[imapResult objectForKey: @"RawResponse"] objectForKey: @"search"]; - unseen = [NSNumber numberWithInt: [searchResult count]]; - } - - if (!unseen) - unseen = [NSNumber numberWithInt: 0]; - - return [NSDictionary dictionaryWithObjectsAndKeys: unseen, @"unseen", nil]; -} - -- (WOResponse *) statusFoldersAction -{ - WOResponse *response; - NSDictionary *data; - - response = [self responseWithStatus: 200]; - data = [self _statusFolders]; - - [response setHeader: @"text/plain; charset=utf-8" - forKey: @"content-type"]; - [response appendContentString: [data jsonRepresentation]]; - - return response; -} - - (WOResponse *) listMailboxesAction { SOGoMailAccount *co; @@ -214,13 +168,12 @@ // The parameter order is important here, as if the server doesn't support // quota, inboxQuota will be nil and it'll terminate the list of objects/keys. data = [NSDictionary dictionaryWithObjectsAndKeys: folders, @"mailboxes", - [self _statusFolders], @"status", inboxQuota, @"quotas", nil]; - response = [self responseWithStatus: 200]; - [response setHeader: @"text/plain; charset=utf-8" + response = [self responseWithStatus: 200 + andString: [data jsonRepresentation]]; + [response setHeader: @"application/json" forKey: @"content-type"]; - [response appendContentString: [data jsonRepresentation]]; return response; } diff --git a/UI/MailerUI/UIxMailFolderActions.m b/UI/MailerUI/UIxMailFolderActions.m index 0723d21e4..1d530e236 100644 --- a/UI/MailerUI/UIxMailFolderActions.m +++ b/UI/MailerUI/UIxMailFolderActions.m @@ -24,6 +24,7 @@ #import #import #import +#import #import #import @@ -31,6 +32,7 @@ #import #import #import +#import #import #import @@ -585,4 +587,51 @@ return response; } +- (NSDictionary *) _unseenCount +{ + EOQualifier *searchQualifier; + NSArray *searchResult; + NSDictionary *imapResult; + NGImap4Connection *connection; + NGImap4Client *client; + int unseen; + SOGoMailFolder *folder; + + folder = [self clientObject]; + + connection = [folder imap4Connection]; + client = [connection client]; + + if ([connection selectFolder: [folder imap4URL]]) + { + searchQualifier + = [EOQualifier qualifierWithQualifierFormat: @"flags = %@ AND not flags = %@", + @"unseen", @"deleted"]; + imapResult = [client searchWithQualifier: searchQualifier]; + searchResult = [[imapResult objectForKey: @"RawResponse"] objectForKey: @"search"]; + unseen = [searchResult count]; + } + else + unseen = 0; + + return [NSDictionary + dictionaryWithObject: [NSNumber numberWithInt: unseen] + forKey: @"unseen"]; +} + +- (WOResponse *) unseenCountAction +{ + WOResponse *response; + NSDictionary *data; + + response = [self responseWithStatus: 200]; + data = [self _unseenCount]; + + [response setHeader: @"text/plain; charset=utf-8" + forKey: @"content-type"]; + [response appendContentString: [data jsonRepresentation]]; + + return response; +} + @end diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index 67fe617c0..abca1d46c 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -111,12 +111,6 @@ return [names jsonRepresentation]; } -- (NSString *) defaultColumnsOrder -{ - return [[[self columnsDisplayOrder] objectsForKey: @"value" - notFoundMarker: @""] jsonRepresentation]; -} - - (NSString *) pageFormURL { NSString *u; @@ -619,5 +613,14 @@ return [self labelForKey: [currentColumn objectForKey: @"value"]]; } +- (NSString *) getUnseenCountForAllFolders +{ + SOGoDomainDefaults *dd; + + dd = [[context activeUser] domainDefaults]; + + return ([dd mailCheckAllUnseenCounts] ? @"true" : @"false"); +} + @end /* UIxMailMainFrame */ diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index 5429ca2bc..abd4c0c67 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -171,6 +171,11 @@ protectedBy = "ReadAcls"; pageName = "UIxMailUserRightsEditor"; }; + unseenCount = { + protectedBy = "View"; + actionClass = "UIxMailFolderActions"; + actionName = "unseenCount"; + }; saveUserRights = { protectedBy = "Change Permissions"; pageName = "UIxMailUserRightsEditor"; @@ -383,11 +388,6 @@ actionClass = "UIxMailFolderActions"; actionName = "createFolder"; }; - statusFolders = { - protectedBy = "View"; - actionClass = "UIxMailAccountActions"; - actionName = "statusFolders"; - }; }; }; diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index ccc68d7f2..1d6a93e43 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -11,9 +11,9 @@ const:userSettingsKeys="Mail" const:jsFiles="dtree.js,MailerUIdTree.js,SOGoAutoCompletion.js,SOGoResizableTable.js,SOGoMailDataSource.js,SOGoDataTable.js">