Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r0751e64daecb64ee15d7c004a66b3ad5c8b6e26a -r6ad9d70c6f0a8834f64e481b6099497b41326120 --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 0751e64daecb64ee15d7c004a66b3ad5c8b6e26a) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 6ad9d70c6f0a8834f64e481b6099497b41326120) @@ -895,4 +895,10 @@ authoring.application.exercise.allow.multiple.responses.tooltip =When learners are allowed to select multiple answers the grade is the sum of the grade for all correct responses selected. message.teacher.role.not.recognized =Please wait for a teacher to start the lesson. (You were logged in as a learner, as your current role does not conform LTI specification). +label.multiple.lessons =Multiple lessons +label.add.lessons.to.subgroups =Add lessons to all these subgroups +label. +label. +label. + #======= End labels: Exported 872 labels for en AU ===== Index: lams_central/src/java/org/lamsfoundation/lams/web/HomeController.java =================================================================== diff -u -r587ed647f8d1a0410710ce167369607c1eb57c45 -r6ad9d70c6f0a8834f64e481b6099497b41326120 --- lams_central/src/java/org/lamsfoundation/lams/web/HomeController.java (.../HomeController.java) (revision 587ed647f8d1a0410710ce167369607c1eb57c45) +++ lams_central/src/java/org/lamsfoundation/lams/web/HomeController.java (.../HomeController.java) (revision 6ad9d70c6f0a8834f64e481b6099497b41326120) @@ -66,6 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.WebApplicationContext; @@ -245,9 +246,8 @@ @RequestMapping("/addLesson") @SuppressWarnings("unchecked") - public String addLesson(HttpServletRequest req, HttpServletResponse res) + public String addLesson(HttpServletRequest req, HttpServletResponse res, @RequestParam Integer organisationID) throws IOException, UserAccessDeniedException, RepositoryCheckedException { - Integer organisationID = new Integer(WebUtil.readIntParam(req, "organisationID")); UserDTO userDTO = getUser(); if (!securityService.isGroupMonitor(organisationID, userDTO.getUserID(), "add lesson", false)) { res.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the organisation"); @@ -286,7 +286,6 @@ users.withArray("unselectedMonitors").add(userJSON); } } - req.setAttribute("users", users.toString()); // find lessons which can be set as preceding ones for newly created lesson @@ -300,6 +299,9 @@ } } req.setAttribute("availablePrecedingLessons", availableLessons); + + // find subgroups which can be set as multiple lessons start + req.setAttribute("subgroups", organisation.getChildOrganisations()); return "addLesson"; } Index: lams_central/web/addLesson.jsp =================================================================== diff -u -rae05b164c9f505d387c1e49c02a36c4e92861150 -r6ad9d70c6f0a8834f64e481b6099497b41326120 --- lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision ae05b164c9f505d387c1e49c02a36c4e92861150) +++ lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision 6ad9d70c6f0a8834f64e481b6099497b41326120) @@ -103,6 +103,7 @@ +
@@ -158,43 +159,43 @@
+ - +
-
-
- -
-
-
-
- -
- - - -
- -
+
+
+
+
+
+
+ +
+ +
+ +
+
@@ -205,67 +206,101 @@
+ +
-
+
+ +
- - + +
- - + +
+ + + +
+
+
+ +
+ + +
+ +
+
+
+
+
-
+
+ +
-
-
+
+ +
+
+ +
Index: lams_central/web/includes/javascript/addLesson.js =================================================================== diff -u -rae05b164c9f505d387c1e49c02a36c4e92861150 -r6ad9d70c6f0a8834f64e481b6099497b41326120 --- lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision ae05b164c9f505d387c1e49c02a36c4e92861150) +++ lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 6ad9d70c6f0a8834f64e481b6099497b41326120) @@ -386,12 +386,19 @@ // copy CKEditor contents to textarea for submit $('#introDescription').val(CKEDITOR.instances['introDescription'].getData()); + + //handle multiple lessons feature + if ($(".multiple-lessons:checked").length) { + //don't send main organisation's id to the server in case other multiple lessons are chosen + $("#organisation-id").prop("disabled", true); + } submitInProgress = true; $('#lessonForm').ajaxSubmit({ 'success' : function(){ window.parent.closeDialog('dialogAddLesson', true); - }}); + } + }); } function previewLesson(){ Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringController.java =================================================================== diff -u -r29efbf8dd9d499c948e51a97d560c5d6d1cbf0af -r6ad9d70c6f0a8834f64e481b6099497b41326120 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringController.java (.../MonitoringController.java) (revision 29efbf8dd9d499c948e51a97d560c5d6d1cbf0af) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringController.java (.../MonitoringController.java) (revision 6ad9d70c6f0a8834f64e481b6099497b41326120) @@ -96,6 +96,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; @@ -288,16 +289,14 @@ } @RequestMapping("/addLesson") - public String addLesson(HttpServletRequest request, HttpServletResponse response) + public String addLesson(HttpServletRequest request, HttpServletResponse response, + @RequestParam String lessonName, @RequestParam long learningDesignID) throws IOException, ServletException, ParseException { - String lessonName = request.getParameter("lessonName"); if (!ValidationUtil.isOrgNameValid(lessonName)) { throw new IOException("Lesson name contains invalid characters"); } - - int organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID); - long ldId = WebUtil.readLongParam(request, AttributeNames.PARAM_LEARNINGDESIGN_ID); - + + String[] organisationIdsStr = request.getParameterValues(AttributeNames.PARAM_ORGANISATION_ID); boolean introEnable = WebUtil.readBooleanParam(request, "introEnable", false); String introDescription = introEnable ? request.getParameter("introDescription") : null; boolean introImage = introEnable && WebUtil.readBooleanParam(request, "introImage", false); @@ -333,94 +332,99 @@ Integer timeLimitLesson = timeLimitEnable && !timeLimitIndividualField ? timeLimitDays : null; boolean gradebookOnComplete = WebUtil.readBooleanParam(request, "gradebookOnComplete", false); - Organisation organisation = (Organisation) userManagementService.findById(Organisation.class, organisationId); Integer userId = getUserId(); User creator = (User) userManagementService.findById(User.class, userId); - List allUsers = userManagementService.getUsersFromOrganisation(organisationId); - List learners = parseUserList(request, "learners", allUsers); - String learnerGroupName = organisation.getName() + " learners"; + for (String organisationIdStr : organisationIdsStr) { + Integer organisationId = Integer.parseInt(organisationIdStr); + Organisation organisation = (Organisation) userManagementService.findById(Organisation.class, + organisationId); + List organisationUsers = userManagementService.getUsersFromOrganisation(organisationId); + List learners = parseUserList(request, "learners", organisationUsers); + String learnerGroupName = organisation.getName() + " learners"; - List staff = parseUserList(request, "monitors", allUsers); - // add the creator as staff, if not already done - if (!staff.contains(creator)) { - staff.add(creator); - } - String staffGroupName = organisation.getName() + " staff"; + List staff = parseUserList(request, "monitors", organisationUsers); + // add the creator as staff, if not already done + if (!staff.contains(creator)) { + staff.add(creator); + } + String staffGroupName = organisation.getName() + " staff"; - // either all users participate in a lesson, or we split them among instances - List lessonInstanceLearners = splitNumberLessons == null ? learners - : new ArrayList<>((learners.size() / splitNumberLessons) + 1); - for (int lessonIndex = 1; lessonIndex <= (splitNumberLessons == null ? 1 : splitNumberLessons); lessonIndex++) { - String lessonInstanceName = lessonName; - String learnerGroupInstanceName = learnerGroupName; - String staffGroupInstanceName = staffGroupName; + // either all users participate in a lesson, or we split them among instances + List lessonInstanceLearners = splitNumberLessons == null ? learners + : new ArrayList<>((learners.size() / splitNumberLessons) + 1); + for (int lessonIndex = 1; lessonIndex <= (splitNumberLessons == null ? 1 + : splitNumberLessons); lessonIndex++) { + String lessonInstanceName = lessonName; + String learnerGroupInstanceName = learnerGroupName; + String staffGroupInstanceName = staffGroupName; - if (splitNumberLessons != null) { - // prepare data for lesson split - lessonInstanceName += " " + lessonIndex; - learnerGroupInstanceName += " " + lessonIndex; - staffGroupInstanceName += " " + lessonIndex; - lessonInstanceLearners.clear(); - for (int learnerIndex = lessonIndex - 1; learnerIndex < learners - .size(); learnerIndex += splitNumberLessons) { - lessonInstanceLearners.add(learners.get(learnerIndex)); + if (splitNumberLessons != null) { + // prepare data for lesson split + lessonInstanceName += " " + lessonIndex; + learnerGroupInstanceName += " " + lessonIndex; + staffGroupInstanceName += " " + lessonIndex; + lessonInstanceLearners.clear(); + for (int learnerIndex = lessonIndex - 1; learnerIndex < learners + .size(); learnerIndex += splitNumberLessons) { + lessonInstanceLearners.add(learners.get(learnerIndex)); + } } - } - if (MonitoringController.log.isDebugEnabled()) { - MonitoringController.log.debug("Creating lesson " - + (splitNumberLessons == null ? "" : "(" + lessonIndex + "/" + splitNumberLessons + ") ") + "\"" - + lessonInstanceName + "\""); - } - - Lesson lesson = null; - try { - lesson = monitoringService.initializeLesson(lessonInstanceName, introDescription, ldId, organisationId, - userId, null, introEnable, introImage, presenceEnable, imEnable, enableLiveEdit, - notificationsEnable, forceRestart, allowRestart, gradebookOnComplete, timeLimitIndividual, - precedingLessonId); - - monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation, - learnerGroupInstanceName, lessonInstanceLearners, staffGroupInstanceName, staff, userId); - } catch (SecurityException e) { - try { - response.sendError(HttpServletResponse.SC_FORBIDDEN, - "User is not a monitor in the organisation or lesson"); - } catch (IllegalStateException e1) { - MonitoringController.log - .warn("Tried to tell user that \"User is not a monitor in the organisation or lesson\"," - + "but the HTTP response was already written, probably by some other error"); + if (log.isDebugEnabled()) { + log.debug("Creating lesson " + + (splitNumberLessons == null ? "" : "(" + lessonIndex + "/" + splitNumberLessons + ") ") + + "\"" + lessonInstanceName + "\""); } - return null; - } - if (!startMonitor) { + Lesson lesson = null; try { - if (schedulingDatetime == null) { - monitoringService.startLesson(lesson.getLessonId(), userId); - } else { - // if lesson should start in few days, set it here - monitoringService.startLessonOnSchedule(lesson.getLessonId(), schedulingDatetime, userId); - } + lesson = monitoringService.initializeLesson(lessonInstanceName, introDescription, learningDesignID, + organisationId, userId, null, introEnable, introImage, presenceEnable, imEnable, + enableLiveEdit, notificationsEnable, forceRestart, allowRestart, gradebookOnComplete, + timeLimitIndividual, precedingLessonId); - // monitor has given an end date/time for the lesson - if (schedulingEndDatetime != null) { - monitoringService.finishLessonOnSchedule(lesson.getLessonId(), schedulingEndDatetime, userId); - // if lesson should finish in few days, set it here - } else if (timeLimitLesson != null) { - monitoringService.finishLessonOnSchedule(lesson.getLessonId(), timeLimitLesson, userId); - } - + monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation, + learnerGroupInstanceName, lessonInstanceLearners, staffGroupInstanceName, staff, userId); } catch (SecurityException e) { try { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson"); + response.sendError(HttpServletResponse.SC_FORBIDDEN, + "User is not a monitor in the organisation or lesson"); } catch (IllegalStateException e1) { - MonitoringController.log.warn("Tried to tell user that \"User is not a monitor in the lesson\"," + log.warn("Tried to tell user that \"User is not a monitor in the organisation or lesson\"," + "but the HTTP response was already written, probably by some other error"); } return null; } + + if (!startMonitor) { + try { + if (schedulingDatetime == null) { + monitoringService.startLesson(lesson.getLessonId(), userId); + } else { + // if lesson should start in few days, set it here + monitoringService.startLessonOnSchedule(lesson.getLessonId(), schedulingDatetime, userId); + } + + // monitor has given an end date/time for the lesson + if (schedulingEndDatetime != null) { + monitoringService.finishLessonOnSchedule(lesson.getLessonId(), schedulingEndDatetime, + userId); + // if lesson should finish in few days, set it here + } else if (timeLimitLesson != null) { + monitoringService.finishLessonOnSchedule(lesson.getLessonId(), timeLimitLesson, userId); + } + + } catch (SecurityException e) { + try { + response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson"); + } catch (IllegalStateException e1) { + log.warn("Tried to tell user that \"User is not a monitor in the lesson\"," + + "but the HTTP response was already written, probably by some other error"); + } + return null; + } + } } } @@ -653,8 +657,8 @@ return; } - if (MonitoringController.log.isDebugEnabled()) { - MonitoringController.log.debug("Force complete for learners " + learnerIdNameBuf.toString() + " lesson " + if (log.isDebugEnabled()) { + log.debug("Force complete for learners " + learnerIdNameBuf.toString() + " lesson " + lessonId + ". " + message); } @@ -853,11 +857,11 @@ } if (result) { - MonitoringController.log.info((add ? "Added a " : "Removed a ") + role + " with ID " + userId - + (add ? " to" : " from") + " lesson " + lessonId); + log.info((add ? "Added a " : "Removed a ") + role + " with ID " + userId + (add ? " to" : " from") + + " lesson " + lessonId); } else { - MonitoringController.log.warn("Failed when trying to " + (add ? "add a " : "remove a ") + role + " with ID " - + userId + (add ? " to" : " from") + " lesson " + lessonId); + log.warn("Failed when trying to " + (add ? "add a " : "remove a ") + role + " with ID " + userId + + (add ? " to" : " from") + " lesson " + lessonId); } }