mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-12 07:17:12 +00:00
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:
1 parent
6951e6a527
commit
c6b8cb5a1c
8 files changed
+74
-5
No files matched your search
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user