In the AssetManager, do not show the Edit link in the More menu if the asset is locked.

This commit is contained in:
Colin Kuskie 2009-02-11 04:42:15 +00:00
parent 1edc66367e
commit 0fa1ec4901
3 changed files with 11 additions and 6 deletions

View file

@ -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

View file

@ -428,8 +428,9 @@ ENDHTML
}
# And ourself
$output .= sprintf q{<li><a href="#" onclick="WebGUI.AssetManager.showMoreMenu('%s','crumbMoreMenuLink'); return false;"><span id="crumbMoreMenuLink">%s</span></a></li>},
$output .= sprintf q{<li><a href="#" onclick="WebGUI.AssetManager.showMoreMenu('%s','crumbMoreMenuLink', %s); return false;"><span id="crumbMoreMenuLink">%s</span></a></li>},
$currentAsset->getUrl,
($currentAsset->canEdit && $currentAsset->canEditIfLocked ? 1 : 0),
$currentAsset->get( "menuTitle" ),
;
$output .= '</ol>';

View file

@ -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( /<url>/ )
? rawItems[i].url.replace( /<url>(?:\?(.*))?/, 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' ) );