+2005-02-23 Helge Hess <helge.hess@opengroupware.org>
+
+ * mailer.js: split into multiple files (v0.9.121)
+
2005-02-22 Helge Hess <helge.hess@opengroupware.org>
* UIxMailMainFrame.m: added ability not to generate the HTML frame
uix.css \
mailer.css \
mailer.js \
+ generic.js \
+ searchfield.js \
MailerUI_RESOURCE_FILES += \
Images/tbtv_*.gif \
@interface UIxMailFilterPanel : WOComponent
{
NSString *searchText;
+ struct {
+ int hideFrame:1;
+ int reserved:31;
+ } mfFlags;
}
@end
/* accessors */
+- (void)setHideFrame:(BOOL)_flag {
+ self->mfFlags.hideFrame = _flag ? 1 : 0;
+}
+- (BOOL)hideFrame {
+ return self->mfFlags.hideFrame ? YES : NO;
+}
+
- (void)setSearchText:(NSString *)_txt {
ASSIGNCOPY(self->searchText, _txt);
}
if (self->searchText == nil) {
// TODO: kinda hack
self->searchText =
- [[[[self context] request] formValueForKey:@"searchtext"] copy];
+ [[[[self context] request] formValueForKey:@"search"] copy];
}
return self->searchText;
}
[super dealloc];
}
+/* frame */
+
+- (BOOL)hideFrame {
+ return [[[[self context] request] formValueForKey:@"noframe"] boolValue];
+}
+
/* notifications */
- (void)sleep {
# version file
-SUBMINOR_VERSION:=120
+SUBMINOR_VERSION:=121
# v0.9.100 requires libNGMime v4.5.213
# v0.9.99 requires libNGMime v4.5.212
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+/* some generic JavaScript code for SOGo */
+
+/* generic stuff */
+
+function ml_stripActionInURL(url) {
+ if (url[url.length - 1] != '/') {
+ var i;
+
+ i = url.lastIndexOf("/");
+ if (i != -1) url = url.substring(0, i);
+ }
+ if (url[url.length - 1] != '/') // ensure trailing slash
+ url = url + "/";
+ return url;
+}
+
+function escapeHTML(s) {
+ s = s.replace(/&/g, "&");
+ s = s.replace(/</g, "<");
+ s = s.replace(/>/g, ">");
+ s = s.replace(/"/g, """);
+ return s;
+}
+function unescapeHTML(s) {
+ s = s.replace(/</g, "<");
+ s = s.replace(/>/g, ">");
+ s = s.replace(/"/g, '"');
+ s = s.replace(/&/g, "&");
+ return s;
+}
+
+function createHTTPClient() {
+ // http://developer.apple.com/internet/webcontent/xmlhttpreq.html
+ if (typeof XMLHttpRequest != "undefined")
+ return new XMLHttpRequest();
+
+ try { return new ActiveXObject("Msxml2.XMLHTTP"); }
+ catch (e) { }
+ try { return new ActiveXObject("Microsoft.XMLHTTP"); }
+ catch (e) { }
+ return null;
+}
+
+function resetSelection(win) {
+ var t = "";
+ if (win && win.getSelection) {
+ t = win.getSelection().toString();
+ win.getSelection().removeAllRanges();
+ }
+ return t;
+}
+
+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 null;
+}
+
+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.location.href;
+ if (cburl[cburl.length - 1] != "/") {
+ cburl = cburl.substr(0, cburl.lastIndexOf("/") + 1);
+ }
+ cburl = cburl + t;
+ window.opener.location.href = cburl;
+ }
+}
}
function clearSearch(sender) {
- var searchField = window.document.getElementById("searchtext");
+ var searchField = window.document.getElementById("search");
if (searchField) searchField.value="";
return true;
}
return false; /* stop following the link */
}
-/* generic stuff */
-
-function ml_stripActionInURL(url) {
- if (url[url.length - 1] != '/') {
- var i;
-
- i = url.lastIndexOf("/");
- if (i != -1) url = url.substring(0, i);
- }
- if (url[url.length - 1] != '/') // ensure trailing slash
- url = url + "/";
- return url;
-}
-
-function escapeHTML(s) {
- s = s.replace(/&/g, "&");
- s = s.replace(/</g, "<");
- s = s.replace(/>/g, ">");
- s = s.replace(/"/g, """);
- return s;
-}
-function unescapeHTML(s) {
- s = s.replace(/</g, "<");
- s = s.replace(/>/g, ">");
- s = s.replace(/"/g, '"');
- s = s.replace(/&/g, "&");
- return s;
-}
-
-function createHTTPClient() {
- // http://developer.apple.com/internet/webcontent/xmlhttpreq.html
- if (typeof XMLHttpRequest != "undefined")
- return new XMLHttpRequest();
-
- try { return new ActiveXObject("Msxml2.XMLHTTP"); }
- catch (e) { }
- try { return new ActiveXObject("Microsoft.XMLHTTP"); }
- catch (e) { }
- return null;
-}
-
-function resetSelection(win) {
- var t = "";
- if (win && win.getSelection) {
- t = win.getSelection().toString();
- win.getSelection().removeAllRanges();
- }
- return t;
-}
-
-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 null;
-}
-
-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.location.href;
- if (cburl[cburl.length - 1] != "/") {
- cburl = cburl.substr(0, cburl.lastIndexOf("/") + 1);
- }
- cburl = cburl + t;
- window.opener.location.href = cburl;
- }
-}
-
/* mail list DOM changes */
function markMailInWindow(win, msguid, markread) {
else
sender.className = "tableview";
}
-
-
-/* search field */
-
-var didStop = false;
-var field = null;
-var firstValue = "";
-var isRegistered = false;
-var lastKeyPress = null;
-var submitAfterMS = 500;
-
-function ml_reloadTableView(searchtext, elementid) {
- var http = createHTTPClient();
-
- if (http) {
- var viewURL, url;
- var hasQueryPara;
-
- viewURL = this.location.href;
- hasQueryPara = viewURL.indexOf("?") == -1 ? false : true;
- url = viewURL.replace(/\/tb\.view/, "/tb.view?noframe=1");
- url = url + (hasQueryPara ? "&search=" : "?search=") + searchtext;
-
- http.open("GET", url, false);
- http.send(null);
- if (http.status != 200) {
- alert("Could not reload view.");
- }
- else {
- var tv;
-
- tv = document.getElementById(elementid)
- tv.innerHTML = http.responseText;
- }
- }
-}
-
-function ml_reloadSearchIfFieldChanged() {
- if (field) {
- if (field.value != firstValue) {
- // TODO: we should just reload the tableview, not the whole page
- //document.pageform.submit();
- ml_reloadTableView(field.value, "cl_tableview_reloadroot");
- }
- }
-}
-
-function ml_timeoutCallback() {
- if (didStop) {
- didStop = false;
- return;
- }
-
- var now = new Date().getTime();
- if ((now - lastKeyPress) < submitAfterMS) {
- setTimeout("ml_timeoutCallback()", 10);
- isRegistered = true;
- return;
- }
-
- ml_reloadSearchIfFieldChanged();
- isRegistered = false;
-}
-
-function ml_activateSearchField(sender, _submitTimeout) {
- didStop = false;
- field = sender;
- firstValue = field.value;
- submitAfterMS = _submitTimeout;
- return true;
-}
-function ml_deactivateSearchField(sender) {
- didStop = true;
- field = null;
- firstValue = "";
- return true;
-}
-
-function ml_searchFieldKeyPressed(sender) {
- lastKeyPress = new Date().getTime();
-
- if (isRegistered)
- return;
-
- setTimeout("ml_timeoutCallback()", 10);
- isRegistered = true;
- return true;
-}
"uix.css",
"mailer.css",
"mailer.js",
+ "generic.js",
+ "searchfield.js",
"lori_32x32.png",
--- /dev/null
+/*
+ Copyright (C) 2005 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+/* JavaScript for SOGo Mailer */
+
+var didStop = false;
+var field = null;
+var firstValue = "";
+var isRegistered = false;
+var lastKeyPress = null;
+var submitAfterMS = 500;
+
+function ml_reloadTableView(searchtext, elementid) {
+ var http = createHTTPClient();
+
+ if (http) {
+ var viewURL, url;
+ var hasQueryPara;
+
+ // TODO: properly parse query parameters
+ viewURL = this.location.href;
+ hasQueryPara = viewURL.indexOf("?") == -1 ? false : true;
+ url = viewURL + "?noframe=1&search=" + searchtext;
+
+ http.open("GET", url, false);
+ http.send(null);
+ if (http.status != 200) {
+ alert("Could not reload view.");
+ }
+ else {
+ var tv;
+
+ tv = document.getElementById(elementid)
+ tv.innerHTML = http.responseText;
+ }
+ }
+}
+
+function ml_reloadSearchIfFieldChanged() {
+ if (field) {
+ if (field.value != firstValue) {
+ ml_reloadTableView(field.value, "cl_tableview_reloadroot");
+ firstValue = field.value;
+ }
+ }
+}
+
+function ml_timeoutCallback() {
+ if (didStop) {
+ didStop = false;
+ return;
+ }
+
+ var now = new Date().getTime();
+ if ((now - lastKeyPress) < submitAfterMS) {
+ setTimeout("ml_timeoutCallback()", 10);
+ isRegistered = true;
+ return;
+ }
+
+ ml_reloadSearchIfFieldChanged();
+ isRegistered = false;
+}
+
+function ml_activateSearchField(sender, _submitTimeout) {
+ didStop = false;
+ field = sender;
+ firstValue = field.value;
+ submitAfterMS = _submitTimeout;
+ return true;
+}
+function ml_deactivateSearchField(sender) {
+ didStop = true;
+ field = null;
+ firstValue = "";
+ return true;
+}
+
+function ml_searchFieldKeyPressed(sender) {
+ lastKeyPress = new Date().getTime();
+
+ if (isRegistered)
+ return;
+
+ setTimeout("ml_timeoutCallback()", 10);
+ isRegistered = true;
+ return true;
+}
<?xml version='1.0' standalone='yes'?>
+<container
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+>
+ <var:if condition="hideFrame" const:negate="YES">
<table
xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
<var:string label:value="Subject or Sender contains" />:
</td>
<td class="titlecell" style="width: 80%; padding-right: 1px;">
- <input name="searchtext" type="text" var:value="searchText"
+ <input name="search" type="text" var:value="searchText"
style="width: 100%;"
autocomplete="off"
onkeypress="ml_searchFieldKeyPressed(this)"
</td>
</tr>
</table>
+</var:if>
+</container>
xmlns:label="OGo:label"
className="UIxMailMainFrame"
title="panelTitle"
+ hideFrame="hideFrame"
>
- <var:component className="UIxMailFilterPanel" qualifier="qualifier" />
+ <var:component className="UIxMailFilterPanel" qualifier="qualifier"
+ hideFrame="hideFrame" />
+ <div id="cl_tableview_reloadroot">
<div class="embedwhite_out">
<div class="embedwhite_in">
<script language="JavaScript">
</span>
</div>
</div>
+ </div>
- <script language="JavaScript">
- document.pageform.searchtext.focus();
- </script>
+ <var:if condition="hideFrame" const:negate="YES">
+ <script language="JavaScript">
+ document.pageform.searchtext.focus();
+ </script>
+ </var:if>
</var:component>
<meta name="author" content="SKYRIX Software AG"/>
<meta name="robots" content="stop"/>
- <script rsrc:src="mailer.js"> </script>
+ <script rsrc:src="generic.js" > <!-- space required --></script>
+ <script rsrc:src="mailer.js" > <!-- space required --></script>
+ <script rsrc:src="searchfield.js"> <!-- space required --></script>
<link type="text/css" rel="stylesheet" rsrc:href="uix.css"/>
<link type="text/css" rel="stylesheet" rsrc:href="mailer.css"/>