Index: lams_central/src/java/org/lamsfoundation/lams/web/GradebookServlet.java =================================================================== diff -u -ra8510000562f3bc64243d35a8518639806ec1bcc -r935066ab304c8de82b2d511422f26996c87cb60c --- lams_central/src/java/org/lamsfoundation/lams/web/GradebookServlet.java (.../GradebookServlet.java) (revision a8510000562f3bc64243d35a8518639806ec1bcc) +++ lams_central/src/java/org/lamsfoundation/lams/web/GradebookServlet.java (.../GradebookServlet.java) (revision 935066ab304c8de82b2d511422f26996c87cb60c) @@ -75,31 +75,35 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession hses = request.getSession(true); - String username = request.getParameter(CentralConstants.PARAM_USERNAME); + String username = request.getParameter(LoginRequestDispatcher.PARAM_USER_ID); String serverId = request.getParameter(LoginRequestDispatcher.PARAM_SERVER_ID); - String datetime = request.getParameter(CentralConstants.PARAM_DATE_TIME); + String timestamp = request.getParameter(LoginRequestDispatcher.PARAM_TIMESTAMP); String hash = request.getParameter(LoginRequestDispatcher.PARAM_HASH); String countryIsoCode = request.getParameter(LoginRequestDispatcher.PARAM_COUNTRY); String langIsoCode = request.getParameter(LoginRequestDispatcher.PARAM_LANGUAGE); String extCourseId = request.getParameter(LoginRequestDispatcher.PARAM_COURSE_ID); - String lessonId = request.getParameter(CentralConstants.PARAM_LESSON_ID); - + String lessonId = request.getParameter(LoginRequestDispatcher.PARAM_LESSON_ID); + String courseName = request.getParameter(CentralConstants.PARAM_COURSE_NAME); + String method = request.getParameter(LoginRequestDispatcher.PARAM_METHOD); + // either lesson ID or course ID is required; if both provided, only lesson ID is used - if ((username == null) || (serverId == null) || (datetime == null) || (hash == null) + if ((username == null) || (serverId == null) || (timestamp == null) || (hash == null) || ((lessonId == null) && (extCourseId == null))) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Gradebook request failed - invalid parameters"); } else { ExtServerOrgMap serverMap = getService().getExtServerOrgMap(serverId); try { - Authenticator.authenticate(serverMap, datetime, username, hash); + // if request comes from LoginRequest, method parameter was meaningful there + // if it's a direct call, it can be anything + Authenticator.authenticate(serverMap, timestamp, username, method, hash); String redirect = null; if (lessonId == null) { // translate external course ID to internal organisation ID and then get the gradebook for it ExtUserUseridMap userMap = GradebookServlet.integrationService.getExtUserUseridMap(serverMap, username); ExtCourseClassMap orgMap = GradebookServlet.integrationService.getExtCourseClassMap(serverMap, - userMap, extCourseId, countryIsoCode, langIsoCode, null, null); + userMap, extCourseId, countryIsoCode, langIsoCode, courseName, method); Organisation org = orgMap.getOrganisation(); redirect = Configuration.get(ConfigurationKeys.SERVER_URL) + GradebookServlet.GRADEBOOK_ORGANISATION_URL + org.getOrganisationId(); Index: lams_common/src/java/org/lamsfoundation/lams/integration/util/LoginRequestDispatcher.java =================================================================== diff -u -r99acfa44cf20145d947cb93eb6bfd66ec7be985b -r935066ab304c8de82b2d511422f26996c87cb60c --- lams_common/src/java/org/lamsfoundation/lams/integration/util/LoginRequestDispatcher.java (.../LoginRequestDispatcher.java) (revision 99acfa44cf20145d947cb93eb6bfd66ec7be985b) +++ lams_common/src/java/org/lamsfoundation/lams/integration/util/LoginRequestDispatcher.java (.../LoginRequestDispatcher.java) (revision 935066ab304c8de82b2d511422f26996c87cb60c) @@ -74,14 +74,16 @@ public static final String PARAM_EXT_LMS_ID = "extlmsid"; public static final String PARAM_MODE = "mode"; + + public static final String MODE_GRADEBOOK = "gradebook"; public static final String METHOD_AUTHOR = "author"; public static final String METHOD_MONITOR = "monitor"; public static final String METHOD_LEARNER = "learner"; - private static final String PARAM_LESSON_ID = "lsid"; + public static final String PARAM_LESSON_ID = "lsid"; private static final String URL_DEFAULT = "/index.jsp"; @@ -90,6 +92,8 @@ private static final String URL_LEARNER = "/home.do?method=learner&lessonID="; private static final String URL_MONITOR = "/home.do?method=monitorLesson&lessonID="; + + private static final String URL_GRADEBOOK = "/services/Gradebook?"; private static IIntegrationService integrationService = null; @@ -115,9 +119,11 @@ throw new ServletException(e); } + if (MODE_GRADEBOOK.equals(mode)) { + return request.getContextPath() + URL_GRADEBOOK + request.getQueryString(); + } /** AUTHOR * */ - if (METHOD_AUTHOR.equals(method)) { - + else if (METHOD_AUTHOR.equals(method)) { String requestSrc = request.getParameter(PARAM_REQUEST_SRC); String notifyCloseURL = request.getParameter(PARAM_NOTIFY_CLOSE_URL); @@ -148,8 +154,7 @@ /** LEARNER * */ else if (METHOD_LEARNER.equals(method) && lessonId != null) { String url = request.getContextPath() + URL_LEARNER + lessonId; - if (mode != null) - { + if (mode != null) { url += "&" + PARAM_MODE + "=" + mode; } return url;