From 9826fb0872e99ee765128abafff99c9214d6fafb Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 21 Sep 2010 10:34:49 -0500 Subject: [PATCH] open search in new tab instead --- www/extras/admin/admin.js | 62 +++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 29b4d81da..987746459 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -807,7 +807,7 @@ WebGUI.Admin.LocationBar } ); this.btnSearchDialog = new YAHOO.widget.Button( "searchDialogButton", { label : '', - onclick : { fn: this.toggleSearchDialog, scope: this } + onclick : { fn: this.createSearchTab, scope: this } } ); this.btnHome = new YAHOO.widget.Button( "homeButton", { type : "button", @@ -815,23 +815,6 @@ WebGUI.Admin.LocationBar onclick : { fn: this.goHome, scope: this } } ); - this.btnSearch = new YAHOO.widget.Button( "searchButton", { - onclick : { fn: this.requestSearch, scope: this } - } ); - - this.filterSelect = new YAHOO.widget.Button( "searchFilterAdd", { - type : "menu", - menu : 'searchFilterSelect' - } ); - var self = this; - YAHOO.util.Event.on( window, "load", function () { - self.filterSelect.getMenu().subscribe( "click", self.addFilter, self, true ); - } ); - - YAHOO.util.Event.on( 'searchKeywords', 'keyup', this.updateLocationBarQuery, this, true ); - YAHOO.util.Event.on( 'searchKeywords', 'focus', this.focusKeywords, this, true ); - YAHOO.util.Event.on( 'searchKeywords', 'blur', this.blurKeywords, this, true ); - // Take control of the location input this.klInput = new YAHOO.util.KeyListener( "locationInput", { keys: 13 }, { fn: this.doInputSearch, @@ -1161,6 +1144,49 @@ WebGUI.Admin.LocationBar.prototype.hideSearchDialog anim.animate(); }; +/** + * createSearchTab ( ) + * Create a new search tab and clone the searchForm node into it + */ +WebGUI.Admin.LocationBar.prototype.createSearchTab += function ( ) { + // Prepare the tab + var newForm = document.getElementById( 'searchForm' ).cloneNode( true ); + newForm.id = null; // Duplicate IDs are baaaad + newForm.style.display = "block"; + + var newTab = new YAHOO.widget.Tab({ + label : "Loading...", + content : '' + }); + newTab.get('contentEl').appendChild( newForm ); + + // Fire when ready, Gridley + window.admin.tabBar.addTab( newTab ); + + var searchForm = newForm.getElementsByTagName('form')[0]; + var searchButton = searchForm.elements['searchButton']; + new YAHOO.widget.Button( searchButton, { + onclick : { fn: this.requestSearch, scope: newTab } + } ); + + var searchFilterSelect = searchForm.elements['searchFilterSelect']; + var searchFilterAdd = searchForm.elements['searchFilterAdd']; + new YAHOO.widget.Button( searchFilterAdd, { + type : "menu", + menu : searchFilterSelect + } ); + var self = this; + YAHOO.util.Event.on( window, "load", function () { + self.filterSelect.getMenu().subscribe( "click", self.addFilter, newTab, true ); + } ); + + var searchKeywords = searchForm.elements['searchKeywords']; + YAHOO.util.Event.on( searchKeywords, 'keyup', this.updateLocationBarQuery, newTab, true ); + YAHOO.util.Event.on( searchKeywords, 'focus', this.focusKeywords, newTab, true ); + YAHOO.util.Event.on( searchKeywords, 'blur', this.blurKeywords, newTab, true ); +}; + /** * addFilter ( eventType, args ) * Add the selected filter into the filter list