Make sure search criteria is opened up if recent search is selected
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 5 Dec 2009 02:43:05 +0000 (19:43 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 7 Dec 2009 03:44:00 +0000 (20:44 -0700)
imp/js/search.js

index 60147ff..e4534ec 100644 (file)
@@ -122,6 +122,9 @@ var ImpSearch = {
         switch (elt.readAttribute('id')) {
         case 'recent_searches':
             this.updateSearchCriteria(this.saved_searches[$F(elt)]);
+            if (!$('search_criteria_table').up().visible()) {
+                this._toggleHeader($('search_criteria_table').up().previous());
+            }
             elt.clear();
             break;
 
@@ -407,10 +410,7 @@ var ImpSearch = {
             default:
                 if (elt.hasClassName('arrowExpanded') ||
                     elt.hasClassName('arrowCollapsed')) {
-                    elt.up().down().toggle().next().toggle().up().next().toggle();
-                    if (elt.descendantOf('search_folders_hdr')) {
-                        elt.next('SPAN.searchuiFoldersActions').toggle();
-                    }
+                    this._toggleHeader(elt.up());
                 } else if (elt.hasClassName('searchuiDelete')) {
                     this.deleteCriteria(elt.up('TR'));
                     e.stop();
@@ -428,6 +428,14 @@ var ImpSearch = {
         }
     },
 
+    _toggleHeader: function(elt)
+    {
+        elt.down().toggle().next().toggle().up().next().toggle();
+        if (elt.descendantOf('search_folders_hdr')) {
+            elt.next('SPAN.searchuiFoldersActions').toggle();
+        }
+    },
+
     _showFoldersCallback: function(flist, r)
     {
         this.updateFolderList(r.responseJSON);