diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 6cf579a6f..3d20d1d3c 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -251,9 +251,32 @@ WebGUI.Admin.prototype.updateClipboard a.appendChild( icon ); a.appendChild( document.createTextNode( asset.title ) ); div.appendChild( a ); + this.addPasteHandler( a, asset.assetId ); } }; +/** + * addPasteHandler( elem, assetId ) + * Add an onclick handler to paste an asset. + */ +WebGUI.Admin.prototype.addPasteHandler += function ( elem, assetId ) { + var self = this; + YAHOO.util.Event.on( elem, "click", function(){ + self.pasteAsset( assetId ); + }, self ); +}; + +/** + * pasteAsset( id ) + * Paste an asset and update the clipboard + */ +WebGUI.Admin.prototype.pasteAsset += function ( id ) { + var url = appendToUrl( this.currentAssetDef.url, 'func=paste;assetId=' + id ); + this.gotoAsset( url ); +}; + /**************************************************************************** * WebGUI.Admin.LocationBar */