Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -r509cebe97fca335b7d517abc7e8d9af03d6eab2e -rcf649302ae2ccdcb1eda11b21525ab516572a7f2 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 509cebe97fca335b7d517abc7e8d9af03d6eab2e) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision cf649302ae2ccdcb1eda11b21525ab516572a7f2) @@ -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);