+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
- 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
"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}%";
"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}%";
#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"
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
actionClass = "UIxMailFolderActions";
actionName = "unsubscribe";
};
+ quotas = {
+ protectedBy = "View";
+ actionClass = "UIxMailFolderActions";
+ actionName = "quotas";
+ };
view = {
protectedBy = "View";
pageName = "UIxMailListView";
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++) {
document.messageListAjaxRequest
= triggerAjaxRequest(url, messageListCallback,
currentMessages[mailbox]);
+
+ var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
+ document.quotasAjaxRequest
+ = triggerAjaxRequest(quotasUrl, quotasCallback);
}
}
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);
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\ _-]+)\ (<|<)/;
- // 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)
}
return false; /* stop following the link */
- }
+}
function newEmailTo(sender) {
return openMailTo(document.menuTarget.innerHTML);