From: helge Date: Mon, 7 Feb 2005 15:39:46 +0000 (+0000) Subject: fixed maillist refresh on delete/mark read X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e1303fb4bdbe73d70b206a05bdaeb2921524510;p=scalable-opengroupware.org fixed maillist refresh on delete/mark read git-svn-id: http://svn.opengroupware.org/SOGo/trunk@527 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 795bc8a3..c8418d55 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,19 @@ 2005-02-07 Helge Hess + * v0.9.92 + + * UIxMailView.m: properly refresh mail list after a mail got deleted + + * UIxMailWindowCloser.m: added ability to refresh the opener window + prior closing the panel + + * UIxMailView.wox: triggers opener callback to mark a mail as read + + * mailer.js: added refreshOpener() function which refreshes the + panel that opened the current window, added triggerOpenerCallback() + function which triggers a URL given in the "openerurl" query + parameter on the opener window + * UIxMailEditor.m: disabled Internet warning in the mail editor per default, can be enabled using the 'SOGoShowInternetMarker' default, made Internet header detection qualifier configurable, see README diff --git a/SOGo/UI/Mailer/UIxMailView.m b/SOGo/UI/Mailer/UIxMailView.m index 45198e22..d7ffaedd 100644 --- a/SOGo/UI/Mailer/UIxMailView.m +++ b/SOGo/UI/Mailer/UIxMailView.m @@ -142,7 +142,11 @@ if (![self isInlineViewer]) { // if everything is ok, close the window (send a JS closing the Window) - return [self pageWithName:@"UIxMailWindowCloser"]; + id page; + + page = [self pageWithName:@"UIxMailWindowCloser"]; + [page takeValue:@"YES" forKey:@"refreshOpener"]; + return page; } else { id url; diff --git a/SOGo/UI/Mailer/UIxMailView.wox b/SOGo/UI/Mailer/UIxMailView.wox index bcd92b1d..eb2cae63 100644 --- a/SOGo/UI/Mailer/UIxMailView.wox +++ b/SOGo/UI/Mailer/UIxMailView.wox @@ -74,8 +74,5 @@ bodyInfo="clientObject.bodyStructure" /> - + diff --git a/SOGo/UI/Mailer/UIxMailWindowCloser.m b/SOGo/UI/Mailer/UIxMailWindowCloser.m index 98c936c8..cb80f477 100644 --- a/SOGo/UI/Mailer/UIxMailWindowCloser.m +++ b/SOGo/UI/Mailer/UIxMailWindowCloser.m @@ -23,6 +23,7 @@ @interface UIxMailWindowCloser : WOComponent { + BOOL refreshOpener; } @end @@ -31,4 +32,18 @@ @implementation UIxMailWindowCloser +- (void)setRefreshOpener:(BOOL)_flag { + self->refreshOpener = _flag; +} +- (BOOL)refreshOpener { + return self->refreshOpener; +} + +- (NSString *)refreshOpenerScript { + return + @"if (window.opener && !window.opener.closed) {\n" + @" window.opener.location.reload();\n" + @"}\n"; +} + @end /* UIxMailWindowCloser */ diff --git a/SOGo/UI/Mailer/UIxMailWindowCloser.wox b/SOGo/UI/Mailer/UIxMailWindowCloser.wox index e21397c7..77498df8 100644 --- a/SOGo/UI/Mailer/UIxMailWindowCloser.wox +++ b/SOGo/UI/Mailer/UIxMailWindowCloser.wox @@ -7,13 +7,20 @@ xmlns:label="OGo:label" > - <var:string label:value="OpenGroupware.org"/> + <var:string label:value="Closing Window ..."/> - - + + - + + + + + + - \ No newline at end of file + diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index df435c35..e7ef8c16 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=91 +SUBMINOR_VERSION:=92 # v0.9.91 requires SoObjects/Mailer v0.9.68 # v0.9.89 requires SoObjects/Mailer v0.9.67 diff --git a/SOGo/UI/Mailer/mailer.js b/SOGo/UI/Mailer/mailer.js index 2927ffc2..b8ddaced 100644 --- a/SOGo/UI/Mailer/mailer.js +++ b/SOGo/UI/Mailer/mailer.js @@ -8,9 +8,10 @@ */ function clickedUid(sender, msguid) { - var urlstr; + var urlstr, cburl; - urlstr = msguid + "/view?markread=1"; + cburl = "markMessageRead?uid=" + msguid; + urlstr = msguid + "/view?openerurl=" + encodeURIComponent(cburl); window.open(urlstr, "SOGo_msg_" + msguid, "width=640,height=480,resizable=1,scrollbars=1,toolbar=0," + "location=0,directories=0,status=0,menubar=0,copyhistory=0") @@ -43,7 +44,6 @@ function clickedCompose(sender) { return false; /* stop following the link */ } - /* mail editor */ function validateEditorInput(sender) { @@ -141,3 +141,46 @@ function clickedNewFilter(sender) { "location=0,directories=0,status=0,menubar=0,copyhistory=0"); return false; /* stop following the link */ } + +/* generic stuff */ + +function refreshOpener() { + if (window.opener && !window.opener.closed) { + window.opener.location.reload(); + } +} + +function getQueryParaArray(s) { + if (s.charAt(0) == "?") s = s.substr(1, s.length - 1); + return s.split("&"); +} +function getQueryParaValue(s, name) { + var t; + + t = getQueryParaArray(s); + for (var i = 0; i < t.length; i++) { + var s = t[i]; + + if (s.indexOf(name) != 0) + continue; + + s = s.substr(name.length, s.length - name.length); + return decodeURIComponent(s); + } + return None; +} + +function triggerOpenerCallback() { + /* this code has some issue if the folder has no proper trailing slash! */ + if (window.opener && !window.opener.closed) { + var t, cburl; + + t = getQueryParaValue(window.location.search, "openerurl="); + cburl = window.opener.window.location.href; + if (cburl[cburl.length - 1] != "/") { + cburl = cburl.substr(0, cburl.lastIndexOf("/") + 1); + } + cburl = cburl + t; + window.opener.window.location.href = cburl; + } +} diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index 30c049f9..42c3f4a4 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -316,7 +316,7 @@ static BOOL uixDebugEnabled = NO; NSString *s; NSRange r; -#warning !! USE USER MANAGER INSTEAD! +#warning TODO: USE USER MANAGER INSTEAD! s = [[self user] login]; if ([s length] < 10) @@ -341,10 +341,9 @@ static BOOL uixDebugEnabled = NO; NSString *lKey, *lTable, *lVal; NSRange r; - if ([_str length] == 0) { + if ([_str length] == 0) return nil; - } - + /* lookup languages */ ctx = [self context]; @@ -372,19 +371,20 @@ static BOOL uixDebugEnabled = NO; } lVal = lKey; - if([lKey hasPrefix:@"$"]) { + if ([lKey hasPrefix:@"$"]) lKey = [self valueForKeyPath:[lKey substringFromIndex:1]]; - } - if([lTable hasPrefix:@"$"]) { + + if ([lTable hasPrefix:@"$"]) lTable = [self valueForKeyPath:[lTable substringFromIndex:1]]; - } + #if 0 - if([lVal hasPrefix:@"$"]) { + if ([lVal hasPrefix:@"$"]) lVal = [self valueForKeyPath:[lVal substringFromIndex:1]]; - } + #endif + /* lookup string */ - + label = [rm stringForKey:lKey inTableNamed:lTable withDefaultValue:lVal languages:languages]; return label;