the 'cut' drop down (AssetHelper) operation basically worked, but the screen wasn't redrawn after the change, and the JSON returned during Fork polling in WebGUI::AssetHelper::Cut didn't match what the YAHOO.WebGUI.Fork.poll callback in WebGUI.Admin.prototype.openForkDialog was expecting so status communication had to be wired up. wG::ProgressTree exposes 'flat' now too for the sake of computing a progress bar. looking at only the roots nodes is ineffective; in this case, the number of root nodes would only ever be 1 though the number of child nodes to be processed could be much higher. WebGUI.Admin.prototype.openForkDialog's callback to YAHOO.WebGUI.Fork.poll handles a status JSON message (JSON inside of JSON, ugh) of "reload" and there's an admin.reload() method now. that's also callable from WebGUI.Admin.prototype.processPlugin and was done in the style of its handlers.

This commit is contained in:
Scott Walters 2013-09-13 15:52:53 -05:00
parent 3061626753
commit 8be9ed7d59
3 changed files with 81 additions and 6 deletions

View file

@ -171,7 +171,6 @@ WebGUI.Admin = function(cfg){
}
} );
};
/**
@ -288,6 +287,27 @@ WebGUI.Admin.prototype.gotoAsset
}
};
/**
* reload()
* Open the appropriate tab (View or Tree) and force a reload of the current URL
*/
WebGUI.Admin.prototype.reload
= function () {
if ( this.tabBar.get('activeIndex') > 1 ) {
this.tabBar.selectTab( 0 );
this.currentTab = "view";
}
if ( this.currentTab == "view" ) {
window.frames[ "view" ].location.reload(1);
this.treeDirty = 1;
}
else if ( this.currentTab == "tree" ) {
// Make tree request
this.tree.goto( window.frames[ "view" ].location.href );
this.viewDirty = 1;
}
};
/**
* showView ( [url] )
* Open the view tab, optionally navigating to the given URL
@ -695,6 +715,7 @@ WebGUI.Admin.prototype.requestHelper
* scriptFile : Load a JS file
* scriptFunc : Run a JS function. Used with scriptFile
* scriptArgs : Arguments to scriptFunc. Used with scriptFile
* reload : Reload the current page eg after an asset cut or paste
*/
WebGUI.Admin.prototype.processPlugin
= function ( resp ) {
@ -719,6 +740,9 @@ WebGUI.Admin.prototype.processPlugin
else if ( resp.redirect ) {
this.gotoAsset( resp.redirect );
}
else if ( resp.reload ) {
this.reload();
}
else {
alert( "Unknown plugin response: " + YAHOO.lang.JSON.stringify(resp) );
}
@ -851,6 +875,7 @@ WebGUI.Admin.prototype.openForkDialog
url : '?op=fork;pid=' + forkId,
draw : function(data) {
var status = YAHOO.lang.JSON.parse( data.status );
// console.log(status);
if ( status ) {
pbTaskBar.set( 'maxValue', status.total );
pbTaskBar.set( 'value', status.finished );
@ -859,10 +884,15 @@ WebGUI.Admin.prototype.openForkDialog
},
finish : function(data){
var status = YAHOO.lang.JSON.parse( data.status );
// console.log(status);
if ( status.redirect ) {
alert("Dispensing product...");
// alert("Dispensing product...");
window.admin.gotoAsset( status.redirect );
}
if ( status.reload ) {
// alert("Reload requested...");
window.admin.reload();
}
dialog.destroy();
dialog = null;
// TODO: Handle the last request of the forked process
@ -1877,6 +1907,8 @@ WebGUI.Admin.Tree.prototype.runHelperForSelected
var self = this;
var assetIds = this.getSelected();
// alert("ok");
// Open the dialog with two progress bars
var dialog = new YAHOO.widget.Panel( 'helperForkModalDialog', {
"width" : '350px',