Monotone-Parent: b485f305175502819e660d9557bad5fa6d20222f

Monotone-Revision: a5370a41693bc2294eb25921c8e19dda7570a063

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-07-11T05:05:03
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-07-11 05:05:03 +00:00
parent 18026b4f47
commit 956c4f2109
12 changed files with 87 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2007-07-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions
-quotasAction]): new method that returns a json representation of
the mailbox quotas.
2007-07-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailBaseObject.m ([SOGoMailBaseObject

4
NEWS
View File

@ -3,14 +3,16 @@
- added the ability to specify a super user through the SOGoSuperUsername user
default;
- added the ability to view the message source;
- no longer autocreate folders if we are not their owners;
- don't autocreate folders if we are not their owners;
- made compatible with PostgreSQL 8.2;
- the months and years menus of the date selector would no longer appear;
- fixed a bug which would produce task SQL records which would violate
non-null constraints on the quick calendar tables;
- the tasks due date was wrongly set because of a change in the API;
- it was impossible to reset the start and the due date in the task editor
whenever they were set once;
- imap folders with non-ascii characters are now correctly accessed;
- display the quotas of the selected mailbox on servers that support quotas;
Local variables:
mode: text

View File

@ -18,7 +18,7 @@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: common.h 577 2005-02-17 14:38:14Z helge $
// $Id: common.h 1101 2007-07-10 19:27:48Z wolfgang $
#import <Foundation/Foundation.h>

View File

@ -18,7 +18,7 @@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: common.h 269 2004-08-25 16:06:10Z znek $
// $Id: common.h 1101 2007-07-10 19:27:48Z wolfgang $
#import <Foundation/Foundation.h>

View File

@ -126,3 +126,5 @@
"Do you really want to move this folder into the trash ?"
= "Do you really want to move this folder into the trash ?";
"Operation failed" = "Operation failed";
"quotasFormat" = "Quotas: %{0} used on %{1} Kb; %{2}%";

View File

@ -176,3 +176,5 @@
"Do you really want to move this folder into the trash ?"
= "Voulez-vous vraiment déplacer le dossier sélectionné dans la corbeille?";
"Operation failed" = "L'opération a échoué.";
"quotasFormat" = "Quotas: %{0} Ko utilisés sur %{1}; %{2}%";

View File

@ -29,10 +29,12 @@
#import <NGObjWeb/WOResponse.h>
#import <NGObjWeb/WORequest.h>
#import <NGImap4/NGImap4Connection.h>
#import <NGImap4/NGImap4Client.h>
#import <SoObjects/Mailer/SOGoMailFolder.h>
#import <SoObjects/Mailer/SOGoTrashFolder.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import "UIxMailFolderActions.h"
@ -249,4 +251,29 @@
return [self _subscriptionStubAction];
}
- (WOResponse *) quotasAction
{
SOGoMailFolder *folder;
NSURL *folderURL;
id infos;
WOResponse *response;
NGImap4Client *client;
NSString *responseString;
response = [context response];
[response setStatus: 200];
[response setHeader: @"text/plain; charset=UTF-8"
forKey: @"content-type"];
folder = [self clientObject];
folderURL = [folder imap4URL];
client = [[folder imap4Connection] client];
infos = [client getQuotaRoot: [folder nameInContainer]];
responseString = [[infos objectForKey: @"quotas"] jsonRepresentation];
[response appendContentString: responseString];
return response;
}
@end

View File

@ -95,6 +95,11 @@ categories = {
actionClass = "UIxMailFolderActions";
actionName = "unsubscribe";
};
quotas = {
protectedBy = "View";
actionClass = "UIxMailFolderActions";
actionName = "quotas";
};
view = {
protectedBy = "View";
pageName = "UIxMailListView";

View File

@ -18,7 +18,7 @@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: common.h 91 2004-06-30 07:48:53Z helge $
// $Id: common.h 1101 2007-07-10 19:27:48Z wolfgang $
#import <Foundation/Foundation.h>

View File

@ -18,7 +18,7 @@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
// $Id: common.h 181 2004-08-11 15:13:25Z helge $
// $Id: common.h 1101 2007-07-10 19:27:48Z wolfgang $
#import <Foundation/Foundation.h>

View File

@ -2,6 +2,15 @@ String.prototype.trim = function() {
return this.replace(/(^\s+|\s+$)/g, '');
}
String.prototype.formatted = function() {
var newString = this;
for (var i = 0; i < arguments.length; i++)
newString = newString.replace("%{" + i + "}", arguments[i], "g");
return newString;
}
String.prototype.repeat = function(count) {
var newString = "";
for (var i = 0; i < count; i++) {

View File

@ -461,6 +461,10 @@ function openMailbox(mailbox, reload, idx) {
document.messageListAjaxRequest
= triggerAjaxRequest(url, messageListCallback,
currentMessages[mailbox]);
var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
document.quotasAjaxRequest
= triggerAjaxRequest(quotasUrl, quotasCallback);
}
}
@ -509,6 +513,30 @@ function messageListCallback(http) {
log("messageListCallback: problem during ajax request (readyState = " + http.readyState + ", status = " + http.status + ")");
}
function quotasCallback(http) {
if (http.readyState == 4
&& http.status == 200) {
var hasQuotas = false;
var quotas = http.responseText.evalJSON(true);
for (var i in quotas) {
hasQuotas = true;
break;
}
if (hasQuotas) {
var treePath = currentMailbox.split("/");
var mbQuotas = quotas["/" + treePath[2]];
var used = mbQuotas["usedSpace"];
var max = mbQuotas["maxQuota"];
var percents = (Math.round(used * 10000 / max) / 100);
var format = labels["quotasFormat"].decodeEntities();
var text = format.formatted(used, max, percents);
window.status = text;
}
}
}
function onMessageContextMenu(event) {
var menu = $('messageListMenu');
Event.observe(menu, "hideMenu", onMessageContextMenuHide);
@ -815,18 +843,6 @@ function onMenuViewMessageSource(event) {
function newContactFromEmail(event) {
var mailto = document.menuTarget.innerHTML;
// var emailre
// = /([a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])/g;
// emailre.exec(mailto);
// email = RegExp.$1;
// var namere = /(\w[\w\ _-]+)\ (&lt;|<)/;
// var c_name = '';
// if (namere.test(mailto)) {
// namere.exec(mailto);
// c_name += RegExp.$1;
// }
var email = extractEmailAddress(mailto);
var c_name = extractEmailName(mailto);
if (email.length > 0)
@ -841,7 +857,7 @@ function newContactFromEmail(event) {
}
return false; /* stop following the link */
}
}
function newEmailTo(sender) {
return openMailTo(document.menuTarget.innerHTML);