From d32d452efe15f8d0acc109c44682e1d823683186 Mon Sep 17 00:00:00 2001 From: Scott Walters Date: Thu, 26 Sep 2013 21:23:05 -0500 Subject: [PATCH] change WebGUI.Admin.prototype.processPlugin, which handles messages back from calls to AssetHelper classes, to do any number of little chores according to the message contents rather than just the first one it tests for. change the Lock AssetHelper to both refresh and display a message indicating that the asset is locked. the refresh is needed for tree view which displays a little icon. --- lib/WebGUI/AssetHelper/Lock.pm | 1 + www/extras/admin/admin.js | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/WebGUI/AssetHelper/Lock.pm b/lib/WebGUI/AssetHelper/Lock.pm index 4bdbf76f2..72d2b82e0 100644 --- a/lib/WebGUI/AssetHelper/Lock.pm +++ b/lib/WebGUI/AssetHelper/Lock.pm @@ -55,6 +55,7 @@ sub process { $asset->addRevision; return { message => sprintf($i18n->get('locked asset'), $asset->getTitle), + reload => 1, }; } diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 17b7f0c94..f71352774 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -745,33 +745,34 @@ WebGUI.Admin.prototype.requestHelper */ WebGUI.Admin.prototype.processPlugin = function ( resp ) { + if( ! ( resp.openTab || resp.openDialog || resp.scriptFile || resp.message || resp.error || resp.forkId || resp.redirect || resp.reload ) ) { + alert( "Unknown plugin response: " + YAHOO.lang.JSON.stringify(resp) ); + return; + } if ( resp.openTab ) { this.openTab( resp.openTab ); } - else if ( resp.openDialog ) { + if ( resp.openDialog ) { this.openModalDialog( resp.openDialog, resp.width, resp.height ); } - else if ( resp.scriptFile ) { + if ( resp.scriptFile ) { this.loadAndRun( resp.scriptFile, resp.scriptFunc, resp.scriptArgs ); } - else if ( resp.message ) { + if ( resp.message ) { this.showInfoMessage( resp.message ); } - else if ( resp.error ) { + if ( resp.error ) { this.showInfoMessage( resp.error ); } - else if ( resp.forkId ) { + if ( resp.forkId ) { this.openForkDialog( resp.forkId ); } - else if ( resp.redirect ) { + if ( resp.redirect ) { this.gotoAsset( resp.redirect ); } - else if ( resp.reload ) { + if ( resp.reload ) { this.reload(); } - else { - alert( "Unknown plugin response: " + YAHOO.lang.JSON.stringify(resp) ); - } this.requestUpdateClipboard(); // always do this };