Index: lams_monitoring/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rc95c723dea03ae1643682c78dda77366ff8f20a1 -rf18741b5a62481b01d469935b3c32ad4cb62fe54 --- lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision c95c723dea03ae1643682c78dda77366ff8f20a1) +++ lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision f18741b5a62481b01d469935b3c32ad4cb62fe54) @@ -472,4 +472,6 @@ button.task.gate.open.now.tooltip = Opens gate immediately button.task.gate.open = Open selectively... button.task.gate.open.tooltip = Choose which learners can go through the gate +button.task.gate.close = Close +button.task.gate.close.tooltip = Immediately closes the gate again label.task.gate.opened = Opened Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== diff -u -r7116e79c883ad42375d9fa3278dec8a84733ea86 -rf18741b5a62481b01d469935b3c32ad4cb62fe54 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 7116e79c883ad42375d9fa3278dec8a84733ea86) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision f18741b5a62481b01d469935b3c32ad4cb62fe54) @@ -378,7 +378,7 @@ Lesson precedingLesson = (precedingLessonId == null) ? null : lessonDAO.getLesson(precedingLessonId); // The duplicated sequence should go in the run sequences folder under the given organisation - Organisation org = (Organisation) baseDAO.find(Organisation.class, organisationId); + Organisation org = baseDAO.find(Organisation.class, organisationId); WorkspaceFolder runSeqFolder = null; int MAX_DEEP_LEVEL_FOLDER = 50; for (int idx = 0; idx < MAX_DEEP_LEVEL_FOLDER; idx++) { @@ -517,7 +517,7 @@ } // Change client/users schedule date to server's timezone. - User user = (User) baseDAO.find(User.class, userId); + User user = baseDAO.find(User.class, userId); TimeZone userTimeZone = TimeZone.getTimeZone(user.getTimeZone()); Date tzStartLessonDate = DateUtil.convertFromTimeZoneToDefault(userTimeZone, startDate); String triggerName = "startLessonOnScheduleTrigger:" + lessonId; @@ -581,7 +581,7 @@ } // Change client/users schedule date to server's timezone. - User user = (User) baseDAO.find(User.class, userId); + User user = baseDAO.find(User.class, userId); TimeZone userTimeZone = TimeZone.getTimeZone(user.getTimeZone()); Date tzEndLessonDate = DateUtil.convertFromTimeZoneToDefault(userTimeZone, userEnteredEndDate); finishLessonOnScheduleAsServerDate(requestedLesson, tzEndLessonDate, userId); @@ -878,7 +878,7 @@ MonitoringService.log.debug("Setting gate schedule for gate " + gateId + "to " + schedulingDatetime); } - User user = (User) baseDAO.find(User.class, userId); + User user = baseDAO.find(User.class, userId); TimeZone userTimeZone = TimeZone.getTimeZone(user.getTimeZone()); Date tzSchedulingDatetime = DateUtil.convertFromTimeZoneToDefault(userTimeZone, schedulingDatetime); @@ -1259,7 +1259,7 @@ gate.setGateOpen(new Boolean(true)); gate.setGateOpenTime(new Date()); if (openerId != null) { - gate.setGateOpenUser((User) baseDAO.find(User.class, openerId)); + gate.setGateOpenUser(baseDAO.find(User.class, openerId)); } // we un-schedule the gate from the scheduler if it's of a scheduled @@ -1284,7 +1284,7 @@ public GateActivity openGateForSingleUser(Long gateId, Integer[] userIds) { GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(gateId); for (Integer userId : userIds) { - User user = (User) baseDAO.find(User.class, userId); + User user = baseDAO.find(User.class, userId); gate.getAllowedToPassLearners().add(user); activityDAO.update(gate); } @@ -1305,7 +1305,7 @@ @Override public GateActivity closeGate(Long gateId) { GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(gateId); - gate.setGateOpen(new Boolean(false)); + gate.setGateOpen(false); gate.setGateOpenUser(null); gate.setGateOpenTime(null); activityDAO.update(gate); @@ -1321,7 +1321,7 @@ securityService.isLessonMonitor(lessonId, requesterId, "force complete", true); } Lesson lesson = lessonDAO.getLesson(Long.valueOf(lessonId)); - User learner = (User) baseDAO.find(User.class, learnerId); + User learner = baseDAO.find(User.class, learnerId); LearnerProgress learnerProgress = learnerService.getProgress(learnerId, lessonId); @@ -1954,8 +1954,7 @@ @Override public List exportArchivedEmailNotification(Long emailNotificationUid) { - EmailNotificationArchive notification = (EmailNotificationArchive) baseDAO.find(EmailNotificationArchive.class, - emailNotificationUid); + EmailNotificationArchive notification = baseDAO.find(EmailNotificationArchive.class, emailNotificationUid); List sheets = new LinkedList<>(); ExcelSheet sheet = new ExcelSheet(messageService.getMessage("email.notifications.archived.export.sheet.name")); @@ -2057,7 +2056,7 @@ Lesson lesson = lessonDAO.getLesson(lessonID); Activity activity = activityDAO.getActivityByActivityId(activityID); - User learner = (User) baseDAO.find(User.class, learnerUserID); + User learner = baseDAO.find(User.class, learnerUserID); String url = null; if ((activity == null) || (learner == null)) { @@ -2187,7 +2186,7 @@ @Override public void createPreviewClassForLesson(int userID, long lessonID) throws UserAccessDeniedException { - User user = (User) baseDAO.find(User.class, userID); + User user = baseDAO.find(User.class, userID); if (user == null) { throw new UserAccessDeniedException("User " + userID + " not found"); } @@ -2337,7 +2336,7 @@ boolean added = false; try { Integer learnerID = new Integer(Integer.parseInt(strlearnerID)); - User learner = (User) baseDAO.find(User.class, learnerID); + User learner = baseDAO.find(User.class, learnerID); if (learner != null) { learners.add(learner); added = true; @@ -2663,7 +2662,7 @@ @Override public Organisation getOrganisation(Integer organisationId) { - return (Organisation) baseDAO.find(Organisation.class, organisationId); + return baseDAO.find(Organisation.class, organisationId); } @Override Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/GateController.java =================================================================== diff -u -r7116e79c883ad42375d9fa3278dec8a84733ea86 -rf18741b5a62481b01d469935b3c32ad4cb62fe54 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/GateController.java (.../GateController.java) (revision 7116e79c883ad42375d9fa3278dec8a84733ea86) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/GateController.java (.../GateController.java) (revision f18741b5a62481b01d469935b3c32ad4cb62fe54) @@ -61,6 +61,8 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; /** *

