open search in new tab instead

This commit is contained in:
Doug Bell 2010-09-21 10:34:49 -05:00
parent 59d387a9ee
commit 9826fb0872

View file

@ -807,7 +807,7 @@ WebGUI.Admin.LocationBar
} );
this.btnSearchDialog = new YAHOO.widget.Button( "searchDialogButton", {
label : '<img src="' + getWebguiProperty("extrasURL") + 'icon/magnifier.png" />',
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