summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/app.js15
-rw-r--r--program/localization/en_GB/labels.inc2
-rw-r--r--program/localization/en_US/labels.inc2
-rw-r--r--program/localization/pl_PL/labels.inc2
-rw-r--r--program/steps/mail/func.inc1
-rw-r--r--program/steps/mail/search.inc45
-rw-r--r--skins/default/common.css9
-rw-r--r--skins/default/functions.js50
-rw-r--r--skins/default/images/icons/glass.gifbin0 -> 909 bytes
-rw-r--r--skins/default/images/searchfield.gifbin484 -> 397 bytes
-rw-r--r--skins/default/mail.css13
-rw-r--r--skins/default/templates/addressbook.html4
-rw-r--r--skins/default/templates/mail.html15
14 files changed, 131 insertions, 28 deletions
diff --git a/CHANGELOG b/CHANGELOG
index da99c7ef2..84c0726ae 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Added quick search box menu (#1484304)
- Fix wrong column sort order icons (#1485823)
- Updated TinyMCE to 3.2.3 version
- Fix attachment names encoding when charset isn't specified in attachment part (#1484969)
diff --git a/program/js/app.js b/program/js/app.js
index 8ac0e7256..e8444031d 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2392,19 +2392,26 @@ function rcube_webmail()
};
// send remote request to search mail or contacts
- this.qsearch = function(value, addurl)
+ this.qsearch = function(value)
{
if (value != '')
{
- if (this.message_list)
+ var addurl = '';
+ if (this.message_list) {
this.message_list.clear();
- else if (this.contact_list) {
+ if (this.env.search_mods) {
+ var head_arr = new Array();
+ for (var n in this.env.search_mods)
+ head_arr.push(n);
+ addurl += '&_headers='+head_arr.join(',');
+ }
+ } else if (this.contact_list) {
this.contact_list.clear(true);
this.show_contentframe(false);
}
if (this.gui_objects.search_filter)
- addurl = '&_filter=' + this.gui_objects.search_filter.value;
+ addurl += '&_filter=' + this.gui_objects.search_filter.value;
// reset vars
this.env.current_page = 1;
diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc
index fae87c558..da2709c70 100644
--- a/program/localization/en_GB/labels.inc
+++ b/program/localization/en_GB/labels.inc
@@ -131,6 +131,8 @@ $labels['unknown'] = 'unknown';
$labels['unlimited'] = 'unlimited';
$labels['quicksearch'] = 'Quick search';
$labels['resetsearch'] = 'Reset search';
+$labels['searchmod'] = 'Search modifiers';
+$labels['msgtext'] = 'Entire message';
$labels['openinextwin'] = 'Open in new window';
$labels['compose'] = 'Compose a message';
$labels['savemessage'] = 'Save this draft';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 7f0538703..87cb08b49 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -161,6 +161,8 @@ $labels['unlimited'] = 'unlimited';
$labels['quicksearch'] = 'Quick search';
$labels['resetsearch'] = 'Reset search';
+$labels['searchmod'] = 'Search modifiers';
+$labels['msgtext'] = 'Entire message';
$labels['openinextwin'] = 'Open in new window';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index dba23a8e0..7b8a39d64 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -142,6 +142,8 @@ $labels['unknown'] = 'nieznane';
$labels['unlimited'] = 'bez limitu';
$labels['quicksearch'] = 'Szybkie wyszukiwanie';
$labels['resetsearch'] = 'Wyczyść filtr';
+$labels['searchmod'] = 'Parametry wyszukiwania';
+$labels['msgtext'] = 'Cała wiadomość';
$labels['openinextwin'] = 'Otwórz w nowym oknie';
$labels['compose'] = 'Utwórz wiadomość';
$labels['savemessage'] = 'Zapisz kopię roboczą';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index f0d7d6f01..537199cc8 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -79,6 +79,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
$OUTPUT->set_env('search_request', $search_request);
}
+ $OUTPUT->set_env('search_mods', $_SESSION['search_mods'] ? $_SESSION['search_mods'] : array('subject'=>'subject'));
// make sure the message count is refreshed (for default view)
$IMAP->messagecount($mbox_name, 'ALL', true);
}
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 95ca67a12..8d24460bc 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -28,6 +28,7 @@ $imap_charset = 'UTF-8';
$str = get_input_value('_q', RCUBE_INPUT_GET);
$filter = get_input_value('_filter', RCUBE_INPUT_GET);
$mbox = get_input_value('_mbox', RCUBE_INPUT_GET);
+$headers = get_input_value('_headers', RCUBE_INPUT_GET);
$search_request = md5($mbox.$filter.$str);
// add list filter string
@@ -39,47 +40,55 @@ $_SESSION['search_filter'] = $filter;
if (preg_match("/^from:.*/i", $str))
{
list(,$srch) = explode(":", $str);
- $subject = "HEADER FROM";
- $search = trim($srch);
+ $subject['from'] = "HEADER FROM";
}
else if (preg_match("/^to:.*/i", $str))
{
list(,$srch) = explode(":", $str);
- $subject = "HEADER TO";
- $search = trim($srch);
+ $subject['to'] = "HEADER TO";
}
else if (preg_match("/^cc:.*/i", $str))
{
list(,$srch) = explode(":", $str);
- $subject = "HEADER CC";
- $search = trim($srch);
+ $subject['cc'] = "HEADER CC";
+}
+else if (preg_match("/^bcc:.*/i", $str))
+{
+ list(,$srch) = explode(":", $str);
+ $subject['bcc'] = "HEADER BCC";
}
else if (preg_match("/^subject:.*/i", $str))
{
list(,$srch) = explode(":", $str);
- $subject = "HEADER SUBJECT";
- $search = trim($srch);
+ $subject['subject'] = "HEADER SUBJECT";
}
else if (preg_match("/^body:.*/i", $str))
{
list(,$srch) = explode(":", $str);
- $subject = "TEXT";
- $search = trim($srch);
+ $subject['text'] = "TEXT";
}
// search in subject and sender by default
else if(trim($str))
{
- $from = ($mbox == $CONFIG['sent_mbox'] || $mbox == $CONFIG['drafts_mbox']) ? "TO" : "FROM";
- $subject = array("HEADER SUBJECT", "HEADER $from");
- $search = trim($str);
+ if ($headers) {
+ $headers = explode(',', $headers);
+ foreach($headers as $header)
+ switch ($header) {
+ case 'text': $subject['text'] = 'TEXT'; break;
+ default: $subject[$header] = 'HEADER '.$header;
+ }
+ } else {
+ $subject['subject'] = 'HEADER SUBJECT';
+ }
}
-if ($subject && !is_array($subject))
- $search_str .= sprintf(" %s {%d}\r\n%s", $subject, strlen($search), $search);
-else if ($subject) {
- $search_str .= ' OR';
- foreach($subject as $sub)
+$search = $srch ? trim($srch) : trim($str);
+
+if ($subject) {
+ $search_str .= str_repeat(' OR', count($subject)-1);
+ foreach ($subject as $sub)
$search_str .= sprintf(" %s {%d}\r\n%s", $sub, strlen($search), $search);
+ $_SESSION['search_mods'] = $subject;
}
$search_str = trim($search_str);
diff --git a/skins/default/common.css b/skins/default/common.css
index a01985413..b445cd2c9 100644
--- a/skins/default/common.css
+++ b/skins/default/common.css
@@ -347,7 +347,7 @@ table.records-table tr.unfocused td
background: url('images/searchfield.gif') top left no-repeat;
}
-#quicksearchbar a
+#searchreset
{
position: absolute;
top: 3px;
@@ -355,6 +355,13 @@ table.records-table tr.unfocused td
text-decoration: none;
}
+#searchmod
+{
+ position: absolute;
+ top: 3px;
+ right: 162px;
+}
+
#quicksearchbar img
{
vertical-align: middle;
diff --git a/skins/default/functions.js b/skins/default/functions.js
index fd6e612ee..31c464792 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -121,6 +121,7 @@ function rcmail_init_compose_form()
function rcube_mail_ui()
{
this.markmenu = $('#markmessagemenu');
+ this.searchmenu = $('#searchmenu');
}
rcube_mail_ui.prototype = {
@@ -137,16 +138,61 @@ show_markmenu: function(show)
this.markmenu[show?'show':'hide']();
},
+show_searchmenu: function(show)
+{
+ if (typeof show == 'undefined')
+ show = this.searchmenu.is(':visible') ? false : true;
+
+ var ref = rcube_find_object('searchmod');
+ if (show && ref) {
+ var pos = $(ref).offset();
+ this.searchmenu.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)});
+
+ if (rcmail.env.search_mods) {
+ for (var n in rcmail.env.search_mods) {
+ box = rcube_find_object('s_mod_' + n);
+ box.checked = 'checked';
+ }
+ }
+ }
+ this.searchmenu[show?'show':'hide']();
+},
+
+set_searchmod: function(elem)
+{
+ if (!rcmail.env.search_mods)
+ rcmail.env.search_mods = new Object();
+
+ if (!elem.checked)
+ delete(rcmail.env.search_mods[elem.value]);
+ else
+ rcmail.env.search_mods[elem.value] = elem.value;
+},
+
body_mouseup: function(evt, p)
{
if (this.markmenu && this.markmenu.is(':visible') && rcube_event.get_target(evt) != rcube_find_object('markreadbutton'))
this.show_markmenu(false);
+ else if (this.searchmenu && this.searchmenu.is(':visible') && rcube_event.get_target(evt) != rcube_find_object('searchmod')) {
+ var menu = rcube_find_object('searchmenu');
+ var target = rcube_event.get_target(evt);
+ while (target.parentNode) {
+ if (target.parentNode == menu)
+ return;
+ target = target.parentNode;
+ }
+ this.show_searchmenu(false);
+ }
},
body_keypress: function(evt, p)
{
- if (rcube_event.get_keycode(evt) == 27 && this.markmenu && this.markmenu.is(':visible'))
- this.show_markmenu(false);
+ if (rcube_event.get_keycode(evt) == 27) {
+ if (this.markmenu && this.markmenu.is(':visible'))
+ this.show_markmenu(false);
+ if (this.searchmenu && this.searchmenu.is(':visible'))
+ this.show_searchmenu(false);
+ }
}
};
diff --git a/skins/default/images/icons/glass.gif b/skins/default/images/icons/glass.gif
new file mode 100644
index 000000000..9a705b410
--- /dev/null
+++ b/skins/default/images/icons/glass.gif
Binary files differ
diff --git a/skins/default/images/searchfield.gif b/skins/default/images/searchfield.gif
index b1dc9389e..756a17e47 100644
--- a/skins/default/images/searchfield.gif
+++ b/skins/default/images/searchfield.gif
Binary files differ
diff --git a/skins/default/mail.css b/skins/default/mail.css
index 93c63de0f..00f8ca327 100644
--- a/skins/default/mail.css
+++ b/skins/default/mail.css
@@ -45,7 +45,8 @@
padding-left: 2px;
}
-#markmessagemenu
+#markmessagemenu,
+#searchmenu
{
position: absolute;
top: 32px;
@@ -60,6 +61,11 @@
z-index: 240;
}
+#searchmenu
+{
+ width: 172px;
+}
+
ul.toolbarmenu
{
margin: 0;
@@ -89,6 +95,11 @@ ul.toolbarmenu li a.active:hover
background-color: #ddd;
}
+ul.toolbarmenu li input
+{
+ vertical-align: middle;
+}
+
#searchfilter
{
position: absolute;
diff --git a/skins/default/templates/addressbook.html b/skins/default/templates/addressbook.html
index 431c0589e..b341172f1 100644
--- a/skins/default/templates/addressbook.html
+++ b/skins/default/templates/addressbook.html
@@ -41,7 +41,9 @@
</div>
<div id="quicksearchbar">
-<roundcube:object name="searchform" id="quicksearchbox" /><roundcube:button command="reset-search" id="searchreset" image="/images/icons/reset.gif" title="resetsearch" />
+<roundcube:button name="searchmod" id="searchmod" image="/images/icons/glass.gif" />
+<roundcube:object name="searchform" id="quicksearchbox" />
+<roundcube:button command="reset-search" id="searchreset" image="/images/icons/reset.gif" title="resetsearch" />
</div>
<roundcube:if condition="count(env:address_sources) &gt; 1" />
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index 4e1d7ce3a..735144646 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -136,8 +136,21 @@
</div>
</div>
+<div id="searchmenu">
+ <ul class="toolbarmenu">
+ <li><input type="checkbox" name="s_mods[]" value="subject" id="s_mod_subject" onclick="rcmail_ui.set_searchmod(this)" /><label for="s_mod_subject"><roundcube:label name="subject" /></label></li>
+ <li><input type="checkbox" name="s_mods[]" value="from" id="s_mod_from" onclick="rcmail_ui.set_searchmod(this)" /><label for="s_mod_from"><roundcube:label name="from" /></label></li>
+ <li><input type="checkbox" name="s_mods[]" value="to" id="s_mod_to" onclick="rcmail_ui.set_searchmod(this)" /><label for="s_mod_to"><roundcube:label name="to" /></label></li>
+ <li><input type="checkbox" name="s_mods[]" value="cc" id="s_mod_cc" onclick="rcmail_ui.set_searchmod(this)" /><label for="s_mod_cc"><roundcube:label name="cc" /></label></li>
+ <li><input type="checkbox" name="s_mods[]" value="bcc" id="s_mod_bcc" onclick="rcmail_ui.set_searchmod(this)" /><label for="s_mod_bcc"><roundcube:label name="bcc" /></label></li>
+ <li><input type="checkbox" name="s_mods[]" value="text" id="s_mod_text" onclick="rcmail_ui.set_searchmod(this)" /><label for="s_mod_text"><roundcube:label name="msgtext" /></label></li>
+ </ul>
+</div>
+
<div id="quicksearchbar">
-<roundcube:object name="searchform" id="quicksearchbox" /><roundcube:button command="reset-search" id="searchreset" image="/images/icons/reset.gif" title="resetsearch" />
+<roundcube:button name="searchmod" id="searchmod" image="/images/icons/glass.gif" onclick="rcmail_ui.show_searchmenu();return false" title="searchmod" />
+<roundcube:object name="searchform" id="quicksearchbox" />
+<roundcube:button command="reset-search" id="searchreset" image="/images/icons/reset.gif" title="resetsearch" />
</div>
</body>