refactor helper processing to use in progressbar
This commit is contained in:
parent
35d05a7f38
commit
105b368b1e
1 changed files with 31 additions and 16 deletions
|
|
@ -431,22 +431,7 @@ WebGUI.Admin.prototype.requestHelper
|
||||||
var callback = {
|
var callback = {
|
||||||
success : function (o) {
|
success : function (o) {
|
||||||
var resp = YAHOO.lang.JSON.parse( o.responseText );
|
var resp = YAHOO.lang.JSON.parse( o.responseText );
|
||||||
|
this.processHelper( resp );
|
||||||
if ( resp.openTab ) {
|
|
||||||
this.openTab( resp.openTab );
|
|
||||||
}
|
|
||||||
else if ( resp.openDialog ) {
|
|
||||||
this.openModalDialog( resp.openDialog, resp.width, resp.height );
|
|
||||||
}
|
|
||||||
else if ( resp.scriptFile ) {
|
|
||||||
this.loadAndRun( resp.scriptFile, resp.scriptFunc, resp.scriptArgs );
|
|
||||||
}
|
|
||||||
else if ( resp.message ) {
|
|
||||||
this.showInfoMessage( resp.message );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
alert( "Unknown helper response: " + resp );
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
failure : function (o) {
|
failure : function (o) {
|
||||||
|
|
||||||
|
|
@ -458,6 +443,36 @@ WebGUI.Admin.prototype.requestHelper
|
||||||
var ajax = YAHOO.util.Connect.asyncRequest( 'GET', url, callback );
|
var ajax = YAHOO.util.Connect.asyncRequest( 'GET', url, callback );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* processHelper( response )
|
||||||
|
* Process the helper response. Possible responses include:
|
||||||
|
* message : A message to the user
|
||||||
|
* error : An error message
|
||||||
|
* openDialog : Open a dialog with the given URL
|
||||||
|
* redirect : Redirect the View pane to the given URL
|
||||||
|
* scriptFile : Load a JS file
|
||||||
|
* scriptFunc : Run a JS function. Used with scriptFile
|
||||||
|
* scriptArgs : Arguments to scriptFunc. Used with scriptFile
|
||||||
|
*/
|
||||||
|
WebGUI.Admin.prototype.processHelper
|
||||||
|
= function ( resp ) {
|
||||||
|
if ( resp.openTab ) {
|
||||||
|
this.openTab( resp.openTab );
|
||||||
|
}
|
||||||
|
else if ( resp.openDialog ) {
|
||||||
|
this.openModalDialog( resp.openDialog, resp.width, resp.height );
|
||||||
|
}
|
||||||
|
else if ( resp.scriptFile ) {
|
||||||
|
this.loadAndRun( resp.scriptFile, resp.scriptFunc, resp.scriptArgs );
|
||||||
|
}
|
||||||
|
else if ( resp.message ) {
|
||||||
|
this.showInfoMessage( resp.message );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert( "Unknown helper response: " + resp );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* openModalDialog( url, width, height )
|
* openModalDialog( url, width, height )
|
||||||
* Open a modal dialog with an iframe containing the given URL.
|
* Open a modal dialog with an iframe containing the given URL.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue