+2007-10-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/Mailer/SOGoMailBodyPart.m ([SOGoMailBodyPart
+ -GETAction:]): use the "application/octet-stream" mime type for
+ elements of type "application/x-xpinstall" to avoid confusing
+ Firefox.
+
+ * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences -messageCheckList])
+ ([UIxPreferences -itemMessageCheckText])
+ ([UIxPreferences -userMessageCheck])
+ ([UIxPreferences -setUserMessageCheck:newMessageCheck]): new
+ methods for handling the retrieval of new messages automatically.
+
+ * SoObjects/SOGo/SOGoUser.m ([SOGoUser -messageCheck]): new method
+ that returns the interval of time between automatic message
+ retrievals.
+
+ * UI/MailerUI/UIxMailListView.m ([UIxMailListView
+ -defaultAction]): now expunges the last folder marked for expunge.
+
+ * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
+ -trashInContext:_ctx]): now marks the container folder for
+ expunge.
+
+ * SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder
+ -markForExpunge]): new method that marks the folder for the next
+ automatic expunge operation in the user settings.
+ ([SOGoMailFolder -expungeLastMarkedFolder]): new methods that
+ takes the last folder marked for expunge, expunges it and removes
+ it from the user settings, if it exists.
+
2007-10-25 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailListView.m ([UIxMailListView
NSException *error;
WOResponse *r;
NSData *data;
- NSString *etag;
+ NSString *etag, *mimeType;
if ((error = [self matchesRequestConditionInContext:_ctx]) != nil) {
// TODO: currently we fetch the body structure to get here - check this!
// TODO: wrong, could be encoded
r = [(WOContext *)_ctx response];
- [r setHeader:[self davContentType] forKey:@"content-type"];
- [r setHeader:[NSString stringWithFormat:@"%d", [data length]]
- forKey:@"content-length"];
-
+ mimeType = [self davContentType];
+ if ([mimeType isEqualToString: @"application/x-xpinstall"])
+ mimeType = @"application/octet-stream";
+
+ [r setHeader: mimeType forKey:@"content-type"];
+ [r setHeader: [NSString stringWithFormat:@"%d", [data length]]
+ forKey: @"content-length"];
+
if ((etag = [self davEntityTag]) != nil)
[r setHeader:etag forKey:@"etag"];
[r setContent:data];
+
return r;
}
- (NSException *) postData: (NSData *) _data flags: (id) _flags;
+- (void) markForExpunge;
+- (void) expungeLastMarkedFolder;
+
- (NSException *) expunge;
/* flags */
02111-1307, USA.
*/
+#import <Foundation/NSDictionary.h>
+#import <Foundation/NSURL.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/NSException+HTTP.h>
+#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSURL+misc.h>
#import <NGExtensions/NSObject+Logs.h>
return [[self imap4Connection] expungeAtURL: [self imap4URL]];
}
+- (void) markForExpunge
+{
+ NSUserDefaults *ud;
+ NSMutableDictionary *mailSettings;
+
+ ud = [[context activeUser] userSettings];
+ mailSettings = [ud objectForKey: @"Mail"];
+ if (!mailSettings)
+ {
+ mailSettings = [NSMutableDictionary dictionaryWithCapacity: 1];
+ [ud setObject: mailSettings forKey: @"Mail"];
+ }
+
+ [mailSettings setObject: [self imap4URLString] forKey: @"folderForExpunge"];
+ [ud synchronize];
+}
+
+- (void) expungeLastMarkedFolder
+{
+ NSUserDefaults *ud;
+ NSMutableDictionary *mailSettings;
+ NSString *expungeURL;
+ NSURL *folderURL;
+
+ ud = [[context activeUser] userSettings];
+ mailSettings = [ud objectForKey: @"Mail"];
+ if (mailSettings)
+ {
+ expungeURL = [mailSettings objectForKey: @"folderForExpunge"];
+ if (expungeURL)
+ {
+ folderURL = [NSURL URLWithString: expungeURL];
+ if (![[self imap4Connection] expungeAtURL: folderURL])
+ {
+ [mailSettings removeObjectForKey: @"folderForExpunge"];
+ [ud synchronize];
+ }
+ }
+ }
+}
+
/* flags */
- (NSException *) addFlagsToAllMessages: (id) _f
error = [[self imap4Connection] markURLDeleted: [self imap4URL]];
if (error != nil) return error;
-
+
+ [container markForExpunge];
+
[self flushMailCaches];
return nil;
- (NSArray *) allIdentities;
- (NSDictionary *) primaryIdentity;
- (NSString *) messageForwarding;
+- (NSString *) messageCheck;
/* folders */
return messageForwarding;
}
+- (NSString *) messageCheck
+{
+ NSString *messageCheck;
+
+ messageCheck
+ = [[self userDefaults] stringForKey: @"MessageCheck"];
+ if (![messageCheck length])
+ messageCheck = @"manually";
+
+ return messageCheck;
+}
+
/* folders */
// TODO: those methods should check whether the traversal stack in the context
{
WORequest *request;
NSString *specificMessage, *searchCriteria, *searchValue;
+ SOGoUserFolder *co;
request = [context request];
- [[self clientObject] flushMailCaches];
+ co = [self clientObject];
+ [co flushMailCaches];
+ [co expungeLastMarkedFolder];
specificMessage = [request formValueForKey: @"pageforuid"];
searchCriteria = [request formValueForKey: @"search"];
= ((specificMessage)
? [self firstMessageOfPageFor: [specificMessage intValue]]
: [[request formValueForKey:@"idx"] intValue]);
+
return self;
}
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSURL.h>
+#import <Foundation/NSTimeZone.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import <NGObjWeb/WOCookie.h>
[response setHeader: [container baseURLInContext: context]
forKey: @"location"];
auth = [[self clientObject] authenticatorInContext: context];
+
+ date = [NSCalendarDate calendarDate];
+ [date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
+
cookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
value: @"discard"];
[cookie setPath: @"/"];
- date = [NSCalendarDate calendarDate];
[cookie setExpires: [date yesterday]];
[response addCookie: cookie];
-
- [response setHeader: date forKey: @"Last-Modified"];
- [response setHeader: @"no-store, no-cache, must-revalidate, max-age=0" forKey: @"Cache-Control"];
+
+ [response setHeader: [date rfc822DateString] forKey: @"Last-Modified"];
+ [response setHeader: @"no-store, no-cache, must-revalidate, max-age=0"
+ forKey: @"Cache-Control"];
[response setHeader: @"post-check=0, pre-check=0" forKey: @"Cache-Control"];
[response setHeader: @"no-cache" forKey: @"Pragma"];
"reminderTime_4800" = "2 days";
/* Mailer */
+"Check for new mail:" = "Check for new mail:";
+"messagecheck_manually" = "Manually";
+"messagecheck_every_minute" = "Every minute";
+"messagecheck_every_2_minutes" = "Every 2 minutes";
+"messagecheck_every_5_minutes" = "Every 5 minutes";
+"messagecheck_every_10_minutes" = "Every 10 minutes";
+"messagecheck_every_20_minutes" = "Every 20 minutes";
+"messagecheck_every_30_minutes" = "Every 30 minutes";
+"messagecheck_once_per_hour" = "Once per hour";
+
"Forward messages:" = "Forward messages:";
"messageforward_inline" = "Inline";
"messageforward_attached" = "As Attachment";
"reminderTime_4800" = "2 journées";
/* Mailer */
+"Check for new mail:" = "Vérifier l'arrivée de messages:";
+"messagecheck_manually" = "Manuellement";
+"messagecheck_every_minute" = "Chaque minute";
+"messagecheck_every_2_minutes" = "Toutes les 2 minutes";
+"messagecheck_every_5_minutes" = "Toutes les 5 minutes";
+"messagecheck_every_10_minutes" = "Toutes les 10 minutes";
+"messagecheck_every_20_minutes" = "Toutes les 20 minutes";
+"messagecheck_every_30_minutes" = "Toutes les 30 minutes";
+"messagecheck_once_per_hour" = "Une fois par heure";
+
"Forward messages:" = "Transérer les messages :";
"messageforward_inline" = "intégrés";
"messageforward_attached" = "en pièces jointes";
"reminderTime_4800" = "2 Tage";
/* Mailer */
+"Check for new mail:" = "Check for new mail:";
+"messagecheck_manually" = "Manually";
+"messagecheck_every_minute" = "Every minute";
+"messagecheck_every_2_minutes" = "Every 2 minutes";
+"messagecheck_every_5_minutes" = "Every 5 minutes";
+"messagecheck_every_10_minutes" = "Every 10 minutes";
+"messagecheck_every_20_minutes" = "Every 20 minutes";
+"messagecheck_every_30_minutes" = "Every 30 minutes";
+"messagecheck_once_per_hour" = "Once per hour";
+
"Forward messages:" = "Nachrichten weiterleiten:";
"messageforward_inline" = "Eingebunden";
"messageforward_attached" = "Als Anhang";
}
/* Mailer */
+- (NSArray *) messageCheckList
+{
+ return [NSArray arrayWithObjects: @"manually", @"every_minute",
+ @"every_2_minutes", @"every_5_minutes", @"every_10_minutes",
+ @"every_20_minutes", @"every_30_minutes", @"once_per_hour",
+ nil];
+}
+
+- (NSString *) itemMessageCheckText
+{
+ return [self labelForKey:
+ [NSString stringWithFormat: @"messagecheck_%@", item]];
+}
+
+- (NSString *) userMessageCheck
+{
+ return [user messageCheck];
+}
+
+- (void) setUserMessageCheck: (NSString *) newMessageCheck
+{
+ [userDefaults setObject: newMessageCheck forKey: @"MessageCheck"];
+}
+
- (NSArray *) messageForwardingList
{
return [NSArray arrayWithObjects: @"inline", @"attached", nil];
</ul>
<div id="generalView" class="tab">
<label><var:string label:value="Current Time Zone :"/>
- <var:popup list="timeZonesList" item="item"
- string="item" selection="userTimeZone" /></label><br/>
+ <var:popup list="timeZonesList" item="item"
+ string="item" selection="userTimeZone" /></label><br/>
<br/>
<div id="dateTimeFormat">
<label><var:string label:value="Short Date Format :"/>
/></label><br/>
<label><var:string label:value="First week of year :"/>
<var:popup list="firstWeekList" item="item"
- string="itemFirstWeekText" selection="userFirstWeek"
+ string="itemFirstWeekText" selection="userFirstWeek"
/></label><br/>
<br/>
<label><input class="checkBox"
string="itemReminderTimeText" selection="userReminderTime"/></label>
</div>
<div id="mailOptionsView" class="tab">
+ <label><var:string label:value="Check for new mail:"/>
+ <var:popup list="messageCheckList" item="item"
+ string="itemMessageCheckText" selection="userMessageCheck"/></label><br/>
<label><var:string label:value="Forward messages:"/>
<var:popup list="messageForwardingList" item="item"
string="itemMessageForwardingText" selection="userMessageForwarding"/></label><br/>
+ <!-- <label><input
+ const:name="inTheOffice" type="radio" const:value="YES"
+ var:selection="inTheOffice"/>
+ <var:string label:value="I'm currently in the office"/></label><br/>
<label><input
- const:name="inTheOffice" type="radio" const:value="YES"
- var:selection="inTheOffice"/>
- <var:string label:value="I'm currently in the office"/></label><br/>
- <label><input
- const:name="inTheOffice" type="radio" const:value="NO"
- var:selection="inTheOffice"/>
- <var:string label:value="I'm currently out of the office"/></label><br/>
+ const:name="inTheOffice" type="radio" const:value="NO"
+ var:selection="inTheOffice"/>
+ <var:string label:value="I'm currently out of the office"/></label><br/>
<br/>
<div id="outOfOfficeMessage">
- <label><var:string label:value="AutoReply only once to each sender with the following text :"/><br/>
- <textarea const:name="autoReplyText" var:value="autoReplyText"/>
- </label>
- </div>
+ <label><var:string label:value="AutoReply only once to each sender with the following text :"/><br/>
+ <textarea const:name="autoReplyText" var:value="autoReplyText"/>
+ </label> -->
</div>
<var:if condition="shouldDisplayPasswordChange">
<div id="passwordView" class="tab">
width: 100%; }
DIV.mailer_mailcontent
-{
- background-color: #fff;
- position: absolute;
+{ background-color: #fff;
padding: .5em;
+ position: absolute;
top: 7.5em;
- overflow: auto;
left: 0px;
right: 0px;
bottom: 0px;
-}
+ overflow: auto; }
TD.mailer_fieldname
{
}
DIV.mailer_plaincontent
-{
+{
position: relative;
font-family: monospace, fixed;
white-space: pre;
var deleteMessageRequestCount = 0;
+var messageCheckTimer;
+
/* mail list */
function openMessageWindow(msguid, url) {
function onMenuSharing(event) {
var folderID = document.menuTarget.getAttribute("dataname");
var type = document.menuTarget.getAttribute("datatype");
+
if (type == "additional")
window.alert(clabels["The user rights cannot be"
+ " edited for this object!"]);
var row = $("row_" + selected);
if (row) {
row.select();
+ lastClickedRow = row.rowIndex - $(row).up('table').down('thead').getElementsByTagName('tr').length;
div.scrollTop = row.rowIndex * row.getHeight(); // scroll to selected message
}
else
cachedMessage['time'] = (new Date()).getTime();
document.messageAjaxRequest = null;
configureLinksInMessage();
+ resizeMailContent();
}
}
}
else
Event.observe(anchors[i], "click",
- onMessageAnchorClick);
+ onMessageAnchorClick.bindAsEventListener(anchors[i]));
var editDraftButton = $("editDraftButton");
if (editDraftButton)
- Event.observe(editDraftButton, "click", onMessageEditDraft);
+ Event.observe(editDraftButton, "click",
+ onMessageEditDraft.bindAsEventListener(editDraftButton));
+}
+
+function resizeMailContent() {
+ var headerTable = document.getElementsByClassName('mailer_fieldtable')[0];
+ var contentDiv = document.getElementsByClassName('mailer_mailcontent')[0];
+
+ contentDiv.setStyle({ 'top': (Element.getHeight(headerTable) + headerTable.offsetTop) + 'px' });
}
function onMessageContentMenu(event) {
popupMenu(event, 'addressMenu', this);
}
-function onMessageAnchorClick (event) {
+function onMessageAnchorClick(event) {
window.open(this.href);
preventDefault(event);
}
document.messageAjaxRequest = null;
div.update(http.responseText);
configureLinksInMessage();
-
+ resizeMailContent();
+
if (http.callbackData) {
var cachedMessage = new Array();
cachedMessage['idx'] = currentMailbox + '/' + http.callbackData;
if (!document.body.hasClassName("popup")) {
// initDnd();
initMailboxTree();
+ initMessageCheckTimer();
}
}
+function initMessageCheckTimer() {
+ var messageCheck = userDefaults["MessageCheck"];
+ if (messageCheck && messageCheck != "manually") {
+ var interval;
+ if (messageCheck == "once_per_hour")
+ interval = 3600;
+ else if (messageCheck == "every_minute")
+ interval = 60;
+ else {
+ interval = parseInt(messageCheck.substr(6)) * 60;
+ }
+ messageCheckTimer = window.setInterval(onMessageCheckCallback,
+ interval * 1000);
+ }
+}
+
+function onMessageCheckCallback(event) {
+ refreshMailbox();
+}
+
function initMailboxTree() {
mailboxTree = new dTree("mailboxTree");
mailboxTree.config.folderLinks = true;
return account;
}
-function onMenuCreateFolder(event) {
+function onMenuCreateFolder(event) { log ("onMenuCreateFolder " + document.menuTarget);
var name = window.prompt(labels["Name :"], "");
if (name && name.length > 0) {
var folderID = document.menuTarget.getAttribute("dataname");
- var urlstr = URLForFolderID(folderID) + "/createFolder?name=" + name;
+ var urlstr = URLForFolderID(folderID) + "/createFolder?name=" + name; log ("create " + urlstr);
triggerAjaxRequest(urlstr, folderOperationCallback);
}
}
function onMenuExpungeFolder(event) {
var folderID = document.menuTarget.getAttribute("dataname");
var urlstr = URLForFolderID(folderID) + "/expunge";
-
triggerAjaxRequest(urlstr, folderRefreshCallback, folderID);
}
BODY
-{ background-color: #999; }
+{ background-color: #999;
+ text-align: center; }
IMG#preparedAnimation
{
margin-top: 5em;
padding: 5px;
border: 2px solid transparent;
+ text-align: left;
width: 200px;
-moz-border-top-colors: #efebe7 #fff;
-moz-border-left-colors: #efebe7 #fff;
function attachmentDeleteCallback(http) {
if (http.readyState == 4) {
- if (http.status == 204) {
+ if (isHttpStatus204(http.status)) {
var node = http.callbackData;
node.parentNode.removeChild(node);
}
preventDefault(event);
}
-function initMailerPopup(event) {
- var headerTable = document.getElementsByClassName('mailer_fieldtable')[0];
- var contentDiv = document.getElementsByClassName('mailer_mailcontent')[0];
-
- contentDiv.setStyle({ 'top': (Element.getHeight(headerTable) + headerTable.offsetTop) + 'px' });
-}
-
-addEvent(window, 'load', initMailerPopup);
+addEvent(window, 'load', resizeMailContent);
margin-right: 1em; }
DIV#pageContent
-{ /* position: absolute;
- background-color: #ffa;
- top: 3em;
- left: 0px;
- right: 0px;
- bottom: 0px;
- margin: 0px;
- padding: 0px;
- border: 0px;
- */clear: both; }
+{ clear: both; }
A
{ text-decoration: none;
}
function onBodyClickMenuHandler(event) {
- document.menuTarget = null;
hideMenu(document.currentPopupMenu);
Event.stopObserving(document.body, "click", onBodyClickMenuHandler);
- preventDefault(event);
+ if (event)
+ preventDefault(event);
}
function hideMenu(menuNode) {
popupSubmenu.bindAsEventListener(node));
}
}
- else
+ else {
Event.observe(node, "mouseup",
+ onBodyClickMenuHandler);
+ Event.observe(node, "click",
$(callback).bindAsEventListener(node));
+ }
}
else
node.addClassName("disabled");
+/* SOGoRootPage */
+DIV#loginScreen
+{ border: 2px solid #fff;
+ border-right: 2px solid #666;
+ border-bottom: 2px solid #666;
+}
+
/* generic */
SPAN.disabledToolbarButton
{ filter: alpha(opacity=40); }