Add AND keyword to search UI
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 28 Sep 2009 22:26:59 +0000 (16:26 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 28 Sep 2009 22:27:21 +0000 (16:27 -0600)
imp/js/search.js
imp/search.php
imp/themes/screen.css

index 139018e..21d71ec 100644 (file)
@@ -160,10 +160,19 @@ var ImpSearch = {
 
     insertCriteria: function(tds)
     {
-        var tr = new Element('TR');
-        tds.each(function(td) {
-            tr.insert(new Element('TD').insert(td));
+        var tr = new Element('TR'),
+            td = new Element('TD');
+
+        if ($('search_criteria_table').childElements().size()) {
+            tds.unshift(new Element('EM', { className: 'join' }).insert(this.text.and));
+        } else {
+            tds.unshift('');
+        }
+
+        tds.each(function(node) {
+            tr.insert(td.cloneNode(false).insert(node));
         });
+
         tr.childElements().last().insert(new Element('A', { href: '#', className: 'searchuiImg searchuiDelete' }));
         $('search_criteria').setValue('');
         $('search_criteria_table').insert(tr);
@@ -359,6 +368,9 @@ var ImpSearch = {
                     tmp = elt.up('TR');
                     delete this.criteria[tmp.identify()];
                     tmp.remove();
+                    if ($('search_criteria_table').childElements().size()) {
+                        $('search_criteria_table').down('TR TD').update('');
+                    }
                     e.stop();
                     return;
                 } else if (elt.hasClassName('searchuiCalendar')) {
index 183e509..86639f3 100644 (file)
@@ -178,6 +178,7 @@ Horde_UI_JsCalendar::init();
 
 /* Gettext strings for this page. */
 $gettext_strings = array(
+    'and' => _("AND"),
     'customhdr' => _("Custom Header:"),
     'dateselection' => _("Date Selection"),
     'flag' => _("Flag:"),
index 9cdc609..4a94750 100644 (file)
@@ -166,6 +166,11 @@ div.msgActions, #fmanager div.folderActions {
 }
 #search_form .checkbox {
     vertical-align: middle;
+    margin-right: 2px;
+}
+#search_form EM.join {
+    font-style: normal;
+    font-weight: bold;
 }
 
 .searchuiCalendar {