function submitDeploy()

in web/js/serverprofiles.js [505:638]


function submitDeploy() {
	var cont = dojo.byId('deploycont').value;
	if((dijit.byId('deployimage') && ! dijit.byId('deployimage').isValid()) ||
	   (dijit.byId('deployadmingroup') && ! dijit.byId('deployadmingroup').isValid()) ||
	   (dijit.byId('deploylogingroup') && ! dijit.byId('deploylogingroup').isValid())) {
		alert('Please correct the fields with invalid input');
		return;
	}
	if(dojo.byId('startlater').checked &&
	   (! dijit.byId('deploystarttime').isValid() ||
	   ! dijit.byId('deploystartdate').isValid())) {
		dijit.byId('deploystarttime')._hasBeenBlurred = true;
		dijit.byId('deploystarttime').validate();
		dijit.byId('deploystartdate')._hasBeenBlurred = true;
		dijit.byId('deploystartdate').validate();
		alert('Please correct the fields with invalid input');
		return;
	}
	if(dojo.byId('endat').checked &&
	   (! dijit.byId('deployendtime').isValid() ||
	   ! dijit.byId('deployenddate').isValid())) {
		dijit.byId('deployendtime')._hasBeenBlurred = true;
		dijit.byId('deployendtime').validate();
		dijit.byId('deployenddate')._hasBeenBlurred = true;
		dijit.byId('deployenddate').validate();
		alert('Please correct the fields with invalid input');
		return;
	}
	if(dojo.byId('startlater').checked) {
		var today = new Date();
		today.setMilliseconds(0);
		var testday = dijit.byId('deploystartdate').get('value');
		var tmp = dijit.byId('deploystarttime').get('value');
		testday.setHours(tmp.getHours());
		testday.setMinutes(tmp.getMinutes());
		testday.setSeconds(tmp.getSeconds());
		testday.setMilliseconds(tmp.getMilliseconds());
		if(testday < today) {
			alert('The starting time and date must be in the future.');
			return;
		}
	}
	if(dojo.byId('endat').checked) {
		if(dojo.byId('startlater').checked) {
			var teststart = dijit.byId('deploystartdate').get('value');
			var tmp = dijit.byId('deploystarttime').get('value');
			teststart.setHours(tmp.getHours());
			teststart.setMinutes(tmp.getMinutes());
			teststart.setSeconds(tmp.getSeconds());
			teststart.setMilliseconds(tmp.getMilliseconds());
		}
		else {
			var teststart = new Date();
			teststart.setMilliseconds(0);
		}
		var testend = dijit.byId('deployenddate').get('value');
		var tmp = dijit.byId('deployendtime').get('value');
		testend.setHours(tmp.getHours());
		testend.setMinutes(tmp.getMinutes());
		testend.setSeconds(tmp.getSeconds());
		testend.setMilliseconds(tmp.getMilliseconds());
		if(testend <= teststart) {
			alert('The ending time and date must be later than the starting time and date.');
			return;
		}
	}
	if(dijit.byId('deploybtn').get('label') == 'View Available Times') {
		dijit.byId('suggestDlgBtn').set('disabled', true);
		showSuggestedTimes();
		return;
	}
	var data = {continuation: cont,
	            profileid: dojo.byId('appliedprofileid').value};
	data.name = dijit.byId('deployname').get('value');
	if(dijit.byId('deployimage'))
		data.imageid = dijit.byId('deployimage').get('value');
	else
		data.imageid = dojo.byId('deployimage').value;
	if(dijit.byId('deployadmingroup'))
		data.admingroupid = dijit.byId('deployadmingroup').get('value');
	else
		data.admingroupid = dojo.byId('deployadmingroup').value;
	if(dijit.byId('deploylogingroup'))
		data.logingroupid = dijit.byId('deploylogingroup').get('value');
	else
		data.logingroupid = dojo.byId('deploylogingroup').value;
	data.ipaddr = dijit.byId('deployfixedIP').get('value');
	if(data.ipaddr != '') {
		data.netmask = dijit.byId('deploynetmask').get('value');
		data.router = dijit.byId('deployrouter').get('value');
		data.dns = dijit.byId('deploydns').get('value');
	}
	else {
		data.netmask = '';
		data.router = '';
		data.dns = '';
	}
	//data.macaddr = dijit.byId('deployfixedMAC').get('value');
	/*if(dijit.byId('deploymonitored').get('value') == 'on')
		data.monitored = 1;
	else
		data.monitored = 0;*/
	if(dojo.byId('startnow').checked) {
		data.startmode = 0;
	}
	if(dojo.byId('startlater').checked) {
		data.startmode = 1;
		var time = dijit.byId('deploystarttime').get('value');
		var date = dijit.byId('deploystartdate').get('value');
		data.start = dojox.string.sprintf('%d%02d%02d%02d%02d',
		                                  date.getFullYear(),
		                                  date.getMonth() + 1,
		                                  date.getDate(),
		                                  time.getHours(),
		                                  time.getMinutes());
	}
	if(dojo.byId('endindef').checked) {
		data.endmode = 0;
	}
	if(dojo.byId('endat').checked) {
		data.endmode = 1;
		var time = dijit.byId('deployendtime').get('value');
		var date = dijit.byId('deployenddate').get('value');
		data.end = dojox.string.sprintf('%d%02d%02d%02d%02d',
		                                date.getFullYear(),
		                                date.getMonth() + 1,
		                                date.getDate(),
		                                time.getHours(),
		                                time.getMinutes());
	}
	dijit.byId('deploybtn').set('label', 'Working...');
	dijit.byId('deploybtn').set('disabled', true);
	RPCwrapper(data, submitDeployCB, 1);
}