Complete asset manager rewrite.

This commit is contained in:
Doug Bell 2008-05-26 22:07:16 +00:00
parent dc30ecccbe
commit f3996eb316
14 changed files with 1189 additions and 331 deletions

View file

@ -0,0 +1,139 @@
/*** Asset manager Stylesheet ***/
/* Override retarded admin console styles */
li, td, a, a:link, a:hover, a:visited, a:active, #assetManager {
font-size: 10pt;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, Arial, sans-serif;
}
a:link, a:visited, a:active {
color: blue;
}
a:hover {
color: purple;
}
/** Page stats **/
#pageStats {
float: right;
text-align: right;
}
#pageLinks {
float: right;
text-align: right;
}
/** Crumbtrail **/
#crumbtrail ol {
float: left;
}
#crumbtrail li {
list-style: none;
float: left;
padding-left: 0.5em;
}
/* fix more menu */
#crumbtrail li li {
float: none;
}
/** More menus **/
.moreMenu {
position: relative;
}
.moreMenu ul {
display: none;
position: absolute;
top: 1em;
left: 0;
width: 12em;
margin: 0;
padding: 0;
background-color: white;
border: 1px solid blue;
z-index: 1000;
}
.moreMenu li {
list-style: none;
background-color: white;
}
.moreMenu li a {
display: block;
padding: 0.25em;
z-index: 1100;
text-align: left;
width: 10em;
}
/** Asset Manager table **/
.assetManager {
clear: both;
width: 100%;
}
.assetManager th {
border: solid #666;
border-width: 0 1px 2px 0;
background-color: #eee;
}
.assetManager th, .assetManager td {
padding: 0 0.8em;
}
#assetManager th, #assetManager td, .assetManager {
font-size: 0.8em;
}
.assetManager .center, .assetManager th {
text-align: center;
}
.assetManager .right {
text-align: right;
}
.hasChildren {
font-family: "Courier New", monospace;
}
.assetManager .rank {
text-align: right;
}
.assetManager a:link, .assetManager a:visited, .assetManager a:active, .assetManager a:hover {
font-size: 8pt;
}
.assetManager tr.alt td {
background-color: #ddd;
}
.assetManager tr.highlight td {
background-color: #CCF;
}
/** Actions **/
.actions {
float: left;
}
/** The function panes **/
.functionPane {
width: 28%;
float: left;
padding-right: 30px;
font-size: 14px;
}
.functionPane a {
vertical-align: bottom;
}

View file

@ -0,0 +1,180 @@
/*** The WebGUI Asset Manager
* Requires: YAHOO, Dom, Event
*
*/
if ( typeof WebGUI == "undefined" ) {
WebGUI = {};
}
if ( typeof WebGUI.AssetManager == "undefined" ) {
WebGUI.AssetManager = {};
}
/*---------------------------------------------------------------------------
WebGUI.AssetManager.addHighlightToRow ( child )
Highlight the row containing this element by adding to it the "highlight"
class
*/
WebGUI.AssetManager.addHighlightToRow
= function ( child ) {
var row = WebGUI.AssetManager.findRow( child );
if ( !YAHOO.util.Dom.hasClass( row, "highlight" ) ) {
YAHOO.util.Dom.addClass( row, "highlight" );
}
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.findRow ( child )
Find the row that contains this child element.
*/
WebGUI.AssetManager.findRow
= function ( child ) {
var node = child;
while ( node ) {
if ( node.tagName == "TR" ) {
return node;
}
node = node.parentNode;
}
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.hideMoreMenu ( event, element )
Hide the more menu located inside element after a short delay.
*/
WebGUI.AssetManager.hideMoreMenu
= function ( event, element ) {
var ul = element.getElementsByTagName( "ul" )[0];
// Store the timeout in the element itself (bad, yes)
element.menuTimeout
= setTimeout( function () { ul.style.display = "none"; }, 100 );
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.initManager ( )
Initialize the www_manage page
*/
WebGUI.AssetManager.initManager
= function () {
WebGUI.AssetManager.initMoreMenus();
// Start the data source
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.initMoreMenus ( )
Initialize the more menus in an asset manager page
*/
WebGUI.AssetManager.initMoreMenus
= function () {
// Initialize the more menus
var moreMenus = YAHOO.util.Dom.getElementsByClassName( "moreMenu" );
for ( var i = 0; i < moreMenus.length; i++ ) {
var a = moreMenus[ i ].getElementsByTagName( "a" );
for ( var h = 0; h < a.length; h++ ) {
YAHOO.util.Event.addListener( a[ h ], "mouseover", WebGUI.AssetManager.showMoreMenu, moreMenus[ i ] );
YAHOO.util.Event.addListener( a[ h ], "mouseout", WebGUI.AssetManager.hideMoreMenu, moreMenus[ i ] );
}
}
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.initSearch ( )
Initialize the www_search page
*/
WebGUI.AssetManager.initSearch
= function () {
WebGUI.AssetManager.initMoreMenus();
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.removeHighlightFromRow ( child )
Remove the highlight from a row by removing the "highlight" class.
*/
WebGUI.AssetManager.removeHighlightFromRow
= function ( child ) {
var row = WebGUI.AssetManager.findRow( child );
if ( YAHOO.util.Dom.hasClass( row, "highlight" ) ) {
YAHOO.util.Dom.removeClass( row, "highlight" );
}
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.selectRow ( child )
Check the assetId checkbox in the row that contains the given child.
Used when something in the row changes.
*/
WebGUI.AssetManager.selectRow
= function ( child ) {
// First find the row
var node = WebGUI.AssetManager.findRow( child );
WebGUI.AssetManager.addHighlightToRow( child );
// Now find the assetId checkbox in the first element
var inputs = node.getElementsByTagName( "input" );
for ( var i = 0; i < inputs.length; i++ ) {
if ( inputs[i].name == "assetId" ) {
inputs[i].checked = true;
break;
}
}
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.showMoreMenu ( event, element )
Show the more menu located inside element.
*/
WebGUI.AssetManager.showMoreMenu
= function ( event, element ) {
if ( element.menuTimeout ) {
clearTimeout( element.menuTimeout );
}
var ul = element.getElementsByTagName( "ul" )[0];
ul.style.display = "block";
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.toggleHighlightForRow ( checkbox )
Toggle the highlight for the row based on the state of the checkbox
*/
WebGUI.AssetManager.toggleHighlightForRow
= function ( checkbox ) {
if ( checkbox.checked ) {
WebGUI.AssetManager.addHighlightToRow( checkbox );
}
else {
WebGUI.AssetManager.removeHighlightFromRow( checkbox );
}
};
/*---------------------------------------------------------------------------
WebGUI.AssetManager.toggleRow ( child )
Toggles the entire row by finding the checkbox and doing what needs to be
done.
*/
WebGUI.AssetManager.toggleRow
= function ( child ) {
var row = WebGUI.AssetManager.findRow( child );
// Find the checkbox
var inputs = row.getElementsByTagName( "input" );
for ( var i = 0; i < inputs.length; i++ ) {
if ( inputs[i].name == "assetId" ) {
inputs[i].checked = inputs[i].checked
? false
: true
;
WebGUI.AssetManager.toggleHighlightForRow( inputs[i] );
break;
}
}
};

View file

@ -30,7 +30,10 @@ WebGUI.Form.toggleAllCheckboxesInForm
if (checkboxesName && input.name != checkboxesName)
continue;
// Change the state
input.checked = state;
// Run the appropriate scripts
input.onchange();
}
// Update the saved state