From 0fa1ec4901ba62609b77e3d6819a41d5c90564a0 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 11 Feb 2009 04:42:15 +0000 Subject: [PATCH] In the AssetManager, do not show the Edit link in the More menu if the asset is locked. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Content/AssetManager.pm | 3 ++- .../yui-webgui/build/assetManager/assetManager.js | 13 ++++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index aef2df004..13e08d7eb 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,6 @@ 7.6.12 - fixed: During postback on a recurring transaction, the routine could error out instead of catching an error. + - fixed: Do not show the Edit entry in the More menu in the asset manager if the asset is locked. 7.6.11 - fixed: Asset Manager can generate URLs that are too long diff --git a/lib/WebGUI/Content/AssetManager.pm b/lib/WebGUI/Content/AssetManager.pm index 57ae25469..593a9ba3b 100644 --- a/lib/WebGUI/Content/AssetManager.pm +++ b/lib/WebGUI/Content/AssetManager.pm @@ -428,8 +428,9 @@ ENDHTML } # And ourself - $output .= sprintf q{
  • %s
  • }, + $output .= sprintf q{
  • %s
  • }, $currentAsset->getUrl, + ($currentAsset->canEdit && $currentAsset->canEditIfLocked ? 1 : 0), $currentAsset->get( "menuTitle" ), ; $output .= ''; diff --git a/www/extras/yui-webgui/build/assetManager/assetManager.js b/www/extras/yui-webgui/build/assetManager/assetManager.js index 18c07a40a..eb26339c2 100644 --- a/www/extras/yui-webgui/build/assetManager/assetManager.js +++ b/www/extras/yui-webgui/build/assetManager/assetManager.js @@ -46,16 +46,19 @@ WebGUI.AssetManager.addHighlightToRow Build a WebGUI style "More" menu for the asset referred to by url */ WebGUI.AssetManager.buildMoreMenu -= function ( url, linkElement ) { += function ( url, linkElement, isNotLocked ) { // Build a more menu var rawItems = WebGUI.AssetManager.MoreMenuItems; var menuItems = []; + var isLocked = !isNotLocked; for ( var i = 0; i < rawItems.length; i++ ) { var itemUrl = rawItems[i].url.match( // ) ? rawItems[i].url.replace( /(?:\?(.*))?/, WebGUI.AssetManager.appendToUrl(url, "$1") ) : url + rawItems[i].url ; - menuItems.push( { "url" : itemUrl, "text" : rawItems[i].label } ); + if (! (itemUrl.match( /func=edit;/) && isLocked )) { + menuItems.push( { "url" : itemUrl, "text" : rawItems[i].label } ); + } } var options = { "zindex" : 1000, @@ -109,7 +112,7 @@ WebGUI.AssetManager.formatActions = function ( elCell, oRecord, oColumn, orderNu oldMenu.parentNode.removeChild( oldMenu ); } - var options = WebGUI.AssetManager.buildMoreMenu(oRecord.getData( 'url' ), more); + var options = WebGUI.AssetManager.buildMoreMenu(oRecord.getData( 'url' ), more, oRecord.getData( 'actions' )); var menu = new YAHOO.widget.Menu( "moreMenu" + oRecord.getData( 'assetId' ), options ); YAHOO.util.Event.onDOMReady( function () { menu.render( document.getElementById( 'assetManager' ) ) } ); @@ -346,10 +349,10 @@ WebGUI.AssetManager.selectRow = function ( child ) { Build a More menu for the last element of the Crumb trail */ WebGUI.AssetManager.showMoreMenu -= function ( url, linkTextId ) { += function ( url, linkTextId, isNotLocked ) { var more = document.getElementById(linkTextId); - var options = WebGUI.AssetManager.buildMoreMenu(url, more); + var options = WebGUI.AssetManager.buildMoreMenu(url, more, isNotLocked); var menu = new YAHOO.widget.Menu( "crumbMoreMenu", options ); menu.render( document.getElementById( 'assetManager' ) );