more work on admin console
This commit is contained in:
parent
9c613ab638
commit
d46f77bf2e
3 changed files with 50 additions and 12 deletions
|
|
@ -177,6 +177,7 @@ sub www_view {
|
||||||
}
|
}
|
||||||
|
|
||||||
$var->{viewUrl} = $url->page;
|
$var->{viewUrl} = $url->page;
|
||||||
|
$var->{homeUrl} = WebGUI::Asset->getDefault( $session )->getUrl;
|
||||||
|
|
||||||
# All this needs to be template attachments
|
# All this needs to be template attachments
|
||||||
$style->setLink( $url->extras('yui/build/button/assets/skins/sam/button.css'), {type=>"text/css",rel=>"stylesheet"});
|
$style->setLink( $url->extras('yui/build/button/assets/skins/sam/button.css'), {type=>"text/css",rel=>"stylesheet"});
|
||||||
|
|
@ -265,6 +266,7 @@ __DATA__
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
YAHOO.util.Event.onDOMReady( function() {
|
YAHOO.util.Event.onDOMReady( function() {
|
||||||
window.admin = new WebGUI.Admin( {
|
window.admin = new WebGUI.Admin( {
|
||||||
|
homeUrl : '<tmpl_var homeUrl>'
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -39,22 +39,22 @@
|
||||||
|
|
||||||
#locationBar #left {
|
#locationBar #left {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 16%;
|
width: 12%;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#locationBar #right {
|
#locationBar #right {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 8%;
|
width: 10%;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#locationBar #location {
|
#locationBar #location {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: auto 7% auto 16%;
|
margin: auto 10% auto 12%;
|
||||||
width: 75%;
|
width: 77%;
|
||||||
height: 80%;
|
height: 80%;
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,10 @@ WebGUI.Admin.prototype.navigate
|
||||||
* WebGUI.Admin.LocationBar
|
* WebGUI.Admin.LocationBar
|
||||||
*/
|
*/
|
||||||
WebGUI.Admin.LocationBar
|
WebGUI.Admin.LocationBar
|
||||||
= function (id) {
|
= function (id, cfg) {
|
||||||
// Public properties
|
// Public properties
|
||||||
this.id = id; // ID of the element containing the location bar
|
this.id = id; // ID of the element containing the location bar
|
||||||
|
this.cfg = cfg; // Configuration
|
||||||
this.currentAssetDef = null; // Object containing assetId, title, url, icon
|
this.currentAssetDef = null; // Object containing assetId, title, url, icon
|
||||||
this.backAssetDefs = [ ]; // Asset defs to go back to
|
this.backAssetDefs = [ ]; // Asset defs to go back to
|
||||||
this.forwardAssetDefs = [ ]; // Asset defs to go forward to
|
this.forwardAssetDefs = [ ]; // Asset defs to go forward to
|
||||||
|
|
@ -129,12 +130,20 @@ WebGUI.Admin.LocationBar
|
||||||
menu : []
|
menu : []
|
||||||
} );
|
} );
|
||||||
self.btnSearch = new YAHOO.widget.Button( "searchButton", {
|
self.btnSearch = new YAHOO.widget.Button( "searchButton", {
|
||||||
label : '<img src="' + getWebguiProperty("extrasURL") + 'icon/magnifier.png" />'
|
label : '<img src="' + getWebguiProperty("extrasURL") + 'icon/magnifier.png" />',
|
||||||
|
onclick : { fn: self.clickSearchButton, scope: self }
|
||||||
} );
|
} );
|
||||||
self.btnHome = new YAHOO.widget.Button( "homeButton", {
|
self.btnHome = new YAHOO.widget.Button( "homeButton", {
|
||||||
label : '<img src="' + getWebguiProperty("extrasURL") + 'icon/house.png" />'
|
type : "button",
|
||||||
|
label : '<img src="' + getWebguiProperty("extrasURL") + 'icon/house.png" />',
|
||||||
|
onclick : { fn: self.goHome, scope: self }
|
||||||
} );
|
} );
|
||||||
// Take control of the location input
|
// Take control of the location input
|
||||||
|
self.klInput = new YAHOO.util.KeyListener( "locationUrl", { keys: 13 }, {
|
||||||
|
fn: self.doInputSearch,
|
||||||
|
scope: self,
|
||||||
|
correctScope: true
|
||||||
|
} );
|
||||||
YAHOO.util.Event.addListener( "locationUrl", "focus", self.inputFocus, self, true );
|
YAHOO.util.Event.addListener( "locationUrl", "focus", self.inputFocus, self, true );
|
||||||
YAHOO.util.Event.addListener( "locationUrl", "blur", self.inputBlur, self, true );
|
YAHOO.util.Event.addListener( "locationUrl", "blur", self.inputBlur, self, true );
|
||||||
}
|
}
|
||||||
|
|
@ -186,6 +195,29 @@ WebGUI.Admin.LocationBar.prototype.clickForwardMenuItem
|
||||||
this.swapForwardToBack( assetDef );
|
this.swapForwardToBack( assetDef );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doInputSearch()
|
||||||
|
* Perform the search as described in the location bar
|
||||||
|
*/
|
||||||
|
WebGUI.Admin.LocationBar.prototype.doInputSearch
|
||||||
|
= function ( ) {
|
||||||
|
var input = document.getElementById("locationUrl").value;
|
||||||
|
// If input starts with a / and doesn't contain a ? go to the asset
|
||||||
|
if ( input.match(/^\//) ) {
|
||||||
|
if ( !input.match(/\?/) ) {
|
||||||
|
window.admin.gotoAsset( input );
|
||||||
|
}
|
||||||
|
// If does contain a ?, go to url
|
||||||
|
else {
|
||||||
|
window.admin.go( input );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Otherwise ask WebGUI what do
|
||||||
|
else {
|
||||||
|
alert("TODO");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getMenuItemLabel( assetDef )
|
* getMenuItemLabel( assetDef )
|
||||||
* Build a menu item label for the given assetDef
|
* Build a menu item label for the given assetDef
|
||||||
|
|
@ -234,6 +266,7 @@ WebGUI.Admin.LocationBar.prototype.inputBlur
|
||||||
if ( e.target.value.match(/^\s*$/) ) {
|
if ( e.target.value.match(/^\s*$/) ) {
|
||||||
e.target.value = this.currentAssetDef.url;
|
e.target.value = this.currentAssetDef.url;
|
||||||
}
|
}
|
||||||
|
this.klInput.disable();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -245,6 +278,7 @@ WebGUI.Admin.LocationBar.prototype.inputFocus
|
||||||
if ( e.target.value == this.currentAssetDef.url ) {
|
if ( e.target.value == this.currentAssetDef.url ) {
|
||||||
e.target.value = "";
|
e.target.value = "";
|
||||||
}
|
}
|
||||||
|
this.klInput.enable();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -257,12 +291,14 @@ WebGUI.Admin.LocationBar.prototype.navigate
|
||||||
this.setTitle( assetDef.title );
|
this.setTitle( assetDef.title );
|
||||||
this.setUrl( assetDef.url );
|
this.setUrl( assetDef.url );
|
||||||
|
|
||||||
if ( this.currentAssetDef ) {
|
// Don't do the same asset twice
|
||||||
if ( this.currentAssetDef.assetId == assetDef.assetId ) {
|
if ( this.currentAssetDef && this.currentAssetDef.assetId != assetDef.assetId ) {
|
||||||
// Don't do the same asset twice
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.addBackAsset( this.currentAssetDef );
|
this.addBackAsset( this.currentAssetDef );
|
||||||
|
// We navigated, so destroy the forward queue
|
||||||
|
//this.forwardAssetDefs = [];
|
||||||
|
//this.btnForward.getMenu().clearItems();
|
||||||
|
//this.btnForward.getMenu().render();
|
||||||
|
//this.btnForward.set( "disabled", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current asset is now...
|
// Current asset is now...
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue