Monotone-Parent: 0bf13271077dfd22aaca8a2663fe7490f9d84cb3

Monotone-Revision: a216f87669942e793f9124b63661a5ae82105c1d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-02-01T16:28:53
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-02-01 16:28:53 +00:00
parent 6951e6a527
commit c6b8cb5a1c
8 changed files with 74 additions and 5 deletions
+10
View File
@@ -1,3 +1,13 @@
2008-02-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame
-quotaSupport]): new json string that lists the quota support
among the user's mail accounts.
* SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount
-supportsQuotas]): new method that returns whether the current
account server has support for quotas.
2008-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder
+2
View File
@@ -48,6 +48,8 @@
SOGoTrashFolder *trashFolder;
}
- (BOOL) supportsQuotas;
/* folder pathes */
- (NSArray *) allFolderPaths;
+11
View File
@@ -31,6 +31,8 @@
#import <NGExtensions/NSObject+Logs.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGImap4/NGImap4Connection.h>
#import <NGImap4/NGImap4Client.h>
#import <NGImap4/NGImap4Context.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
@@ -170,6 +172,15 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
return folders;
}
- (BOOL) supportsQuotas
{
NGImap4Client *imapClient;
imapClient = [[self imap4Connection] client];
return [[imapClient context] canQuota];
}
/* hierarchy */
- (SOGoMailAccount *) mailAccountFolder
+2
View File
@@ -41,6 +41,8 @@
@interface SOGoMailAccounts : SOGoFolder
- (NSArray *) toManyRelationshipKeys;
@end
#endif /* __Mailer_SOGoMailAccounts_H__ */
+1
View File
@@ -76,6 +76,7 @@ static NSString *AgenorShareLoginMarker = @".-.";
}
ct = [[ctClass alloc] initWithName:_key inContainer:self];
return [ct autorelease];
}
+28 -1
View File
@@ -20,6 +20,7 @@
*/
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WORequest.h>
@@ -28,6 +29,7 @@
#import <NGExtensions/NSString+misc.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoMailAccounts.h>
#import <SoObjects/SOGo/NSDictionary+URL.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
@@ -71,6 +73,29 @@
return [accountNames jsonRepresentation];
}
- (NSString *) quotaSupport
{
NSEnumerator *accountNames;
NSMutableArray *quotas;
NSString *currentAccount;
SOGoMailAccounts *co;
BOOL supportsQuota;
co = [self clientObject];
accountNames = [[co toManyRelationshipKeys] objectEnumerator];
quotas = [NSMutableArray array];
while ((currentAccount = [accountNames nextObject]))
{
supportsQuota = [[co lookupName: currentAccount
inContext: context
acquire: NO] supportsQuotas];
[quotas addObject: [NSNumber numberWithInt: supportsQuota]];
}
return [quotas jsonRepresentation];
}
- (NSString *) pageFormURL
{
NSString *u;
@@ -127,7 +152,9 @@
accounts = [[context activeUser] mailAccounts];
firstAccount = [[accounts objectsForKey: @"name"] objectAtIndex: 0];
formValues = [[context request] formValues];
parameters = [formValues count] > 0 ? [formValues asURLParameters] : @"?mailto=";
parameters = ([formValues count] > 0
? [formValues asURLParameters]
: @"?mailto=");
newLocation = [NSString stringWithFormat: @"%@/%@/compose%@",
[co baseURLInContext: context],
firstAccount,
@@ -10,6 +10,7 @@
const:jsFiles="dtree.js,MailerUI+dTree.js">
<script type="text/javascript">
var textMailAccounts = '<var:string value="mailAccounts" const:escapeHTML="NO"/>';
var textQuotaSupport = '<var:string value="quotaSupport" const:escapeHTML="NO"/>';
</script>
<div class="menu" id="accountIconMenu">
<ul>
+19 -4
View File
@@ -2,12 +2,19 @@
var accounts = {};
var mailboxTree;
var mailAccounts;
var quotaSupport;
if (typeof textMailAccounts != 'undefined') {
if (textMailAccounts.length > 0)
mailAccounts = textMailAccounts.evalJSON(true);
else
mailAccounts = new Array();
}
if (typeof textQuotaSupport != 'undefined') {
if (textQuotaSupport.length > 0)
quotaSupport = textQuotaSupport.evalJSON(true);
else
quotaSupport = new Array();
}
var Mailer = {
currentMailbox: null,
@@ -484,8 +491,11 @@ function openMailbox(mailbox, reload, idx) {
= triggerAjaxRequest(url, messageListCallback,
currentMessage);
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
triggerAjaxRequest(quotasUrl, quotasCallback);
var account = Mailer.currentMailbox.split("/")[1];
if (accounts[account].supportsQuotas) {
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
triggerAjaxRequest(quotasUrl, quotasCallback);
}
}
}
@@ -623,7 +633,7 @@ function onMessageContextMenuHide(event) {
function onFolderMenuClick(event) {
var onhide, menuName;
var menutype = this.parentNode.getAttribute("datatype");
if (menutype) {
if (menutype == "inbox") {
@@ -1152,7 +1162,8 @@ function configureMessageListBodyEvents(table) {
if ($(cell).hasClassName("tbtv_navcell")) {
var anchors = $(cell).childNodesWithTag("a");
for (var i = 0; i < anchors.length; i++)
Event.observe(anchors[i], "click", openMailboxAtIndex.bindAsEventListener(anchors[i]));
Event.observe(anchors[i], "click",
openMailboxAtIndex.bindAsEventListener(anchors[i]));
}
rows = table.tBodies[0].rows;
@@ -1446,6 +1457,10 @@ function onLoadMailboxesCallback(http) {
function buildMailboxes(accountName, encoded) {
var account = new Mailbox("account", accountName);
var accountIndex = mailAccounts.indexOf(accountName);
account.supportsQuotas = (quotaSupport[accountIndex] != 0);
var data = encoded.evalJSON(true);
for (var i = 0; i < data.length; i++) {
var currentNode = account;