Index: lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java =================================================================== diff -u -rfeee204a289bd433707cdb69a02c7a61b0ff90f8 -rb8a97155817e7f95d73dc663de0c9a1ef27e2333 --- lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision feee204a289bd433707cdb69a02c7a61b0ff90f8) +++ lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision b8a97155817e7f95d73dc663de0c9a1ef27e2333) @@ -177,9 +177,9 @@ //show lesson intro page if required if (lesson.isEnableLessonIntro()) { - req.setAttribute("lessonName", lesson.getLessonName()); - req.setAttribute("lessonDescription", lesson.getLessonDescription()); + req.setAttribute("lesson", lesson); req.setAttribute("displayDesignImage", lesson.isDisplayDesignImage()); + req.setAttribute("isMonitor", lesson.getLessonClass().isStaffMember(getRealUser(user))); //check if we need to create learning design SVG if (lesson.isDisplayDesignImage()) { Index: lams_central/src/java/org/lamsfoundation/lams/web/action/EditLessonIntroAction.java =================================================================== diff -u --- lams_central/src/java/org/lamsfoundation/lams/web/action/EditLessonIntroAction.java (revision 0) +++ lams_central/src/java/org/lamsfoundation/lams/web/action/EditLessonIntroAction.java (revision b8a97155817e7f95d73dc663de0c9a1ef27e2333) @@ -0,0 +1,110 @@ +/**************************************************************** + * 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$ */ +package org.lamsfoundation.lams.web.action; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.actions.DispatchAction; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.dao.ILessonDAO; +import org.lamsfoundation.lams.lesson.service.ILessonService; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Edit lesson intro page. + * + * @struts:action path="/editLessonIntro" validate="false" parameter="method" + * @struts:action-forward name="editLessonIntro" path="/editLessonIntro.jsp" + * + */ +public class EditLessonIntroAction extends DispatchAction { + + private static ILessonService lessonService; + + private static ILessonDAO lessonDAO; + + /** + * Edit lesson intro page. + */ + public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) + throws IOException, ServletException { + + Long lessonId = WebUtil.readLongParam(req, AttributeNames.PARAM_LESSON_ID); + Lesson lesson = getLessonService().getLesson(lessonId); + req.setAttribute("lesson", lesson); + req.setAttribute("displayDesignImage", lesson.isDisplayDesignImage()); + req.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID, lesson.getLearningDesign().getContentFolderID()); + + return mapping.findForward("editLessonIntro"); + } + + /** + * Save lesson intro page. + */ + public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) + throws IOException, ServletException { + + Long lessonId = WebUtil.readLongParam(req, AttributeNames.PARAM_LESSON_ID); + Lesson lesson = getLessonService().getLesson(lessonId); + String lessonName = WebUtil.readStrParam(req, "lessonName"); + String lessonDescription = WebUtil.readStrParam(req, "lessonDescription"); + boolean displayDesignImage = WebUtil.readBooleanParam(req, "displayDesignImage"); + + //sore lesson in DB + lesson.setLessonName(lessonName); + lesson.setLessonDescription(lessonDescription); + lesson.setDisplayDesignImage(displayDesignImage); + getLessonDAO().saveLesson(lesson); + + return null; + } + + private ILessonService getLessonService() { + if (lessonService == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + lessonService = (ILessonService) ctx.getBean("lessonService"); + } + return lessonService; + } + + private ILessonDAO getLessonDAO() { + if (lessonDAO == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + lessonDAO = (ILessonDAO) ctx.getBean("lessonDAO"); + } + return lessonDAO; + } +} Index: lams_central/web/editLessonIntro.jsp =================================================================== diff -u --- lams_central/web/editLessonIntro.jsp (revision 0) +++ lams_central/web/editLessonIntro.jsp (revision b8a97155817e7f95d73dc663de0c9a1ef27e2333) @@ -0,0 +1,86 @@ + + +<%@ 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" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + checked="checked" class="noBorder" value="true"/> + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_central/web/lessonIntro.jsp =================================================================== diff -u -r649330e52376bc8f361c19c734dd219c593b460a -rb8a97155817e7f95d73dc663de0c9a1ef27e2333 --- lams_central/web/lessonIntro.jsp (.../lessonIntro.jsp) (revision 649330e52376bc8f361c19c734dd219c593b460a) +++ lams_central/web/lessonIntro.jsp (.../lessonIntro.jsp) (revision b8a97155817e7f95d73dc663de0c9a1ef27e2333) @@ -6,44 +6,53 @@ <%@ taglib uri="tags-fmt" prefix="fmt" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-html" prefix="html" %> - - - - -learner.jsp?mode=${mode}&portfolioEnabled=${portfolioEnabled}&presenceEnabledPatch=${presenceEnabledPatch}&presenceImEnabled=${presenceImEnabled}&title=${title}&createDateTime=${createDateTime}&serverUrl=${serverUrl}&presenceUrl=${presenceUrl}&lessonID=${lessonID} + +mode=${mode}&portfolioEnabled=${portfolioEnabled}&presenceEnabledPatch=${presenceEnabledPatch}&presenceImEnabled=${presenceImEnabled}&title=${title}&createDateTime=${createDateTime}&serverUrl=${serverUrl}&presenceUrl=${presenceUrl}&lessonID=${lessonID} + + + + + + + + + + + + - ${lessonName} + ${lesson.lessonName} - ${lessonDescription} + ${lesson.lessonDescription} - + - + @@ -52,7 +61,7 @@ - +
${lessonDescription}
${lesson.lessonDescription}