From 68bde02f28359031ed96c92334f9407bf90410ab Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Thu, 15 Jul 2010 15:37:56 -0500 Subject: [PATCH] add paste action to clipboard items --- www/extras/admin/admin.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 */