Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rd0b6f213cba1026b0c9fdbdaa5dd44a49eddd3aa -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d0b6f213cba1026b0c9fdbdaa5dd44a49eddd3aa) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -1,8 +1,6 @@ appName = lams_central #language code: en -#locale code: AU - - +#locale code: AU #=================== labels for LAMS Central =================# @@ -671,4 +669,18 @@ label.top.comments=Top Comments label.add.sticky=Stick To Top label.remove.sticky=Remove Sticky + +label.organisations =Select course with the lessons that needs to be export +label.lesson.id =Lesson ID +label.display.design.image =Display sequence image? +label.select.sequence =You must select a sequence before proceeding +label.choose.sequence =Choose Lams sequence +label.author.sequence =Author new LAMS lessons +label.open.monitor =Open Monitor +label.your.progress =Your Lesson Progress +label.you.completed.this.lesson =You have completed this lesson. +label.total.activities.depend.on.path =Total activities depend on your learning path. +label.lesson.not.completed =Lesson is not yet completed. +label.you.completed.activities =You have completed {0} activities + #======= End labels: Exported 439 labels for en AU ===== Index: lams_central/conf/xdoclet/servlet-mappings.xml =================================================================== diff -u -rd4fa9dbb6727dc972463755175d4904fad3ebfb4 -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/conf/xdoclet/servlet-mappings.xml (.../servlet-mappings.xml) (revision d4fa9dbb6727dc972463755175d4904fad3ebfb4) +++ lams_central/conf/xdoclet/servlet-mappings.xml (.../servlet-mappings.xml) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -31,6 +31,11 @@ + LoginRequestLti + /LoginRequestLti + + + LearningDesignRepository /services/xml/LearningDesignRepository/* Index: lams_central/conf/xdoclet/servlets.xml =================================================================== diff -u -rd4fa9dbb6727dc972463755175d4904fad3ebfb4 -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/conf/xdoclet/servlets.xml (.../servlets.xml) (revision d4fa9dbb6727dc972463755175d4904fad3ebfb4) +++ lams_central/conf/xdoclet/servlets.xml (.../servlets.xml) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -62,6 +62,14 @@ + LoginRequestLti + + + org.lamsfoundation.lams.web.LoginRequestLtiServlet + + + + LearningDesignRepository Index: lams_central/conf/xdoclet/web-security.xml =================================================================== diff -u -r2a2047e068c7cbb3a2ba0bc228bb7e459a028e77 -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/conf/xdoclet/web-security.xml (.../web-security.xml) (revision 2a2047e068c7cbb3a2ba0bc228bb7e459a028e77) +++ lams_central/conf/xdoclet/web-security.xml (.../web-security.xml) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -20,6 +20,7 @@ Public content /LoginRequest + /LoginRequestLti /services/xml/LessonManager/* /services/xml/LearningDesignRepository/* /services/LearningDesignSVG/* Index: lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java =================================================================== diff -u -r2c6d99838a7d029871ec9a697efbfb636ea6a329 -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision 2c6d99838a7d029871ec9a697efbfb636ea6a329) +++ lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -468,18 +468,18 @@ * Redirects to URL specified in redirectURL parameter. Used by LoginRequest. */ public ActionForward redirect(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse res) throws IOException, ServletException { + HttpServletResponse response) throws IOException, ServletException { String redirectUrlParam = request.getParameter("redirectURL"); if (redirectUrlParam != null) { -// redirectUrlParam = URLDecoder.decode(redirectUrlParam, "UTF8"); log.info("home.do?method=redirect is requested. Redirecting to " + redirectUrlParam); - res.sendRedirect(redirectUrlParam); + redirectUrlParam = response.encodeRedirectURL(redirectUrlParam); + response.sendRedirect(redirectUrlParam); return null; } log.warn("home.do?method=redirect is requested but no redirectURL paramter is provided."); String defaultUrl = request.getContextPath() + "/index.jsp"; - res.sendRedirect(defaultUrl); + response.sendRedirect(defaultUrl); return null; } Index: lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java =================================================================== diff -u -raa6023fdecba00eb9a7df76e834e681f7d58462d -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java (.../IndexAction.java) (revision aa6023fdecba00eb9a7df76e834e681f7d58462d) +++ lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java (.../IndexAction.java) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -162,7 +162,7 @@ if (IndexAction.isPedagogicalPlannerAvailable()) { headerLinks.add(new IndexLinkBean("index.planner", "javascript:openPedagogicalPlanner()")); } - headerLinks.add(new IndexLinkBean("index.author", "javascript:openAuthor()")); + headerLinks.add(new IndexLinkBean("index.author", "javascript:openAuthor(false)")); } headerLinks.add(new IndexLinkBean("index.myprofile", "index.do?tab=profile")); Index: lams_central/src/java/org/lamsfoundation/lams/web/action/LtiAction.java =================================================================== diff -u --- lams_central/src/java/org/lamsfoundation/lams/web/action/LtiAction.java (revision 0) +++ lams_central/src/java/org/lamsfoundation/lams/web/action/LtiAction.java (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -0,0 +1,318 @@ +package org.lamsfoundation.lams.web.action; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpStatus; +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionRedirect; +import org.apache.tomcat.util.json.JSONException; +import org.imsglobal.lti.BasicLTIConstants; +import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; +import org.lamsfoundation.lams.integration.ExtCourseClassMap; +import org.lamsfoundation.lams.integration.ExtServerLessonMap; +import org.lamsfoundation.lams.integration.ExtServerOrgMap; +import org.lamsfoundation.lams.integration.ExtUserUseridMap; +import org.lamsfoundation.lams.integration.UserInfoFetchException; +import org.lamsfoundation.lams.integration.UserInfoValidationException; +import org.lamsfoundation.lams.integration.service.IIntegrationService; +import org.lamsfoundation.lams.integration.service.IntegrationService; +import org.lamsfoundation.lams.integration.util.LoginRequestDispatcher; +import org.lamsfoundation.lams.integration.util.LtiUtils; +import org.lamsfoundation.lams.learningdesign.service.ILearningDesignService; +import org.lamsfoundation.lams.lesson.LearnerProgress; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.dto.LearnerProgressDTO; +import org.lamsfoundation.lams.lesson.service.ILessonService; +import org.lamsfoundation.lams.monitoring.service.IMonitoringService; +import org.lamsfoundation.lams.security.ISecurityService; +import org.lamsfoundation.lams.usermanagement.Organisation; +import org.lamsfoundation.lams.usermanagement.Role; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.usermanagement.exception.UserAccessDeniedException; +import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.CentralConstants; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.util.svg.SVGGenerator; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.workspace.service.IWorkspaceManagementService; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Shows either addLesson.jsp or learnerMonitor.jsp pages. + * + * @author Andrey Balan + * + * @struts:action path="/lti" scope="request" + * parameter="method" validate="false" + * + * @struts:action-forward name="addLesson" path="/lti/addLesson.jsp" + * @struts:action-forward name="learnerMonitor" path="/lti/learnerMonitor.jsp" + * @struts:action-forward name ="learnerMonitorRedirect" path="/lti.do?method=learnerMonitor" redirect="true" + * @struts:action-forward name="error" path="/error.jsp" + */ +public class LtiAction extends LamsDispatchAction { + + private static Logger log = Logger.getLogger(LtiAction.class); + private static IIntegrationService integrationService = null; + private static IMonitoringService monitoringService = null; + private static IUserManagementService userManagementService = null; + private static ILearningDesignService learningDesignService; + private static ILessonService lessonService = null; + private static IWorkspaceManagementService workspaceManagementService; + private static ISecurityService securityService; + + /** + * Single entry point to LAMS LTI processing mechanism. It determines here whether to show author or learnerMonitor + * pages + */ + public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, UserAccessDeniedException, JSONException, + RepositoryCheckedException, UserInfoFetchException, UserInfoValidationException { + initServices(); + String consumerKey = request.getParameter(LtiUtils.OAUTH_CONSUMER_KEY); + String resourceLinkId = request.getParameter(BasicLTIConstants.RESOURCE_LINK_ID); + String tcGradebookId = request.getParameter(BasicLTIConstants.LIS_RESULT_SOURCEDID); + String extUserId = request.getParameter(BasicLTIConstants.USER_ID); + + ExtServerLessonMap lesson = integrationService.getLtiConsumerLesson(consumerKey, resourceLinkId); + + //update lessonFinishCallbackUrl. We store it one time during the very first call to LAMS and it stays the same all the time afterwards + String lessonFinishCallbackUrl = request.getParameter(BasicLTIConstants.LIS_OUTCOME_SERVICE_URL); + ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(consumerKey); + if (StringUtils.isNotBlank(lessonFinishCallbackUrl) && StringUtils.isBlank(serverMap.getLessonFinishUrl())) { + serverMap.setLessonFinishUrl(lessonFinishCallbackUrl); + userManagementService.save(serverMap); + } + + //check if learner tries to access the link that hasn't been authored by teacher yet + String method = request.getParameter("_" + LoginRequestDispatcher.PARAM_METHOD); + if (LoginRequestDispatcher.METHOD_LEARNER_STRICT_AUTHENTICATION.equals(method) && lesson == null) { + String errorMsg = "Learner tries to access the link that hasn't been authored by teacher yet. resource_link_id: " + + tcGradebookId; + log.debug(errorMsg); + request.setAttribute("error", errorMsg); + request.setAttribute("javax.servlet.error.exception", new UserAccessDeniedException(errorMsg)); + return mapping.findForward("error"); + } + + //determine whether to show author or learnerMonitor pages + if (lesson == null) { + return addLesson(mapping, form, request, response); + + } else { + + //as per LTI spec we need to update tool consumer's gradebook id on every LTI call + ExtUserUseridMap extUserMap = integrationService.getExistingExtUserUseridMap(serverMap, extUserId); + extUserMap.setTcGradebookId(tcGradebookId); + userManagementService.save(extUserMap); + + return learnerMonitor(mapping, form, request, response); + } + + } + + /** + * When teacher accesses link for the very first time, we show him addLesson page where he can choose learning + * design and start a lesson. + */ + public ActionForward addLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, UserAccessDeniedException, JSONException, + RepositoryCheckedException, UserInfoFetchException, UserInfoValidationException { + initServices(); + Integer userId = getUser().getUserID(); + String contextId = request.getParameter(BasicLTIConstants.CONTEXT_ID); + String consumerKey = request.getParameter(LtiUtils.OAUTH_CONSUMER_KEY); + String resourceLinkId = request.getParameter(BasicLTIConstants.RESOURCE_LINK_ID); + String resourceLinkTitle = request.getParameter(BasicLTIConstants.RESOURCE_LINK_TITLE); + String resourceLinkDescription = request.getParameter(BasicLTIConstants.RESOURCE_LINK_DESCRIPTION); + + ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(consumerKey); + ExtCourseClassMap orgMap = integrationService.getExtCourseClassMap(serverMap.getSid(), contextId); + Integer organisationId = orgMap.getOrganisation().getOrganisationId(); + //only monitors are allowed to create lesson + if (!securityService.isGroupMonitor(organisationId, userId, "add lesson", false)) { + response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the organisation"); + return null; + } + + // get all user accessible folders and LD descriptions as JSON + String folderContentsJSON = workspaceManagementService.getFolderContentsJSON(null, userId, false); + request.setAttribute("folderContents", folderContentsJSON); + request.setAttribute(LtiUtils.OAUTH_CONSUMER_KEY, consumerKey); + request.setAttribute(BasicLTIConstants.RESOURCE_LINK_ID, resourceLinkId); + request.setAttribute(CentralConstants.ATTR_COURSE_ID, organisationId); + request.setAttribute(BasicLTIConstants.CONTEXT_ID, contextId); + request.setAttribute(CentralConstants.PARAM_TITLE, resourceLinkTitle); + request.setAttribute(CentralConstants.PARAM_DESC, resourceLinkDescription); + + return mapping.findForward("addLesson"); + } + + /** + * Starts a lesson. Then prompts to learnerMonitor page. + */ + public ActionForward startLesson(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, UserAccessDeniedException, JSONException, + RepositoryCheckedException, UserInfoValidationException, UserInfoFetchException { + initServices(); + Integer userId = getUser().getUserID(); + User user = getRealUser(getUser()); + + String consumerKey = request.getParameter(LtiUtils.OAUTH_CONSUMER_KEY); + String resourceLinkId = request.getParameter(BasicLTIConstants.RESOURCE_LINK_ID); + String title = request.getParameter(CentralConstants.PARAM_TITLE); + String desc = request.getParameter(CentralConstants.PARAM_DESC); + String ldIdStr = request.getParameter(CentralConstants.PARAM_LEARNING_DESIGN_ID); + String contextId = request.getParameter(BasicLTIConstants.CONTEXT_ID); + Integer organisationId = new Integer(WebUtil.readIntParam(request, CentralConstants.ATTR_COURSE_ID)); + boolean enableLessonIntro = WebUtil.readBooleanParam(request, "enableLessonIntro", false); + + //only monitors are allowed to create lesson + if (!securityService.isGroupMonitor(organisationId, userId, "add lesson", false)) { + response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the organisation"); + return null; + } + + ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(consumerKey); + Organisation organisation = monitoringService.getOrganisation(organisationId); + + // 1. init lesson + Lesson lesson = monitoringService.initializeLesson(title, desc, new Long(ldIdStr), + organisation.getOrganisationId(), user.getUserId(), null, false, enableLessonIntro, false, false, false, + true, true, false, false, null, null); + // 2. create lessonClass for lesson + List staffList = new LinkedList(); + staffList.add(user); + List learnerList = new LinkedList(); + Vector learnerVector = userManagementService + .getUsersFromOrganisationByRole(organisation.getOrganisationId(), Role.LEARNER, false, true); + learnerList.addAll(learnerVector); + monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation, + organisation.getName() + "Learners", learnerList, organisation.getName() + "Staff", staffList, + user.getUserId()); + // 3. start lesson + monitoringService.startLesson(lesson.getLessonId(), user.getUserId()); + // store information which extServer has started the lesson + integrationService.createExtServerLessonMap(lesson.getLessonId(), resourceLinkId, serverMap); + + //set roles to contain monitor so that the user can see monitor link + ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("learnerMonitorRedirect")); + redirect.addParameter(LtiUtils.OAUTH_CONSUMER_KEY, consumerKey); + redirect.addParameter(BasicLTIConstants.RESOURCE_LINK_ID, resourceLinkId); + redirect.addParameter(BasicLTIConstants.CONTEXT_ID, contextId); + return redirect; + } + + /** + * Once lesson was created, start showing learnerMonitor page to everybody regardless of his role. + */ + public ActionForward learnerMonitor(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, UserAccessDeniedException, JSONException, + RepositoryCheckedException, UserInfoValidationException, UserInfoFetchException { + initServices(); + Integer userId = getUser().getUserID(); + String consumerKey = request.getParameter(LtiUtils.OAUTH_CONSUMER_KEY); + String resourceLinkId = request.getParameter(BasicLTIConstants.RESOURCE_LINK_ID); + + //get orgId +// String contextId = request.getParameter(BasicLTIConstants.CONTEXT_ID); +// ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(consumerKey); +// ExtCourseClassMap orgMap = integrationService.getExtCourseClassMap(serverMap.getSid(), contextId); +// Integer organisationId = orgMap.getOrganisation().getOrganisationId(); + + //get lesson + ExtServerLessonMap extLesson = integrationService.getLtiConsumerLesson(consumerKey, resourceLinkId); + Long lessonId = extLesson.getLessonId(); + Lesson lesson = (Lesson) userManagementService.findById(Lesson.class, lessonId); + + //set all required attributes for jsp + request.setAttribute("lessonId", lessonId); + request.setAttribute("ldId", lesson.getLearningDesign().getLearningDesignId()); + request.setAttribute("title", lesson.getLessonName()); + request.setAttribute("description", lesson.getLessonDescription()); + request.setAttribute("isDisplayDesignImage", lesson.isDisplayDesignImage()); + boolean isMonitor = securityService.isLessonMonitor(lessonId, userId, "learner monitor", false); + request.setAttribute("isMonitor", isMonitor); + + //get learnerProgressDto + LearnerProgress learnProg = lessonService.getUserProgressForLesson(userId, lessonId); + if (learnProg != null) { + LearnerProgressDTO learnerProgress = learnProg.getLearnerProgressData(); + request.setAttribute("learnerProgressDto", learnerProgress); + } + + // check if we need to create svg, png files on the server + if (lesson.isDisplayDesignImage() && lesson.getLearnerProgresses().isEmpty()) { + Long learningDesignId = lesson.getLearningDesign().getLearningDesignId(); + learningDesignService.createLearningDesignSVG(learningDesignId, SVGGenerator.OUTPUT_FORMAT_SVG); + learningDesignService.createLearningDesignSVG(learningDesignId, SVGGenerator.OUTPUT_FORMAT_PNG); + } + + return mapping.findForward("learnerMonitor"); + } + + private UserDTO getUser() { + HttpSession ss = SessionManager.getSession(); + return (UserDTO) ss.getAttribute(AttributeNames.USER); + } + + private User getRealUser(UserDTO dto) { + return userManagementService.getUserByLogin(dto.getLogin()); + } + + private void initServices() { + if (integrationService == null) { + integrationService = (IntegrationService) WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()).getBean("integrationService"); + } + + if (monitoringService == null) { + monitoringService = (IMonitoringService) WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()).getBean("monitoringService"); + } + + if (userManagementService == null) { + userManagementService = (IUserManagementService) WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()) + .getBean("userManagementService"); + } + + if (learningDesignService == null) { + learningDesignService = (ILearningDesignService) WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()) + .getBean("learningDesignService"); + } + + if (lessonService == null) { + lessonService = (ILessonService) WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()).getBean("lessonService"); + } + + if (workspaceManagementService == null) { + WebApplicationContext webContext = WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()); + workspaceManagementService = (IWorkspaceManagementService) webContext.getBean("workspaceManagementService"); + } + + if (securityService == null) { + WebApplicationContext webContext = WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()); + securityService = (ISecurityService) webContext.getBean("securityService"); + } + } + +} Index: lams_central/src/java/org/lamsfoundation/lams/webservice/xml/LessonManagerServlet.java =================================================================== diff -u -rba01af158086652da1315805f16925872093df1f -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/src/java/org/lamsfoundation/lams/webservice/xml/LessonManagerServlet.java (.../LessonManagerServlet.java) (revision ba01af158086652da1315805f16925872093df1f) +++ lams_central/src/java/org/lamsfoundation/lams/webservice/xml/LessonManagerServlet.java (.../LessonManagerServlet.java) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -361,29 +361,29 @@ doGet(request, response); } - private Long startLesson(String serverId, String datetime, String hashValue, String username, long ldId, + private static Long startLesson(String serverId, String datetime, String hashValue, String username, long ldId, String courseId, String title, String desc, String countryIsoCode, String langIsoCode, String customCSV, boolean exportPortfolioEnable, boolean presenceEnable, boolean imEnable, boolean enableNotifications) throws RemoteException { try { - ExtServerOrgMap serverMap = LessonManagerServlet.integrationService.getExtServerOrgMap(serverId); + ExtServerOrgMap serverMap = integrationService.getExtServerOrgMap(serverId); Authenticator.authenticate(serverMap, datetime, username, hashValue); - ExtUserUseridMap userMap = LessonManagerServlet.integrationService.getExtUserUseridMap(serverMap, username); - ExtCourseClassMap orgMap = LessonManagerServlet.integrationService.getExtCourseClassMap(serverMap, userMap, + ExtUserUseridMap userMap = integrationService.getExtUserUseridMap(serverMap, username); + ExtCourseClassMap orgMap = integrationService.getExtCourseClassMap(serverMap, userMap, courseId, countryIsoCode, langIsoCode, null, LoginRequestDispatcher.METHOD_MONITOR); User user = userMap.getUser(); Organisation organisation = orgMap.getOrganisation(); // 1. init lesson - Lesson lesson = LessonManagerServlet.monitoringService.initializeLesson(title, desc, ldId, + Lesson lesson = monitoringService.initializeLesson(title, desc, ldId, organisation.getOrganisationId(), user.getUserId(), customCSV, false, false, exportPortfolioEnable, presenceEnable, imEnable, true, enableNotifications, false, false, null, null); // 2. create lessonClass for lesson createLessonClass(lesson, organisation, user); // 3. start lesson - LessonManagerServlet.monitoringService.startLesson(lesson.getLessonId(), user.getUserId()); + monitoringService.startLesson(lesson.getLessonId(), user.getUserId()); // store information which extServer has started the lesson - LessonManagerServlet.integrationService.createExtServerLessonMap(lesson.getLessonId(), serverMap); + integrationService.createExtServerLessonMap(lesson.getLessonId(), serverMap); return lesson.getLessonId(); } catch (Exception e) { @@ -785,17 +785,16 @@ } @SuppressWarnings("unchecked") - private void createLessonClass(Lesson lesson, Organisation organisation, User creator) { + private static void createLessonClass(Lesson lesson, Organisation organisation, User creator) { List staffList = new LinkedList(); staffList.add(creator); List learnerList = new LinkedList(); - Vector learnerVector = LessonManagerServlet.userManagementService + Vector learnerVector = userManagementService .getUsersFromOrganisationByRole(organisation.getOrganisationId(), Role.LEARNER, false, true); learnerList.addAll(learnerVector); - LessonManagerServlet.monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation, + monitoringService.createLessonClassForLesson(lesson.getLessonId(), organisation, organisation.getName() + "Learners", learnerList, organisation.getName() + "Staff", staffList, creator.getUserId()); - } /** @@ -908,7 +907,11 @@ if ((firstNames != null) && ((firstNameArray.length != lastNameArray.length) || (firstNameArray.length != emailArray.length) || (firstNameArray.length != (learnerIdArray.length + monitorIdArray.length)))) { - LessonManagerServlet.log.error("Invalid parameters sent: wrong array length."); + LessonManagerServlet.log.error("Invalid parameters sent: wrong array length. " + "learnerIds=" + + learnerIds + " &monitorIds=" + monitorIds + " &firstNames=" + firstNames + " &lastNames=" + + lastNames + " &emails=" + emails + " &array lengths=" + learnerIdArray.length + "!" + + monitorIdArray.length + "!" + firstNameArray.length + "!" + lastNameArray.length + "!" + + emailArray.length); return false; } @@ -1064,14 +1067,7 @@ lessonElement.setAttribute("lessonName", lesson.getLessonName()); // calculate lesson's MaxPossibleMark - Set activities = getLessonActivities(lesson); - Long lessonMaxPossibleMark = 0L; - for (ToolActivity activity : activities) { - Long activityMaxPossibleMark = LessonManagerServlet.toolService.getActivityMaxPossibleMark(activity); - if (activityMaxPossibleMark != null) { - lessonMaxPossibleMark += activityMaxPossibleMark; - } - } + Long lessonMaxPossibleMark = toolService.getLessonMaxPossibleMark(lesson); lessonElement.setAttribute("lessonMaxPossibleMark", lessonMaxPossibleMark.toString()); // get gradebook marks from DB Index: lams_central/web/includes/javascript/openUrls.js =================================================================== diff -u -r139ce76b08375351cd3e25accf171fafe4cb8600 -r9db721b6278cdcb38a07eac5f12e2c14c11a624f --- lams_central/web/includes/javascript/openUrls.js (.../openUrls.js) (revision 139ce76b08375351cd3e25accf171fafe4cb8600) +++ lams_central/web/includes/javascript/openUrls.js (.../openUrls.js) (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -1,4 +1,3 @@ - Index: lams_central/web/lti/addLesson.jsp =================================================================== diff -u --- lams_central/web/lti/addLesson.jsp (revision 0) +++ lams_central/web/lti/addLesson.jsp (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -0,0 +1,278 @@ + + +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ taglib uri="tags-fmt" prefix="fmt" %> +<%@ taglib uri="tags-core" prefix="c" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-function" prefix="fn"%> + + + + + <fmt:message key="title.author.window"/> + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ +

