2005-02-07 Helge Hess <helge.hess@opengroupware.org>
+ * 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
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;
bodyInfo="clientObject.bodyStructure" />
</div>
-<!--
- <pre><var:string value="message" /></pre><br />
- <pre><var:string value="message.body" /></pre><br />
--->
+ <script language="JavaScript">triggerOpenerCallback();</script>
</var:component>
@interface UIxMailWindowCloser : WOComponent
{
+ BOOL refreshOpener;
}
@end
@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 */
xmlns:label="OGo:label"
>
<head>
- <title><var:string label:value="OpenGroupware.org"/></title>
+ <title><var:string label:value="Closing Window ..."/></title>
<meta name="description" content="SOGo Web Interface"/>
- <meta name="author" content="SKYRIX Software AG"/>
- <meta name="robots" content="stop"/>
+ <meta name="author" content="SKYRIX Software AG"/>
+ <meta name="robots" content="stop"/>
<link href="mailto:info@skyrix.com" rev="made"/>
</head>
- <body onload="window.close()">
+ <body>
+ <var:if condition="refreshOpener">
+ <script language="JavaScript"
+ ><var:string value="refreshOpenerScript"
+ const:escapeHTML="0" /></script>
+ </var:if>
+
+ <script language="JavaScript">window.close();</script>
</body>
-</html>
\ No newline at end of file
+</html>
# 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
*/
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")
return false; /* stop following the link */
}
-
/* mail editor */
function validateEditorInput(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;
+ }
+}
NSString *s;
NSRange r;
-#warning !! USE USER MANAGER INSTEAD!
+#warning TODO: USE USER MANAGER INSTEAD!
s = [[self user] login];
if ([s length] < 10)
NSString *lKey, *lTable, *lVal;
NSRange r;
- if ([_str length] == 0) {
+ if ([_str length] == 0)
return nil;
- }
-
+
/* lookup languages */
ctx = [self context];
}
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;