Index: lams_build/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_build/build.xml,v diff -u -r1.123 -r1.124 --- lams_build/build.xml 28 Nov 2014 22:41:30 -0000 1.123 +++ lams_build/build.xml 4 Dec 2014 23:06:50 -0000 1.124 @@ -154,7 +154,6 @@ - @@ -271,9 +270,6 @@ - - Deploying ROOT.war responsible for launching learner url - Index: lams_build/shared.properties =================================================================== RCS file: /usr/local/cvsroot/lams_build/shared.properties,v diff -u -r1.44 -r1.45 --- lams_build/shared.properties 28 Nov 2014 22:41:30 -0000 1.44 +++ lams_build/shared.properties 4 Dec 2014 23:06:50 -0000 1.45 @@ -32,7 +32,6 @@ lams_common=lams_common lams_contentrepository=lams_contentrepository lams_gradebook=lams_gradebook -lams_launchlearnerurl=lams_launchlearnerurl lams_learning=lams_learning lams_monitoring=lams_monitoring lams_planner=lams_planner Index: lams_build/lib/lams/lams.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v diff -u -r1.436 -r1.437 Binary files differ Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_central/src/java/org/lamsfoundation/lams/web/LaunchLearnerAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_central/src/java/org/lamsfoundation/lams/web/LaunchLearnerUrlServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/LaunchLearnerUrlServlet.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/src/java/org/lamsfoundation/lams/web/LaunchLearnerUrlServlet.java 4 Dec 2014 23:06:55 -0000 1.1 @@ -0,0 +1,130 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id: LaunchLearnerUrlServlet.java,v 1.1 2014/12/04 23:06:55 andreyb Exp $$ */ +package org.lamsfoundation.lams.web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Date; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +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.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.service.ILessonService; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsAction; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Sends redirect to lams learner. Format: launchlearner.do?lessonID= + * + * @web:servlet name="LaunchLearnerUrlServlet" + * @web:servlet-mapping url-pattern="/r/*" + */ +public class LaunchLearnerUrlServlet extends HttpServlet { + + private static Logger log = Logger.getLogger(LaunchLearnerUrlServlet.class); + + private static ILessonService lessonService; + + private ILessonService getLessonService() { + if (lessonService == null) { + WebApplicationContext ctx = WebApplicationContextUtils + .getRequiredWebApplicationContext(getServletContext()); + lessonService = (ILessonService) ctx.getBean("lessonService"); + } + return lessonService; + } + + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String encodedLessonId = request.getPathInfo(); + + // redirect to login page if accessing / URL + if (StringUtils.isBlank(encodedLessonId) || encodedLessonId.length() < 2) { + String lamsUrl = Configuration.get(ConfigurationKeys.SERVER_URL); + response.sendRedirect(lamsUrl); + return; + } + + // cut off the first '/' + encodedLessonId = encodedLessonId.substring(1); + + Long lessonId; + try { + String decodedLessonId = WebUtil.decodeLessonId(encodedLessonId); + lessonId = Long.valueOf(decodedLessonId); + + } catch (IllegalArgumentException e) { + log.warn("Supplied lessonId: " + encodedLessonId + " has wrong format."); + response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Supplied lessonId: " + encodedLessonId + " has wrong format."); +// return mapping.findForward("error"); +// displayMessage(request, response, "error.lessonid.has.wrong.format"); + return; + } + + + + Lesson lesson = lessonId != null ? getLessonService().getLesson(lessonId) : null; + if (lesson != null) { + // return displayMessage(mapping, req, "message.lesson.not.started.cannot.participate"); + } + + request.setAttribute("name", lesson.getLessonName()); + request.setAttribute("description", lesson.getLessonDescription()); + request.setAttribute("status", lesson.getLessonStateId()); + request.setAttribute(AttributeNames.PARAM_LESSON_ID, lessonId); + + request.getRequestDispatcher("/launchlearner.jsp").forward(request, response); + + // getServletContext().getContext(serverURLContextPath + "learning") + // .getRequestDispatcher("/main.jsp").forward(req, res); + // return null; + // + // + // request.setAttribute( AttributeNames.PARAM_LESSON_ID, encodedLessonId); + // request.getRequestDispatcher("/launchlearner.do").forward(request, response); + } + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + doPost(request, response); + } + + private void displayMessage(HttpServletRequest request, HttpServletResponse response, String messageKey) + throws ServletException, IOException { + request.setAttribute("messageKey", messageKey); + request.getRequestDispatcher("/.message").forward(request, response); + } +} \ No newline at end of file Index: lams_central/web/launchlearner.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/launchlearner.jsp,v diff -u -r1.6 -r1.7 --- lams_central/web/launchlearner.jsp 2 Jul 2009 08:19:14 -0000 1.6 +++ lams_central/web/launchlearner.jsp 4 Dec 2014 23:06:54 -0000 1.7 @@ -1,5 +1,4 @@ - + <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ page import="org.lamsfoundation.lams.lesson.Lesson" %> @@ -11,9 +10,9 @@ <fmt:message key="index.welcome" /> - - - + + + @@ -26,50 +25,51 @@

- - <%= Lesson.CREATED %> - <%= Lesson.NOT_STARTED_STATE %> - <%= Lesson.STARTED_STATE %> - <%= Lesson.FINISHED_STATE %> - <%= Lesson.SUSPENDED_STATE %> - <%= Lesson.ARCHIVED_STATE %> - <%= Lesson.REMOVED_STATE %> + + + <%= Lesson.CREATED %> + <%= Lesson.NOT_STARTED_STATE %> + <%= Lesson.STARTED_STATE %> + <%= Lesson.FINISHED_STATE %> + <%= Lesson.SUSPENDED_STATE %> + <%= Lesson.ARCHIVED_STATE %> + <%= Lesson.REMOVED_STATE %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

@@ -80,6 +80,4 @@ - - \ No newline at end of file Index: lams_central/web/login.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/login.jsp,v diff -u -r1.52 -r1.53 --- lams_central/web/login.jsp 8 Oct 2014 05:50:55 -0000 1.52 +++ lams_central/web/login.jsp 4 Dec 2014 23:06:55 -0000 1.53 @@ -39,8 +39,8 @@ - - + +