Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java =================================================================== diff -u -rccf0c98665da622cc43ff39393de652596752cdf -r95eba499e8c3bafed1173499dd0e0547ee0a40ef --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java (.../ActivityMappingStrategy.java) (revision ccf0c98665da622cc43ff39393de652596752cdf) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java (.../ActivityMappingStrategy.java) (revision 95eba499e8c3bafed1173499dd0e0547ee0a40ef) @@ -59,9 +59,6 @@ else if (activity.isOptionsActivity()) { strutsAction = "/DisplayOptionsActivity.do"; } - else if ( activity.isSequenceActivity() ) { - strutsAction = "/SequenceActivity.do"; - } else { // unexpected type log.error("Unexpected activity type "+activity); Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/SequenceAction.java =================================================================== diff -u --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/SequenceAction.java (revision 0) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/SequenceAction.java (revision 95eba499e8c3bafed1173499dd0e0547ee0a40ef) @@ -0,0 +1,125 @@ +/**************************************************************** + * 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.monitoring.web; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +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.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.learningdesign.BranchingActivity; +import org.lamsfoundation.lams.learningdesign.Group; +import org.lamsfoundation.lams.learningdesign.BranchActivityEntry; +import org.lamsfoundation.lams.learningdesign.SequenceActivity; +import org.lamsfoundation.lams.monitoring.BranchDTO; +import org.lamsfoundation.lams.monitoring.BranchingDTO; +import org.lamsfoundation.lams.monitoring.service.IMonitoringService; +import org.lamsfoundation.lams.monitoring.service.MonitoringServiceProxy; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; + +/** +* The action servlet that provides the support for the Sequence activities. At present, this is +* only a basic view screen that lists the user's in the sequence. +* +* @struts:action path="/sequence" +* parameter="method" +* validate="false" +* @struts.action-forward name = "viewSequence" path = ".viewSequence" +* +* @author Fiona Malikoff +*/ +public class SequenceAction extends LamsDispatchAction { + + public static final String VIEW_SEQUENCE = "viewSequence"; + public static final String PARAM_LEARNERS = "learners"; + /** If localFiles = true will be written to a local file for export portfolio */ + public static final String PARAM_LOCAL_FILES= "localFiles"; + + /** + * Export Portfolio Page + */ + public ActionForward exportPortfolio(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID); + long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); + + IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext()); + SequenceActivity activity = (SequenceActivity) monitoringService.getActivityById(activityId, BranchingActivity.class); + return viewSequence(activity, lessonId, true, mapping, request, monitoringService); + } + + /** + * Display the view screen - to be used if we ever want direct access to the screen rather than export portfolio version. + */ + public ActionForward viewSequence(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID); + long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); + + IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext()); + SequenceActivity activity = (SequenceActivity) monitoringService.getActivityById(activityId, BranchingActivity.class); + return viewSequence(activity, lessonId, false, mapping, request, monitoringService); + } + + protected ActionForward viewSequence(SequenceActivity activity, Long lessonId, boolean useLocalFiles, + ActionMapping mapping, HttpServletRequest request, IMonitoringService monitoringService) throws IOException, ServletException { + + // in general the progress engine expects the activity and lesson id to be in the request, + // so follow that standard. + request.setAttribute(AttributeNames.PARAM_ACTIVITY_ID, activity.getActivityId()); + request.setAttribute(AttributeNames.PARAM_LESSON_ID, lessonId); + request.setAttribute(AttributeNames.PARAM_TITLE, activity.getTitle()); + request.setAttribute(PARAM_LOCAL_FILES, useLocalFiles); + + // only show the group names if this is a group based branching activity - the names + // are meaningless for chosen and tool based branching + List learners = monitoringService.getLearnersHaveAttemptedActivity(activity); + request.setAttribute(PARAM_LEARNERS, learners); + return mapping.findForward(VIEW_SEQUENCE); + } + + } Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/SequenceExportPortfolioServlet.java =================================================================== diff -u --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/SequenceExportPortfolioServlet.java (revision 0) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/SequenceExportPortfolioServlet.java (revision 95eba499e8c3bafed1173499dd0e0547ee0a40ef) @@ -0,0 +1,65 @@ +/**************************************************************** + * 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.monitoring.web; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet; +import org.lamsfoundation.lams.web.util.AttributeNames; + + +/** + * Export portfolio page for the sequence. Only the teacher gets portfolio pages for gates - learners + * do not see a page in their portfolio. This page just lists the learners in a branch. + * + * @web:servlet name="sequenceExportPortfolio" + * @web:servlet-mapping url-pattern="/sequenceExportPortfolio" + * + */ +public class SequenceExportPortfolioServlet extends AbstractExportPortfolioServlet { + + private final String FILENAME = "sequence.html"; + + public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) + { + Long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID); + Long gateId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); + + // should really be a different URL for each type of branching, but really it goes to the same method not matter what + // so just use the simplest one! + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath(); + writeResponseToFile( + basePath+"/sequence.do?method=exportPortfolio&lessonID="+lessonId+"&activityID="+gateId, + directoryName,FILENAME,cookies); + return FILENAME; + } + + + +} Index: lams_monitoring/web/viewSequence.jsp =================================================================== diff -u --- lams_monitoring/web/viewSequence.jsp (revision 0) +++ lams_monitoring/web/viewSequence.jsp (revision 95eba499e8c3bafed1173499dd0e0547ee0a40ef) @@ -0,0 +1,48 @@ + <%-- +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 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 +--%> +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> + +<%@ taglib uri="tags-tiles" prefix="tiles" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-fmt" prefix="fmt" %> +<%@ taglib uri="tags-core" prefix="c" %> +<%@ taglib uri="tags-lams" prefix="lams" %> + +
+ +

+ + + + + + + +
+
+
+ + + <%@ include file="../template/finishbutton.jsp" %> + +
+ +