Index: lams_tool_laqa/db/sql/tool_insert.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/db/sql/tool_insert.sql,v
diff -u -r1.10 -r1.11
--- lams_tool_laqa/db/sql/tool_insert.sql 28 Feb 2006 07:29:14 -0000 1.10
+++ lams_tool_laqa/db/sql/tool_insert.sql 4 Mar 2006 19:39:17 -0000 1.11
@@ -45,7 +45,7 @@
0,
'tool/laqa11/learningStarter.do',
'tool/laqa11/authoringStarter.do',
-'tool/laqa11/definelater.do',
+'tool/laqa11/defineLaterStarter.do',
'tool/laqa11/export.do',
'tool/laqa11/monitoringStarter.do',
'tool/laqa11/monitoring.do',
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java,v
diff -u -r1.36 -r1.37
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java 4 Mar 2006 05:42:42 -0000 1.36
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java 4 Mar 2006 19:39:17 -0000 1.37
@@ -52,6 +52,15 @@
public static final String DEFAULT_CONTENT_ID_STR ="defaultContentIdStr";
public static final String TOOL_SESSION_ID = "toolSessionID";
+ public static final String ACTIVE_MODULE ="activeModule";
+ public static final String AUTHORING ="authoring";
+ public static final String DEFINE_LATER_IN_EDIT_MODE ="defineLaterInEditMode";
+ public static final String SHOW_AUTHORING_TABS ="showAuthoringTabs";
+ public static final String DEFINE_LATER ="defineLater";
+ public static final String SOURCE_MC_STARTER ="sourceMcStarter";
+
+ public static final String IS_MONITORED_CONTENT_IN_USE ="isMonitoredContentInUse";
+ public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY ="loadMonitoringEditActivity";
/*
* refers to number of questions presented initially, we have a single record for default content
@@ -130,6 +139,12 @@
public static final String LIST_MONITORED_ANSWERS_CONTAINER_DTO ="listMonitoredAnswersContainerDto";
public static final String SUMMARY_TOOL_SESSIONS ="summaryToolSessions";
public static final String SUMMARY_TOOL_SESSIONS_ID ="summaryToolSessionsId";
+
+ public static final String ACTIVITY_TITLE ="activityTitle";
+ public static final String ACTIVITY_INSTRUCTIONS ="activityInstructions";
+ public static final String IS_USERNAME_VISIBLE ="isUsernameVisible";
+ public static final String CURRENT_ANSWER ="currentAnswer";
+
/*
* export portfolio constants
@@ -158,25 +173,18 @@
public static final String CURRENT_QUESTION_INDEX ="currentQuestionIndex";
public static final String TOTAL_QUESTION_COUNT ="totalQuestionCount";
public static final String MAP_ANSWERS ="mapAnswers";
- public static final String CURRENT_ANSWER ="currentAnswer";
public static final String USER_FEEDBACK ="userFeedback";
public static final String REPORT_TITLE ="reportTitle";
public static final String MONITORING_REPORT_TITLE ="monitoringReportTitle";
public static final String REPORT_TITLE_LEARNER ="reportTitleLearner";
public static final String END_LEARNING_MESSAGE ="endLearningMessage";
public static final String IS_TOOL_ACTIVITY_OFFLINE ="isToolActivityOffline";
- public static final String IS_USERNAME_VISIBLE ="isUsernameVisible";
- public static final String IS_ALL_SESSIONS_COMPLETED ="isAllSessionsCompleted";
public static final String CHECK_ALL_SESSIONS_COMPLETED ="checkAllSessionsCompleted";
public static final String FROM_TOOL_CONTENT_ID ="fromToolContentId";
public static final String TO_TOOL_CONTENT_ID ="toToolContentId";
public static final String LEARNER_REPORT ="learnerReport";
- public static final String MAP_USER_RESPONSES ="mapUserResponses";
- public static final String MAP_MAIN_REPORT ="mapMainReport";
- public static final String MAP_STATS ="mapStats";
- public static final String ACTIVITY_TITLE ="activityTitle";
- public static final String ACTIVITY_INSTRUCTIONS ="activityInstructions";
-
+
+
/*
* Monitoring Mode constants
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaUtils.java,v
diff -u -r1.25 -r1.26
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java 4 Mar 2006 05:42:42 -0000 1.25
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java 4 Mar 2006 19:39:17 -0000 1.26
@@ -36,6 +36,7 @@
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
+
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.web.QaAuthoringForm;
import org.lamsfoundation.lams.usermanagement.User;
@@ -423,5 +424,172 @@
}
return map;
}
+
+ public static boolean isContentInUse(QaContent qaContent)
+ {
+ logger.debug("is content inuse: " + qaContent.isContentLocked());
+ return qaContent.isContentLocked();
+ }
+ /**
+ * the only attribute kept is TOOL_SESSION
+ * cleanUpSessionAbsolute(HttpServletRequest request)
+ * @param request
+ */
+ public static void cleanUpSessionAbsolute(HttpServletRequest request)
+ {
+ request.getSession().removeAttribute(MY_SIGNATURE);
+ request.getSession().removeAttribute(ERROR_MCAPPLICATION);
+ request.getSession().removeAttribute(TOOL_CONTENT_ID);
+ request.getSession().removeAttribute(TARGET_MODE);
+ request.getSession().removeAttribute(TARGET_MODE_AUTHORING);
+ request.getSession().removeAttribute(TARGET_MODE_LEARNING);
+ request.getSession().removeAttribute(TARGET_MODE_MONITORING);
+ request.getSession().removeAttribute(TARGET_MODE_EXPORT_PORTFOLIO);
+ request.getSession().removeAttribute(AUTHORING_STARTER);
+ request.getSession().removeAttribute(LOAD_LEARNER);
+ request.getSession().removeAttribute(LEARNING_STARTER);
+ request.getSession().removeAttribute(MONITORING_STARTER);
+ request.getSession().removeAttribute(LOAD_MONITORING);
+ request.getSession().removeAttribute(EDIT_RESPONSE);
+ request.getSession().removeAttribute(EDITABLE_RESPONSE_ID);
+ request.getSession().removeAttribute(COPY_TOOL_CONTENT);
+ request.getSession().removeAttribute(ERROR_LIST);
+ request.getSession().removeAttribute(ERROR_LIST_LEARNER);
+ request.getSession().removeAttribute(DEFAULT_CONTENT_ID_STR);
+ request.getSession().removeAttribute(TOOL_SESSION_ID);
+ request.getSession().removeAttribute(LOAD);
+ request.getSession().removeAttribute(LOAD_QUESTIONS);
+ request.getSession().removeAttribute(LOAD_STARTER);
+ request.getSession().removeAttribute(IS_DEFINE_LATER);
+ request.getSession().removeAttribute(LEARNING_MODE);
+ request.getSession().removeAttribute(IS_ADD_QUESTION);
+ request.getSession().removeAttribute(IS_REMOVE_QUESTION);
+ request.getSession().removeAttribute(IS_REMOVE_CONTENT);
+ request.getSession().removeAttribute(SELECTION_CASE);
+ request.getSession().removeAttribute(MAP_QUESTION_CONTENT);
+ request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT);
+ request.getSession().removeAttribute(ONLINE_INSTRUCTIONS);
+ request.getSession().removeAttribute(OFFLINE_INSTRUCTIONS);
+ request.getSession().removeAttribute(END_LEARNING_MESSSAGE);
+ request.getSession().removeAttribute(ON);
+ request.getSession().removeAttribute(OFF);
+ request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_TITLE);
+ request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_BLANK);
+ request.getSession().removeAttribute(SUBMIT_OFFLINE_FILE);
+ request.getSession().removeAttribute(SUBMIT_ONLINE_FILE);
+ request.getSession().removeAttribute(POPULATED_UPLOADED_FILESDATA);
+ request.getSession().removeAttribute(USER_ID);
+ request.getSession().removeAttribute(NOT_ATTEMPTED);
+ request.getSession().removeAttribute(INCOMPLETE);
+ request.getSession().removeAttribute(COMPLETED);
+ request.getSession().removeAttribute(MAP_TOOL_SESSIONS);
+ request.getSession().removeAttribute(MAX_TOOL_SESSION_COUNT.toString());
+ request.getSession().removeAttribute(IS_TOOL_SESSION_CHANGED);
+ request.getSession().removeAttribute(USER_EXCEPTION_WRONG_FORMAT);
+ request.getSession().removeAttribute(USER_EXCEPTION_UNCOMPATIBLE_IDS);
+ request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT);
+ request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST);
+ request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST);
+ request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE);
+ request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE);
+ request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE);
+ request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTNUMERIC);
+ request.getSession().removeAttribute(USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS);
+ request.getSession().removeAttribute(USER_EXCEPTION_USERID_EXISTING);
+ request.getSession().removeAttribute(USER_EXCEPTION_USER_DOESNOTEXIST);
+ request.getSession().removeAttribute(USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP);
+ request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS);
+ request.getSession().removeAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY);
+ request.getSession().removeAttribute(COUNT_SESSION_COMPLETE);
+ request.getSession().removeAttribute(CURRENT_MONITORED_TOOL_SESSION);
+ request.getSession().removeAttribute(COUNT_ALL_USERS);
+ request.getSession().removeAttribute(CURRENT_MONITORING_TAB);
+ request.getSession().removeAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO);
+ request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS);
+ request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS_ID);
+ request.getSession().removeAttribute(MODE);
+ request.getSession().removeAttribute(LEARNER);
+ request.getSession().removeAttribute(TEACHER);
+ request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED);
+ request.getSession().removeAttribute(PORTFOLIO_REPORT);
+ request.getSession().removeAttribute(PORTFOLIO_REQUEST);
+ request.getSession().removeAttribute(ADD_NEW_QUESTION);
+ request.getSession().removeAttribute(REMOVE_QUESTION);
+ request.getSession().removeAttribute(REMOVE_ALL_CONTENT);
+ request.getSession().removeAttribute(SUBMIT_ALL_CONTENT);
+ request.getSession().removeAttribute(SUBMIT_TAB_DONE);
+ request.getSession().removeAttribute(OPTION_OFF);
+ request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER);
+ request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
+ request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
+ request.getSession().removeAttribute(TOTAL_QUESTION_COUNT);
+ request.getSession().removeAttribute(MAP_ANSWERS);
+ request.getSession().removeAttribute(USER_FEEDBACK);
+ request.getSession().removeAttribute(REPORT_TITLE);
+ request.getSession().removeAttribute(MONITORING_REPORT_TITLE);
+ request.getSession().removeAttribute(REPORT_TITLE_LEARNER);
+ request.getSession().removeAttribute(END_LEARNING_MESSAGE);
+ request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE);
+ request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED);
+ request.getSession().removeAttribute(FROM_TOOL_CONTENT_ID);
+ request.getSession().removeAttribute(TO_TOOL_CONTENT_ID);
+ request.getSession().removeAttribute(LEARNER_REPORT);
+ request.getSession().removeAttribute(EDITACTIVITY_EDITMODE);
+ request.getSession().removeAttribute(RENDER_MONITORING_EDITACTIVITY);
+ request.getSession().removeAttribute(NO_AVAILABLE_SESSIONS);
+ request.getSession().removeAttribute(NO_TOOL_SESSIONS_AVAILABLE);
+ request.getSession().removeAttribute(TIMEZONE);
+ request.getSession().removeAttribute(TIMEZONE_ID);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED);
+ request.getSession().removeAttribute(FEEDBACK_TYPE_SEQUENTIAL);
+ request.getSession().removeAttribute(FEEDBACK_TYPE_COMBINED);
+ request.getSession().removeAttribute(QUESTIONS);
+ request.getSession().removeAttribute(ATTACHMENT_LIST);
+ request.getSession().removeAttribute(SUBMIT_SUCCESS);
+ request.getSession().removeAttribute(DELETED_ATTACHMENT_LIST);
+ request.getSession().removeAttribute(UUID);
+ request.getSession().removeAttribute(ACTIVITY_TITLE);
+ request.getSession().removeAttribute(ACTIVITY_INSTRUCTIONS);
+ request.getSession().removeAttribute(IS_USERNAME_VISIBLE);
+ request.getSession().removeAttribute(CURRENT_ANSWER);
+ request.getSession().removeAttribute(ACTIVE_MODULE);
+ request.getSession().removeAttribute(AUTHORING);
+ request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE);
+ request.getSession().removeAttribute(SHOW_AUTHORING_TABS);
+ request.getSession().removeAttribute(DEFINE_LATER);
+ request.getSession().removeAttribute(SOURCE_MC_STARTER);
+ request.getSession().removeAttribute(IS_MONITORED_CONTENT_IN_USE);
+ request.getSession().removeAttribute(LOAD_MONITORING_CONTENT_EDITACTIVITY);
+ }
+
+
+ public static String getDestination(String sourceMcStarter)
+ {
+ logger.debug("sourceMcStarter: " + sourceMcStarter);
+
+ if ((sourceMcStarter != null) && !sourceMcStarter.equals("monitoring"))
+ {
+ logger.debug("request is from authoring or define Later url. return to: " + LOAD_QUESTIONS);
+ return LOAD_QUESTIONS;
+ }
+ else if (sourceMcStarter == null)
+ {
+ logger.debug("request is from authoring url. return to: " + LOAD_QUESTIONS);
+ return LOAD_QUESTIONS;
+ }
+ else
+ {
+ logger.debug("request is from monitoring url. return to: " + LOAD_MONITORING_CONTENT_EDITACTIVITY);
+ return LOAD_MONITORING_CONTENT_EDITACTIVITY;
+ }
+ }
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/QaDLStarterAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java 4 Mar 2006 19:39:16 -0000 1.1
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ***********************************************************************/
+
+/**
+ * @author Ozgur Demirtas
+ *
+ * QaDLStarterAction activates the Define Later module.
+ * It reuses majority of the functionality from existing authoring module.
+ *
+
+*/
+package org.lamsfoundation.lams.tool.qa.web;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.lamsfoundation.lams.tool.qa.QaAppConstants;
+import org.lamsfoundation.lams.tool.qa.QaApplicationException;
+import org.lamsfoundation.lams.tool.qa.QaUtils;
+import org.lamsfoundation.lams.tool.qa.service.IQaService;
+import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
+
+
+public class QaDLStarterAction extends Action implements QaAppConstants {
+ static Logger logger = Logger.getLogger(QaDLStarterAction.class.getName());
+
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException, QaApplicationException {
+ QaUtils.cleanUpSessionAbsolute(request);
+ logger.debug("init defineLater mode. removed attributes...");
+
+ IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+ request.getSession().setAttribute(TOOL_SERVICE, qaService);
+
+ QaStarterAction qaStarterAction= new QaStarterAction();
+ return qaStarterAction.executeDefineLater(mapping, form, request, response, qaService);
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java,v
diff -u -r1.20 -r1.21
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 4 Mar 2006 05:42:42 -0000 1.20
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java 4 Mar 2006 19:39:16 -0000 1.21
@@ -169,7 +169,7 @@
}
catch(ToolException e)
{
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
logger.debug("tool exception: " + e);
}
}
@@ -184,7 +184,7 @@
}
catch(ToolException e)
{
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
logger.debug("tool exception" + e);
}
}
@@ -200,7 +200,7 @@
}
catch(ToolException e)
{
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
logger.debug("tool exception" + e);
}
}
@@ -244,8 +244,8 @@
{
logger.debug("error: The tool expects qaContent.");
persistError(request,"error.toolContent.notAvailable");
- //McUtils.cleanUpSessionAbsolute(request);
- return (mapping.findForward(ERROR_LIST_LEARNER));
+ QaUtils.cleanUpSessionAbsolute(request);
+ return (mapping.findForward(ERROR_LIST_LEARNER));
}
request.getSession().setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, qaContent.getQaContentId());
@@ -372,7 +372,7 @@
{
logger.debug("warning to learner: the activity is offline.");
persistError(request,"label.learning.runOffline");
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
return (mapping.findForward(ERROR_LIST_LEARNER));
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java,v
diff -u -r1.15 -r1.16
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java 4 Mar 2006 05:42:42 -0000 1.15
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java 4 Mar 2006 19:39:16 -0000 1.16
@@ -44,6 +44,7 @@
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
+import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.web.action.LamsDispatchAction;
import org.lamsfoundation.lams.web.util.AttributeNames;
@@ -123,6 +124,49 @@
}
+ public ActionForward editActivity(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching editActivity...");
+ QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form;
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("qaService: " + qaService);
+
+ request.getSession().setAttribute(CURRENT_MONITORING_TAB, "editActivity");
+
+ QaStarterAction qaStarterAction= new QaStarterAction();
+
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ request.setAttribute(SOURCE_MC_STARTER, "monitoring");
+ logger.debug("SOURCE_MC_STARTER: monitoring");
+
+ /* it is possible that the content is being used by some learners. In this situation, the content is marked as "in use" and
+ content in use is not modifiable*/
+ QaContent qaContent=qaService.loadQa(toolContentId.longValue());
+ logger.debug("qaContent:" + qaContent);
+ boolean isContentInUse=QaUtils.isContentInUse(qaContent);
+ logger.debug("isContentInUse:" + isContentInUse);
+
+ if (isContentInUse == true)
+ {
+ logger.debug("monitoring url does not allow editActivity since the content is in use.");
+ persistError(request,"error.content.inUse");
+ QaUtils.cleanUpSessionAbsolute(request);
+ request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString());
+ logger.debug("forwarding to: " + LOAD_MONITORING);
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
+ return qaStarterAction.executeDefineLater(mapping, form, request, response, qaService);
+ }
+
+
+
/**
* switches to summary tab of the monitoring url
* getSummary(ActionMapping mapping,
@@ -327,12 +371,14 @@
HttpServletResponse response) throws IOException,
ServletException
{
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
/*forward outside of the app. Currently it is index.jsp */
return (mapping.findForward(LOAD_STARTER));
}
+
+
/**
* persists error messages to request scope
* persistError(HttpServletRequest request, String message)
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java,v
diff -u -r1.19 -r1.20
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 3 Mar 2006 16:51:29 -0000 1.19
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 4 Mar 2006 19:39:16 -0000 1.20
@@ -42,7 +42,7 @@
throws IOException, ServletException, QaApplicationException
{
logger.debug("init QaMonitoringStarterAction...");
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
ActionForward validateParameters=validateParameters(request, mapping);
logger.debug("validateParamaters: " + validateParameters);
@@ -94,7 +94,7 @@
if (qaContent == null)
{
persistError(request, "error.content.doesNotExist");
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
return false;
}
@@ -113,9 +113,7 @@
logger.debug("summaryToolSessionsId: " + summaryToolSessionsId);
request.getSession().setAttribute(SUMMARY_TOOL_SESSIONS_ID, summaryToolSessionsId);
-
-
/* SELECTION_CASE == 2 indicates start up */
request.getSession().setAttribute(SELECTION_CASE, new Long(2));
logger.debug("SELECTION_CASE: " + request.getSession().getAttribute(SELECTION_CASE));
@@ -191,7 +189,7 @@
if ((strToolContentId == null) || (strToolContentId.length() == 0))
{
persistError(request, "error.contentId.required");
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
return (mapping.findForward(ERROR_LIST));
}
else
@@ -206,7 +204,7 @@
{
persistError(request, "error.contentId.numberFormatException");
logger.debug("add error.contentId.numberFormatException to ActionMessages.");
- //McUtils.cleanUpSessionAbsolute(request);
+ QaUtils.cleanUpSessionAbsolute(request);
return (mapping.findForward(ERROR_LIST));
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java,v
diff -u -r1.32 -r1.33
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 4 Mar 2006 05:42:42 -0000 1.32
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 4 Mar 2006 19:39:16 -0000 1.33
@@ -102,8 +102,6 @@
import org.apache.struts.action.ActionMessages;
import org.lamsfoundation.lams.tool.exception.ToolException;
-
-
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaApplicationException;
import org.lamsfoundation.lams.tool.qa.QaComparator;
@@ -135,34 +133,68 @@
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException, QaApplicationException {
+ QaUtils.cleanUpSessionAbsolute(request);
+ logger.debug("init authoring mode. removed attributes...");
+
Map mapQuestionContent= new TreeMap(new QaComparator());
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
+ logger.debug("qaAuthoringForm: " + qaAuthoringForm);
qaAuthoringForm.resetRadioBoxes();
- request.getSession().setAttribute(IS_DEFINE_LATER,"false");
- IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
- logger.debug("retrieving qaService from session: " + qaService);
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("qaService: " + qaService);
+ if (qaService == null)
+ {
+ logger.debug("will retrieve qaService");
+ qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("retrieving qaService from session: " + qaService);
+ }
+ request.getSession().setAttribute(TOOL_SERVICE, qaService);
+
+ String servletPath=request.getServletPath();
+ logger.debug("getServletPath: "+ servletPath);
+ if (servletPath.indexOf("authoringStarter") > 0)
+ {
+ logger.debug("request is for authoring module");
+ request.getSession().setAttribute(ACTIVE_MODULE, AUTHORING);
+ request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true));
+ request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(true).toString());
+ }
+ else
+ {
+ logger.debug("request is for define later module. either direct or by monitoring module");
+ request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER);
+ request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false));
+ request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString());
+ }
- /* needs to be called only once. */
+ /* in development this needs to be called only once. */
/* QaUtils.configureContentRepository(request); */
+ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
+ logger.debug("sourceMcStarter: " + sourceMcStarter);
+
+
/*
* obtain and setup the current user's data
* get session from shared session. */
- HttpSession ss = SessionManager.getSession();
- /* get back login user DTO */
+
+ HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
if ((user == null) || (user.getUserID() == null))
{
logger.debug("error: The tool expects userId");
persistError(request,"error.authoringUser.notAvailable");
request.setAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE, new Boolean(true));
- return (mapping.findForward(LOAD_QUESTIONS));
+ logger.debug("forwarding to: " + ERROR_LIST);
+ return (mapping.findForward(ERROR_LIST));
}
-
+
+
ActionForward validateSignature=readSignature(request,mapping);
logger.debug("validateSignature: " + validateSignature);
if (validateSignature != null)
@@ -177,11 +209,6 @@
request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_AUTHORING);
/*
- * define tab controllers for jsp
- */
- request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(false));
-
- /*
* find out whether the request is coming from monitoring module for EditActivity tab or from authoring environment url
*/
String strToolContentId="";
@@ -220,16 +247,41 @@
* there is no need to check if the content is locked in this case.
* It is always unlocked since it is the default content.
*/
+
+ /*
+ QaContent qaContent = qaService.loadQa(contentID.longValue());
+ logger.debug("QaContent: " + qaContent);
+
+ boolean studentActivity=qaService.studentActivityOccurredGlobal(qaContent);
+ logger.debug("studentActivity on content: " + studentActivity);
+ if (studentActivity)
+ {
+ logger.debug("forward to warning screen as the content is not allowed to be modified.");
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse"));
+ saveErrors(request,errors);
+ QaUtils.cleanUpSessionAbsolute(request);
+ logger.debug("forwarding to: " + ERROR_LIST);
+ return (mapping.findForward(ERROR_LIST));
+ }
+
+ */
+
if (!existsContent(contentID.longValue(), qaService))
{
String defaultContentIdStr=(String) request.getSession().getAttribute(DEFAULT_CONTENT_ID_STR);
logger.debug("defaultContentIdStr:" + defaultContentIdStr);
- return retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(defaultContentIdStr).longValue());
+ retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(defaultContentIdStr).longValue());
}
else
{
- return retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, contentID.longValue());
+ retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, contentID.longValue());
}
+
+ logger.debug("will return to jsp with: " + sourceMcStarter);
+ String destination=QaUtils.getDestination(sourceMcStarter);
+ logger.debug("destination: " + destination);
+ return (mapping.findForward(destination));
}
@@ -245,30 +297,28 @@
* @param toolContentId
* @return ActionForward
*/
- protected ActionForward retrieveContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentId)
+ protected void retrieveContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentId)
{
logger.debug("starting retrieveExistingContent for toolContentId: " + toolContentId);
- IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
-
- logger.debug("getting existing content with id:" + toolContentId);
+
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("qaService: " + qaService);
+ if (qaService == null)
+ {
+ logger.debug("will retrieve qaService");
+ qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("retrieving qaService from session: " + qaService);
+ }
+ request.getSession().setAttribute(TOOL_SERVICE, qaService);
+
+ logger.debug("getting existing content with id:" + toolContentId);
QaContent qaContent = qaService.retrieveQa(toolContentId);
logger.debug("QaContent: " + qaContent);
- boolean studentActivity=qaService.studentActivityOccurredGlobal(qaContent);
- logger.debug("studentActivity on content: " + studentActivity);
- if (studentActivity)
- {
- logger.debug("forward to warning screen as the content is not allowed to be modified.");
- ActionMessages errors= new ActionMessages();
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse"));
- saveErrors(request,errors);
- logger.debug("forwarding to:" + LOAD);
- return (mapping.findForward(LOAD));
- }
QaUtils.setDefaultSessionAttributes(request, qaContent, qaAuthoringForm);
QaUtils.populateUploadedFilesData(request, qaContent, qaService);
- request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater()));
+ request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater()));
/*
@@ -297,7 +347,15 @@
logger.debug("Map initialized with existing contentid to: " + mapQuestionContent);
logger.debug("callling presentInitialUserInterface for the existing content.");
- return presentInitialUserInterface(request, mapping, qaAuthoringForm, mapQuestionContent);
+
+ request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent);
+ logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") );
+
+ /*
+ * load questions page
+ */
+ logger.debug("RENDER_MONITORING_EDITACTIVITY: " + request.getAttribute(RENDER_MONITORING_EDITACTIVITY));
+ qaAuthoringForm.resetUserAction();
}
@@ -313,8 +371,15 @@
*/
public ActionForward readSignature(HttpServletRequest request, ActionMapping mapping)
{
- IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
- logger.debug("retrieving qaService from session: " + qaService);
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("qaService: " + qaService);
+ if (qaService == null)
+ {
+ logger.debug("will retrieve qaService");
+ qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("retrieving qaService from session: " + qaService);
+ }
+ request.getSession().setAttribute(TOOL_SERVICE, qaService);
/*
* retrieve the default content id based on tool signature
*/
@@ -337,7 +402,8 @@
logger.debug("error getting the default content id: " + e.getMessage());
persistError(request,"error.defaultContent.notSetup");
request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true));
- return (mapping.findForward(LOAD_QUESTIONS)); //TODO: forward to error page
+ logger.debug("forwarding to: " + ERROR_LIST);
+ return (mapping.findForward(ERROR_LIST));
}
@@ -351,9 +417,8 @@
{
logger.debug("Exception occured: No default content");
persistError(request,"error.defaultContent.notSetup");
+ QaUtils.cleanUpSessionAbsolute(request);
return (mapping.findForward(LOAD_QUESTIONS));
- //McUtils.cleanUpSessionAbsolute(request);
- //return (mapping.findForward(ERROR_LIST));
}
logger.debug("using qaContent: " + qaContent);
logger.debug("using mcContent uid: " + qaContent.getUid());
@@ -364,9 +429,9 @@
{
logger.debug("Exception occured: No default question content");
persistError(request,"error.defaultContent.notSetup");
- return (mapping.findForward(LOAD_QUESTIONS));
- //McUtils.cleanUpSessionAbsolute(request);
- //return (mapping.findForward(ERROR_LIST));
+ QaUtils.cleanUpSessionAbsolute(request);
+ logger.debug("forwarding to: " + ERROR_LIST);
+ return (mapping.findForward(ERROR_LIST));
}
@@ -381,9 +446,8 @@
{
logger.debug("Exception occured: No default question content");
persistError(request,"error.defaultQuestionContent.notAvailable");
+ QaUtils.cleanUpSessionAbsolute(request);
return (mapping.findForward(LOAD_QUESTIONS));
- //McUtils.cleanUpSessionAbsolute(request);
- //return (mapping.findForward(ERROR_LIST));
}
logger.debug("using qaQueContent uid: " + qaQueContent.getUid());
//request.getSession().setAttribute(DEFAULT_QUESTION_UID, new Long(queContentUID));
@@ -393,9 +457,9 @@
{
logger.debug("Exception occured: No default question content");
persistError(request,"error.defaultQuestionContent.notAvailable");
- return (mapping.findForward(LOAD_QUESTIONS));
- //McUtils.cleanUpSessionAbsolute(request);
- //return (mapping.findForward(ERROR_LIST));
+ QaUtils.cleanUpSessionAbsolute(request);
+ logger.debug("forwarding to: " + ERROR_LIST);
+ return (mapping.findForward(ERROR_LIST));
}
logger.debug("QA tool has the default content id: " + defaultContentID);
@@ -404,31 +468,7 @@
}
- /**
- * presents the final Map to the jsp
- * ActionForward presentInitialUserInterface(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent)
- *
- * @param request
- * @param mapping
- * @param qaAuthoringForm
- * @param mapQuestionContent
- * @return
- */
- protected ActionForward presentInitialUserInterface(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent)
- {
- logger.debug("starting presentInitialUserInterface...");
- request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent);
- logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") );
-
- /*
- * load questions page
- */
- logger.debug("RENDER_MONITORING_EDITACTIVITY: " + request.getAttribute(RENDER_MONITORING_EDITACTIVITY));
- qaAuthoringForm.resetUserAction();
- return (mapping.findForward(LOAD_QUESTIONS));
- }
-
/**
* existsContent(long toolContentId)
* @param long toolContentId
@@ -444,29 +484,18 @@
return true;
}
-
- /**
- * mark the request scope to generate monitoring summary screen
- *
- * ActionForward startMonitoringSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException, QaApplicationException
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- * @throws QaApplicationException
- */
- public ActionForward startMonitoringSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException, QaApplicationException
- {
+
+ public ActionForward executeDefineLater(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response, IQaService qaService)
+ throws IOException, ServletException, QaApplicationException {
+ logger.debug("passed qaService: " + qaService);
+ request.getSession().setAttribute(TOOL_SERVICE, qaService);
+ logger.debug("calling execute...");
return execute(mapping, form, request, response);
}
+
-
+
/**
* persists error messages to request scope
* @param request
Index: lams_tool_laqa/web/index.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/Attic/index.jsp,v
diff -u -r1.4 -r1.5
--- lams_tool_laqa/web/index.jsp 24 Feb 2006 15:05:59 -0000 1.4
+++ lams_tool_laqa/web/index.jsp 4 Mar 2006 19:39:17 -0000 1.5
@@ -74,6 +74,12 @@
+
+
+
+
+
Index: lams_tool_laqa/web/WEB-INF/struts-config.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/struts-config.xml,v
diff -u -r1.14 -r1.15
--- lams_tool_laqa/web/WEB-INF/struts-config.xml 4 Mar 2006 05:42:42 -0000 1.14
+++ lams_tool_laqa/web/WEB-INF/struts-config.xml 4 Mar 2006 19:39:17 -0000 1.15
@@ -151,7 +151,33 @@
redirect="true"
/>
+
+
+
+
+
+
+
+
+
+
+