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.50 -r1.51
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java 19 Mar 2006 10:55:57 -0000 1.50
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java 2 Apr 2006 20:37:23 -0000 1.51
@@ -59,6 +59,7 @@
public static final String AUTHORING ="authoring";
public static final String MONITORING ="monitoring";
public static final String DEFINE_LATER_IN_EDIT_MODE ="defineLaterInEditMode";
+ public static final String REMOVABLE_QUESTION_INDEX ="removableQuestionIndex";
public static final String SHOW_AUTHORING_TABS ="showAuthoringTabs";
public static final String MONITORING_ORIGINATED_DEFINELATER ="monitoringOriginatedDefineLater";
public static final String DEFINE_LATER ="defineLater";
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.39 -r1.40
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java 21 Mar 2006 14:52:22 -0000 1.39
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java 2 Apr 2006 20:37:23 -0000 1.40
@@ -611,4 +611,23 @@
return null;
}
}
+
+ public static void setDefineLater(HttpServletRequest request, boolean value)
+ {
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("qaService:" + qaService);
+
+ Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId:" + toolContentId);
+
+ QaContent qaContent=qaService.loadQa(toolContentId.longValue());
+ logger.debug("qaContent:" + qaContent);
+ if (qaContent != null)
+ {
+ qaContent.setDefineLater(value);
+ logger.debug("defineLater has been set to true");
+ qaService.updateQa(qaContent);
+ }
+ }
+
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java,v
diff -u -r1.27 -r1.28
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java 19 Mar 2006 10:55:56 -0000 1.27
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java 2 Apr 2006 20:37:22 -0000 1.28
@@ -78,10 +78,24 @@
*/
protected void reconstructQuestionContentMapForRemove(Map mapQuestionContent, HttpServletRequest request, QaAuthoringForm qaAuthoringForm)
{
+ logger.debug("doing reconstructQuestionContentMapForRemove.");
String questionIndex =qaAuthoringForm.getQuestionIndex();
logger.debug("pre-delete map content: " + mapQuestionContent);
logger.debug("questionIndex: " + questionIndex);
+ String defLater=(String)request.getSession().getAttribute(ACTIVE_MODULE);
+ logger.debug("defLater: " + defLater);
+
+ String removableQuestionIndex=null;
+ if (defLater.equals(MONITORING))
+ {
+ removableQuestionIndex=(String)request.getSession().getAttribute(REMOVABLE_QUESTION_INDEX);
+ logger.debug("removableQuestionIndex: " + removableQuestionIndex);
+ questionIndex=removableQuestionIndex;
+ }
+ logger.debug("final removableQuestionIndex: " + questionIndex);
+
+
long longQuestionIndex= new Long(questionIndex).longValue();
logger.debug("pre-delete count: " + mapQuestionContent.size());
@@ -167,10 +181,16 @@
boolean isSynchInMonitor=false;
boolean isUsernameVisible=false;
String reportTitle = qaAuthoringForm.getReportTitle();
- String richTextTitle = qaAuthoringForm.getTitle();
+ //String richTextTitle = qaAuthoringForm.getTitle();
+
+ String richTextTitle = request.getParameter("title");
+ String richTextInstructions = request.getParameter("instructions");
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+
String monitoringReportTitle = qaAuthoringForm.getMonitoringReportTitle();
String richTextOfflineInstructions = qaAuthoringForm.getOnlineInstructions();
- String richTextInstructions = qaAuthoringForm.getInstructions();
+ //String richTextInstructions = qaAuthoringForm.getInstructions();
String richTextOnlineInstructions = qaAuthoringForm.getOfflineInstructions();
String endLearningMessage = qaAuthoringForm.getEndLearningMessage();
@@ -234,16 +254,13 @@
logger.debug("userId: " + userId);
- String toolContentId=qaAuthoringForm.getToolContentId();
+ Long toolContentIdLong =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentIdLong: " + toolContentIdLong);
+
+ //String toolContentId=qaAuthoringForm.getToolContentId();
+ String toolContentId=toolContentIdLong.toString();
logger.debug("toolContentId: " + toolContentId);
- if ((toolContentId == null) || toolContentId.equals(""))
- {
- logger.debug("getting toolContentId from session.");
- Long longToolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
- toolContentId=longToolContentId.toString();
- logger.debug("toolContentId: " + toolContentId);
- }
- logger.debug("final toolContentId: " + toolContentId);
+
QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue());
logger.debug("qaContent: " + qaContent);
@@ -255,12 +272,14 @@
}
- logger.debug("setting common content values...");
+ logger.debug("setting common content values..." + richTextTitle + " " + richTextInstructions);
qaContent.setQaContentId(new Long(toolContentId));
qaContent.setTitle(richTextTitle);
qaContent.setInstructions(richTextInstructions);
qaContent.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/
+ logger.debug("userId: " + userId);
qaContent.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/
+ logger.debug("end of setting common content values...");
if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent))
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java,v
diff -u -r1.6 -r1.7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java 19 Mar 2006 10:55:56 -0000 1.6
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java 2 Apr 2006 20:37:22 -0000 1.7
@@ -1,3 +1,4 @@
+
/***************************************************************************
* Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
* =============================================================
@@ -182,9 +183,17 @@
public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
+ logger.debug("starting submitAllContent :" +form);
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
- IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaAuthoringForm :" +qaAuthoringForm);
+
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ if (qaService == null)
+ qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService :" +qaService);
+
+
AuthoringUtil authoringUtil= new AuthoringUtil();
Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT);
logger.debug("mapQuestionContent :" +mapQuestionContent);
@@ -231,7 +240,23 @@
QaContent qaContent=authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm, request);
logger.debug("qaContent: " + qaContent);
+
+ String richTextTitle = request.getParameter("title");
+ String richTextInstructions = request.getParameter("instructions");
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+ if (richTextTitle != null)
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, richTextTitle);
+ }
+
+ if (richTextInstructions != null)
+ {
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, richTextInstructions);
+ }
+
+
authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, qaService, qaAuthoringForm, qaContent);
List attacments=saveAttachments(qaContent, attachmentList, deletedAttachmentList, mapping, request);
@@ -249,6 +274,9 @@
saveErrors(request,errors);
+ QaUtils.setDefineLater(request, false);
+ logger.debug("define later set to false");
+
qaAuthoringForm.resetUserAction();
return mapping.findForward(LOAD_QUESTIONS);
}
@@ -404,7 +432,20 @@
toolContentId=longToolContentId.toString();
logger.debug("toolContentId: " + toolContentId);
}
+
+ QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue());
+ logger.debug("existing qaContent:" + qaContent);
+ boolean isContentInUse=QaUtils.isContentInUse(qaContent);
+ logger.debug("isContentInUse:" + isContentInUse);
+
+ request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString());
+ if (isContentInUse == true)
+ {
+ logger.debug("monitoring url does not allow editActivity since the content is in use.");
+ persistError(request,"error.content.inUse");
+ request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString());
+ }
QaUtils.setDefineLater(request, true, toolContentId);
@@ -428,13 +469,32 @@
*/
public ActionForward addNewQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
+
+ logger.debug("dispathcing addNewQuestion");
+
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
AuthoringUtil authoringUtil= new AuthoringUtil();
Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT);
+
+ String richTextTitle = request.getParameter("title");
+ String richTextInstructions = request.getParameter("instructions");
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+ if (richTextTitle != null)
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, richTextTitle);
+ }
+
+ if (richTextInstructions != null)
+ {
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, richTextInstructions);
+ }
+
request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); //FIXME: ??
authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, request);
+ logger.debug("richTextInstructions: " + request.getSession().getAttribute(ACTIVITY_INSTRUCTIONS));
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -454,8 +514,25 @@
*/
public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
+ logger.debug("doing removeQuestion ");
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
- AuthoringUtil authoringUtil= new AuthoringUtil();
+
+ String richTextTitle = request.getParameter("title");
+ String richTextInstructions = request.getParameter("instructions");
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+
+ if (richTextTitle != null)
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, richTextTitle);
+ }
+
+ if (richTextInstructions != null)
+ {
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, richTextInstructions);
+ }
+
+ AuthoringUtil authoringUtil= new AuthoringUtil();
QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT);
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.30 -r1.31
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java 21 Mar 2006 14:52:22 -0000 1.30
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java 2 Apr 2006 20:37:22 -0000 1.31
@@ -146,6 +146,21 @@
{
logger.debug("dispatching getStats..." + request);
+ initStatsContent(mapping, form, request, response);
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
+
+
+ public void initStatsContent(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("starting initStatsContent...");
+ logger.debug("dispatching getStats..." + request);
+
IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
logger.debug("qaService: " + qaService);
if (qaService == null)
@@ -164,23 +179,25 @@
if (qaService.studentActivityOccurredGlobal(qaContent))
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
}
else
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
}
refreshStatsData(request);
request.getSession().setAttribute(EDIT_RESPONSE, new Boolean(false));
request.getSession().setAttribute(CURRENT_MONITORING_TAB, "stats");
- return (mapping.findForward(LOAD_MONITORING));
+ logger.debug("ending initStatsContent...");
}
+
+
/**
* switches to instructions tab of the monitoring url.
* getInstructions(ActionMapping mapping,
@@ -204,7 +221,21 @@
ServletException
{
logger.debug("dispatching getInstructions..." + request);
+ initInstructionsContent(mapping, form, request, response);
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
+
+ public void initInstructionsContent(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("starting initInstructionsContent...");
+ logger.debug("dispatching getInstructions..." + request);
+
IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
logger.debug("qaService: " + qaService);
if (qaService == null)
@@ -222,23 +253,23 @@
if (qaService.studentActivityOccurredGlobal(qaContent))
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
}
else
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
}
refreshInstructionsData(request, qaContent);
request.getSession().setAttribute(EDIT_RESPONSE, new Boolean(false));
request.getSession().setAttribute(CURRENT_MONITORING_TAB, "instructions");
- return (mapping.findForward(LOAD_MONITORING));
+ logger.debug("ending initInstructionsContent...");
+
}
-
/**
* activates editActivity screen
* ActionForward editActivity(ActionMapping mapping,
@@ -325,6 +356,21 @@
HttpServletResponse response) throws IOException,
ServletException
{
+ logger.debug("start getSummary...");
+ initSummaryContent(mapping, form, request, response);
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
+
+
+ public void initSummaryContent(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("start initSummaryContent...");
+
logger.debug("dispatching getSummary..." + request);
request.getSession().setAttribute(EDIT_RESPONSE, new Boolean(false));
@@ -350,22 +396,69 @@
logger.debug("SUMMARY_TOOL_SESSIONS: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS));
/* ends here. */
-
+ /*true means there is at least 1 response*/
if (qaService.studentActivityOccurredGlobal(qaContent))
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
}
else
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
}
request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary");
- return (mapping.findForward(LOAD_MONITORING));
+ logger.debug("end initSummaryContent...");
}
+
+ public ActionForward editActivityQuestions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException,
+ ToolException
+ {
+ logger.debug("dispatching editActivityQuestions...");
+ request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString());
+
+ request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true));
+ QaUtils.setDefineLater(request, true);
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
+ public ActionForward addNewQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ logger.debug("dispatching proxy editActivityQuestions...");
+ QaAction qaAction= new QaAction();
+ return qaAction.addNewQuestion(mapping, form, request, response);
+ }
+
+
+ public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ logger.debug("dispatching proxy removeQuestion...");
+ QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form;
+ logger.debug("qaMonitoringForm: " + qaMonitoringForm);
+ String questionIndex=qaMonitoringForm.getQuestionIndex();
+ logger.debug("questionIndex: " + questionIndex);
+ request.getSession().setAttribute(REMOVABLE_QUESTION_INDEX, questionIndex);
+
+ QaAction qaAction= new QaAction();
+ return qaAction.removeQuestion(mapping, form, request, response);
+ }
+
+ public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ logger.debug("dispatching proxy submitAllContent...");
+ request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER);
+ QaAction qaAction= new QaAction();
+ return qaAction.submitAllContent(mapping, form, request, response);
+
+ }
+
/**
* gets called when the user selects a group from dropdown box in the summary tab
*
@@ -721,12 +814,12 @@
if (qaService.studentActivityOccurredGlobal(qaContent))
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
}
else
{
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
}
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.31 -r1.32
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 21 Mar 2006 14:52:22 -0000 1.31
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java 2 Apr 2006 20:37:22 -0000 1.32
@@ -2,6 +2,9 @@
package org.lamsfoundation.lams.tool.qa.web;
import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -17,7 +20,9 @@
import org.apache.struts.action.ActionMessages;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaApplicationException;
+import org.lamsfoundation.lams.tool.qa.QaComparator;
import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaQueContent;
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
@@ -91,7 +96,78 @@
if (initData == false)
return (mapping.findForward(ERROR_LIST));
- return (mapping.findForward(LOAD_MONITORING));
+ QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form;
+ logger.debug("qaMonitoringForm: " + qaMonitoringForm);
+ qaMonitoringForm.setCurrentTab("1");
+ logger.debug("setting current tab to 1: ");
+
+
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+
+ QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
+ logger.debug("calling initSummaryContent.");
+ qaMonitoringAction.initSummaryContent(mapping, form, request, response);
+ logger.debug("calling initInstructionsContent.");
+ qaMonitoringAction.initInstructionsContent(mapping, form, request, response);
+ logger.debug("calling initStatsContent.");
+ qaMonitoringAction.initStatsContent(mapping, form, request, response);
+
+
+ IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
+
+ /* we have made sure TOOL_CONTENT_ID is passed */
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ QaContent qaContent=qaService.loadQa(toolContentId.longValue());
+
+ logger.debug("existing qaContent:" + qaContent);
+ Map mapQuestionContent= new TreeMap(new QaComparator());
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ /*
+ * get the existing question content
+ */
+ logger.debug("setting existing content data from the db");
+ mapQuestionContent.clear();
+ Iterator queIterator=qaContent.getQaQueContents().iterator();
+ Long mapIndex=new Long(1);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ while (queIterator.hasNext())
+ {
+ QaQueContent qaQueContent=(QaQueContent) queIterator.next();
+ if (qaQueContent != null)
+ {
+ logger.debug("question: " + qaQueContent.getQuestion());
+ mapQuestionContent.put(mapIndex.toString(),qaQueContent.getQuestion());
+ /**
+ * make the first entry the default(first) one for jsp
+ */
+ if (mapIndex.longValue() == 1)
+ request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion());
+ mapIndex=new Long(mapIndex.longValue()+1);
+ }
+ }
+ logger.debug("Map initialized with existing contentid to: " + mapQuestionContent);
+ logger.debug("callling presentInitialUserInterface for the existing content.");
+
+ request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent);
+ logger.debug("execute initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") );
+
+ /*true means there is at least 1 response*/
+ if (qaService.studentActivityOccurredGlobal(qaContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+
+
+ request.getSession().setAttribute(ACTIVE_MODULE, MONITORING);
+ return (mapping.findForward(LOAD_MONITORING));
}
@@ -114,10 +190,8 @@
request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary");
request.getSession().setAttribute(EDIT_RESPONSE, new Boolean(false));
- /*by default display summary data*/
- request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
-
- /*
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ /*
* persist time zone information to session scope.
*/
QaUtils.persistTimeZone(request);
@@ -137,6 +211,32 @@
return false;
}
+
+ boolean isContentInUse=QaUtils.isContentInUse(qaContent);
+ logger.debug("isContentInUse:" + isContentInUse);
+
+
+ request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString());
+ if (isContentInUse == true)
+ {
+ logger.debug("monitoring url does not allow editActivity since the content is in use.");
+ persistError(request,"error.content.inUse");
+ request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString());
+ }
+
+
+ if (qaContent.getTitle() == null)
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, "Questions and Answers");
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, "Please answer the questions.");
+ }
+ else
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, qaContent.getTitle());
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, qaContent.getInstructions());
+ }
+
+
if (qaService.studentActivityOccurred(qaContent))
{
QaUtils.cleanUpSessionAbsolute(request);
@@ -156,9 +256,8 @@
/* this section is related to instructions tab. Starts here. */
/* ends here. */
- request.getSession().setAttribute(ACTIVITY_TITLE, qaContent.getTitle());
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, qaContent.getInstructions());
-
+
+ logger.debug("end initializing monitoring data...");
return true;
}
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.42 -r1.43
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 21 Mar 2006 14:52:22 -0000 1.42
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 2 Apr 2006 20:37:22 -0000 1.43
@@ -193,6 +193,11 @@
IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
logger.debug("qaService: " + qaService);
+
+ qaAuthoringForm.setCurrentTab("1");
+ logger.debug("setting currrent tab to 1: ");
+
+
if (qaService == null)
{
logger.debug("will retrieve qaService");
@@ -315,7 +320,7 @@
qaAuthoringForm.setToolContentId(strToolContentId);
request.getSession().setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, new Long(strToolContentId));
- logger.debug("using TOOL_CONTENT_ID: " + strToolContentId);
+ logger.debug("using TOOL_CONTENT_ID: " + strToolContentId);
/*
@@ -398,9 +403,19 @@
qaAuthoringForm.setTitle(qaContent.getTitle());
qaAuthoringForm.setInstructions(qaContent.getInstructions());
- //request.getSession().setAttribute(ACTIVITY_TITLE, qaContent.getTitle());
- //request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, qaContent.getInstructions());
+ if (qaContent.getTitle() == null)
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, "Questions and Answers");
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, "Please answer the questions.");
+ }
+ else
+ {
+ request.getSession().setAttribute(ACTIVITY_TITLE, qaContent.getTitle());
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, qaContent.getInstructions());
+ }
+
+
logger.debug("Title is: " + qaContent.getTitle());
logger.debug("Instructions is: " + qaContent.getInstructions());
if ((qaAuthoringForm.getTitle() == null) || (qaAuthoringForm.getTitle().equals("")))
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.24 -r1.25
--- lams_tool_laqa/web/WEB-INF/struts-config.xml 21 Mar 2006 13:02:05 -0000 1.24
+++ lams_tool_laqa/web/WEB-INF/struts-config.xml 2 Apr 2006 20:37:23 -0000 1.25
@@ -420,7 +420,7 @@
Index: lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp,v
diff -u -r1.4 -r1.5
--- lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp 30 Mar 2006 22:17:20 -0000 1.4
+++ lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp 2 Apr 2006 20:37:23 -0000 1.5
@@ -82,13 +82,11 @@
initEditor("title");
initEditor("instructions");
initEditor("questionContent0");
- initEditor("onlineInstructions");
- initEditor("offlineInstructions");
-
+
- initEditor(" ");
+ initEditor(" ");
}
Index: lams_tool_laqa/web/authoring/BasicContent.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/authoring/BasicContent.jsp,v
diff -u -r1.10 -r1.11
--- lams_tool_laqa/web/authoring/BasicContent.jsp 30 Mar 2006 22:17:20 -0000 1.10
+++ lams_tool_laqa/web/authoring/BasicContent.jsp 2 Apr 2006 20:37:23 -0000 1.11
@@ -27,7 +27,6 @@
<%@ taglib uri="fck-editor" prefix="FCK" %>
<%@ taglib uri="tags-lams" prefix="lams" %>
-
@@ -52,15 +51,15 @@
:
-
+
:
-
+
@@ -89,11 +88,21 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -127,6 +136,12 @@
document.QaAuthoringForm.questionIndex.value=questionIndex;
submitMethod('removeQuestion');
}
+
+ function removeMonitoringQuestion(questionIndex)
+ {
+ document.QaMonitoringForm.questionIndex.value=questionIndex;
+ submitMonitoringMethod('removeQuestion');
+ }
Index: lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/authoring/Attic/BasicContentViewOnly.jsp,v
diff -u -r1.4 -r1.5
--- lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp 30 Mar 2006 22:17:20 -0000 1.4
+++ lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp 2 Apr 2006 20:37:23 -0000 1.5
@@ -34,15 +34,15 @@
:
-
+
:
-
+
@@ -58,7 +58,6 @@
-
Index: lams_tool_laqa/web/monitoring/Edit.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/Edit.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_laqa/web/monitoring/Edit.jsp 2 Apr 2006 20:37:23 -0000 1.1
@@ -0,0 +1,49 @@
+<%--
+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
+--%>
+
+<%@ taglib uri="tags-bean" prefix="bean"%>
+<%@ taglib uri="tags-html" prefix="html"%>
+<%@ taglib uri="tags-logic" prefix="logic" %>
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+<%@ taglib uri="fck-editor" prefix="FCK" %>
+<%@ taglib uri="tags-lams" prefix="lams" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_laqa/web/monitoring/Instructions.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/Attic/Instructions.jsp,v
diff -u -r1.2 -r1.3
--- lams_tool_laqa/web/monitoring/Instructions.jsp 2 Mar 2006 15:04:13 -0000 1.2
+++ lams_tool_laqa/web/monitoring/Instructions.jsp 2 Apr 2006 20:37:23 -0000 1.3
@@ -30,8 +30,6 @@
-
-
Index: lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp,v
diff -u -r1.7 -r1.8
--- lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp 19 Mar 2006 10:55:57 -0000 1.7
+++ lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp 2 Apr 2006 20:37:23 -0000 1.8
@@ -27,35 +27,50 @@
<%@ taglib uri="fck-editor" prefix="FCK" %>
<%@ taglib uri="tags-lams" prefix="lams" %>
+<%@ page import="java.util.LinkedHashSet" %>
+<%@ page import="java.util.Set" %>
+
+ <%
+ Set tabs = new LinkedHashSet();
+ tabs.add("label.summary");
+ tabs.add("label.instructions");
+ tabs.add("label.editActivity");
+ tabs.add("label.stats");
+ pageContext.setAttribute("tabs", tabs);
+
+ %>
+
-
-
-
+
+
+
-
-
+
- includes/javascript/tabcontroller.js">
- includes/javascript/common.js">
-
-
- css/tool_custom.css" rel="stylesheet" type="text/css">
-
+
+
+
+
+
+
+
+
-
-
-<%-- chooses which tab to highlight --%>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ")'>
+ var imgRoot="${lams}images/";
+ var themeName="aqua";
+
+ function init(){
+
+ initTabSize(4);
+
+ var tag = document.getElementById("currentTab");
+ if(tag.value != "")
+ selectTab(tag.value);
+ else
+ selectTab(1); //select the default tab;
+
+ initEditor("title");
+ initEditor("instructions");
+ initEditor("questionContent0");
+
+
+
+
+ initEditor(" ");
+
+ }
+
+ function doSelectTab(tabId) {
+ // start optional tab controller stuff
+ var tag = document.getElementById("currentTab");
+ tag.value = tabId;
+ // end optional tab controller stuff
+ selectTab(tabId);
+ }
+
+ function doSubmit(method) {
+ document.QaMonitoringForm.dispatch.value=method;
+ document.QaMonitoringForm.submit();
+ }
+
+
+
+ author_page/js/tabcontroller.js">
+ includes/javascript/common.js">
+
+
+
+
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-   
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
Fisheye: Tag 1.3 refers to a dead (removed) revision in file `lams_tool_laqa/web/monitoring/MonitoringTabsHeader.jsp'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/web/monitoring/Stats.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/Stats.jsp,v
diff -u -r1.2 -r1.3
--- lams_tool_laqa/web/monitoring/Stats.jsp 2 Mar 2006 15:04:13 -0000 1.2
+++ lams_tool_laqa/web/monitoring/Stats.jsp 2 Apr 2006 20:37:23 -0000 1.3
@@ -30,9 +30,6 @@
-
-
-
Index: lams_tool_laqa/web/monitoring/SummaryContent.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_laqa/web/monitoring/SummaryContent.jsp,v
diff -u -r1.10 -r1.11
--- lams_tool_laqa/web/monitoring/SummaryContent.jsp 19 Mar 2006 10:55:57 -0000 1.10
+++ lams_tool_laqa/web/monitoring/SummaryContent.jsp 2 Apr 2006 20:37:22 -0000 1.11
@@ -30,16 +30,9 @@
-
-
-
-
-
-
-
-
+
\ No newline at end of file