Index: umc/js/setup.js
===================================================================
--- umc/js/setup.js (Revision 53215)
+++ umc/js/setup.js (Arbeitskopie)
@@ -363,13 +363,9 @@
load: function() {
// get settings from server
- this.standby(true);
- return this.umcpCommand('setup/load').then(lang.hitch(this, function(data) {
+ return this.standbyDuring(this.umcpCommand('setup/load')).then(lang.hitch(this, function(data) {
// update setup pages with loaded values
this.setValues(data.result);
- this.standby(false);
- }), lang.hitch(this, function() {
- this.standby(false);
}));
},
@@ -501,7 +497,7 @@
};
// function to locally validate the pages
- var _localValidation = function() {
+ var _localValidation = lang.hitch(this, function() {
var allValid = true;
var validationMessage = '
' + _('The following entries could not be validated:') + '
';
array.forEach(this._pages, function(ipage) {
@@ -525,10 +521,10 @@
_alert(validationMessage);
throw new Error('Validation failed!');
}
- };
+ });
// function to confirm changes
- var _confirmChanges = function(values, summaries) {
+ var _confirmChanges = lang.hitch(this, function(values, summaries) {
// first see which message needs to be displayed for the confirmation message
tools.forIn(values, function(ikey) {
array.forEach(summaries, function(idesc) {
@@ -560,10 +556,10 @@
throw new CancelDialogException();
}
}));
- };
+ });
// function for server side validation of user changes
- var _remoteValidation = function(values, summaries) {
+ var _remoteValidation = lang.hitch(this, function(values, summaries) {
this.standby(true);
return this.umcpCommand('setup/validate', { values: values }).then(lang.hitch(this, function(data) {
var allValid = true;
@@ -606,10 +602,10 @@
_alert(validationMessage);
throw new Error('Validation failed!');
}));
- };
+ });
// function to save data
- var _save = function(values, umc_url) {
+ var _save = lang.hitch(this, function(values, umc_url) {
var deferred = new Deferred();
// send save command to server
@@ -639,22 +635,22 @@
return deferred.then(lang.hitch(this, function() {
this.standby(false);
}));
- };
+ });
// ask user whether UMC server components shall be restarted or not
- var _restart = function() {
+ var _restart = lang.hitch(this, function() {
libServer.askRestart(_('The changes have been applied successfully.'));
this.load(); // sets 'standby(false)'
- };
+ });
// notify user that saving was successful
- var _success = function() {
+ var _success = lang.hitch(this, function() {
this.addNotification(_('The changes have been applied successfully.'));
this.load(); // sets 'standby(false)'
- };
+ });
// tell user that saving was not successful (has to confirm)
- var _failure = function(errorHtml) {
+ var _failure = lang.hitch(this, function(errorHtml) {
var msg = _('Not all changes could be applied successfully:') + errorHtml;
var choices = [{
name: 'apply',
@@ -664,10 +660,10 @@
return dialog.confirm(msg, choices).then(lang.hitch(this, function() {
this.load(); // sets 'standby(false)'
}));
- };
+ });
// show success/error message and eventually restart UMC server components
- var _checkForErrorsDuringSave = function(values) {
+ var _checkForErrorsDuringSave = lang.hitch(this, function(values) {
var errors = this._progressBar.getErrors().errors;
if (errors.length) {
// errors have occurred
@@ -696,16 +692,16 @@
return _success();
}
}
- };
+ });
// chain all methods together
var deferred = new Deferred();
deferred.resolve();
- deferred = deferred.then(lang.hitch(this, _localValidation, values));
- deferred = deferred.then(lang.hitch(this, _confirmChanges, values, summaries));
- deferred = deferred.then(lang.hitch(this, _remoteValidation, values, summaries));
- deferred = deferred.then(lang.hitch(this, _save, values, umc_url));
- deferred = deferred.then(lang.hitch(this, _checkForErrorsDuringSave, values));
+ deferred = deferred.then(lang.partial(_localValidation, values));
+ deferred = deferred.then(lang.partial(_confirmChanges, values, summaries));
+ deferred = deferred.then(lang.partial(_remoteValidation, values, summaries));
+ deferred = deferred.then(lang.partial(_save, values, umc_url));
+ deferred = deferred.then(lang.partial(_checkForErrorsDuringSave, values));
deferred.then(
lang.hitch(this, 'standby', false),
lang.hitch(this, 'standby', false)