Merge branch 'WebGUI8' of github.com:plainblack/webgui into WebGUI8
This commit is contained in:
commit
1753ce64b3
156 changed files with 1044 additions and 940 deletions
|
|
@ -5,6 +5,18 @@
|
|||
|
||||
html,body { margin: 0; padding: 0; height: 100% }
|
||||
|
||||
input.disabled {
|
||||
font-style: italic;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.with_avatar {
|
||||
background-position: 0 0;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 50px;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
position: relative;
|
||||
margin-left: 165px; /* move out of the adminbar's way */
|
||||
|
|
@ -103,11 +115,12 @@ html,body { margin: 0; padding: 0; height: 100% }
|
|||
-webkit-border-radius: 3px;
|
||||
}
|
||||
|
||||
#locationBar #locationUrl {
|
||||
#locationBar #locationInput {
|
||||
width: 99%;
|
||||
height: 90%;
|
||||
border: none;
|
||||
font: 14px Verdana, sans-serif;
|
||||
font-size: 14px;
|
||||
font-family: Verdana, sans-serif;
|
||||
}
|
||||
|
||||
#locationBar #locationTitle {
|
||||
|
|
@ -153,6 +166,47 @@ html,body { margin: 0; padding: 0; height: 100% }
|
|||
|
||||
#searchFilters {
|
||||
clear: both;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#searchFilters .deleteIcon {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#searchFilters li { height: 28px; } /* autocomplete is position: absolute, so pretend some height */
|
||||
|
||||
#searchFilters span.name {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 9%;
|
||||
text-align: right;
|
||||
padding-right: 1%;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
#searchFilterAdd {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.filter_title input, .filter_ownerUserId div.autocomplete {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 89%;
|
||||
}
|
||||
|
||||
#searchFilters .yui-ac-bd li {
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.autocomplete_value {
|
||||
font-size: larger;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.autocomplete_subtext {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
#wrapper .yui-content {
|
||||
|
|
|
|||
|
|
@ -746,6 +746,7 @@ WebGUI.Admin.LocationBar
|
|||
this.currentAssetDef = null; // Object containing assetId, title, url, icon
|
||||
this.backAssetDefs = [ ]; // Asset defs to go back to
|
||||
this.forwardAssetDefs = [ ]; // Asset defs to go forward to
|
||||
this.filters = [ ]; // search filters
|
||||
|
||||
// Private members
|
||||
var self = this;
|
||||
|
|
@ -787,21 +788,22 @@ WebGUI.Admin.LocationBar
|
|||
menu : 'searchFilterSelect'
|
||||
} );
|
||||
var self = this;
|
||||
YAHOO.util.Event.onDOMReady( 'searchFilterSelect', function () {
|
||||
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( "locationUrl", { keys: 13 }, {
|
||||
this.klInput = new YAHOO.util.KeyListener( "locationInput", { keys: 13 }, {
|
||||
fn: this.doInputSearch,
|
||||
scope: this,
|
||||
correctScope: true
|
||||
} );
|
||||
YAHOO.util.Event.addListener( "locationUrl", "focus", this.inputFocus, this, true );
|
||||
YAHOO.util.Event.addListener( "locationUrl", "blur", this.inputBlur, this, true );
|
||||
YAHOO.util.Event.addListener( "locationInput", "focus", this.inputFocus, this, true );
|
||||
YAHOO.util.Event.addListener( "locationInput", "blur", this.inputBlur, this, true );
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -855,7 +857,7 @@ WebGUI.Admin.LocationBar.prototype.clickForwardMenuItem
|
|||
*/
|
||||
WebGUI.Admin.LocationBar.prototype.doInputSearch
|
||||
= function ( ) {
|
||||
var input = document.getElementById("locationUrl").value;
|
||||
var input = document.getElementById("locationInput").value;
|
||||
// If input starts with a / it's a URL
|
||||
if ( input.match(/^\//) ) {
|
||||
// If it doesn't have a ?, just go to the asset
|
||||
|
|
@ -984,7 +986,7 @@ WebGUI.Admin.LocationBar.prototype.setTitle
|
|||
*/
|
||||
WebGUI.Admin.LocationBar.prototype.setUrl
|
||||
= function ( url ) {
|
||||
var input = document.getElementById( "locationUrl" );
|
||||
var input = document.getElementById( "locationInput" );
|
||||
input.value = url;
|
||||
};
|
||||
|
||||
|
|
@ -1055,13 +1057,23 @@ WebGUI.Admin.LocationBar.prototype.goHome
|
|||
*/
|
||||
WebGUI.Admin.LocationBar.prototype.toggleSearchDialog
|
||||
= function ( ) {
|
||||
var input = document.getElementById( 'locationInput' );
|
||||
if ( this.searchDialog == true ) {
|
||||
this.hideSearchDialog();
|
||||
this.searchDialog = false;
|
||||
input.value = this.savedLocationInput;
|
||||
this.savedLocationInput = "";
|
||||
input.readonly = false;
|
||||
YAHOO.util.Dom.removeClass( input, 'disabled' );
|
||||
}
|
||||
else {
|
||||
this.showSearchDialog();
|
||||
this.searchDialog = true;
|
||||
this.savedLocationInput = input.value;
|
||||
input.value = "";
|
||||
this.updateLocationBarQuery();
|
||||
input.readonly = true;
|
||||
YAHOO.util.Dom.addClass( input, 'disabled' );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1113,6 +1125,130 @@ WebGUI.Admin.LocationBar.prototype.hideSearchDialog
|
|||
anim.animate();
|
||||
};
|
||||
|
||||
/**
|
||||
* addFilter ( eventType, args )
|
||||
* Add the selected filter into the filter list
|
||||
*/
|
||||
WebGUI.Admin.LocationBar.prototype.addFilter
|
||||
= function ( eventType, args ) {
|
||||
var self = this;
|
||||
var ev = args[0];
|
||||
var menuitem = args[1];
|
||||
var keys = {}; // Listen for all keys
|
||||
|
||||
// Keep track of our filters
|
||||
var filter = { };
|
||||
this.filters.push( filter );
|
||||
|
||||
var li = document.createElement( 'li' );
|
||||
filter.li = li;
|
||||
|
||||
var type = menuitem.value;
|
||||
filter.type = type;
|
||||
li.className = "filter_" + filter.type;
|
||||
|
||||
var ul = document.getElementById( 'searchFilters' );
|
||||
ul.appendChild( li );
|
||||
|
||||
var delIcon = document.createElement('img');
|
||||
delIcon.className = "clickable";
|
||||
YAHOO.util.Event.on( delIcon, "click", function(){
|
||||
self.removeFilter( filter.li );
|
||||
} );
|
||||
|
||||
var name = menuitem.cfg.getProperty('text');
|
||||
var nameElem = document.createElement('span');
|
||||
nameElem.className = "name";
|
||||
nameElem.appendChild( document.createTextNode( name ) );
|
||||
li.appendChild( nameElem );
|
||||
|
||||
if ( filter.type == "title" ) {
|
||||
var inputElem = document.createElement('input');
|
||||
filter.inputElem = inputElem;
|
||||
inputElem.type = "text";
|
||||
li.appendChild( inputElem );
|
||||
YAHOO.util.Event.on( inputElem, 'keyup', this.updateLocationBarQuery, this, true );
|
||||
inputElem.focus();
|
||||
}
|
||||
else if ( filter.type == "ownerUserId" ) {
|
||||
var container = document.createElement( 'div' );
|
||||
container.className = "autocomplete";
|
||||
li.appendChild( container );
|
||||
|
||||
var inputElem = document.createElement('input');
|
||||
filter.inputElem = inputElem;
|
||||
inputElem.type = "text";
|
||||
container.appendChild( inputElem );
|
||||
filter.dataSource = new YAHOO.util.XHRDataSource( '?op=admin;method=findUser;' );
|
||||
filter.dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
|
||||
filter.dataSource.responseSchema = {
|
||||
resultsList : "results",
|
||||
fields : [ 'username', 'name', 'userId', 'avatar', 'email' ]
|
||||
};
|
||||
|
||||
// Auto-complete container
|
||||
var acDiv = document.createElement('div');
|
||||
filter.acDiv = acDiv;
|
||||
container.appendChild( acDiv );
|
||||
|
||||
filter.autocomplete = new YAHOO.widget.AutoComplete( inputElem, acDiv, filter.dataSource );
|
||||
filter.autocomplete.queryQuestionMark = false;
|
||||
filter.autocomplete.animVert = true;
|
||||
filter.autocomplete.animSpeed = 0.1;
|
||||
filter.autocomplete.minQueryLength = 1;
|
||||
filter.autocomplete.queryDelay = 0.2;
|
||||
filter.autocomplete.typeAhead = true;
|
||||
filter.autocomplete.resultTypeList = false;
|
||||
filter.autocomplete.applyLocalFilter = true;
|
||||
filter.autocomplete.formatResult = function ( result, query, match ) {
|
||||
var subtext = ( result.name ? result.name : "" )
|
||||
+ ( result.email ? " <" + result.email + ">" : "" )
|
||||
;
|
||||
return '<div style="float: left; width: 50px; height: 50px; background: url(' + result.avatar + ') no-repeat 50% 50%;"></div>'
|
||||
+ '<div class="autocomplete_value">' + result.username + "</div>"
|
||||
+ '<div class="autocomplete_subtext">' + subtext + '</div>';
|
||||
|
||||
};
|
||||
|
||||
inputElem.focus();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* updateLocationBarQuery( )
|
||||
* Update the location bar text with the filters in the search box
|
||||
*/
|
||||
WebGUI.Admin.LocationBar.prototype.updateLocationBarQuery
|
||||
= function () {
|
||||
var query = "";
|
||||
|
||||
// First add filters
|
||||
var filterVals = [];
|
||||
for ( var i = 0; i < this.filters.length; i++ ) {
|
||||
var filter = this.filters[i];
|
||||
if ( filter.type == "title" ) {
|
||||
var value = filter.inputElem.value;
|
||||
if ( !value ) continue;
|
||||
var quote = "";
|
||||
if ( value.match(/\s/) ) {
|
||||
quote = '"';
|
||||
}
|
||||
filterVals.push( "title:" + quote + filter.inputElem.value + quote );
|
||||
}
|
||||
}
|
||||
query += filterVals.join(" ");
|
||||
|
||||
|
||||
// Then add keywords
|
||||
if ( query != "" ) {
|
||||
query += " "; // Add a space between filters and keywords
|
||||
}
|
||||
query += document.getElementById( 'searchKeywords' ).value;
|
||||
|
||||
// Set the new value
|
||||
document.getElementById( 'locationInput' ).value = query;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* WebGUI.Admin.Tree
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue