Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java,v diff -u -r1.118.2.43 -r1.118.2.44 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 27 Jun 2016 10:01:29 -0000 1.118.2.43 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 8 Aug 2016 16:57:26 -0000 1.118.2.44 @@ -40,6 +40,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; +import java.util.Vector; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -99,7 +100,7 @@ /** * The action servlet that provide all the monitoring functionalities. It interact with the teacher via JSP monitoring * interface. - * + * * @author Jacky Fang */ public class MonitoringAction extends LamsDispatchAction { @@ -385,6 +386,24 @@ return null; } + /** + * Adds all course learners to the given lesson. + */ + @SuppressWarnings("unchecked") + public ActionForward addAllOrganisationLearnersToLesson(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws IOException { + Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + if (!getSecurityService().isLessonMonitor(lessonId, getUserId(), "get lesson learners", false)) { + response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson"); + return null; + } + Lesson lesson = getLessonService().getLesson(lessonId); + Vector learners = getUserManagementService() + .getUsersFromOrganisationByRole(lesson.getOrganisation().getOrganisationId(), Role.LEARNER, true); + getLessonService().addLearners(lesson, learners); + return null; + } + public ActionForward startOnScheduleLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ParseException, IOException { long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID);