Fix the More menus in the AssetManager. Fixes bug #11069.

Also, some jslint cleanup of the code.
This commit is contained in:
Colin Kuskie 2009-10-28 09:14:19 -07:00
parent c1ce7470b9
commit 74e4e25bc0
2 changed files with 11 additions and 12 deletions

View file

@ -19,6 +19,7 @@
- fixed #11165: DatePicker broken in IE7 - fixed #11165: DatePicker broken in IE7
- added: Manage System Clipboard group setting - added: Manage System Clipboard group setting
- added: Manage System Trash group setting - added: Manage System Trash group setting
- fixed #11069: "More" options menu in asset manager
7.8.2 7.8.2
- Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi) - Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi)

View file

@ -13,7 +13,7 @@ if ( typeof WebGUI.AssetManager == "undefined" ) {
// Keep track of the open more menus // Keep track of the open more menus
WebGUI.AssetManager.MoreMenusDisplayed = {}; WebGUI.AssetManager.MoreMenusDisplayed = {};
WebGUI.AssetManager.CrumbMoreMenu; WebGUI.AssetManager.CrumbMoreMenu = undefined;
// Append something to a url: // Append something to a url:
WebGUI.AssetManager.appendToUrl = function ( url, params ) { WebGUI.AssetManager.appendToUrl = function ( url, params ) {
var components = [ url ]; var components = [ url ];
@ -25,15 +25,14 @@ WebGUI.AssetManager.appendToUrl = function ( url, params ) {
} }
components.push(params); components.push(params);
return components.join(''); return components.join('');
} };
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
WebGUI.AssetManager.addHighlightToRow ( child ) WebGUI.AssetManager.addHighlightToRow ( child )
Highlight the row containing this element by adding to it the "highlight" Highlight the row containing this element by adding to it the "highlight"
class class
*/ */
WebGUI.AssetManager.addHighlightToRow WebGUI.AssetManager.addHighlightToRow = function ( child ) {
= function ( child ) {
var row = WebGUI.AssetManager.findRow( child ); var row = WebGUI.AssetManager.findRow( child );
if ( !YAHOO.util.Dom.hasClass( row, "highlight" ) ) { if ( !YAHOO.util.Dom.hasClass( row, "highlight" ) ) {
YAHOO.util.Dom.addClass( row, "highlight" ); YAHOO.util.Dom.addClass( row, "highlight" );
@ -44,8 +43,7 @@ WebGUI.AssetManager.addHighlightToRow
WebGUI.AssetManager.buildMoreMenu ( url, linkElement ) WebGUI.AssetManager.buildMoreMenu ( url, linkElement )
Build a WebGUI style "More" menu for the asset referred to by url Build a WebGUI style "More" menu for the asset referred to by url
*/ */
WebGUI.AssetManager.buildMoreMenu WebGUI.AssetManager.buildMoreMenu = function ( url, linkElement, isNotLocked ) {
= function ( url, linkElement, isNotLocked ) {
// Build a more menu // Build a more menu
var rawItems = WebGUI.AssetManager.MoreMenuItems; var rawItems = WebGUI.AssetManager.MoreMenuItems;
var menuItems = []; var menuItems = [];
@ -63,7 +61,7 @@ WebGUI.AssetManager.buildMoreMenu
"zindex" : 1000, "zindex" : 1000,
"clicktohide" : true, "clicktohide" : true,
"position" : "dynamic", "position" : "dynamic",
"context" : [ linkElement, "tl", "bl" ], "context" : [ linkElement, "tl", "bl", ["beforeShow", "windowResize"] ],
"itemdata" : menuItems "itemdata" : menuItems
}; };
@ -74,8 +72,7 @@ WebGUI.AssetManager.buildMoreMenu
WebGUI.AssetManager.findRow ( child ) WebGUI.AssetManager.findRow ( child )
Find the row that contains this child element. Find the row that contains this child element.
*/ */
WebGUI.AssetManager.findRow WebGUI.AssetManager.findRow = function ( child ) {
= function ( child ) {
var node = child; var node = child;
while ( node ) { while ( node ) {
if ( node.tagName == "TR" ) { if ( node.tagName == "TR" ) {
@ -114,7 +111,7 @@ WebGUI.AssetManager.formatActions = function ( elCell, oRecord, oColumn, orderNu
var options = WebGUI.AssetManager.buildMoreMenu(oRecord.getData( 'url' ), more, oRecord.getData( 'actions' )); var options = WebGUI.AssetManager.buildMoreMenu(oRecord.getData( 'url' ), more, oRecord.getData( 'actions' ));
var menu = new YAHOO.widget.Menu( "moreMenu" + oRecord.getData( 'assetId' ), options ); var menu = new YAHOO.widget.Menu( "moreMenu" + oRecord.getData( 'assetId' ), options );
YAHOO.util.Event.onDOMReady( function () { menu.render( document.getElementById( 'assetManager' ) ) } ); YAHOO.util.Event.onDOMReady( function () { menu.render( document.getElementById( 'assetManager' ) ); } );
YAHOO.util.Event.addListener( more, "click", function (e) { YAHOO.util.Event.stopEvent(e); menu.show(); menu.focus(); }, null, menu ); YAHOO.util.Event.addListener( more, "click", function (e) { YAHOO.util.Event.stopEvent(e); menu.show(); menu.focus(); }, null, menu );
}; };
@ -202,8 +199,9 @@ WebGUI.AssetManager.BuildQueryString = function ( state, dt ) {
WebGUI.AssetManager.formatRevisionDate = function ( elCell, oRecord, oColumn, orderNumber ) { WebGUI.AssetManager.formatRevisionDate = function ( elCell, oRecord, oColumn, orderNumber ) {
var revisionDate = new Date( oRecord.getData( "revisionDate" ) * 1000 ); var revisionDate = new Date( oRecord.getData( "revisionDate" ) * 1000 );
var minutes = revisionDate.getMinutes(); var minutes = revisionDate.getMinutes();
if (minutes < 10) if (minutes < 10) {
minutes = "0" + minutes; minutes = "0" + minutes;
}
elCell.innerHTML = revisionDate.getFullYear() + '-' + ( revisionDate.getMonth() + 1 ) elCell.innerHTML = revisionDate.getFullYear() + '-' + ( revisionDate.getMonth() + 1 )
+ '-' + revisionDate.getDate() + ' ' + ( revisionDate.getHours() ) + '-' + revisionDate.getDate() + ' ' + ( revisionDate.getHours() )
+ ':' + minutes + ':' + minutes
@ -308,7 +306,7 @@ WebGUI.AssetManager.initDataTable = function (o) {
WebGUI.AssetManager.DataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { WebGUI.AssetManager.DataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) {
oPayload.totalRecords = oResponse.meta.totalRecords; oPayload.totalRecords = oResponse.meta.totalRecords;
return oPayload; return oPayload;
} };
}; };