bundles/org.eclipse.orion.client.cf/web/cfui/cfUtil.js
function(options){
			var cFService = options.cFService;

			var showMessage = options.showMessage;
			var hideMessage = options.hideMessage;
			var showError = options.showError;
			var render = options.render;

			var self = this;
			var handleError = function(error, target, retryFunc){
				error = self.defaultDecorateError(error, target);
				showError(error);

				if(error.Retry && error.Retry.parameters){

					var paramInputs = {};
					function submitParams(){

						var params = {};
						error.Retry.parameters.forEach(function(param){
							if(param.hidden)
								params[param.id] = param.value;
							else
								params[param.id] = paramInputs[param.id].value;
						});

						/* handle login errors */
						if(params.url && params.user && params.password){
							showMessage(i18Util.formatMessage(messages["loggingInTo${0}..."], params.url));
							cFService.login(params.url, params.user, params.password).then(function(result){

								hideMessage();
								if(retryFunc)
									retryFunc(result);

							}, function(newError){
								hideMessage();
								if(newError.HttpCode === 401)
									handleError(error, target, retryFunc);
								else
									handleError(newError, target, retryFunc);
							});
						}
					}

					var fields = document.createElement("div"); //$NON-NLS-0$
					fields.className = "retryFields"; //$NON-NLS-0$
					var firstField;

					error.Retry.parameters.forEach(function(param, i){
						if(!param.hidden){

							var div = document.createElement("div"); //$NON-NLS-0$
							var label = document.createElement("label"); //$NON-NLS-0$
							label.appendChild(document.createTextNode(param.name));

							var input = document.createElement("input"); //$NON-NLS-0$
							if(i===0)
								firstField = input;

							input.type = param.type;
							input.id = param.id;
							input.onkeydown = function(event){
								if(event.keyCode === 13)
									submitParams();
								else if(event.keyCode === 27)
									hideMessage();
							};

							paramInputs[param.id] = input;
							div.appendChild(label);
							div.appendChild(input);
							fields.appendChild(div);
						}
					});

					var submitButton = document.createElement("button"); //$NON-NLS-0$
					submitButton.appendChild(document.createTextNode(messages["submit"]));
					submitButton.onclick = submitParams;

					fields.appendChild(submitButton);
					render(fields);

					if(firstField)
						firstField.focus();
				}
			};

			return handleError;
		}
function(options){
			var cFService = options.cFService;

			var showMessage = options.showMessage;
			var hideMessage = options.hideMessage;
			var showError = options.showError;
			var render = options.render;

			var self = this;
			var handleError = function(error, target, retryFunc){
				error = self.defaultDecorateError(error, target);
				showError(error);

				if(error.Retry && error.Retry.parameters){

					var paramInputs = {};
					function submitParams(){

						var params = {};
						error.Retry.parameters.forEach(function(param){
							if(param.hidden)
								params[param.id] = param.value;
							else
								params[param.id] = paramInputs[param.id].value;
						});

						/* handle login errors */
						if(params.url && params.user && params.password){
							showMessage(i18Util.formatMessage(messages["loggingInTo${0}..."], params.url));
							cFService.login(params.url, params.user, params.password).then(function(result){

								hideMessage();
								if(retryFunc)
									retryFunc(result);

							}, function(newError){
								hideMessage();
								if(newError.HttpCode === 401)
									handleError(error, target, retryFunc);
								else
									handleError(newError, target, retryFunc);
							});
						}
					}

					var fields = document.createElement("div"); //$NON-NLS-0$
					fields.className = "retryFields"; //$NON-NLS-0$
					var firstField;

					error.Retry.parameters.forEach(function(param, i){
						if(!param.hidden){

							var div = document.createElement("div"); //$NON-NLS-0$
							var label = document.createElement("label"); //$NON-NLS-0$
							label.appendChild(document.createTextNode(param.name));

							var input = document.createElement("input"); //$NON-NLS-0$
							if(i===0)
								firstField = input;

							input.type = param.type;
							input.id = param.id;
							input.onkeydown = function(event){
								if(event.keyCode === 13)
									submitParams();
								else if(event.keyCode === 27)
									hideMessage();
							};

							paramInputs[param.id] = input;
							div.appendChild(label);
							div.appendChild(input);
							fields.appendChild(div);
						}
					});

					var submitButton = document.createElement("button"); //$NON-NLS-0$
					submitButton.appendChild(document.createTextNode(messages["submit"]));
					submitButton.onclick = submitParams;

					fields.appendChild(submitButton);
					render(fields);

					if(firstField)
						firstField.focus();
				}
			};

			return handleError;
		}
function ( options ) { var cFService = options . cFService ; var showMessage = options . showMessage ; var hideMessage = options . hideMessage ; var showError = options . showError ; var render = options . render ; var self = this ; var handleError = function ( error , target , retryFunc ) { error = self . defaultDecorateError ( error , target ) ; showError ( error ) ; if ( error . Retry && error . Retry . parameters ) { var paramInputs = { } ; function submitParams ( ) { var params = { } ; error . Retry . parameters . forEach ( function ( param ) { if ( param . hidden ) params [ param . id ] = param . value ; else params [ param . id ] = paramInputs [ param . id ] . value ; } ) ; /* handle login errors */ if ( params . url && params . user && params . password ) { showMessage ( i18Util . formatMessage ( messages [ "loggingInTo${0}..." ] , params . url ) ) ; cFService . login ( params . url , params . user , params . password ) . then ( function ( result ) { hideMessage ( ) ; if ( retryFunc ) retryFunc ( result ) ; } , function ( newError ) { hideMessage ( ) ; if ( newError . HttpCode === 401 ) handleError ( error , target , retryFunc ) ; else handleError ( newError , target , retryFunc ) ; } ) ; } } var fields = document . createElement ( "div" ) ; //$NON-NLS-0$ fields . className = "retryFields" ; //$NON-NLS-0$ var firstField ; error . Retry . parameters . forEach ( function ( param , i ) { if ( ! param . hidden ) { var div = document . createElement ( "div" ) ; //$NON-NLS-0$ var label = document . createElement ( "label" ) ; //$NON-NLS-0$ label . appendChild ( document . createTextNode ( param . name ) ) ; var input = document . createElement ( "input" ) ; //$NON-NLS-0$ if ( i === 0 ) firstField = input ; input . type = param . type ; input . id = param . id ; input . onkeydown = function ( event ) { if ( event . keyCode === 13 ) submitParams ( ) ; else if ( event . keyCode === 27 ) hideMessage ( ) ; } ; paramInputs [ param . id ] = input ; div . appendChild ( label ) ; div . appendChild ( input ) ; fields . appendChild ( div ) ; } } ) ; var submitButton = document . createElement ( "button" ) ; //$NON-NLS-0$ submitButton . appendChild ( document . createTextNode ( messages [ "submit" ] ) ) ; submitButton . onclick = submitParams ; fields . appendChild ( submitButton ) ; render ( fields ) ; if ( firstField ) firstField . focus ( ) ; } } ; return handleError ; }
Builds a default error handler which handles the given error
in the wizard without communication with the parent window.
Builds a default error handler which handles the given error in the wizard without communication with the parent window .