diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index cdb143c37..c055c4601 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -10,6 +10,7 @@ - fixed #12133: RenderThingData macro doesn't accept templateId - fixed #12152: PayPal Standard ignores shop-credit - fixed #12119: Locale setting for paypal + - fixed #12156: Asset Manager performance 7.10.17 - fixed: Forced to use a PayDriver even with a balance of 0 in the cart. diff --git a/www/extras/yui-webgui/build/assetManager/assetManager.js b/www/extras/yui-webgui/build/assetManager/assetManager.js index eb418c639..4844d1159 100644 --- a/www/extras/yui-webgui/build/assetManager/assetManager.js +++ b/www/extras/yui-webgui/build/assetManager/assetManager.js @@ -7,6 +7,7 @@ if ( typeof WebGUI == "undefined" ) { WebGUI = {}; } + if ( typeof WebGUI.AssetManager == "undefined" ) { WebGUI.AssetManager = {}; } @@ -82,37 +83,52 @@ WebGUI.AssetManager.findRow = function ( child ) { } }; +WebGUI.AssetManager.assetActionCache = {}; + /*--------------------------------------------------------------------------- WebGUI.AssetManager.formatActions ( ) Format the Edit and More links for the row */ WebGUI.AssetManager.formatActions = function ( elCell, oRecord, oColumn, orderNumber ) { - if ( oRecord.getData( 'actions' ) ) { - elCell.innerHTML - = '' - + WebGUI.AssetManager.i18n.get('Asset', 'edit') + '' - + ' | ' - ; - } - else { - elCell.innerHTML = ""; - } - var more = document.createElement( 'a' ); - elCell.appendChild( more ); - more.appendChild( document.createTextNode( WebGUI.AssetManager.i18n.get('Asset','More' ) ) ); - more.href = '#'; + var data = oRecord.getData(), + id = data.assetId, + assets = WebGUI.AssetManager.assetActionCache, + asset = assets[id], + edit, more; - // Delete the old menu - if ( document.getElementById( 'moreMenu' + oRecord.getData( 'assetId' ) ) ) { - var oldMenu = document.getElementById( 'moreMenu' + oRecord.getData( 'assetId' ) ); - oldMenu.parentNode.removeChild( oldMenu ); + elCell.innerHTML = ''; + + if (!data.actions) { + return; } - var options = WebGUI.AssetManager.buildMoreMenu(oRecord.getData( 'url' ), more, oRecord.getData( 'actions' )); + if (!asset) { + assets[id] = asset = {}; + asset.data = data; + asset.bar = document.createTextNode(' | '); - var menu = new YAHOO.widget.Menu( "moreMenu" + oRecord.getData( 'assetId' ), options ); - 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 ); + edit = asset.edit = document.createElement('a'); + edit.href = WebGUI.AssetManager.appendToUrl( + data.url, 'func=edit;proceed=manageAssets' + ); + edit.appendChild(document.createTextNode( + WebGUI.AssetManager.i18n.get('Asset', 'edit') + )); + + more = asset.more = document.createElement('a'); + more.href = '#'; + more.appendChild(document.createTextNode( + WebGUI.AssetManager.i18n.get('Asset','More') + )); + + YAHOO.util.Event.addListener( + more, 'click', WebGUI.AssetManager.onMoreClick, asset + ); + } + + elCell.appendChild(asset.edit); + elCell.appendChild(asset.bar); + elCell.appendChild(asset.more); }; /*--------------------------------------------------------------------------- @@ -171,6 +187,21 @@ WebGUI.AssetManager.formatRank = function ( elCell, oRecord, oColumn, orderNumbe + 'onchange="WebGUI.AssetManager.selectRow( this )" />'; }; +/*--------------------------------------------------------------------------- + WebGUI.AssetManager.onMoreClick ( event, asset ) + Event handler for the more menu's click event +*/ +WebGUI.AssetManager.onMoreClick = function (e, a) { + var options, menu = a.menu, d = a.data; + YAHOO.util.Event.stopEvent(e); + if (!menu) { + options = WebGUI.AssetManager.buildMoreMenu(d.url, a.more, d.actions); + a.menu = menu = new YAHOO.widget.Menu('assetMenu'+d.assetId, options); + menu.render(document.getElementById('assetManager')); + } + menu.show(); + menu.focus(); +}; /*--------------------------------------------------------------------------- WebGUI.AssetManager.DefaultSortedBy ( )