Index: lams_tool_laqa/db/sql/activity_insert.sql
===================================================================
diff -u -re4a031bce4c3d968bcdec679ba17fbc361eaef18 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/db/sql/activity_insert.sql (.../activity_insert.sql) (revision e4a031bce4c3d968bcdec679ba17fbc361eaef18)
+++ lams_tool_laqa/db/sql/activity_insert.sql (.../activity_insert.sql) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -44,9 +44,9 @@
VALUES
(
NULL
-, 'Question and Answer Description'
+, 'Allows creation and use of question and answer format'
, 'Question and Answer'
-, 'Put some help text here.'
+, 'Help text'
, NULL
, NULL
, NULL
Index: lams_tool_laqa/db/sql/tool_insert.sql
===================================================================
diff -u -re4a031bce4c3d968bcdec679ba17fbc361eaef18 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/db/sql/tool_insert.sql (.../tool_insert.sql) (revision e4a031bce4c3d968bcdec679ba17fbc361eaef18)
+++ lams_tool_laqa/db/sql/tool_insert.sql (.../tool_insert.sql) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -33,7 +33,7 @@
'laqa11',
'qaService',
'Question and Answer',
-'Question and Answer Tool Description',
+'Q/A Tool',
'qa',
'1.1',
NULL,
@@ -49,8 +49,8 @@
'tool/laqa11/defineLaterStarter.do',
'tool/laqa11/export.do?mode=learner',
'tool/laqa11/export.do?mode=teacher',
-'tool/laqa11/monitoring.do',
-'tool/laqa11/monitoring.do',
+'tool/laqa11/monitoringStarter.do',
+'tool/laqa11/monitoringStarter.do',
'org.lamsfoundation.lams.tool.qa.QaResources',
NOW()
)
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java
===================================================================
diff -u -r45a3263a49a830c6e5392591ccd854264c5e6730 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 45a3263a49a830c6e5392591ccd854264c5e6730)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -44,7 +44,7 @@
public static final String LEARNING_STARTER ="learningStarter";
public static final String MONITORING_STARTER ="monitoringStarter";
public static final String EXPORT_PORTFOLIO = "exportPortfolio";
- public static final String LOAD_MONITORING ="loadMonitoring";
+ public static final String LOAD_MONITORING ="refreshMonitoring";
public static final String LOAD_VIEW_ONLY ="loadViewOnly";
public static final String EDIT_RESPONSE ="editResponse";
public static final String EDITABLE_RESPONSE_ID ="editableResponseId";
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java
===================================================================
diff -u -r45a3263a49a830c6e5392591ccd854264c5e6730 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 45a3263a49a830c6e5392591ccd854264c5e6730)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -98,6 +98,11 @@
qaAuthoringForm.setTitle(defaultQaContent.getTitle());
qaAuthoringForm.setInstructions(defaultQaContent.getInstructions());
+ request.getSession().setAttribute(ACTIVITY_TITLE, defaultQaContent.getTitle());
+ request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, defaultQaContent.getInstructions());
+
+ logger.debug("ACTIVITY_INSTRUCTIONS: " + defaultQaContent.getInstructions());
+
qaAuthoringForm.setReportTitle(defaultQaContent.getReportTitle());
qaAuthoringForm.setMonitoringReportTitle(defaultQaContent.getMonitoringReportTitle());
qaAuthoringForm.setEndLearningMessage(defaultQaContent.getEndLearningMessage());
@@ -112,6 +117,42 @@
}
+ public static void persistRichText(HttpServletRequest request)
+ {
+ String richTextOfflineInstructions=request.getParameter(RICHTEXT_OFFLINEINSTRUCTIONS);
+ logger.debug("read parameter richTextOfflineInstructions: " + richTextOfflineInstructions);
+ String richTextOnlineInstructions=request.getParameter(RICHTEXT_ONLINEINSTRUCTIONS);
+ logger.debug("read parameter richTextOnlineInstructions: " + richTextOnlineInstructions);
+
+ if ((richTextOfflineInstructions != null) && (richTextOfflineInstructions.length() > 0))
+ {
+ request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,richTextOfflineInstructions);
+ }
+
+ if ((richTextOnlineInstructions != null) && (richTextOnlineInstructions.length() > 0))
+ {
+ request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,richTextOnlineInstructions);
+ }
+
+
+ String richTextTitle=request.getParameter(RICHTEXT_TITLE);
+ logger.debug("read parameter richTextTitle: " + richTextTitle);
+ String richTextInstructions=request.getParameter(RICHTEXT_INSTRUCTIONS);
+ logger.debug("read parameter richTextInstructions: " + richTextInstructions);
+
+
+ if ((richTextTitle != null) && (richTextTitle.length() > 0))
+ {
+ request.getSession().setAttribute(RICHTEXT_TITLE,richTextTitle);
+ }
+
+ if ((richTextInstructions != null) && (richTextInstructions.length() > 0))
+ {
+ request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,richTextInstructions);
+ }
+ }
+
+
public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException
{
HttpSession ss = SessionManager.getSession();
@@ -212,46 +253,7 @@
request.getSession().setAttribute(TIMEZONE_ID, timeZone.getID());
}
-
- /**
- * stores the rich text values on the forms into the session scope
- * persistRichText(HttpServletRequest request)
- * @param request
- */
- public static void persistRichText(HttpServletRequest request)
- {
- String richTextOfflineInstructions=request.getParameter(RICHTEXT_OFFLINEINSTRUCTIONS);
- logger.debug("read parameter richTextOfflineInstructions: " + richTextOfflineInstructions);
- String richTextOnlineInstructions=request.getParameter(RICHTEXT_ONLINEINSTRUCTIONS);
- logger.debug("read parameter richTextOnlineInstructions: " + richTextOnlineInstructions);
-
- if ((richTextOfflineInstructions != null) && (richTextOfflineInstructions.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,richTextOfflineInstructions);
- }
-
- if ((richTextOnlineInstructions != null) && (richTextOnlineInstructions.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,richTextOnlineInstructions);
- }
-
- String richTextTitle=request.getParameter(RICHTEXT_TITLE);
- logger.debug("read parameter richTextTitle: " + richTextTitle);
- String richTextInstructions=request.getParameter(RICHTEXT_INSTRUCTIONS);
- logger.debug("read parameter richTextInstructions: " + richTextInstructions);
-
- if ((richTextTitle != null) && (richTextTitle.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_TITLE,richTextTitle);
- }
-
- if ((richTextInstructions != null) && (richTextInstructions.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,richTextInstructions);
- }
- }
-
public static void configureContentRepository(HttpServletRequest request)
{
logger.debug("attempt configureContentRepository");
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -r45a3263a49a830c6e5392591ccd854264c5e6730 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 45a3263a49a830c6e5392591ccd854264c5e6730)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -29,6 +29,7 @@
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
@@ -158,7 +159,7 @@
}
- public QaContent saveOrUpdateQaContent(Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm)
+ public QaContent saveOrUpdateQaContent(Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm, HttpServletRequest request)
{
UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);
@@ -182,59 +183,118 @@
String usernameVisible = qaAuthoringForm.getUsernameVisible();
logger.debug("usernameVisible: " + usernameVisible);
+ boolean setCommonContent=true;
+ if ((questionsSequenced == null) || (synchInMonitor == null) || (usernameVisible == null))
+ {
+ setCommonContent=false;
+ }
+ logger.debug("setCommonContent: " + setCommonContent);
+
+ String activeModule=(String)request.getSession().getAttribute(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
boolean questionsSequencedBoolean=false;
- if (questionsSequenced.equalsIgnoreCase(ON))
- questionsSequencedBoolean=true;
-
boolean synchInMonitorBoolean=false;
- if (synchInMonitor.equalsIgnoreCase(ON))
- synchInMonitorBoolean=true;
-
boolean usernameVisibleBoolean=false;
- if (usernameVisible.equalsIgnoreCase(ON))
- usernameVisibleBoolean=true;
+ if (setCommonContent)
+ {
+ if (questionsSequenced.equalsIgnoreCase(ON))
+ questionsSequencedBoolean=true;
+
+ if (synchInMonitor.equalsIgnoreCase(ON))
+ synchInMonitorBoolean=true;
+
+
+ if (usernameVisible.equalsIgnoreCase(ON))
+ usernameVisibleBoolean=true;
+ }
- long userId = toolUser.getUserID().longValue();
+ long userId=0;
+ if (toolUser != null)
+ {
+ userId = toolUser.getUserID().longValue();
+ }
+ else
+ {
+ HttpSession ss = SessionManager.getSession();
+ logger.debug("ss: " + ss);
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ logger.debug("user" + user);
+ if (user != null)
+ {
+ userId = user.getUserID().longValue();
+ }
+ else
+ {
+ logger.debug("should not reach here");
+ userId=0;
+ }
+ }
+ logger.debug("userId: " + userId);
- QaContent qa = qaService.loadQa(Long.parseLong(qaAuthoringForm.getToolContentId()));
- if(qa==null)
- qa = new QaContent();
-
- qa.setTitle(richTextTitle);
- qa.setInstructions(richTextInstructions);
- qa.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/
- qa.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/
- qa.setUsernameVisible(isUsernameVisible);
- qa.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/
- qa.setSynchInMonitor(isSynchInMonitor);
- qa.setOnlineInstructions(richTextOnlineInstructions);
- qa.setOfflineInstructions(richTextOfflineInstructions);
- qa.setEndLearningMessage(endLearningMessage);
- qa.setReportTitle(reportTitle);
- qa.setMonitoringReportTitle(monitoringReportTitle);
- qa.setUsernameVisible(usernameVisibleBoolean);
- qa.setQuestionsSequenced(questionsSequencedBoolean);
- qa.setSynchInMonitor(synchInMonitorBoolean);
-
- /**
- * TODO: right now the code simply remove all the questions and recreate them.
- * Ideally, when existing questions changed it should be updated accordingly
- * and when new questions is added it should be created in the in the database.
- */
-
- if(qa.getQaContentId() == null){
- qa.setQaContentId(new Long(qaAuthoringForm.getToolContentId()));
- logger.debug("will create: " + qa);
- qaService.createQa(qa);
+
+ String toolContentId=qaAuthoringForm.getToolContentId();
+ 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);
+
+ boolean newContent=false;
+ if(qaContent == null)
+ {
+ qaContent = new QaContent();
+ newContent=true;
}
+
+
+ logger.debug("setting common content values...");
+ qaContent.setQaContentId(new Long(toolContentId));
+ qaContent.setTitle(richTextTitle);
+ qaContent.setInstructions(richTextInstructions);
+ qaContent.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/
+ qaContent.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/
+
+
+ if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent))
+ {
+ logger.debug("setting other content values...");
+ qaContent.setUsernameVisible(isUsernameVisible);
+ qaContent.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/
+ qaContent.setSynchInMonitor(isSynchInMonitor);
+ qaContent.setOnlineInstructions(richTextOnlineInstructions);
+ qaContent.setOfflineInstructions(richTextOfflineInstructions);
+ qaContent.setEndLearningMessage(endLearningMessage);
+ qaContent.setReportTitle(reportTitle);
+ qaContent.setMonitoringReportTitle(monitoringReportTitle);
+ qaContent.setUsernameVisible(usernameVisibleBoolean);
+ qaContent.setQuestionsSequenced(questionsSequencedBoolean);
+ qaContent.setSynchInMonitor(synchInMonitorBoolean);
+ }
+
+
+
+ if (newContent)
+ {
+ logger.debug("will create: " + qaContent);
+ qaService.createQa(qaContent);
+ }
else
{
- logger.debug("will update: " + qa);
- qaService.updateQa(qa);
+ logger.debug("will update: " + qaContent);
+ qaService.updateQa(qaContent);
}
- QaContent qaContent=qaService.loadQa(new Long(qaAuthoringForm.getToolContentId()).longValue());
+ qaContent=qaService.loadQa(new Long(toolContentId).longValue());
+ logger.debug("qaContent: " + qaContent);
+
qaContent=createQuestionContent(mapQuestionContent, qaService, qaContent);
return qaContent;
@@ -249,13 +309,24 @@
* @param qaService
* @param qaAuthoringForm
*/
- public void removeRedundantQuestions (Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm)
+ public void removeRedundantQuestions (Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm, HttpServletRequest request)
{
logger.debug("removing unused entries... ");
logger.debug("mapQuestionContent: " + mapQuestionContent);
- logger.debug("qaAuthoringForm.getToolContentId(): " + qaAuthoringForm.getToolContentId());
- QaContent qaContent=qaService.loadQa(new Long(qaAuthoringForm.getToolContentId()).longValue());
+ String toolContentId=qaAuthoringForm.getToolContentId();
+ 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);
if (qaContent != null)
@@ -324,16 +395,6 @@
List questions=qaService.retrieveQaQueContentsByToolContentId(qaContent.getUid().longValue());
logger.debug("questions: " + questions);
- /*
- Iterator listIterator=questions.iterator();
- Long mapIndex=new Long(1);
- while (listIterator.hasNext())
- {
- QaQueContent queContent=(QaQueContent)listIterator.next();
- logger.debug("queContent data: " + queContent);
- logger.debug("queContent: " + queContent.getQuestion() + "" + queContent.getDisplayOrder());
- }
- */
Iterator itMap = mapQuestionContent.entrySet().iterator();
int diplayOrder=0;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java
===================================================================
diff -u -r792f3d848039cb49080fbaf49d9bc2b2d461943e -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 792f3d848039cb49080fbaf49d9bc2b2d461943e)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -76,8 +76,6 @@
return true;
}
-
-
/**
@@ -548,7 +546,8 @@
logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO);
return mapMonitoredUserContainerDTO;
}
-
+
+
public static Map convertToMcMonitoredUserDTOMap(List list)
{
logger.debug("using convertToQaMonitoredUserDTOMap: " + list);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java
===================================================================
diff -u -re9b9a4b7a0e27ad4a900150c29a30cd0e1eff428 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision e9b9a4b7a0e27ad4a900150c29a30cd0e1eff428)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -226,10 +226,10 @@
/*to remove deleted entries in the questions table based on mapQuestionContent */
- authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm);
+ authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm, request);
logger.debug("end of removing unused entries... ");
- QaContent qaContent=authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm);
+ QaContent qaContent=authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm, request);
logger.debug("qaContent: " + qaContent);
authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, qaService, qaAuthoringForm, qaContent);
@@ -397,6 +397,15 @@
String toolContentId=qaAuthoringForm.getToolContentId();
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);
+ }
+
+
QaUtils.setDefineLater(request, true, toolContentId);
logger.debug("forwarding to : " + LOAD_QUESTIONS);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java
===================================================================
diff -u -re9b9a4b7a0e27ad4a900150c29a30cd0e1eff428 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision e9b9a4b7a0e27ad4a900150c29a30cd0e1eff428)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -312,7 +312,7 @@
/*
* The content we retrieved above must have been created before in Authoring time.
- * And the passed tool session id already refers to it.
+ * And the passed tool session id refers to it.
*/
logger.debug("ACTIVITY_TITLE: " + qaContent.getTitle());
@@ -395,8 +395,6 @@
teacher
learner
*/
- /* ? CHECK THIS: how do we determine whether preview is requested? Mode is not enough on its own.*/
-
/*handling PREVIEW mode*/
String mode=(String) request.getSession().getAttribute(LEARNING_MODE);
logger.debug("mode: " + mode);
@@ -405,7 +403,7 @@
logger.debug("Author requests for a preview of the content.");
logger.debug("existing qaContent:" + qaContent);
- /* overwrite qiestionListing mode for preview*/
+ /* overwrite questionListing mode for preview*/
request.getSession().setAttribute(QUESTION_LISTING_MODE, QUESTION_LISTING_MODE_PREVIEW);
logger.debug("forwarding to for preview: " + LOAD_LEARNER);
return (mapping.findForward(LOAD_LEARNER));
@@ -509,24 +507,21 @@
/*
* obtain and setup the current user's data
*/
-
+
String userID = "";
- /* get session from shared session.*/
HttpSession ss = SessionManager.getSession();
- /* get back login user DTO*/
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- if ((user == null) || (user.getUserID() == null))
- {
- QaUtils.cleanUpSessionAbsolute(request);
- logger.debug("error: The tool expects userId");
- request.getSession().setAttribute(USER_EXCEPTION_USER_DOESNOTEXIST, new Boolean(true).toString());
- persistError(request,"error.learningUser.notAvailable");
- return (mapping.findForward(ERROR_LIST_LEARNER));
- }else
- userID = user.getUserID().toString();
+ logger.debug("ss: " + ss);
- logger.debug("retrieved userId: " + userID);
- request.getSession().setAttribute(USER_ID, userID);
+ if (ss != null)
+ {
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ if ((user != null) || (user.getUserID() != null))
+ {
+ userID = user.getUserID().toString();
+ logger.debug("retrieved userId: " + userID);
+ request.getSession().setAttribute(USER_ID, userID);
+ }
+ }
/*
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java
===================================================================
diff -u -re9b9a4b7a0e27ad4a900150c29a30cd0e1eff428 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision e9b9a4b7a0e27ad4a900150c29a30cd0e1eff428)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -146,6 +146,30 @@
{
logger.debug("dispatching getStats..." + request);
+ 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);
+ }
+
+ 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 summaryToolSessions=MonitoringUtil.populateToolSessions(request, qaContent, qaService);
+ logger.debug("summaryToolSessions: " + summaryToolSessions);
+ if (summaryToolSessions.isEmpty())
+ {
+ /* inform in the Summary tab that the tool has no active sessions */
+ request.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));
@@ -192,6 +216,15 @@
QaContent qaContent=qaService.loadQa(toolContentId.longValue());
logger.debug("existing qaContent:" + qaContent);
+
+ Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, qaContent, qaService);
+ logger.debug("summaryToolSessions: " + summaryToolSessions);
+ if (summaryToolSessions.isEmpty())
+ {
+ /* inform in the Summary tab that the tool has no active sessions */
+ request.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));
@@ -249,7 +282,7 @@
QaContent qaContent=qaService.loadQa(toolContentId.longValue());
logger.debug("qaContent:" + qaContent);
- if (qaService.studentActivityOccurred(qaContent))
+ if (qaService.studentActivityOccurredGlobal(qaContent))
{
logger.debug("student activity occurred on this content:" + qaContent);
request.getSession().setAttribute(USER_EXCEPTION_CONTENT_IN_USE, new Boolean(true).toString());
@@ -312,12 +345,13 @@
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(SUMMARY_TOOL_SESSIONS, summaryToolSessions);
logger.debug("SUMMARY_TOOL_SESSIONS: " + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS));
/* ends here. */
- request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary");
+ request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary");
+
return (mapping.findForward(LOAD_MONITORING));
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
diff -u -re9b9a4b7a0e27ad4a900150c29a30cd0e1eff428 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision e9b9a4b7a0e27ad4a900150c29a30cd0e1eff428)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -143,7 +143,6 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.apache.struts.Globals;
@@ -162,8 +161,6 @@
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
-import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
-import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
/**
@@ -239,23 +236,6 @@
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();
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- if ((user == null) || (user.getUserID() == null))
- {
- QaUtils.cleanUpSessionAbsolute(request);
- logger.debug("error: The tool expects userId");
- request.getSession().setAttribute(USER_EXCEPTION_USER_DOESNOTEXIST, new Boolean(true).toString());
- persistError(request,"error.authoringUser.notAvailable");
- logger.debug("forwarding to: " + ERROR_LIST);
- return (mapping.findForward(ERROR_LIST));
- }
-
ActionForward validateSignature=readSignature(request,mapping);
logger.debug("validateSignature: " + validateSignature);
if (validateSignature != null)
@@ -349,17 +329,19 @@
if (!existsContent(new Long(strToolContentId).longValue(), qaService))
{
+ logger.debug("getting default content");
/*fetch default content*/
String defaultContentIdStr=(String) request.getSession().getAttribute(DEFAULT_CONTENT_ID_STR);
logger.debug("defaultContentIdStr:" + defaultContentIdStr);
retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(defaultContentIdStr).longValue());
}
else
{
+ logger.debug("getting existing content");
/* it is possible that the content is in use by learners.*/
QaContent qaContent=qaService.loadQa(new Long(strToolContentId).longValue());
logger.debug("qaContent: " + qaContent);
- if (qaService.studentActivityOccurred(qaContent))
+ if (qaService.studentActivityOccurredGlobal(qaContent))
{
QaUtils.cleanUpSessionAbsolute(request);
logger.debug("student activity occurred on this content:" + qaContent);
@@ -413,6 +395,15 @@
request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater()));
+ qaAuthoringForm.setTitle(qaContent.getTitle());
+ qaAuthoringForm.setInstructions(qaContent.getInstructions());
+ 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());
+
+
/*
* get the existing question content
*/
Index: lams_tool_laqa/web/WEB-INF/struts-config.xml
===================================================================
diff -u -r792f3d848039cb49080fbaf49d9bc2b2d461943e -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 792f3d848039cb49080fbaf49d9bc2b2d461943e)
+++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -53,7 +53,7 @@
name="QaAuthoringForm"
scope="session"
unknown="false"
- validate="false"
+ validate="true"
>
-
+
+
+
@@ -127,13 +133,19 @@
+
+
+ name="QaLearningForm"
+ scope="session"
+ unknown="false"
+ validate="false"
+ input="/learningIndex.jsp">
+
+
+
@@ -210,7 +233,7 @@
input="/learning/AnswersContent.jsp"
parameter="method"
unknown="false"
- validate="true">
+ validate="false">
-
+
+
+
@@ -264,6 +293,7 @@
path="/defineLaterStarter"
type="org.lamsfoundation.lams.tool.qa.web.QaDLStarterAction"
name="QaAuthoringForm"
+ scope="session"
input="/index.jsp">
@@ -314,7 +344,7 @@
scope="session"
parameter="method"
unknown="false"
- validate="false">
+ validate="true">
+
+
@@ -352,7 +388,7 @@
scope="session"
parameter="method"
unknown="false"
- validate="false">
+ validate="true">
+
+
@@ -409,7 +451,7 @@
scope="session"
parameter="mode"
unknown="false"
- validate="false"
+ validate="true"
>
Index: lams_tool_laqa/web/authoring/BasicContent.jsp
===================================================================
diff -u -r45a3263a49a830c6e5392591ccd854264c5e6730 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 45a3263a49a830c6e5392591ccd854264c5e6730)
+++ lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -64,7 +64,9 @@
-
+
@@ -82,7 +84,9 @@
-
+
Index: lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp
===================================================================
diff -u -r394b0f24142992b4a38bd07797d6f439e51f0838 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp (.../BasicContentViewOnly.jsp) (revision 394b0f24142992b4a38bd07797d6f439e51f0838)
+++ lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp (.../BasicContentViewOnly.jsp) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -35,15 +35,15 @@
: |
-
+
|
: |
-
+
|
Index: lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp
===================================================================
diff -u -r1158d541cead46e6f0c26f71fdd99e46f031acd1 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp (.../MonitoringMaincontent.jsp) (revision 1158d541cead46e6f0c26f71fdd99e46f031acd1)
+++ lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp (.../MonitoringMaincontent.jsp) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -219,17 +219,6 @@
Index: lams_tool_laqa/web/monitoring/SummaryContent.jsp
===================================================================
diff -u -r404cdcb0a5907ebb660bbc4f5da45b4a8de4ecd4 -r5ce575b11f3206c1e80792d2a2be752612bd26d7
--- lams_tool_laqa/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 404cdcb0a5907ebb660bbc4f5da45b4a8de4ecd4)
+++ lams_tool_laqa/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 5ce575b11f3206c1e80792d2a2be752612bd26d7)
@@ -40,7 +40,7 @@