From 9f1cbd3f5038e902ca91d966b40a310ecaad1ac6 Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 16 Feb 2005 20:30:54 +0000 Subject: [PATCH] added automagic search submits git-svn-id: http://svn.opengroupware.org/SOGo/trunk@574 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Mailer/ChangeLog | 2 + SOGo/UI/Mailer/UIxMailFilterPanel.wox | 6 +- SOGo/UI/Mailer/UIxMailListView.wox | 4 ++ SOGo/UI/Mailer/Version | 2 +- SOGo/UI/Mailer/mailer.js | 61 +++++++++++++++++++ SOGo/UI/MailerContacts/ChangeLog | 4 ++ SOGo/UI/MailerContacts/UIxMailContactList.wox | 10 ++- SOGo/UI/MailerContacts/Version | 2 +- 8 files changed, 87 insertions(+), 4 deletions(-) diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index c65c0885..f590d146 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,7 @@ 2005-02-16 Helge Hess + * added automatic search field posting (v0.9.115) + * mailer.js: fixed a row highlighting bug (v0.9.114) * product.plist: fixed compose button in mail viewer (v0.9.113) diff --git a/SOGo/UI/Mailer/UIxMailFilterPanel.wox b/SOGo/UI/Mailer/UIxMailFilterPanel.wox index f2a52f43..709c418e 100644 --- a/SOGo/UI/Mailer/UIxMailFilterPanel.wox +++ b/SOGo/UI/Mailer/UIxMailFilterPanel.wox @@ -25,7 +25,11 @@ + style="width: 100%;" + autocomplete="off" + onkeypress="ml_searchFieldKeyPressed(this)" + onfocus="ml_activateSearchField(this, 500)" + onblur="ml_deactivateSearchField(this)" /> diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index efb46889..567a6cca 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -186,4 +186,8 @@ + + diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 6e59c920..b12a6124 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=114 +SUBMINOR_VERSION:=115 # v0.9.100 requires libNGMime v4.5.213 # v0.9.99 requires libNGMime v4.5.212 diff --git a/SOGo/UI/Mailer/mailer.js b/SOGo/UI/Mailer/mailer.js index 9385227f..99c682b6 100644 --- a/SOGo/UI/Mailer/mailer.js +++ b/SOGo/UI/Mailer/mailer.js @@ -358,3 +358,64 @@ function ml_lowlight(sender) { 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_reloadSearchIfFieldChanged() { + if (field) { + if (field.value != firstValue) { + // TODO: we should just reload the tableview, not the whole page + document.pageform.submit(); + } + } +} + +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; +} diff --git a/SOGo/UI/MailerContacts/ChangeLog b/SOGo/UI/MailerContacts/ChangeLog index f2b137b2..5ed733d1 100644 --- a/SOGo/UI/MailerContacts/ChangeLog +++ b/SOGo/UI/MailerContacts/ChangeLog @@ -1,3 +1,7 @@ +2005-02-16 Helge Hess + + * added automatic search submit (v0.9.4) + 2005-02-15 Helge Hess * UIxMailContactEditor.m: added object title (v0.9.3) diff --git a/SOGo/UI/MailerContacts/UIxMailContactList.wox b/SOGo/UI/MailerContacts/UIxMailContactList.wox index bf1a1f68..a6844e50 100644 --- a/SOGo/UI/MailerContacts/UIxMailContactList.wox +++ b/SOGo/UI/MailerContacts/UIxMailContactList.wox @@ -32,7 +32,11 @@ + style="width: 100%;" + autocomplete="off" + onkeypress="ml_searchFieldKeyPressed(this)" + onfocus="ml_activateSearchField(this, 500)" + onblur="ml_deactivateSearchField(this)" /> @@ -106,4 +110,8 @@ + + diff --git a/SOGo/UI/MailerContacts/Version b/SOGo/UI/MailerContacts/Version index 81d0f5a4..9d93031b 100644 --- a/SOGo/UI/MailerContacts/Version +++ b/SOGo/UI/MailerContacts/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=3 +SUBMINOR_VERSION:=4 -- 2.39.5