From: wolfgang Date: Fri, 26 Oct 2007 15:56:00 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1201 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60cd3426c9fdd82b846f5b002bd7c3131f547af8;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1201 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index 2239ac96..e91bb16d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2007-10-26 Wolfgang Sourdeau + + * 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 * UI/MailerUI/UIxMailListView.m ([UIxMailListView diff --git a/SoObjects/Mailer/SOGoMailBodyPart.m b/SoObjects/Mailer/SOGoMailBodyPart.m index fb11b019..d1a1f42f 100644 --- a/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SoObjects/Mailer/SOGoMailBodyPart.m @@ -258,7 +258,7 @@ static BOOL debugOn = NO; 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! @@ -283,14 +283,19 @@ static BOOL debugOn = NO; // 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; } diff --git a/SoObjects/Mailer/SOGoMailFolder.h b/SoObjects/Mailer/SOGoMailFolder.h index 3cd98c20..3de6f3ee 100644 --- a/SoObjects/Mailer/SOGoMailFolder.h +++ b/SoObjects/Mailer/SOGoMailFolder.h @@ -52,6 +52,9 @@ - (NSException *) postData: (NSData *) _data flags: (id) _flags; +- (void) markForExpunge; +- (void) expungeLastMarkedFolder; + - (NSException *) expunge; /* flags */ diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index 50f2484b..ec66e366 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -19,9 +19,12 @@ 02111-1307, USA. */ +#import +#import #import #import +#import #import #import #import @@ -236,6 +239,47 @@ static NSString *defaultUserID = @"anyone"; 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 diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 86eb94e8..e126222f 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -874,7 +874,9 @@ static BOOL debugSoParts = NO; error = [[self imap4Connection] markURLDeleted: [self imap4URL]]; if (error != nil) return error; - + + [container markForExpunge]; + [self flushMailCaches]; return nil; diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index 203f1c22..bea3b724 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -112,6 +112,7 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (NSArray *) allIdentities; - (NSDictionary *) primaryIdentity; - (NSString *) messageForwarding; +- (NSString *) messageCheck; /* folders */ diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 5ea1146c..f3a0633a 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -499,6 +499,18 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; 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 diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index 7c6a855b..16251421 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -516,10 +516,13 @@ static int attachmentFlagSize = 8096; { 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"]; @@ -532,6 +535,7 @@ static int attachmentFlagSize = 8096; = ((specificMessage) ? [self firstMessageOfPageFor: [specificMessage intValue]] : [[request formValueForKey:@"idx"] intValue]); + return self; } diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index 22c6a295..8134af2c 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -24,6 +24,7 @@ #import #import #import +#import #import #import #import @@ -213,15 +214,19 @@ static NSString *defaultModule = nil; [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"]; diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index 64aa487e..d216c0fe 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -68,6 +68,16 @@ "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"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings index a3e625db..99d33387 100644 --- a/UI/PreferencesUI/French.lproj/Localizable.strings +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -65,6 +65,16 @@ "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"; diff --git a/UI/PreferencesUI/German.lproj/Localizable.strings b/UI/PreferencesUI/German.lproj/Localizable.strings index 34ac1698..e25c85fb 100644 --- a/UI/PreferencesUI/German.lproj/Localizable.strings +++ b/UI/PreferencesUI/German.lproj/Localizable.strings @@ -65,6 +65,16 @@ "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"; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 7259f60d..0a6c33ef 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -421,6 +421,30 @@ static BOOL shouldDisplayPasswordChange = NO; } /* 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]; diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 8a890c58..dd0ca1af 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -25,8 +25,8 @@

+




+

+
diff --git a/UI/WebServerResources/MailerUI.css b/UI/WebServerResources/MailerUI.css index 22c3feb5..fcf07c2e 100644 --- a/UI/WebServerResources/MailerUI.css +++ b/UI/WebServerResources/MailerUI.css @@ -365,16 +365,14 @@ TABLE.mailer_fieldtable 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 { @@ -408,7 +406,7 @@ img.mailer_imagecontent } DIV.mailer_plaincontent -{ +{ position: relative; font-family: monospace, fixed; white-space: pre; diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index a2c35ed5..ddc8f027 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -18,6 +18,8 @@ var pageContent; var deleteMessageRequestCount = 0; +var messageCheckTimer; + /* mail list */ function openMessageWindow(msguid, url) { @@ -68,6 +70,7 @@ function openAddressbook(sender) { 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!"]); @@ -475,6 +478,7 @@ function messageListCallback(http) { 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 @@ -692,6 +696,7 @@ function loadMessage(idx) { cachedMessage['time'] = (new Date()).getTime(); document.messageAjaxRequest = null; configureLinksInMessage(); + resizeMailContent(); } } @@ -711,11 +716,19 @@ function configureLinksInMessage() { } 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) { @@ -730,7 +743,7 @@ function onEmailAddressClick(event) { popupMenu(event, 'addressMenu', this); } -function onMessageAnchorClick (event) { +function onMessageAnchorClick(event) { window.open(this.href); preventDefault(event); } @@ -743,7 +756,8 @@ function messageCallback(http) { document.messageAjaxRequest = null; div.update(http.responseText); configureLinksInMessage(); - + resizeMailContent(); + if (http.callbackData) { var cachedMessage = new Array(); cachedMessage['idx'] = currentMailbox + '/' + http.callbackData; @@ -1095,9 +1109,30 @@ function initMailer(event) { 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; @@ -1297,11 +1332,11 @@ function buildMailboxes(accountName, encoded) { 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); } } @@ -1329,7 +1364,6 @@ function onMenuDeleteFolder(event) { function onMenuExpungeFolder(event) { var folderID = document.menuTarget.getAttribute("dataname"); var urlstr = URLForFolderID(folderID) + "/expunge"; - triggerAjaxRequest(urlstr, folderRefreshCallback, folderID); } diff --git a/UI/WebServerResources/SOGoRootPage.css b/UI/WebServerResources/SOGoRootPage.css index 0018554e..f82a77b8 100644 --- a/UI/WebServerResources/SOGoRootPage.css +++ b/UI/WebServerResources/SOGoRootPage.css @@ -1,5 +1,6 @@ BODY -{ background-color: #999; } +{ background-color: #999; + text-align: center; } IMG#preparedAnimation { @@ -14,6 +15,7 @@ DIV#loginScreen 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; diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 8720dd56..fd8d1e7d 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -297,7 +297,7 @@ function onRemoveAttachments() { function attachmentDeleteCallback(http) { if (http.readyState == 4) { - if (http.status == 204) { + if (isHttpStatus204(http.status)) { var node = http.callbackData; node.parentNode.removeChild(node); } diff --git a/UI/WebServerResources/UIxMailPopupView.js b/UI/WebServerResources/UIxMailPopupView.js index 98e8eb71..bfbed7db 100644 --- a/UI/WebServerResources/UIxMailPopupView.js +++ b/UI/WebServerResources/UIxMailPopupView.js @@ -4,11 +4,4 @@ function onPrintCurrentMessage(event) { 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); diff --git a/UI/WebServerResources/generic.css b/UI/WebServerResources/generic.css index b33b6dee..e3712550 100644 --- a/UI/WebServerResources/generic.css +++ b/UI/WebServerResources/generic.css @@ -34,16 +34,7 @@ IMG#progressIndicator 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; diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index b3c9d070..8eb94035 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -619,11 +619,11 @@ function getParentMenu(node) { } function onBodyClickMenuHandler(event) { - document.menuTarget = null; hideMenu(document.currentPopupMenu); Event.stopObserving(document.body, "click", onBodyClickMenuHandler); - preventDefault(event); + if (event) + preventDefault(event); } function hideMenu(menuNode) { @@ -1167,9 +1167,12 @@ function initMenu(menuDIV, callbacks) { popupSubmenu.bindAsEventListener(node)); } } - else + else { Event.observe(node, "mouseup", + onBodyClickMenuHandler); + Event.observe(node, "click", $(callback).bindAsEventListener(node)); + } } else node.addClassName("disabled"); diff --git a/UI/WebServerResources/iefixes.css b/UI/WebServerResources/iefixes.css index fe29000e..38dc140c 100644 --- a/UI/WebServerResources/iefixes.css +++ b/UI/WebServerResources/iefixes.css @@ -1,3 +1,10 @@ +/* SOGoRootPage */ +DIV#loginScreen +{ border: 2px solid #fff; + border-right: 2px solid #666; + border-bottom: 2px solid #666; +} + /* generic */ SPAN.disabledToolbarButton { filter: alpha(opacity=40); }