+ + <%-- Form to Collect ID of Selected LAMS Sequence --%> +
+ + + + + + + + + + + + + + + +
+ + + + +
+ + + +
+ +

+ +

+ + <%-- Preview and Author Buttons --%> +
+ " > + + " > + + " > +
+ +
+
+ +

+ + +

+ +
+ "> +
+
+ +
+ + + + + +
+ Index: lams_central/web/lti/learnerMonitor.jsp =================================================================== diff -u --- lams_central/web/lti/learnerMonitor.jsp (revision 0) +++ lams_central/web/lti/learnerMonitor.jsp (revision 9db721b6278cdcb38a07eac5f12e2c14c11a624f) @@ -0,0 +1,141 @@ + + +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ taglib uri="tags-fmt" prefix="fmt" %> +<%@ taglib uri="tags-core" prefix="c" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-function" prefix="fn"%> + + + + + + + <fmt:message key="title.author.window"/> + + + + + + + + + + + + + +
+ +

+ ${title} +

+ + +
+ ${description} +
+
+ + +
+ Sequence Preview +
+ + Sequence Preview + +
+
+
+ + +
+
+ +
+ + + +

+ +

+ +

+ + + ${fn:length(learnerProgressDto.completedActivities)} + + + [*] +

+ +
+ * + +
+
+ +

+ +

+
+
+
+
+ +
+ + " > + + + " > +
+ +
+ + + + +