@@ -140,6 +142,15 @@ } /** + * Close the gate again. + */ + @RequestMapping(path = "/closeGate", method = RequestMethod.POST) + @ResponseBody + public void closeGate(@RequestParam long activityId) { + monitoringService.closeGate(activityId); + } + + /** * Allows a single learner to pass the gate. */ @RequestMapping(path = "/openGateForSingleUser", method = RequestMethod.POST) Index: lams_monitoring/web/css/_monitorLesson_base.scss =================================================================== diff -u -r510cf291f6867875d52184469518fd30b806ee1a -rf18741b5a62481b01d469935b3c32ad4cb62fe54 --- lams_monitoring/web/css/_monitorLesson_base.scss (.../_monitorLesson_base.scss) (revision 510cf291f6867875d52184469518fd30b806ee1a) +++ lams_monitoring/web/css/_monitorLesson_base.scss (.../_monitorLesson_base.scss) (revision f18741b5a62481b01d469935b3c32ad4cb62fe54) @@ -426,6 +426,12 @@ } +.contributeEntryCell .gate-opened { + color: #5cb85c; + font-weight: 700; + margin-right: 10px; +} + /***** Group View Page **/ .group-table>tbody>tr:nth-of-type(odd){ background-color:$brand-primary-light; Index: lams_monitoring/web/includes/javascript/monitorLesson.js =================================================================== diff -u -r29b37b4eef36e73fa22c6af4d0c39219cf8994e1 -rf18741b5a62481b01d469935b3c32ad4cb62fe54 --- lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision 29b37b4eef36e73fa22c6af4d0c39219cf8994e1) +++ lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision f18741b5a62481b01d469935b3c32ad4cb62fe54) @@ -647,7 +647,8 @@ row = $('

').addClass('contributeRow').insertAfter(row).append(cell); $.each(this.contributeEntries, function(){ - var entryContent = ''; + var entryContent = '', + closeable = false; switch (this.contributionType) { case 3 : entryContent = LABELS.CONTRIBUTE_GATE; break; case 6 : entryContent = LABELS.CONTRIBUTE_GROUPING; break; @@ -657,9 +658,17 @@ case 12 : entryContent = LABELS.CONTRIBUTE_GATE_PASSWORD; break; } switch (this.contributionType) { - case 3 : + case 3 : closeable = true; case 12 : if (this.isComplete) { - entryContent += '' + LABELS.CONTRIBUTE_OPENED_GATE + ''; + entryContent += '
' + + LABELS.CONTRIBUTE_OPENED_GATE + + ''; + if (closeable) { + entryContent += '' + } + entryContent += '
'; } else { entryContent += '
'; - } break; default : entryContent += '', CONTRIBUTE_OPEN_GATE_TOOLTIP : '', + + CONTRIBUTE_CLOSE_GATE_BUTTON : '', + + CONTRIBUTE_CLOSE_GATE_TOOLTIP : '', CONTRIBUTE_OPENED_GATE : '',