2 Copyright (C) 2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 /* JavaScript for SOGo Mailer */
26 var isRegistered = false;
27 var lastKeyPress = null;
28 var submitAfterMS = 500;
30 function ml_reloadTableView(searchtext, elementid) {
31 var http = createHTTPClient();
37 // TODO: properly parse query parameters
38 viewURL = this.location.href;
39 hasQueryPara = viewURL.indexOf("?") == -1 ? false : true;
40 url = (hasQueryPara ? "&" : "?") + "noframe=1&search=";
41 url = url + encodeURIComponent(searchtext);
42 // alert("GET " + url);
45 http.open("GET", url, false);
47 if (http.status != 200) {
48 alert("Could not reload view.");
53 tv = document.getElementById(elementid)
54 tv.innerHTML = http.responseText;
59 function ml_reloadSearchIfFieldChanged() {
61 if (field.value && field.value != firstValue) {
62 ml_reloadTableView(field.value, "cl_tableview_reloadroot");
63 firstValue = field.value;
68 function ml_timeoutCallback() {
74 var now = new Date().getTime();
75 if ((now - lastKeyPress) < submitAfterMS) {
76 setTimeout("ml_timeoutCallback()", 10);
81 ml_reloadSearchIfFieldChanged();
85 function ml_activateSearchField(sender, _submitTimeout) {
88 firstValue = field.value;
89 submitAfterMS = _submitTimeout;
92 function ml_deactivateSearchField(sender) {
99 function ml_searchFieldKeyPressed(sender) {
100 lastKeyPress = new Date().getTime();
105 setTimeout("ml_timeoutCallback()", 10);