Working on SCD change time drag ============================================== BEGIN RECOVERY FROM NEW DisplaySchedule ERROR: VScode open files are: Schedule/index.php (No changes) Schedule/MoveClassDialog/MoveClassDialog.phpinc (Changing Move meeting button on line 181) - unsaved. Schedule/ScheduleClass/ScheduleClassUpdate.php (No changes) Schedule/ScheduleClass/ScheduleClassUpdate/MoveClassMeetings.phpinc (No changes) - need to complete update, see line 56 js/site.js (Added function ElementBoundsCorrected) Schedule/schedule.js (Modified ScheduleClassDrop jsReturnCode line 2531 and Element_Unhighlight line 4067) Schedule/schedule2.js (Working on MoveClass_DialogClick line 46) Schedule/schedule3.js (Working on PositionDialog) Schedule/schedule7.js (No changes) Made a copy of the current html folder. Ran WinSCP and a sync to remote. Saw the following files as changed: site.js schedule.js schedule2.js schedule3.js Reversed the upload to a download for these files. Downloaded the original files. This did not fix the error: caught TypeError: Cannot read properties of undefined (reading 'push') at Events_Prepare (schedule.js?datetime=2023-05-02+13%3A08%3A47:1430:41) at DisplaySchedule (schedule.js?datetime=2023-05-02+13%3A08%3A47:550:4) at _Initialize (schedule.js?datetime=2023-05-02+13%3A08%3A47:110:2) at onload ((index):86:178) Emptied the html folder. Downloaded the entire Scheduler folder from the cst site to the html folder. Ran WinSCP to see if changed needed to be made. Sync to local showed no files that mattered. Still got the error. Logged into https://134.29.175.74/Scheduler/ When to Schedule and all was fine. Downloaded a new database backup: scheduler_2023-05-02_13.18.09.sql Restored the database using that file. Workbench locked up. Restarted web services Ran Workbenh and restored database with scheduler_2023-05-02_13.18.09.sql Closed and reopened Chrome, Logged in, went to Schedule. All is fine Ran WinMerge. Checked original site.js against changed copy. There were two changes: Line 152 DEBUG = false, ElementBoundsCorrected function was added. Replaced original site.js with changed. Site still works. Checked original schedule.js against changed copy. jsReturnCode line 2531 was: jsReturnCode = `OpenDialog(${ScheduleCurrent.departmentId}, ${scId}); PositionDialog();`; jsReturnCode += " ScheduleClass_MoveSingleMeetingDiv('ScheduleClassDrop~2519');"; now: jsReturnCode = "ScheduleClass_MoveSingleMeetingDiv('ScheduleClassDrop~2531');"; jsReturnCode += ` OpenDialog(${ScheduleCurrent.departmentId}, ${scId});`; jsReturnCode += ` PositionDialog();`; URI line 3494 was: URI = ROOT_http + '/Schedule/ScheduleClass/ScheduleClassUpdate.php?task=RemoveClass'; now: URI = ROOT_http + '/Schedule/ScheduleClass/ScheduleClassUpdate.php?'; URI += 'task=RemoveClass'; UnhighlightLikeMe() function removed line 4083 Replaced original schedule.js with changed. Site still works. Checked original schedule2.js against changed copy. line added at 19 if ( DEBUG ) { console.log(PC+'SCMnow[scId]='+D_formatJSONstring(SCMnow[scId]),CA); } empty lines added at 46 Replaced original schedule2.js with changed. Site still works. Checked original schedule3.js against changed copy. lines added at 15 let dragElementBounds = ElementBounds(dragElement.id); if ( DEBUG ) { console.log(`${PC}dragElementBounds=${D_formatJSONstring(dragElementBounds)}`,CL); } let dragElementBoundsCorrected = ElementBoundsCorrected(dragElement.id); if ( DEBUG ) { console.log(`${PC}dragElementBoundsCorrected=${D_formatJSONstring(dragElementBoundsCorrected)}`,CL); } posY line 19 was: let posY = dragElement.mY - ( dialogDivBounds.height / 2 ); now: let posY = dragElementBoundsCorrected.top- ( dialogDivBounds.height );//dragElement.mY - ( dialogDivBounds.height ); Replaced original schedule3.js with changed. Site still works. Conclusion: Must have been database corruption. END RECOVERY FROM NEW DisplaySchedule ERROR: ============================================== Continue working with schedule3.js PositionDialog() function. AJAX call example: // BEGIN Make AJAX call. // Build the URL for the AJAX call if ( DEBUG ) { console.log('BEGIN Make AJAX call.'); } URI = ROOT_http + '/Schedule/ScheduleClass/ScheduleClassUpdate.php?'; URI += 'task=MoveClassMeeting'; URI += '&scId='+scId; URI += '&scmId='+scmId; URI += '&bTime='+SCMnow[scId][scmIndex].bTime; URI += '&eTime='+SCMnow[scId][scmIndex].eTime; var days = ''; for ( var di=0; di Move the T 9:45am - 11:00am meeting to T 11:30am - 12:45pm Start: SCMnow[scId]=[ {"scmId":"4474","sDate":"2019-08-26","eDate":"2019-12-20","arranged":false,"bTime":"09:45:00","eTime":"11:00:00","onCampus":"1","rooms":["325","B48"],"days":[],"instructors":["20"],"tdMinute":570} , {"scmId":"_4474_0","sDate":"2019-08-26","eDate":"2019-12-20","arranged":false,"bTime":"11:30:00","eTime":"12:45:00","onCampus":"1","rooms":["325","B48"],"days":["T","H"],"instructors":["20"],"tdMinute":690,"dayDiff":0,"mbTimeDiff":105} ] End: SCMnow[scId]=[ {"scmId":"4474","sDate":"2019-08-26","eDate":"2019-12-20","arranged":false,"bTime":"09:45:00","eTime":"11:00:00","onCampus":"1","rooms":["325","B48"],"days":["H"],"instructors":["20"],"tdMinute":570} , {"scmId":"4474","sDate":"2019-08-26","eDate":"2019-12-20","arranged":false,"bTime":"09:45:00","eTime":"11:00:00","onCampus":"1","rooms":["325","B48"],"days":["T"],"instructors":["20"],"tdMinute":585} ] EventListeners_Remove() 2155 3420 AutoscrollPage() Need to fix autoscroll issues. schedule.js search for scrollTo Fixed drag/drop for 1 meeting class working on // Restore original calendar_class div Ids. ScheduleClassDrop() Dialog cancel => schedule3 Created PositionDialog(). Need to ensure element is in the viewport $f (11 elements) = MoveClassMeetings.phpinc:36 (C:\CST2146\nginx\html\Schedule\ScheduleClass\ScheduleClassUpdate\MoveClassMeetings.phpinc) $f['DEBUG'] == 1 $f['difference_day'] == 0 $f['difference_mTime'] == +105 $f['form'] == 'Schedule_form' $f['moveMeeting_3'] == 'T' $f['moveMeeting_5'] == 'H' $f['scheduleclassId'] == 2465 $f['scheduleclassmeetingId'] == 4474 $f['subtask'] is NULL $f['task'] == 'Move meetings' $f['uuid'] == '0e02d37232dd67c7a8a3b3fc74aeaeaa' var mX = mouseX(evt); mXprevious = mX; var mY = mouseY(evt); mYprevious = mY; dragElementTL = ElementBounds(dragElement.id,'schedule.js 1449'); schedulecontainerTL = ElementBounds('schedulecontainer','schedule.js 1455'); scrollTL = ScrollLeftTop(); viewportTL = {}; viewportTL.width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); viewportTL.height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);