Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java
===================================================================
diff -u -r97ebe40dad2731256147d74073b541245be53871 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 97ebe40dad2731256147d74073b541245be53871)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -33,6 +33,13 @@
public static final String TOOL_SERVICE ="tool_service";
public static final String ERROR_QAAPPLICATION = "error.exception.QaApplication";
public static final String TOOL_CONTENT_ID = "toolContentID";
+ public static final String MAP_QUESTION_CONTENT_KEY = "mapQuestionContentKey";
+ public static final String ATTACHMENT_LIST_KEY = "attachmentListKey";
+ public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey";
+ public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey";
+ public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey";
+ public static final String ACTIVITY_TITLE_KEY = "activityTitleKey";
+ public static final String ACTIVITY_INSTRUCTIONS_KEY = "activityInstructionsKey";
public static final String TARGET_MODE ="targetMode";
public static final String TARGET_MODE_AUTHORING ="Authoring";
@@ -41,6 +48,8 @@
public static final String TARGET_MODE_EXPORT_PORTFOLIO ="ExportPortfolio";
public static final String AUTHORING_STARTER ="starter";
+ public static final String TITLE ="title";
+ public static final String INSTRUCTIONS ="instructions";
public static final String LOAD_LEARNER ="loadLearner";
public static final String LEARNING_STARTER ="learningStarter";
public static final String MONITORING_STARTER ="monitoringStarter";
@@ -71,16 +80,21 @@
public static final String MONITORING_ORIGINATED_DEFINELATER ="monitoringOriginatedDefineLater";
public static final String DEFINE_LATER ="defineLater";
public static final String REQUESTED_MODULE ="requestedModule";
+ public static final String SYNC_IN_MONITOR ="synchInMonitor";
+ public static final String USERNAME_VISIBLE ="usernameVisible";
+ public static final String QUESTIONS_SEQUENCED ="questionsSequenced";
public static final String SOURCE_MC_STARTER ="sourceMcStarter";
public static final Integer MAX_QUESTION_COUNT =new Integer(50);
+
public static final String IS_MONITORED_CONTENT_IN_USE ="isMonitoredContentInUse";
public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY ="loadMonitoringEditActivity";
public static final String IS_PORTFOLIO_EXPORT ="isPortfolioExport";
public static final String GENERAL_LEARNER_FLOW_DTO ="generalLearnerFlowDTO";
- public static final Long INITIAL_QUESTION_COUNT =new Long(1);
+ public static final Long INITIAL_QUESTION_COUNT =new Long(1);
+ public static final String QA_GENERAL_AUTHORING_DTO ="qaGeneralAuthoringDTO";
/*
* Struts level constants
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -0,0 +1,482 @@
+/***************************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ***********************************************************************/
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+
+/**
+ *
DTO that holds authoring properties for authoring jsps
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaGeneralAuthoringDTO implements Comparable
+{
+ protected String toolContentID;
+ protected String currentTab;
+ protected String activeModule;
+ protected String defineLaterInEditMode;
+ protected String showAuthoringTabs;
+ protected String monitoringOriginatedDefineLater;
+ protected String targetMode;
+ protected String defaultQuestionContent;
+ protected String defaultContentIdStr;
+
+ protected String activityTitle;
+ protected String activityInstructions;
+ protected String reportTitle;
+ protected String monitoringReportTitle;
+ protected String endLearningMessage;
+ protected String onlineInstructions;
+ protected String offlineInstructions;
+ protected String usernameVisible;
+ protected String synchInMonitor;
+ protected String questionsSequenced;
+ protected String editActivityEditMode;
+
+ protected String monitoredContentInUse;
+
+ protected String httpSessionID;
+ protected String requestedModule;
+ protected String isDefineLater;
+ protected Map mapQuestionContent;
+ protected List attachmentList;
+ protected List deletedAttachmentList;
+
+ protected String sbmtSuccess;
+ protected String userExceptionQuestionsDuplicate;
+
+
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("toolContentID: ", toolContentID)
+ .append("httpSessionID: ", httpSessionID)
+ .append("currentTab: ", currentTab)
+ .append("activeModule: ", activeModule)
+ .append("defineLaterInEditMode: ", defineLaterInEditMode)
+ .append("showAuthoringTabs: ", showAuthoringTabs)
+ .append("monitoringOriginatedDefineLater: ", monitoringOriginatedDefineLater)
+ .append("targetMode: ", targetMode)
+ .append("defaultQuestionContent: ", defaultQuestionContent)
+ .append("defaultContentIdStr: ", defaultContentIdStr)
+ .append("activityTitle: ", activityTitle)
+ .append("activityInstructions: ", activityInstructions)
+ .append("reportTitle: ", reportTitle)
+ .append("monitoringReportTitle: ", monitoringReportTitle)
+ .append("endLearningMessage: ", endLearningMessage)
+ .append("onlineInstructions: ", onlineInstructions)
+ .append("offlineInstructions: ", offlineInstructions)
+ .append("usernameVisible: ", usernameVisible)
+ .append("synchInMonitor: ", synchInMonitor)
+ .append("questionsSequenced: ", questionsSequenced)
+ .append("editActivityEditMode: ", editActivityEditMode)
+ .append("requestedModule: ", requestedModule)
+ .append("isDefineLater: ", isDefineLater)
+ .append("monitoredContentInUse: ", monitoredContentInUse)
+ .append("mapQuestionContent: ", mapQuestionContent)
+ .append("attachmentList: ", attachmentList)
+ .append("deletedAttachmentList: ", deletedAttachmentList)
+ .append("sbmtSuccess: ", sbmtSuccess)
+ .append("userExceptionQuestionsDuplicate: ", userExceptionQuestionsDuplicate)
+ .toString();
+ }
+
+
+
+ /**
+ * @return Returns the userExceptionQuestionsDuplicate.
+ */
+ public String getUserExceptionQuestionsDuplicate() {
+ return userExceptionQuestionsDuplicate;
+ }
+ /**
+ * @param userExceptionQuestionsDuplicate The userExceptionQuestionsDuplicate to set.
+ */
+ public void setUserExceptionQuestionsDuplicate(
+ String userExceptionQuestionsDuplicate) {
+ this.userExceptionQuestionsDuplicate = userExceptionQuestionsDuplicate;
+ }
+ /**
+ * @return Returns the httpSessionID.
+ */
+ public String getHttpSessionID() {
+ return httpSessionID;
+ }
+ /**
+ * @param httpSessionID The httpSessionID to set.
+ */
+ public void setHttpSessionID(String httpSessionID) {
+ this.httpSessionID = httpSessionID;
+ }
+ /**
+ * @return Returns the monitoredContentInUse.
+ */
+ public String getMonitoredContentInUse() {
+ return monitoredContentInUse;
+ }
+ /**
+ * @param monitoredContentInUse The monitoredContentInUse to set.
+ */
+ public void setMonitoredContentInUse(String monitoredContentInUse) {
+ this.monitoredContentInUse = monitoredContentInUse;
+ }
+ /**
+ * @return Returns the editActivityEditMode.
+ */
+ public String getEditActivityEditMode() {
+ return editActivityEditMode;
+ }
+ /**
+ * @param editActivityEditMode The editActivityEditMode to set.
+ */
+ public void setEditActivityEditMode(String editActivityEditMode) {
+ this.editActivityEditMode = editActivityEditMode;
+ }
+ /**
+ * @return Returns the deletedAttachmentList.
+ */
+ public List getDeletedAttachmentList() {
+ return deletedAttachmentList;
+ }
+ /**
+ * @param deletedAttachmentList The deletedAttachmentList to set.
+ */
+ public void setDeletedAttachmentList(List deletedAttachmentList) {
+ this.deletedAttachmentList = deletedAttachmentList;
+ }
+ /**
+ * @return Returns the mapQuestionContent.
+ */
+ public Map getMapQuestionContent() {
+ return mapQuestionContent;
+ }
+ /**
+ * @param mapQuestionContent The mapQuestionContent to set.
+ */
+ public void setMapQuestionContent(Map mapQuestionContent) {
+ this.mapQuestionContent = mapQuestionContent;
+ }
+ /**
+ * @return Returns the isDefineLater.
+ */
+ public String getIsDefineLater() {
+ return isDefineLater;
+ }
+ /**
+ * @param isDefineLater The isDefineLater to set.
+ */
+ public void setIsDefineLater(String isDefineLater) {
+ this.isDefineLater = isDefineLater;
+ }
+
+
+ /**
+ * @return Returns the attachmentList.
+ */
+ public List getAttachmentList() {
+ return attachmentList;
+ }
+ /**
+ * @param attachmentList The attachmentList to set.
+ */
+ public void setAttachmentList(List attachmentList) {
+ this.attachmentList = attachmentList;
+ }
+ /**
+ * @return Returns the toolContentID.
+ */
+ public String getToolContentID() {
+ return toolContentID;
+ }
+ /**
+ * @param toolContentID The toolContentID to set.
+ */
+ public void setToolContentID(String toolContentID) {
+ this.toolContentID = toolContentID;
+ }
+
+
+ /**
+ * @return Returns the targetMode.
+ */
+ public String getTargetMode() {
+ return targetMode;
+ }
+ /**
+ * @param targetMode The targetMode to set.
+ */
+ public void setTargetMode(String targetMode) {
+ this.targetMode = targetMode;
+ }
+
+ /**
+ * @return Returns the monitoringOriginatedDefineLater.
+ */
+ public String getMonitoringOriginatedDefineLater() {
+ return monitoringOriginatedDefineLater;
+ }
+ /**
+ * @param monitoringOriginatedDefineLater The monitoringOriginatedDefineLater to set.
+ */
+ public void setMonitoringOriginatedDefineLater(
+ String monitoringOriginatedDefineLater) {
+ this.monitoringOriginatedDefineLater = monitoringOriginatedDefineLater;
+ }
+
+
+ /**
+ * @return Returns the activeModule.
+ */
+ public String getActiveModule() {
+ return activeModule;
+ }
+ /**
+ * @param activeModule The activeModule to set.
+ */
+ public void setActiveModule(String activeModule) {
+ this.activeModule = activeModule;
+ }
+ /**
+ * @return Returns the defineLaterInEditMode.
+ */
+ public String getDefineLaterInEditMode() {
+ return defineLaterInEditMode;
+ }
+ /**
+ * @param defineLaterInEditMode The defineLaterInEditMode to set.
+ */
+ public void setDefineLaterInEditMode(String defineLaterInEditMode) {
+ this.defineLaterInEditMode = defineLaterInEditMode;
+ }
+ /**
+ * @return Returns the showAuthoringTabs.
+ */
+ public String getShowAuthoringTabs() {
+ return showAuthoringTabs;
+ }
+ /**
+ * @param showAuthoringTabs The showAuthoringTabs to set.
+ */
+ public void setShowAuthoringTabs(String showAuthoringTabs) {
+ this.showAuthoringTabs = showAuthoringTabs;
+ }
+
+ public int compareTo(Object o)
+ {
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO = (QaGeneralAuthoringDTO) o;
+
+ if (qaGeneralAuthoringDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+ /**
+ * @return Returns the defaultContentIdStr.
+ */
+ public String getDefaultContentIdStr() {
+ return defaultContentIdStr;
+ }
+ /**
+ * @param defaultContentIdStr The defaultContentIdStr to set.
+ */
+ public void setDefaultContentIdStr(String defaultContentIdStr) {
+ this.defaultContentIdStr = defaultContentIdStr;
+ }
+ /**
+ * @return Returns the defaultQuestionContent.
+ */
+ public String getDefaultQuestionContent() {
+ return defaultQuestionContent;
+ }
+ /**
+ * @param defaultQuestionContent The defaultQuestionContent to set.
+ */
+ public void setDefaultQuestionContent(String defaultQuestionContent) {
+ this.defaultQuestionContent = defaultQuestionContent;
+ }
+ /**
+ * @return Returns the requestedModule.
+ */
+ public String getRequestedModule() {
+ return requestedModule;
+ }
+ /**
+ * @param requestedModule The requestedModule to set.
+ */
+ public void setRequestedModule(String requestedModule) {
+ this.requestedModule = requestedModule;
+ }
+ /**
+ * @return Returns the activityInstructions.
+ */
+ public String getActivityInstructions() {
+ return activityInstructions;
+ }
+ /**
+ * @param activityInstructions The activityInstructions to set.
+ */
+ public void setActivityInstructions(String activityInstructions) {
+ this.activityInstructions = activityInstructions;
+ }
+ /**
+ * @return Returns the activityTitle.
+ */
+ public String getActivityTitle() {
+ return activityTitle;
+ }
+ /**
+ * @param activityTitle The activityTitle to set.
+ */
+ public void setActivityTitle(String activityTitle) {
+ this.activityTitle = activityTitle;
+ }
+ /**
+ * @return Returns the endLearningMessage.
+ */
+ public String getEndLearningMessage() {
+ return endLearningMessage;
+ }
+ /**
+ * @param endLearningMessage The endLearningMessage to set.
+ */
+ public void setEndLearningMessage(String endLearningMessage) {
+ this.endLearningMessage = endLearningMessage;
+ }
+
+ /**
+ * @return Returns the monitoringReportTitle.
+ */
+ public String getMonitoringReportTitle() {
+ return monitoringReportTitle;
+ }
+ /**
+ * @param monitoringReportTitle The monitoringReportTitle to set.
+ */
+ public void setMonitoringReportTitle(String monitoringReportTitle) {
+ this.monitoringReportTitle = monitoringReportTitle;
+ }
+ /**
+ * @return Returns the offlineInstructions.
+ */
+ public String getOfflineInstructions() {
+ return offlineInstructions;
+ }
+ /**
+ * @param offlineInstructions The offlineInstructions to set.
+ */
+ public void setOfflineInstructions(String offlineInstructions) {
+ this.offlineInstructions = offlineInstructions;
+ }
+ /**
+ * @return Returns the onlineInstructions.
+ */
+ public String getOnlineInstructions() {
+ return onlineInstructions;
+ }
+ /**
+ * @param onlineInstructions The onlineInstructions to set.
+ */
+ public void setOnlineInstructions(String onlineInstructions) {
+ this.onlineInstructions = onlineInstructions;
+ }
+ /**
+ * @return Returns the questionsSequenced.
+ */
+ public String getQuestionsSequenced() {
+ return questionsSequenced;
+ }
+ /**
+ * @param questionsSequenced The questionsSequenced to set.
+ */
+ public void setQuestionsSequenced(String questionsSequenced) {
+ this.questionsSequenced = questionsSequenced;
+ }
+ /**
+ * @return Returns the reportTitle.
+ */
+ public String getReportTitle() {
+ return reportTitle;
+ }
+ /**
+ * @param reportTitle The reportTitle to set.
+ */
+ public void setReportTitle(String reportTitle) {
+ this.reportTitle = reportTitle;
+ }
+ /**
+ * @return Returns the synchInMonitor.
+ */
+ public String getSynchInMonitor() {
+ return synchInMonitor;
+ }
+ /**
+ * @param synchInMonitor The synchInMonitor to set.
+ */
+ public void setSynchInMonitor(String synchInMonitor) {
+ this.synchInMonitor = synchInMonitor;
+ }
+ /**
+ * @return Returns the usernameVisible.
+ */
+ public String getUsernameVisible() {
+ return usernameVisible;
+ }
+ /**
+ * @param usernameVisible The usernameVisible to set.
+ */
+ public void setUsernameVisible(String usernameVisible) {
+ this.usernameVisible = usernameVisible;
+ }
+ /**
+ * @return Returns the currentTab.
+ */
+ public String getCurrentTab() {
+ return currentTab;
+ }
+ /**
+ * @param currentTab The currentTab to set.
+ */
+ public void setCurrentTab(String currentTab) {
+ this.currentTab = currentTab;
+ }
+
+ /**
+ * @return Returns the sbmtSuccess.
+ */
+ public String getSbmtSuccess() {
+ return sbmtSuccess;
+ }
+ /**
+ * @param sbmtSuccess The sbmtSuccess to set.
+ */
+ public void setSbmtSuccess(String sbmtSuccess) {
+ this.sbmtSuccess = sbmtSuccess;
+ }
+
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java
===================================================================
diff -u -r57157cef4ee9b4d70e92be83584eb8d10bcea83c -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 57157cef4ee9b4d70e92be83584eb8d10bcea83c)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -22,14 +22,12 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.qa;
-import java.security.Principal;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Random;
import java.util.TimeZone;
import java.util.TreeMap;
@@ -42,6 +40,7 @@
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
/**
* @author Ozgur Demirtas
@@ -56,104 +55,155 @@
public abstract class QaUtils implements QaAppConstants {
static Logger logger = Logger.getLogger(QaUtils.class.getName());
- public static IQaService getToolService(HttpServletRequest request)
- {
- IQaService qaService=(IQaService)request.getSession().getAttribute(TOOL_SERVICE);
- return qaService;
- }
-
- public static long generateId()
- {
- Random generator = new Random();
- long longId=generator.nextLong();
- if (longId < 0) longId=longId * (-1) ;
- return longId;
- }
-
- /**
- * helps create a mock user object in development time.
- * static long generateIntegerId()
- * @return long
- */
- public static int generateIntegerId()
- {
- Random generator = new Random();
- int intId=generator.nextInt();
- if (intId < 0) intId=intId * (-1) ;
- return intId;
- }
-
-
/**
* setDefaultSessionAttributes(HttpServletRequest request, QaContent defaultQaContent, QaAuthoringForm qaAuthoringForm)
*
* @param request
* @param defaultQaContent
* @param qaAuthoringForm
*/
- public static void setDefaultSessionAttributes(HttpServletRequest request, QaContent defaultQaContent, QaAuthoringForm qaAuthoringForm)
+ public static void populateAuthoringDTO(HttpServletRequest request, QaContent defaultQaContent,
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO)
{
- /*should never be null anyway as default content MUST exist in the db*/
- if(defaultQaContent == null)
- throw new NullPointerException("Default QaContent cannot be null");
-
- qaAuthoringForm.setTitle(defaultQaContent.getTitle());
- qaAuthoringForm.setInstructions(defaultQaContent.getInstructions());
- request.getSession().setAttribute(ACTIVITY_TITLE, defaultQaContent.getTitle());
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, defaultQaContent.getInstructions());
+ qaGeneralAuthoringDTO.setActivityTitle(defaultQaContent.getTitle());
+ qaGeneralAuthoringDTO.setActivityInstructions(defaultQaContent.getInstructions());
- logger.debug("ACTIVITY_INSTRUCTIONS: " + defaultQaContent.getInstructions());
+ qaGeneralAuthoringDTO.setReportTitle(defaultQaContent.getReportTitle());
+ qaGeneralAuthoringDTO.setMonitoringReportTitle(defaultQaContent.getMonitoringReportTitle());
+ qaGeneralAuthoringDTO.setEndLearningMessage(defaultQaContent.getEndLearningMessage());
+ qaGeneralAuthoringDTO.setOnlineInstructions(defaultQaContent.getOnlineInstructions());
+ qaGeneralAuthoringDTO.setOfflineInstructions(defaultQaContent.getOfflineInstructions());
- qaAuthoringForm.setReportTitle(defaultQaContent.getReportTitle());
- qaAuthoringForm.setMonitoringReportTitle(defaultQaContent.getMonitoringReportTitle());
- qaAuthoringForm.setEndLearningMessage(defaultQaContent.getEndLearningMessage());
- qaAuthoringForm.setOnlineInstructions(defaultQaContent.getOnlineInstructions());
- qaAuthoringForm.setOfflineInstructions(defaultQaContent.getOfflineInstructions());
- qaAuthoringForm.setMonitoringReportTitle(defaultQaContent.getMonitoringReportTitle());
-
- //determine the status of radio boxes
- qaAuthoringForm.setUsernameVisible(defaultQaContent.isUsernameVisible()?ON:OFF);
- qaAuthoringForm.setSynchInMonitor(defaultQaContent.isSynchInMonitor()?ON:OFF);
- qaAuthoringForm.setQuestionsSequenced(defaultQaContent.isQuestionsSequenced()?ON:OFF);
+ /* set the status of radio boxes */
+ qaGeneralAuthoringDTO.setUsernameVisible(defaultQaContent.isUsernameVisible()?ON:OFF);
+ qaGeneralAuthoringDTO.setSynchInMonitor(defaultQaContent.isSynchInMonitor()?ON:OFF);
+ qaGeneralAuthoringDTO.setQuestionsSequenced(defaultQaContent.isQuestionsSequenced()?ON:OFF);
}
+
-
- public static void persistRichText(HttpServletRequest request)
+ public static QaGeneralAuthoringDTO buildGeneralAuthoringDTO(HttpServletRequest request, IQaService qaService, QaContent qaContent,
+ QaAuthoringForm qaAuthoringForm)
{
- 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))
+ logger.debug("start buildGeneralAuthoringDTO: " + qaContent);
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= new QaGeneralAuthoringDTO();
+
+ logger.debug("setting for existing content: ");
+ qaGeneralAuthoringDTO.setToolContentID(qaContent.getQaContentId().toString());
+ qaAuthoringForm.setToolContentID(qaContent.getQaContentId().toString());
+
+ Map mapQuestionContent= new TreeMap(new QaComparator());
+ Iterator queIterator=qaContent.getQaQueContents().iterator();
+ Long mapIndex=new Long(1);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ while (queIterator.hasNext())
{
- request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,richTextOfflineInstructions);
+ QaQueContent qaQueContent=(QaQueContent) queIterator.next();
+ if (qaQueContent != null)
+ {
+ logger.debug("question: " + qaQueContent.getQuestion());
+ mapQuestionContent.put(mapIndex.toString(),qaQueContent.getQuestion());
+
+ mapIndex=new Long(mapIndex.longValue()+1);
+ }
}
+
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+
+ long defaultContentID=0;
+ logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE);
+ defaultContentID=qaService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
+ logger.debug("retrieved tool default contentId: " + defaultContentID);
- if ((richTextOnlineInstructions != null) && (richTextOnlineInstructions.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,richTextOnlineInstructions);
- }
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
+ qaGeneralAuthoringDTO.setActivityTitle(qaContent.getTitle());
+ qaGeneralAuthoringDTO.setActivityInstructions(qaContent.getInstructions());
+
+ qaGeneralAuthoringDTO.setReportTitle(qaContent.getReportTitle());
+ qaGeneralAuthoringDTO.setMonitoringReportTitle(qaContent.getMonitoringReportTitle());
+ qaGeneralAuthoringDTO.setEndLearningMessage(qaContent.getEndLearningMessage());
+ qaGeneralAuthoringDTO.setOnlineInstructions(qaContent.getOnlineInstructions());
+ qaGeneralAuthoringDTO.setOfflineInstructions(qaContent.getOfflineInstructions());
+
+ qaGeneralAuthoringDTO.setUsernameVisible(qaContent.isUsernameVisible()?ON:OFF);
+ qaGeneralAuthoringDTO.setSynchInMonitor(qaContent.isSynchInMonitor()?ON:OFF);
+ qaGeneralAuthoringDTO.setQuestionsSequenced(qaContent.isQuestionsSequenced()?ON:OFF);
+
+ qaAuthoringForm.setUsernameVisible(qaContent.isUsernameVisible()?ON:OFF);
+ qaAuthoringForm.setSynchInMonitor(qaContent.isSynchInMonitor()?ON:OFF);
+ qaAuthoringForm.setQuestionsSequenced(qaContent.isQuestionsSequenced()?ON:OFF);
+
+ logger.debug("ending buildGeneralAuthoringDTO with qaGeneralAuthoringDTO : " + qaGeneralAuthoringDTO);
+ logger.debug("ending buildGeneralAuthoringDTO with qaAuthoringForm: " + qaAuthoringForm);
+ return qaGeneralAuthoringDTO;
+ }
+
+
+ public static void setFormProperties(HttpServletRequest request, IQaService qaService, QaContent qaContent,
+ QaAuthoringForm qaAuthoringForm, QaGeneralAuthoringDTO qaGeneralAuthoringDTO, String strToolContentID, String defaultContentIdStr,
+ String activeModule, SessionMap sessionMap, String httpSessionID)
+ {
+ logger.debug("starting setFormProperties: " + qaContent);
+ logger.debug("using strToolContentID: " + strToolContentID);
+ logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
+ logger.debug("using activeModule: " + activeModule);
+ logger.debug("using httpSessionID: " + httpSessionID);
+
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+
+ qaAuthoringForm.setToolContentID(strToolContentID);
+
+ if (defaultContentIdStr != null)
+ qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString());
+
+ qaAuthoringForm.setActiveModule(activeModule);
+
+ String synchInMonitor=request.getParameter(SYNC_IN_MONITOR);
+ logger.debug("synchInMonitor: " + synchInMonitor);
+ qaAuthoringForm.setSynchInMonitor(synchInMonitor);
+ qaGeneralAuthoringDTO.setSynchInMonitor(synchInMonitor);
-
- String richTextTitle=request.getParameter(RICHTEXT_TITLE);
- logger.debug("read parameter richTextTitle: " + richTextTitle);
- String richTextInstructions=request.getParameter(RICHTEXT_INSTRUCTIONS);
- logger.debug("read parameter richTextInstructions: " + richTextInstructions);
+ String usernameVisible=request.getParameter(USERNAME_VISIBLE);
+ logger.debug("usernameVisible: " + usernameVisible);
+ qaAuthoringForm.setUsernameVisible(usernameVisible);
+ qaGeneralAuthoringDTO.setUsernameVisible(usernameVisible);
+ String questionsSequenced=request.getParameter(QUESTIONS_SEQUENCED);
+ logger.debug("questionsSequenced: " + questionsSequenced);
+ qaAuthoringForm.setQuestionsSequenced(questionsSequenced);
+ qaGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced);
- if ((richTextTitle != null) && (richTextTitle.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_TITLE,richTextTitle);
- }
+ String reportTitle=request.getParameter(REPORT_TITLE);
+ logger.debug("reportTitle: " + reportTitle);
+ qaAuthoringForm.setReportTitle(reportTitle);
+ qaGeneralAuthoringDTO.setReportTitle(reportTitle);
- if ((richTextInstructions != null) && (richTextInstructions.length() > 0))
- {
- request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,richTextInstructions);
- }
- }
+ String monitoringReportTitle=request.getParameter(MONITORING_REPORT_TITLE);
+ logger.debug("monitoringReportTitle: " + monitoringReportTitle);
+ qaAuthoringForm.setMonitoringReportTitle(monitoringReportTitle);
+ qaGeneralAuthoringDTO.setMonitoringReportTitle(monitoringReportTitle);
+
+ String endLearningMessage=request.getParameter(END_LEARNING_MESSSAGE);
+ logger.debug("endLearningMessage: " + endLearningMessage);
+ qaAuthoringForm.setEndLearningMessage(endLearningMessage);
+ qaGeneralAuthoringDTO.setEndLearningMessage(endLearningMessage);
+
+
+ String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS);
+ logger.debug("offlineInstructions: " + offlineInstructions);
+ qaAuthoringForm.setOfflineInstructions(offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS);
+ logger.debug("onlineInstructions: " + onlineInstructions);
+ qaAuthoringForm.setOnlineInstructions(onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ logger.debug("ending setFormProperties qaAuthoringForm: " + qaAuthoringForm);
+ logger.debug("ending setFormProperties qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ }
+
-
public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException
{
HttpSession ss = SessionManager.getSession();
@@ -165,53 +215,14 @@
/**
- * Modified to throw QaApplicationException insteadof RuntimeException
- * String getUsername(HttpServletRequest req,boolean isTesting) throws RuntimeException
- * is normally lives in package org.lamsfoundation.lams.util. It generates Runtime exception when the user principal
- * is not found. We find this not too usefulespeciaaly in teh development time. Below is a local and modified version
- * of this function.
- *
- * @return username from principal object
- */
- public static String getUsername(HttpServletRequest req,boolean isTesting) throws QaApplicationException
- {
- if(isTesting)
- return "test";
-
- Principal principal = req.getUserPrincipal();
- if (principal == null)
- {
- throw new QaApplicationException("Trying to get username but principal object missing. Request is "
- + req.toString());
- }
-
- String username = principal.getName();
- if (username == null)
- {
- throw new QaApplicationException("Name missing from principal object. Request is "
- + req.toString()
- + " Principal object is "
- + principal.toString());
- }
- return username;
- }
-
-
- public static boolean getDefineLaterStatus()
- {
- return false;
- }
-
-
- /**
* existsContent(long toolContentId)
* @param long toolContentId
* @return boolean
* determine whether a specific toolContentId exists in the db
*/
- public static boolean existsContent(long toolContentId, IQaService qaService)
+ public static boolean existsContent(long toolContentID, IQaService qaService)
{
- QaContent qaContent=qaService.loadQa(toolContentId);
+ QaContent qaContent=qaService.loadQa(toolContentID);
logger.debug(logger + " " + "QaUtils " + "retrieving qaContent: " + qaContent);
if (qaContent == null)
return false;
@@ -225,10 +236,10 @@
* @param toolSessionId
* @return boolean
*/
- public static boolean existsSession(long toolSessionId, IQaService qaService)
+ public static boolean existsSession(long toolContentID, IQaService qaService)
{
logger.debug("existsSession");
- QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId);
+ QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolContentID);
logger.debug("qaSession:" + qaSession);
if (qaSession == null)
@@ -244,63 +255,17 @@
DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date));
return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date));
}
-
- public static void saveTimeZone(HttpServletRequest request)
- {
- TimeZone timeZone=TimeZone.getDefault();
- logger.debug("current timezone: " + timeZone.getDisplayName());
- request.getSession().setAttribute(TIMEZONE, timeZone.getDisplayName());
- logger.debug("current timezone id: " + timeZone.getID());
- request.getSession().setAttribute(TIMEZONE_ID, timeZone.getID());
- }
-
- public static void configureContentRepository(HttpServletRequest request)
+ public static void configureContentRepository(HttpServletRequest request, IQaService qaService)
{
logger.debug("attempt configureContentRepository");
- IQaService qaService =QaUtils.getToolService(request);
- logger.debug("retrieving qaService from session: " + qaService);
+ logger.debug("qaService: " + qaService);
logger.debug("calling configureContentRepository()");
qaService.configureContentRepository();
logger.debug("configureContentRepository ran successfully");
}
- public static void populateUploadedFilesData(HttpServletRequest request, QaContent qaContent, IQaService qaService) {
- List attachmentList = qaService.retrieveQaUploadedFiles(qaContent);
- request.getSession().setAttribute(ATTACHMENT_LIST, attachmentList);
-
- if(request.getSession().getAttribute(DELETED_ATTACHMENT_LIST)==null)
- request.getSession().setAttribute(DELETED_ATTACHMENT_LIST, new ArrayList());
-
- logger.debug("populated UploadedFilesData");
- }
-
- /**
- * This method is used in authoring and monitoring to display the list of files that have been uploaded.
- * The current files are included in the attachmentList, files that the user has nominated to delete are
- * in the deletedAttachementList.
- *
- * If the input collections are null, then the session variables are not modified. This
- * is particularly useful for the deleted files.
- *
- * @param request the HttpServletRequest which is used to obtain the HttpSession
- * @param attachmentList
- * @param deletedAttachmentList
- */
- public static void addUploadsToSession(HttpServletRequest request, List attachmentList, List deletedAttachmentList)
- {
- if ( attachmentList != null ) {
- request.getSession().setAttribute(ATTACHMENT_LIST, attachmentList);
- }
-
- // deleted will be empty most of the time
- if ( deletedAttachmentList != null ) {
- request.getSession().setAttribute(DELETED_ATTACHMENT_LIST, deletedAttachmentList);
- }
-
- }
-
/** If this file exists in attachments map, move it to the deleted attachments map.
* Returns the updated deletedAttachments map, creating a new one if needed. If uuid supplied
* then tries to match on that, otherwise uses filename and isOnline. */
@@ -567,14 +532,13 @@
* @param value
* @param toolContentId
*/
- public static void setDefineLater(HttpServletRequest request, boolean value, String toolContentId)
+ public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IQaService qaService)
{
- IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
logger.debug("qaService: " + qaService);
logger.debug("value:" + value);
- logger.debug("toolContentId:" + toolContentId);
+ logger.debug("strToolContentID:" + strToolContentID);
- QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue());
+ QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
logger.debug("qaContent:" + qaContent);
if (qaContent != null)
{
@@ -612,15 +576,12 @@
}
}
- public static void setDefineLater(HttpServletRequest request, boolean value)
+ public static void setDefineLater(HttpServletRequest request, boolean value, IQaService qaService, String toolContentID)
{
- IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
logger.debug("qaService:" + qaService);
+ logger.debug("toolContentID:" + toolContentID);
- Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
- logger.debug("toolContentId:" + toolContentId);
-
- QaContent qaContent=qaService.loadQa(toolContentId.longValue());
+ QaContent qaContent=qaService.loadQa(new Long(toolContentID).longValue());
logger.debug("qaContent:" + qaContent);
if (qaContent != null)
{
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java
===================================================================
diff -u -r65166da92a6f0f4ff73acb92b95672e237b25742 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java (.../QaQueContentDAO.java) (revision 65166da92a6f0f4ff73acb92b95672e237b25742)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java (.../QaQueContentDAO.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -58,6 +58,8 @@
public QaQueContent getToolDefaultQuestionContent(final long qaContentId)
{
+ /*
+ logger.debug("running getToolDefaultQuestionContent: " + qaContentId);
return (QaQueContent) getHibernateTemplate().execute(new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException
@@ -67,6 +69,18 @@
.uniqueResult();
}
});
+ */
+
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
+ .setLong("qaContentId", qaContentId)
+ .list();
+
+ if(list != null && list.size() > 0){
+ QaQueContent qa = (QaQueContent) list.get(0);
+ return qa;
+ }
+ return null;
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -rcc57114dde638ab1b37c0ac5556c1a2822e79bf3 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision cc57114dde638ab1b37c0ac5556c1a2822e79bf3)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -36,6 +36,7 @@
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaComparator;
import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaGeneralAuthoringDTO;
import org.lamsfoundation.lams.tool.qa.QaQueContent;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
@@ -57,15 +58,17 @@
* return void
* adds a new entry to the Map
*/
- protected void reconstructQuestionContentMapForAdd(Map mapQuestionContent, HttpServletRequest request)
+ protected void reconstructQuestionContentMapForAdd(Map mapQuestionContent, QaGeneralAuthoringDTO qaGeneralAuthoringDTO,
+ HttpServletRequest request)
{
logger.debug("pre-add Map content: " + mapQuestionContent);
logger.debug("pre-add Map size: " + mapQuestionContent.size());
repopulateMap(mapQuestionContent, request);
mapQuestionContent.put(new Long(mapQuestionContent.size()+1).toString(), "");
- request.getSession().setAttribute("mapQuestionContent", mapQuestionContent);
+ //request.getSession().setAttribute("mapQuestionContent", mapQuestionContent);
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
logger.debug("post-add Map is: " + mapQuestionContent);
logger.debug("post-add count " + mapQuestionContent.size());
@@ -77,19 +80,21 @@
* return void
* deletes the requested entry from the Map
*/
- protected void reconstructQuestionContentMapForRemove(Map mapQuestionContent, HttpServletRequest request, QaAuthoringForm qaAuthoringForm)
+ protected Map reconstructQuestionContentMapForRemove(Map mapQuestionContent, HttpServletRequest request,
+ QaAuthoringForm qaAuthoringForm, String activeModule)
{
- logger.debug("doing reconstructQuestionContentMapForRemove.");
+ logger.debug("doing reconstructQuestionContentMapForRemove with activeModule: " + activeModule);
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 defLater=(String)request.getSession().getAttribute(ACTIVE_MODULE);
+ //logger.debug("defLater: " + defLater);
String removableQuestionIndex=null;
- if (defLater.equals(MONITORING))
+ if (activeModule.equals(MONITORING))
{
+ //remove REMOVABLE_QUESTION_INDEX from the session
removableQuestionIndex=(String)request.getSession().getAttribute(REMOVABLE_QUESTION_INDEX);
logger.debug("removableQuestionIndex: " + removableQuestionIndex);
questionIndex=removableQuestionIndex;
@@ -105,10 +110,11 @@
mapQuestionContent.remove(new Long(longQuestionIndex).toString());
logger.debug("removed the question content with index: " + longQuestionIndex);
- request.getSession().setAttribute("mapQuestionContent", mapQuestionContent);
-
- logger.debug("post-delete count " + mapQuestionContent.size());
- logger.debug("post-delete map content: " + mapQuestionContent);
+
+ logger.debug("returning mapQuestionContent:" + mapQuestionContent);
+ return mapQuestionContent;
+
+ //request.getSession().setAttribute("mapQuestionContent", mapQuestionContent);
}
@@ -148,20 +154,28 @@
*/
protected void repopulateMap(Map mapQuestionContent, HttpServletRequest request)
{
+ logger.debug("starting repopulateMap");
+
+
+ /*
+ logger.debug("queIndex: " + request.getSession().getAttribute("queIndex"));
logger.debug("queIndex: " + request.getSession().getAttribute("queIndex"));
long queIndex= new Long(request.getSession().getAttribute("queIndex").toString()).longValue();
logger.debug("queIndex: " + queIndex);
+ */
+ int intQuestionIndex= mapQuestionContent.size();
+ logger.debug("intQuestionIndex: " + intQuestionIndex);
/* if there is data in the Map remaining from previous session remove those */
mapQuestionContent.clear();
logger.debug("Map got initialized: " + mapQuestionContent);
- for (long i=0; i < queIndex ; i++)
+ for (long i=0; i < intQuestionIndex ; i++)
{
String candidateQuestionEntry =request.getParameter("questionContent" + i);
if (i==0)
{
- request.getSession().setAttribute("defaultQuestionContent", candidateQuestionEntry);
+ //request.getSession().setAttribute("defaultQuestionContent", candidateQuestionEntry);
logger.debug("defaultQuestionContent set to: " + candidateQuestionEntry);
}
if ((candidateQuestionEntry != null) && (candidateQuestionEntry.length() > 0))
@@ -174,35 +188,59 @@
}
- public QaContent saveOrUpdateQaContent(Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm, HttpServletRequest request)
+ public QaContent saveOrUpdateQaContent(Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm,
+ HttpServletRequest request, QaContent qaContent, String strToolContentID)
{
UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);
boolean isQuestionsSequenced=false;
boolean isSynchInMonitor=false;
boolean isUsernameVisible=false;
- String reportTitle = qaAuthoringForm.getReportTitle();
+ //String reportTitle = qaAuthoringForm.getReportTitle();
//String richTextTitle = qaAuthoringForm.getTitle();
String richTextTitle = request.getParameter("title");
String richTextInstructions = request.getParameter("instructions");
+
logger.debug("richTextTitle: " + richTextTitle);
logger.debug("richTextInstructions: " + richTextInstructions);
+
+ String synchInMonitor=request.getParameter("synchInMonitor");
+ //qaAuthoringForm.setSynchInMonitor(synchInMonitor);
+
+ String usernameVisible=request.getParameter("usernameVisible");
+ //qaAuthoringForm.setUsernameVisible(usernameVisible);
+
+ String questionsSequenced=request.getParameter("questionsSequenced");
+ //qaAuthoringForm.setQuestionsSequenced(questionsSequenced);
+
+ String reportTitle=request.getParameter("reportTitle");
+
+ String monitoringReportTitle=request.getParameter("monitoringReportTitle");
+
+ String endLearningMessage=request.getParameter("endLearningMessage");
+
+ String richTextOfflineInstructions=request.getParameter("offlineInstructions");
+
+ String richTextOnlineInstructions=request.getParameter("onlineInstructions");
- String monitoringReportTitle = qaAuthoringForm.getMonitoringReportTitle();
- String richTextOnlineInstructions = qaAuthoringForm.getOnlineInstructions();
+ String activeModule=request.getParameter("activeModule");
+ logger.debug("activeModule: " + activeModule);
+
+ //String monitoringReportTitle = qaAuthoringForm.getMonitoringReportTitle();
+ //String richTextOnlineInstructions = qaAuthoringForm.getOnlineInstructions();
//String richTextInstructions = qaAuthoringForm.getInstructions();
- String richTextOfflineInstructions = qaAuthoringForm.getOfflineInstructions();
- String endLearningMessage = qaAuthoringForm.getEndLearningMessage();
+ //String richTextOfflineInstructions = qaAuthoringForm.getOfflineInstructions();
+ //String endLearningMessage = qaAuthoringForm.getEndLearningMessage();
- String questionsSequenced = qaAuthoringForm.getQuestionsSequenced();
- logger.debug("questionsSequenced: " + questionsSequenced);
+ //String questionsSequenced = qaAuthoringForm.getQuestionsSequenced();
+ //logger.debug("questionsSequenced: " + questionsSequenced);
- String synchInMonitor = qaAuthoringForm.getSynchInMonitor();
- logger.debug("synchInMonitor: " + synchInMonitor);
+ //String synchInMonitor = qaAuthoringForm.getSynchInMonitor();
+ //logger.debug("synchInMonitor: " + synchInMonitor);
- String usernameVisible = qaAuthoringForm.getUsernameVisible();
- logger.debug("usernameVisible: " + usernameVisible);
+ //String usernameVisible = qaAuthoringForm.getUsernameVisible();
+ //logger.debug("usernameVisible: " + usernameVisible);
boolean setCommonContent=true;
if ((questionsSequenced == null) || (synchInMonitor == null) || (usernameVisible == null))
@@ -211,8 +249,8 @@
}
logger.debug("setCommonContent: " + setCommonContent);
- String activeModule=(String)request.getSession().getAttribute(ACTIVE_MODULE);
- logger.debug("activeModule: " + activeModule);
+ //String activeModule=(String)request.getSession().getAttribute(ACTIVE_MODULE);
+
boolean questionsSequencedBoolean=false;
boolean synchInMonitorBoolean=false;
@@ -255,14 +293,15 @@
logger.debug("userId: " + userId);
- Long toolContentIdLong =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
- logger.debug("toolContentIdLong: " + toolContentIdLong);
+ //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);
+ //String toolContentId=toolContentIdLong.toString();
+ //logger.debug("toolContentId: " + toolContentId);
- QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue());
+ //QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue());
logger.debug("qaContent: " + qaContent);
boolean newContent=false;
@@ -274,7 +313,7 @@
logger.debug("setting common content values..." + richTextTitle + " " + richTextInstructions);
- qaContent.setQaContentId(new Long(toolContentId));
+ qaContent.setQaContentId(new Long(strToolContentID));
qaContent.setTitle(richTextTitle);
qaContent.setInstructions(richTextInstructions);
qaContent.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/
@@ -312,7 +351,7 @@
qaService.updateQa(qaContent);
}
- qaContent=qaService.loadQa(new Long(toolContentId).longValue());
+ qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
logger.debug("qaContent: " + qaContent);
qaContent=createQuestionContent(mapQuestionContent, qaService, qaContent);
@@ -329,24 +368,17 @@
* @param qaService
* @param qaAuthoringForm
*/
- public void removeRedundantQuestions (Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm, HttpServletRequest request)
+ public void removeRedundantQuestions (Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm,
+ HttpServletRequest request, String toolContentID)
{
logger.debug("removing unused entries... ");
logger.debug("mapQuestionContent: " + mapQuestionContent);
- 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);
+ //String toolContentID=qaAuthoringForm.getToolContentId();
+ logger.debug("toolContentID: " + toolContentID);
- QaContent qaContent=qaService.loadQa( new Long(toolContentId).longValue());
+ QaContent qaContent=qaService.loadQa( new Long(toolContentID).longValue());
logger.debug("qaContent: " + qaContent);
if (qaContent != null)
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java
===================================================================
diff -u -r0409f98dc17dfd380badf33ae103a47d0fffc4e5 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 0409f98dc17dfd380badf33ae103a47d0fffc4e5)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -1,4 +1,3 @@
-
/***************************************************************************
* Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
* =============================================================
@@ -29,7 +28,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.TreeMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -50,8 +48,8 @@
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;
import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaGeneralAuthoringDTO;
import org.lamsfoundation.lams.tool.qa.QaUploadedFile;
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
@@ -60,6 +58,7 @@
import org.lamsfoundation.lams.util.WebUtil;
import org.lamsfoundation.lams.web.action.LamsDispatchAction;
import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -84,26 +83,33 @@
*
* @author Ozgur Demirtas
*
- *
+
+
+
@@ -148,12 +154,11 @@
*
*/
public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
- request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
return (mapping.findForward(LOAD_QUESTIONS));
}
/**
- * submits content
+ * submits content into the tool database
* ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
*
@@ -168,291 +173,191 @@
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;
- logger.debug("qaAuthoringForm :" +qaAuthoringForm);
+ logger.debug("dispathcing submitAllContent :" +form);
+
+ QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
+
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService: " + qaService);
+
+ String httpSessionID=qaAuthoringForm.getHttpSessionID();
+ logger.debug("httpSessionID: " + httpSessionID);
+
+ SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ logger.debug("sessionMap: " + sessionMap);
+
+ String activeModule=request.getParameter(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
+ String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+
+ String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
+ logger.debug("defaultContentIdStr: " + defaultContentIdStr);
+
+ Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ logger.debug("mapQuestionContent size: " + mapQuestionContent.size());
- 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);
-
- if (mapQuestionContent == null)
- mapQuestionContent= new TreeMap(new QaComparator());
- logger.debug("mapQuestionContent :" +mapQuestionContent);
-
ActionMessages errors= new ActionMessages();
/* full form validation should be performed only in standard authoring mode, but not in monitoring EditActivity */
+ /*
errors=validateSubmit(request, errors, qaAuthoringForm);
if (errors.size() > 0)
{
logger.debug("returning back to from to fix errors:");
- request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true));
+ //qaGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
return (mapping.findForward(LOAD_QUESTIONS));
}
+ */
- List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST);
- List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST);
-
+
+ List attachmentListBackup= new ArrayList();
+ List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY);
+ logger.debug("attachmentList: " + attachmentList);
+ attachmentListBackup=attachmentList;
+
+ List deletedAttachmentListBackup= new ArrayList();
+ List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
+ deletedAttachmentListBackup=deletedAttachmentList;
+
+ AuthoringUtil authoringUtil= new AuthoringUtil();
authoringUtil.reconstructQuestionContentMapForSubmit(mapQuestionContent, request);
- logger.debug("before saveOrUpdateQaContent.");
+ logger.debug("before saveOrUpdateQaContent." + mapQuestionContent);
+
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= new QaGeneralAuthoringDTO();
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+
+ qaGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+
+
+ String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
+ logger.debug("onlineInstructions: " + onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
+ logger.debug("offlineInstructions: " + offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+ logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentList);
+ qaGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList);
+
+ String defaultQuestionContent=request.getParameter("questionContent0");
+ logger.debug("defaultQuestionContent: " + defaultQuestionContent);
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent);
+
+ String reportTitle=request.getParameter(REPORT_TITLE);
+ logger.debug("reportTitle: " + reportTitle);
+ qaAuthoringForm.setReportTitle(reportTitle);
+ qaGeneralAuthoringDTO.setReportTitle(reportTitle);
+
+ String monitoringReportTitle=request.getParameter(MONITORING_REPORT_TITLE);
+ logger.debug("monitoringReportTitle: " + monitoringReportTitle);
+ qaAuthoringForm.setMonitoringReportTitle(monitoringReportTitle);
+ qaGeneralAuthoringDTO.setMonitoringReportTitle(monitoringReportTitle);
+
+ String endLearningMessage=request.getParameter(END_LEARNING_MESSSAGE);
+ logger.debug("endLearningMessage: " + endLearningMessage);
+ qaAuthoringForm.setEndLearningMessage(endLearningMessage);
+ qaGeneralAuthoringDTO.setEndLearningMessage(endLearningMessage);
+
+
+ logger.debug("qaGeneralAuthoringDTO now: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
+
boolean verifyDuplicatesOptionsMap=AuthoringUtil.verifyDuplicatesOptionsMap(mapQuestionContent);
logger.debug("verifyDuplicatesOptionsMap: " + verifyDuplicatesOptionsMap);
- request.getSession().removeAttribute(USER_EXCEPTION_QUESTIONS_DUPLICATE);
+
if (verifyDuplicatesOptionsMap == false)
{
errors= new ActionMessages();
errors.add(Globals.ERROR_KEY,new ActionMessage("error.questions.duplicate"));
- request.getSession().setAttribute(USER_EXCEPTION_QUESTIONS_DUPLICATE, new Boolean(true).toString());
- logger.debug("add error.questions.duplicate to ActionMessages");
saveErrors(request,errors);
+ qaGeneralAuthoringDTO.setUserExceptionQuestionsDuplicate(new Boolean(true).toString());
+
+ logger.debug("error: qaGeneralAuthoringDTO now: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
qaAuthoringForm.resetUserAction();
+ logger.debug("going back to form to fix error: " + LOAD_QUESTIONS);
return (mapping.findForward(LOAD_QUESTIONS));
}
+ logger.debug("there are no issues with input, continue and submit data");
/*to remove deleted entries in the questions table based on mapQuestionContent */
- authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm, request);
+ authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm, request, strToolContentID);
logger.debug("end of removing unused entries... ");
-
-
-
- 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);
- }
-
- if (qaAuthoringForm != null)
- {
- if ((qaAuthoringForm.getOnlineInstructions() == null) || (qaAuthoringForm.getOnlineInstructions().length() == 0))
- qaAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
- if ((qaAuthoringForm.getOfflineInstructions() == null) || (qaAuthoringForm.getOfflineInstructions().length() == 0))
- qaAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
- }
-
+ QaContent qaContentTest=qaService.loadQa(new Long(strToolContentID).longValue());
+ logger.debug("qaContentTest: " + qaContentTest);
+ QaContent qaContent=authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm,
+ request, qaContentTest, strToolContentID);
+ logger.debug("qaContent: " + qaContent);
+
+ qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm);
+ logger.debug("updated qaGeneralAuthoringDTO to: " + qaGeneralAuthoringDTO);
+
authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, qaService, qaAuthoringForm, qaContent);
- String activeModule=qaAuthoringForm.getActiveModule();
logger.debug("activeModule: " + activeModule);
if (activeModule.equals(AUTHORING))
{
List attacments=saveAttachments(qaContent, attachmentList, deletedAttachmentList, mapping, request);
logger.debug("attacments: " + attacments);
}
-
errors.clear();
errors.add(Globals.ERROR_KEY, new ActionMessage("submit.successful"));
- request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(1));
+ qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString());
+
logger.debug("setting SUBMIT_SUCCESS to 1.");
- Long strToolContentId=(Long)request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID);
- logger.debug("strToolContentId: " + strToolContentId);
- QaUtils.setDefineLater(request, false, strToolContentId.toString());
+ logger.debug("strToolContentID: " + strToolContentID);
+ QaUtils.setDefineLater(request, false, strToolContentID, qaService);
saveErrors(request,errors);
- QaUtils.setDefineLater(request, false);
+ QaUtils.setDefineLater(request, false, qaService, strToolContentID);
logger.debug("define later set to false");
qaAuthoringForm.resetUserAction();
- request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE);
- return mapping.findForward(LOAD_QUESTIONS);
- }
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+
+ QaUtils.setFormProperties(request, qaService, qaContent,
+ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
- public ActionForward editActivity(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- {
- logger.debug("dispatching proxy editActivity...");
- return null;
- }
-
- /**
- * calls monitoring action summary screen generation
- * ActionForward getSummary(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- */
- public ActionForward getSummary(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- {
- logger.debug("dispatching proxy getSummary...start with monitoringStarter" + request);
- QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
- return qaMonitoringAction.getSummary(mapping, form, request, response);
- }
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentListBackup);
+ qaGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentListBackup);
-
- /**
- * calls monitoring action instructions screen generation
- * ActionForward getInstructions(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- */
- public ActionForward getInstructions(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- {
- logger.debug("dispatching proxy getInstructions..." + request);
- QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
- return qaMonitoringAction.getInstructions(mapping, form, request, response);
- }
+ defaultQuestionContent=request.getParameter("questionContent0");
+ logger.debug("defaultQuestionContent: " + defaultQuestionContent);
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent);
- /**
- * calls monitoring action stats screen generation
- *
- * ActionForward getStats(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- */
- public ActionForward getStats(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- {
- logger.debug("dispatching proxy getStats..." + request);
- QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
- return qaMonitoringAction.getStats(mapping, form, request, response);
- }
-
-
- /**
- * generates Edit Activity screen
- * ActionForward editActivityQuestions(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException,
- ToolException
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- * @throws ToolException
- */
- public ActionForward editActivityQuestions(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException,
- ToolException
- {
- logger.debug("dispatching editActivityQuestions...");
-
- QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
- logger.debug("qaAuthoringForm: " + qaAuthoringForm);
-
- 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);
- }
-
- /* determine whether the request is from Monitoring url Edit Activity*/
- String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
- logger.debug("sourceMcStarter: " + sourceMcStarter);
-
- request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true).toString());
- request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString());
-
- 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);
- }
-
- 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);
-
- logger.debug("forwarding to : " + LOAD_QUESTIONS);
- return mapping.findForward(LOAD_QUESTIONS);
+ logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
+ request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE);
+ return mapping.findForward(LOAD_QUESTIONS);
}
@@ -474,38 +379,107 @@
logger.debug("dispathcing addNewQuestion");
QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
-
- request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
+
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService: " + qaService);
+
+ String httpSessionID=qaAuthoringForm.getHttpSessionID();
+ logger.debug("httpSessionID: " + httpSessionID);
+
+ SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ logger.debug("sessionMap: " + sessionMap);
+
+ String activeModule=request.getParameter(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
+ String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+
+ String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
+ logger.debug("defaultContentIdStr: " + defaultContentIdStr);
+
+ QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
+ logger.debug("qaContent: " + qaContent);
+
+ if (qaContent == null)
+ {
+ logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
+ qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue());
+ }
+ logger.debug("final qaContent: " + qaContent);
+
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm);
+ logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+
+ qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
+
AuthoringUtil authoringUtil= new AuthoringUtil();
- Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT);
+
+ Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ logger.debug("mapQuestionContent size: " + mapQuestionContent.size());
+
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
- 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);
- }
+ qaGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- if (richTextInstructions != null)
- {
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, richTextInstructions);
- }
+ String defaultQuestionContent=request.getParameter("questionContent0");
+ logger.debug("defaultQuestionContent: " + defaultQuestionContent);
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent);
- if (qaAuthoringForm != null)
- {
- if ((qaAuthoringForm.getOnlineInstructions() == null) || (qaAuthoringForm.getOnlineInstructions().length() == 0))
- qaAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
- if ((qaAuthoringForm.getOfflineInstructions() == null) || (qaAuthoringForm.getOfflineInstructions().length() == 0))
- qaAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
- }
+
+ String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
+ logger.debug("onlineInstructions: " + onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
- request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); //FIXME: ??
- authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, request);
+ String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
+ logger.debug("offlineInstructions: " + offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ qaGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+ authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, qaGeneralAuthoringDTO, request);
- logger.debug("richTextInstructions: " + request.getSession().getAttribute(ACTIVITY_INSTRUCTIONS));
+ sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent);
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+
+ QaUtils.setFormProperties(request, qaService, qaContent,
+ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+
+ qaGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setActiveModule(activeModule);
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+
+ qaAuthoringForm.setToolContentID(strToolContentID);
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaAuthoringForm.setActiveModule(activeModule);
+ qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setCurrentTab("1");
+
+
+ List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY);
+ logger.debug("attachmentList: " + attachmentList);
+
+ List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
+
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentList);
+ qaGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList);
+
+ logger.debug("qaGeneralAuthoringDTO now: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
+ logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -525,40 +499,107 @@
*/
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));
+ logger.debug("dispatching removeQuestion");
QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
- String richTextTitle = request.getParameter("title");
- String richTextInstructions = request.getParameter("instructions");
- logger.debug("richTextTitle: " + richTextTitle);
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService: " + qaService);
+
+ String httpSessionID=qaAuthoringForm.getHttpSessionID();
+ logger.debug("httpSessionID: " + httpSessionID);
+
+ SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ logger.debug("sessionMap: " + sessionMap);
+
+ String activeModule=request.getParameter(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
+ String richTextTitle = request.getParameter(TITLE);
+ logger.debug("richTextTitle: " + richTextTitle);
+
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
logger.debug("richTextInstructions: " + richTextInstructions);
- if (richTextTitle != null)
- {
- request.getSession().setAttribute(ACTIVITY_TITLE, richTextTitle);
- }
+
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- if (richTextInstructions != null)
- {
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, richTextInstructions);
- }
+
+ String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+
+ String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
+ logger.debug("defaultContentIdStr: " + defaultContentIdStr);
+
+ QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
+ logger.debug("qaContent: " + qaContent);
+
+ if (qaContent == null)
+ {
+ logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
+ qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue());
+ }
+ logger.debug("final qaContent: " + qaContent);
+
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm);
+ logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+
+ String defaultQuestionContent=request.getParameter("questionContent0");
+ logger.debug("defaultQuestionContent: " + defaultQuestionContent);
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent);
+
+ qaGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
+ logger.debug("onlineInstructions: " + onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
+ logger.debug("offlineInstructions: " + offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
AuthoringUtil authoringUtil= new AuthoringUtil();
- Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT);
-
- if (qaAuthoringForm != null)
- {
- if ((qaAuthoringForm.getOnlineInstructions() == null) || (qaAuthoringForm.getOnlineInstructions().length() == 0))
- qaAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
- if ((qaAuthoringForm.getOfflineInstructions() == null) || (qaAuthoringForm.getOfflineInstructions().length() == 0))
- qaAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
- }
+ Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ logger.debug("mapQuestionContent size: " + mapQuestionContent.size());
+ qaGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+ mapQuestionContent=authoringUtil.reconstructQuestionContentMapForRemove(mapQuestionContent, request, qaAuthoringForm, activeModule);
+ logger.debug("final mapQuestionContent: " + mapQuestionContent);
- request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); //FIXME: ??
- authoringUtil.reconstructQuestionContentMapForRemove(mapQuestionContent, request, qaAuthoringForm);
+ sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent);
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+
+ QaUtils.setFormProperties(request, qaService, qaContent,
+ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+
+ qaGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setActiveModule(activeModule);
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setToolContentID(strToolContentID);
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaAuthoringForm.setActiveModule(activeModule);
+ qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setCurrentTab("1");
+
+ List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY);
+ logger.debug("attachmentList: " + attachmentList);
+ List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
+
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentList);
+ qaGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList);
+
+ logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
+ logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -579,19 +620,105 @@
*/
public ActionForward addNewFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
- request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
- QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
+ logger.debug("dispathching addNewFile");
+ QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
- if (qaAuthoringForm != null)
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService: " + qaService);
+
+ String httpSessionID=qaAuthoringForm.getHttpSessionID();
+ logger.debug("httpSessionID: " + httpSessionID);
+
+ SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ logger.debug("sessionMap: " + sessionMap);
+
+ String activeModule=request.getParameter(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
+ String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+
+ String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
+ logger.debug("defaultContentIdStr: " + defaultContentIdStr);
+
+ QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
+ logger.debug("qaContent: " + qaContent);
+
+ if (qaContent == null)
{
- if ((qaAuthoringForm.getOnlineInstructions() == null) || (qaAuthoringForm.getOnlineInstructions().length() == 0))
- qaAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
- if ((qaAuthoringForm.getOfflineInstructions() == null) || (qaAuthoringForm.getOfflineInstructions().length() == 0))
- qaAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
+ logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
+ qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue());
}
+ logger.debug("final qaContent: " + qaContent);
+
+
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm);
+ logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
- addFileToContentRepository(request, qaAuthoringForm);
+ Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ logger.debug("mapQuestionContent size: " + mapQuestionContent.size());
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+
+ String defaultQuestionContent=request.getParameter("questionContent0");
+ logger.debug("defaultQuestionContent: " + defaultQuestionContent);
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent);
+
+ qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
+
+ String richTextTitle = (String)sessionMap.get(ACTIVITY_TITLE_KEY);
+ String richTextInstructions = (String)sessionMap.get(ACTIVITY_INSTRUCTIONS_KEY);
+
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+ qaGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
+ logger.debug("onlineInstructions: " + onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
+ logger.debug("offlineInstructions: " + offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY);
+ logger.debug("attachmentList: " + attachmentList);
+ List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
+
+ addFileToContentRepository(request, qaAuthoringForm, attachmentList, deletedAttachmentList, sessionMap, qaGeneralAuthoringDTO);
+ logger.debug("post addFileToContentRepository, attachmentList: " + attachmentList);
+ logger.debug("post addFileToContentRepository, deletedAttachmentList: " + deletedAttachmentList);
+
+ sessionMap.put(ATTACHMENT_LIST_KEY,attachmentList);
+ sessionMap.put(DELETED_ATTACHMENT_LIST_KEY,deletedAttachmentList);
+
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentList);
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ QaUtils.setFormProperties(request, qaService, qaContent,
+ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr,
+ activeModule, sessionMap, httpSessionID);
+
+
+ qaGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setActiveModule(activeModule);
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setToolContentID(strToolContentID);
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaAuthoringForm.setActiveModule(activeModule);
+ qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setCurrentTab("3");
+
+
+ logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
qaAuthoringForm.resetUserAction();
+ logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -618,18 +745,121 @@
HttpServletResponse response) throws IOException,
ServletException
{
- request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
+ logger.debug("dispatching deleteFile");
+ QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
+
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService: " + qaService);
+
+ String httpSessionID=qaAuthoringForm.getHttpSessionID();
+ logger.debug("httpSessionID: " + httpSessionID);
+
+ SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ logger.debug("sessionMap: " + sessionMap);
+
+ String activeModule=request.getParameter(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
+ String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+
+ String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
+ logger.debug("defaultContentIdStr: " + defaultContentIdStr);
+
+ QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
+ logger.debug("qaContent: " + qaContent);
+
+ if (qaContent == null)
+ {
+ logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
+ qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue());
+ }
+ logger.debug("final qaContent: " + qaContent);
+
+
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm);
+ logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+
+ qaGeneralAuthoringDTO.setSbmtSuccess( new Integer(0).toString());
+ Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ logger.debug("mapQuestionContent size: " + mapQuestionContent.size());
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+
+ if ((mapQuestionContent != null) && (mapQuestionContent.size() > 0))
+ {
+ String defaultQuestionContent = (String)mapQuestionContent.get("1");
+ logger.debug("defaultQuestionContent: " + defaultQuestionContent);
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent);
+ }
+
+ QaUtils.setFormProperties(request, qaService, qaContent,
+ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+
+ String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
+ logger.debug("onlineInstructions: " + onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
+ logger.debug("offlineInstructions: " + offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ String richTextTitle = (String)sessionMap.get(ACTIVITY_TITLE_KEY);
+ String richTextInstructions = (String)sessionMap.get(ACTIVITY_INSTRUCTIONS_KEY);
+
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+ qaGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
long uuid = WebUtil.readLongParam(request, UUID);
+
+ List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY);
+ logger.debug("attachmentList: " + attachmentList);
+
+ if(attachmentList == null)
+ attachmentList = new ArrayList();
+
+
+ List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
+
+ if(deletedAttachmentList == null)
+ deletedAttachmentList = new ArrayList();
/* move the file's details from the attachment collection to the deleted attachments collection
the attachment will be delete on saving. */
- List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST);
- List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST);
- if(deletedAttachmentList == null)
- deletedAttachmentList = new ArrayList();
-
+
deletedAttachmentList = QaUtils.moveToDelete(Long.toString(uuid), attachmentList, deletedAttachmentList );
+
+ sessionMap.put(ATTACHMENT_LIST_KEY,attachmentList);
+ sessionMap.put(DELETED_ATTACHMENT_LIST_KEY,deletedAttachmentList);
+
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentList);
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+
+
+ qaGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setActiveModule(activeModule);
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setToolContentID(strToolContentID);
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaAuthoringForm.setActiveModule(activeModule);
+ qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setCurrentTab("3");
+
+
+ logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
+ qaAuthoringForm.resetUserAction();
+ logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS);
+
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -644,24 +874,25 @@
* @return ActionMessages
*/
protected ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, QaAuthoringForm qaAuthoringForm)
+
{
- request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
- String title = qaAuthoringForm.getTitle();
- logger.debug("title: " + title);
-
- String instructions = qaAuthoringForm.getInstructions();
- logger.debug("instructions: " + instructions);
+ //qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
+
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ logger.debug("richTextTitle: " + richTextTitle);
+ logger.debug("richTextInstructions: " + richTextInstructions);
- if ((title == null) || (title.trim().length() == 0) || title.equalsIgnoreCase(RICHTEXT_BLANK))
+ if ((richTextTitle == null) || (richTextTitle.trim().length() == 0) || richTextTitle.equalsIgnoreCase(RICHTEXT_BLANK))
{
errors.add(Globals.ERROR_KEY,new ActionMessage("error.title"));
- logger.debug("add title to ActionMessages");
+ logger.debug("add error.title to ActionMessages");
}
- if ((instructions == null) || (instructions.trim().length() == 0) || instructions.equalsIgnoreCase(RICHTEXT_BLANK))
+ if ((richTextInstructions == null) || (richTextInstructions.trim().length() == 0) || richTextInstructions.equalsIgnoreCase(RICHTEXT_BLANK))
{
errors.add(Globals.ERROR_KEY, new ActionMessage("error.instructions"));
- logger.debug("add instructions to ActionMessages: ");
+ logger.debug("add error.instructions to ActionMessages: ");
}
/*
@@ -674,6 +905,8 @@
logger.debug("add error.defaultquestion.empty to ActionMessages: ");
}
+
+ // check this again in Monitoring
Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY);
if ((renderMonitoringEditActivity != null) && (!renderMonitoringEditActivity.booleanValue()))
{
@@ -716,15 +949,16 @@
* @param request
* @param qaAuthoringForm
*/
- public void addFileToContentRepository(HttpServletRequest request, QaAuthoringForm qaAuthoringForm)
+ public void addFileToContentRepository(HttpServletRequest request, QaAuthoringForm qaAuthoringForm,
+ List attachmentList, List deletedAttachmentList, SessionMap sessionMap,
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO)
{
logger.debug("attempt addFileToContentRepository");
+ logger.debug("attachmentList: " + attachmentList);
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
logger.debug("qaService: " + qaService);
- List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST);
- List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST);
-
if(attachmentList == null)
attachmentList = new ArrayList();
@@ -735,11 +969,15 @@
boolean isOnlineFile = false;
String fileType = null;
if(qaAuthoringForm.getTheOfflineFile() != null && qaAuthoringForm.getTheOfflineFile().getFileSize() > 0 ){
+ logger.debug("theOfflineFile is available: ");
uploadedFile = qaAuthoringForm.getTheOfflineFile();
+ logger.debug("uploadedFile: " + uploadedFile);
fileType = IToolContentHandler.TYPE_OFFLINE;
}
else if(qaAuthoringForm.getTheOnlineFile() != null && qaAuthoringForm.getTheOnlineFile().getFileSize() > 0 ){
+ logger.debug("theOnlineFile is available: ");
uploadedFile = qaAuthoringForm.getTheOnlineFile();
+ logger.debug("uploadedFile: " + uploadedFile);
isOnlineFile = true;
fileType = IToolContentHandler.TYPE_ONLINE;
}
@@ -751,6 +989,7 @@
/* if a file with the same name already exists then move the old one to deleted */
deletedAttachmentList = QaUtils.moveToDelete(uploadedFile.getFileName(), isOnlineFile, attachmentList, deletedAttachmentList );
+ logger.debug("deletedAttachmentList: " + deletedAttachmentList);
try
{
@@ -760,15 +999,24 @@
NodeKey node = getToolContentHandler().uploadFile(uploadedFile.getInputStream(), uploadedFile.getFileName(),
uploadedFile.getContentType(), fileType);
QaUploadedFile file = new QaUploadedFile();
- file.setFileName(uploadedFile.getFileName());
+ String fileName=uploadedFile.getFileName();
+ logger.debug("fileName: " + fileName);
+ logger.debug("fileName length: " + fileName.length());
+
+ if ((fileName != null) && (fileName.length() > 30))
+ {
+ fileName=fileName.substring(0, 31);
+ logger.debug("shortened fileName: " + fileName);
+ }
+
+ file.setFileName(fileName);
file.setFileOnline(isOnlineFile);
file.setUuid(node.getUuid().toString());
/* file.setVersionId(node.getVersion()); */
/* add the files to the attachment collection - if one existed, it should have already been removed. */
attachmentList.add(file);
- QaUtils.addUploadsToSession(request, attachmentList, deletedAttachmentList);
/* reset the fields so that more files can be uploaded */
qaAuthoringForm.setTheOfflineFile(null);
qaAuthoringForm.setTheOnlineFile(null);
@@ -879,4 +1127,214 @@
return deletedAttachmentList;
}
+
+
+ public ActionForward editActivity(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching proxy editActivity...");
+ return null;
+ }
+
+
+ /**
+ * calls monitoring action summary screen generation
+ * ActionForward getSummary(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward getSummary(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching proxy getSummary...start with monitoringStarter" + request);
+ QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
+ return qaMonitoringAction.getSummary(mapping, form, request, response);
+ }
+
+
+ /**
+ * calls monitoring action instructions screen generation
+ * ActionForward getInstructions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward getInstructions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching proxy getInstructions..." + request);
+ QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
+ return qaMonitoringAction.getInstructions(mapping, form, request, response);
+ }
+
+ /**
+ * calls monitoring action stats screen generation
+ *
+ * ActionForward getStats(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward getStats(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ logger.debug("dispatching proxy getStats..." + request);
+ QaMonitoringAction qaMonitoringAction= new QaMonitoringAction();
+ return qaMonitoringAction.getStats(mapping, form, request, response);
+ }
+
+
+ /**
+ * generates Edit Activity screen
+ * ActionForward editActivityQuestions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException,
+ ToolException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @throws ToolException
+ */
+ public ActionForward editActivityQuestions(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException,
+ ToolException
+ {
+ logger.debug("dispatching editActivityQuestions...");
+
+ QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
+ logger.debug("qaAuthoringForm: " + qaAuthoringForm);
+
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
+ logger.debug("qaService: " + qaService);
+
+ String httpSessionID=qaAuthoringForm.getHttpSessionID();
+ logger.debug("httpSessionID: " + httpSessionID);
+
+ SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ logger.debug("sessionMap: " + sessionMap);
+
+ String activeModule=request.getParameter(ACTIVE_MODULE);
+ logger.debug("activeModule: " + activeModule);
+
+
+ String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+
+ String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
+ logger.debug("defaultContentIdStr: " + defaultContentIdStr);
+
+ QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
+ logger.debug("qaContent: " + qaContent);
+
+ if (qaContent == null)
+ {
+ logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
+ qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue());
+ }
+ logger.debug("final qaContent: " + qaContent);
+
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm);
+ logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+
+ /* determine whether the request is from Monitoring url Edit Activity*/
+ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
+ logger.debug("sourceMcStarter: " + sourceMcStarter);
+
+ qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ qaGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(false).toString());
+
+ boolean isContentInUse=QaUtils.isContentInUse(qaContent);
+ logger.debug("isContentInUse:" + isContentInUse);
+
+ qaGeneralAuthoringDTO.setMonitoredContentInUse(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");
+ qaGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(true).toString());
+ }
+
+ QaUtils.setDefineLater(request, true, strToolContentID, qaService);
+
+ QaUtils.setFormProperties(request, qaService, qaContent,
+ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+
+ qaGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setActiveModule(activeModule);
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setToolContentID(strToolContentID);
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaAuthoringForm.setActiveModule(activeModule);
+ qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ qaAuthoringForm.setCurrentTab("1");
+
+ logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
+ logger.debug("forwarding to : " + LOAD_QUESTIONS);
+ return mapping.findForward(LOAD_QUESTIONS);
+ }
+
+
+ protected boolean existsContent(long toolContentID, IQaService qaService)
+ {
+ QaContent qaContent=qaService.loadQa(toolContentID);
+ if (qaContent == null)
+ return false;
+
+ return true;
+ }
+
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java
===================================================================
diff -u -r1453bf6403ce02c29d691fe34e65a049d3285c26 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision 1453bf6403ce02c29d691fe34e65a049d3285c26)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -23,6 +23,7 @@
package org.lamsfoundation.lams.tool.qa.web;
/* ActionForm for the Authoring environment*/
+import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.struts.upload.FormFile;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
@@ -55,7 +56,7 @@
protected String instructions;
protected String questionIndex;
protected String isRemoveContent;
- protected String toolContentId;
+
/* instructions content */
protected String onlineInstructions;
protected String offlineInstructions;
@@ -79,6 +80,8 @@
protected String edit;
+ protected String defaultContentIdStr;
+
public void resetUserAction()
{
this.addContent=null;
@@ -115,7 +118,6 @@
this.instructions=null;
this.questionIndex=null;
this.isRemoveContent=null;
- this.toolContentId=null;
this.onlineInstructions=null;
this.offlineInstructions=null;
@@ -142,6 +144,25 @@
this.questionsSequenced =OPTION_OFF;
}
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("toolContentID: ", toolContentID)
+ .append("currentTab: ", currentTab)
+ .append("activeModule: ", activeModule)
+ .append("defaultContentIdStr: ", defaultContentIdStr)
+ .append("title: ", title)
+ .append("instructions: ", instructions)
+ .append("reportTitle: ", reportTitle)
+ .append("monitoringReportTitle: ", monitoringReportTitle)
+ .append("endLearningMessage: ", endLearningMessage)
+ .append("onlineInstructions: ", onlineInstructions)
+ .append("offlineInstructions: ", offlineInstructions)
+ .append("usernameVisible: ", usernameVisible)
+ .append("synchInMonitor: ", synchInMonitor)
+ .append("questionsSequenced: ", questionsSequenced)
+ .toString();
+ }
+
/**
* @return Returns the isRemoveContent.
@@ -240,19 +261,8 @@
public void setTitle(String title) {
this.title = title;
}
+
/**
- * @return Returns the toolContentId.
- */
- public String getToolContentId() {
- return toolContentId;
- }
- /**
- * @param toolContentId The toolContentId to set.
- */
- public void setToolContentId(String toolContentId) {
- this.toolContentId = toolContentId;
- }
- /**
* @return Returns the offlineInstructions.
*/
public String getOfflineInstructions() {
@@ -572,5 +582,19 @@
*/
public void setActiveModule(String activeModule) {
this.activeModule = activeModule;
- }
+ }
+
+ /**
+ * @return Returns the defaultContentIdStr.
+ */
+ public String getDefaultContentIdStr() {
+ return defaultContentIdStr;
+ }
+ /**
+ * @param defaultContentIdStr The defaultContentIdStr to set.
+ */
+ public void setDefaultContentIdStr(String defaultContentIdStr) {
+ this.defaultContentIdStr = defaultContentIdStr;
+ }
+
}
Fisheye: Tag 2327711a9c21985a1a82c5f470c05152bba8d741 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportForm.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java
===================================================================
diff -u -r57157cef4ee9b4d70e92be83584eb8d10bcea83c -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 57157cef4ee9b4d70e92be83584eb8d10bcea83c)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -81,6 +81,9 @@
*/
/* $$Id$$ */
+
+// Fix public ActionForward editActivityQuestions(ActionMapping mapping,...)
+
package org.lamsfoundation.lams.tool.qa.web;
import java.io.IOException;
@@ -427,10 +430,15 @@
ToolException
{
logger.debug("dispatching editActivityQuestions...");
+ IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("qaService: " + qaService);
+
+ //ATTENTION HERE: obtain strToolContentID
+ String strToolContentID= null;
request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString());
request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true).toString());
- QaUtils.setDefineLater(request, true);
+ QaUtils.setDefineLater(request, true,strToolContentID, qaService);
return (mapping.findForward(LOAD_MONITORING));
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java
===================================================================
diff -u -r57157cef4ee9b4d70e92be83584eb8d10bcea83c -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 57157cef4ee9b4d70e92be83584eb8d10bcea83c)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -204,8 +204,7 @@
request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
/* save time zone information to session scope. */
- QaUtils.saveTimeZone(request);
-
+
/* we have made sure TOOL_CONTENT_ID is passed */
Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
logger.debug("toolContentId: " + toolContentId);
@@ -254,7 +253,8 @@
qaMonitoringAction.refreshInstructionsData(request, qaContent);
logger.debug("populating online and ofline files data for intructions tab");
- QaUtils.populateUploadedFilesData(request, qaContent, qaService);
+ //FIX HERE!!!
+ //QaUtils.populateUploadedFilesData(request, qaContent, qaService, qaGeneralAuthoringDTO);
boolean isContentInUse=QaUtils.isContentInUse(qaContent);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
diff -u -r3ecb833c87586c3a5ea364bbb1632c872f7011cb -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 3ecb833c87586c3a5ea364bbb1632c872f7011cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -45,7 +45,7 @@
* Tool Content:
*
* While tool's manage their own content, the LAMS core and the tools work together to create and use the content.
- * The tool content id (toolContentId) is the key by which the tool and the LAMS core discuss data -
+ * The tool content id (toolContentID) is the key by which the tool and the LAMS core discuss data -
* it is generated by the LAMS core and supplied to the tool whenever content needs to be stored.
* The LAMS core will refer to the tool content id whenever the content needs to be used.
* Tool content will be covered in more detail in following sections.
@@ -78,33 +78,18 @@
* The data elements must be "version" aware. The data elements must be "type" aware if they are to be shared between Tools.
*
*
-*
-*
+
+
+
-
-
-
-
-
+
+
+
@@ -137,7 +128,10 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.qa.web;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -153,16 +147,17 @@
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
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;
import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaGeneralAuthoringDTO;
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;
import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
/**
*
@@ -171,10 +166,7 @@
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*
- * A Map data structure is used to present the UI.
- It is fetched by subsequent Action classes to manipulate its content and gets parsed in the presentation layer for display.
-
- NOTE: You have to keep in mind that once user can have multiple tool session ids.
+ * A Map data structure is used to present the UI.
*/
public class QaStarterAction extends Action implements QaAppConstants {
static Logger logger = Logger.getLogger(QaStarterAction.class.getName());
@@ -183,59 +175,54 @@
throws IOException, ServletException, QaApplicationException {
QaUtils.cleanUpSessionAbsolute(request);
- logger.debug("init authoring mode. removed attributes...");
+ logger.debug("init authoring mode.");
+ QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
+ logger.debug("qaAuthoringForm: " + qaAuthoringForm);
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= new QaGeneralAuthoringDTO();
+
Map mapQuestionContent= new TreeMap(new QaComparator());
logger.debug("mapQuestionContent: " + mapQuestionContent);
- QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
- logger.debug("qaAuthoringForm: " + qaAuthoringForm);
qaAuthoringForm.resetRadioBoxes();
- IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE);
+ IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext());
logger.debug("qaService: " + qaService);
-
- qaAuthoringForm.setCurrentTab("1");
- logger.debug("setting currrent tab to 1: ");
+ qaGeneralAuthoringDTO.setCurrentTab("1");
+ logger.debug("setting currrent tab to 1:");
- 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);
+ qaGeneralAuthoringDTO.setMonitoringOriginatedDefineLater(new Boolean(false).toString());
String servletPath=request.getServletPath();
logger.debug("getServletPath: "+ servletPath);
String requestedModule=null;
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).toString());
- request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(true).toString());
+ qaGeneralAuthoringDTO.setActiveModule(AUTHORING);
+ qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ qaGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(true).toString());
qaAuthoringForm.setActiveModule(AUTHORING);
requestedModule=AUTHORING;
}
else
{
logger.debug("request is for define later module either direcly from define later url or monitoring url");
- request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER);
- request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false).toString());
- request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString());
+ qaGeneralAuthoringDTO.setActiveModule(DEFINE_LATER);
+ qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
+ qaGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(false).toString());
qaAuthoringForm.setActiveModule(DEFINE_LATER);
requestedModule=DEFINE_LATER;
if (servletPath.indexOf("monitoring") > 0)
{
logger.debug("request is from monitoring url.");
- request.getSession().setAttribute(MONITORING_ORIGINATED_DEFINELATER,new Boolean(true).toString());
+ qaGeneralAuthoringDTO.setMonitoringOriginatedDefineLater(new Boolean(true).toString());
}
}
logger.debug("requestedModule: " + requestedModule);
- request.getSession().setAttribute(REQUESTED_MODULE,requestedModule);
+ qaGeneralAuthoringDTO.setRequestedModule(requestedModule);
/* in development this needs to be called only once. */
@@ -244,87 +231,71 @@
String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
logger.debug("sourceMcStarter: " + sourceMcStarter);
- ActionForward validateSignature=readSignature(request,mapping);
+ ActionForward validateSignature=readSignature(request,mapping, qaService, qaGeneralAuthoringDTO, qaAuthoringForm);
logger.debug("validateSignature: " + validateSignature);
if (validateSignature != null)
{
logger.debug("validateSignature not null : " + validateSignature);
return validateSignature;
}
-
- /*
- * mark the http session as an authoring activity
- */
- request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_AUTHORING);
+
+ /* mark the http session as an authoring activity */
+ qaGeneralAuthoringDTO.setTargetMode(TARGET_MODE_AUTHORING);
/*
* find out whether the request is coming from monitoring module for EditActivity tab or from authoring environment url
*/
logger.debug("no problems getting the default content, will render authoring screen");
- String strToolContentId="";
+ String strToolContentID="";
/*the authoring url must be passed a tool content id*/
- strToolContentId=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- logger.debug("strToolContentId: " + strToolContentId);
+ strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ logger.debug("strToolContentID: " + strToolContentID);
+ qaGeneralAuthoringDTO.setToolContentID(strToolContentID);
- if (strToolContentId == null)
+ SessionMap sessionMap = new SessionMap();
+ List sequentialCheckedCa= new LinkedList();
+ sessionMap.put(ATTACHMENT_LIST_KEY, new ArrayList());
+ sessionMap.put(DELETED_ATTACHMENT_LIST_KEY, new ArrayList());
+ sessionMap.put(ACTIVITY_TITLE_KEY, "");
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, "");
+ qaAuthoringForm.setHttpSessionID(sessionMap.getSessionID());
+ qaGeneralAuthoringDTO.setHttpSessionID(sessionMap.getSessionID());
+
+ String defaultContentId=null;
+ //pay attention here: remove request.getSession().getAttribute(TOOL_CONTENT_ID);
+ if (strToolContentID == null)
{
/*it is possible that the original request for authoring module is coming from monitoring url which keeps the
TOOL_CONTENT_ID in the session*/
- Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
- logger.debug("toolContentId: " + toolContentId);
- if (toolContentId != null)
+ logger.debug("strToolContentID is null, handle this");
+
+ Long toolContentID =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentID: " + toolContentID);
+ if (toolContentID != null)
{
- strToolContentId= toolContentId.toString();
- logger.debug("cached strToolContentId from the session: " + strToolContentId);
+ strToolContentID= toolContentID.toString();
+ logger.debug("cached strToolContentID from the session: " + strToolContentID);
}
else
{
logger.debug("we should IDEALLY not arrive here. The TOOL_CONTENT_ID is NOT available from the url or the session.");
/*use default content instead of giving a warning*/
- String defaultContentId=(String) request.getSession().getAttribute(DEFAULT_CONTENT_ID_STR);
+ defaultContentId=qaAuthoringForm.getDefaultContentIdStr();
logger.debug("using MCQ defaultContentId: " + defaultContentId);
- strToolContentId=defaultContentId;
+ strToolContentID=defaultContentId;
}
}
- logger.debug("final strToolContentId: " + strToolContentId);
+ logger.debug("final strToolContentID: " + strToolContentID);
- if ((strToolContentId == null) || (strToolContentId.equals("")))
+ if ((strToolContentID == null) || (strToolContentID.equals("")))
{
QaUtils.cleanUpSessionAbsolute(request);
- request.getSession().setAttribute(USER_EXCEPTION_CONTENTID_REQUIRED, new Boolean(true).toString());
persistError(request,"error.contentId.required");
logger.debug("forwarding to: " + ERROR_LIST);
return (mapping.findForward(ERROR_LIST));
}
-
- /* API test code for copying the content*/
- String copyToolContent= (String) request.getParameter(COPY_TOOL_CONTENT);
- logger.debug("copyToolContent: " + copyToolContent);
-
- if ((copyToolContent != null) && (copyToolContent.equals("1")))
- {
- logger.debug("user request to copy the content");
- Long fromContentId=new Long(strToolContentId);
- logger.debug("fromContentId: " + fromContentId);
-
- Long toContentId=new Long(9876);
- logger.debug("toContentId: " + toContentId);
-
- try
- {
- qaService.copyToolContent(fromContentId, toContentId);
- }
- catch(ToolException e)
- {
- logger.debug("error copying the content: " + e);
- }
- }
-
- qaAuthoringForm.setToolContentId(strToolContentId);
- request.getSession().setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, new Long(strToolContentId));
- logger.debug("using TOOL_CONTENT_ID: " + strToolContentId);
-
+ qaAuthoringForm.setToolContentID(strToolContentID);
/*
* find out if the passed tool content id exists in the db
@@ -335,123 +306,134 @@
* It is always unlocked since it is the default content.
*/
- if (!existsContent(new Long(strToolContentId).longValue(), qaService))
+ String defaultContentIdStr=null;
+ QaContent qaContent=null;
+ 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);
+ defaultContentIdStr=qaAuthoringForm.getDefaultContentIdStr();
logger.debug("defaultContentIdStr:" + defaultContentIdStr);
- retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(defaultContentIdStr).longValue(), true);
+ qaContent=retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent,
+ new Long(defaultContentIdStr).longValue(), true, qaService, qaGeneralAuthoringDTO, sessionMap);
+
+ logger.debug("post retrive content :" + sessionMap);
}
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());
+ qaContent=qaService.loadQa(new Long(strToolContentID).longValue());
logger.debug("qaContent: " + qaContent);
if (qaService.studentActivityOccurredGlobal(qaContent))
{
QaUtils.cleanUpSessionAbsolute(request);
logger.debug("student activity occurred on this content:" + qaContent);
- request.getSession().setAttribute(USER_EXCEPTION_CONTENT_IN_USE, new Boolean(true).toString());
persistError(request, "error.content.inUse");
logger.debug("add error.content.inUse to ActionMessages.");
return (mapping.findForward(ERROR_LIST));
}
- retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(strToolContentId).longValue(),false);
+ qaContent=retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent,
+ new Long(strToolContentID).longValue(),false, qaService, qaGeneralAuthoringDTO, sessionMap);
+
+ logger.debug("post retrive content :" + sessionMap);
}
- if (qaAuthoringForm != null)
- {
- if ((qaAuthoringForm.getOnlineInstructions() == null) || (qaAuthoringForm.getOnlineInstructions().length() == 0))
- qaAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
- if ((qaAuthoringForm.getOfflineInstructions() == null) || (qaAuthoringForm.getOfflineInstructions().length() == 0))
- qaAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
- }
+ if ((qaGeneralAuthoringDTO.getOnlineInstructions() == null) || (qaGeneralAuthoringDTO.getOnlineInstructions().length() == 0))
+ {
+ qaGeneralAuthoringDTO.setOnlineInstructions(DEFAULT_ONLINE_INST);
+ sessionMap.put(ONLINE_INSTRUCTIONS_KEY, DEFAULT_ONLINE_INST);
+ }
+
+ if ((qaGeneralAuthoringDTO.getOfflineInstructions() == null) || (qaGeneralAuthoringDTO.getOfflineInstructions().length() == 0))
+ {
+ qaGeneralAuthoringDTO.setOfflineInstructions(DEFAULT_OFFLINE_INST);
+ sessionMap.put(OFFLINE_INSTRUCTIONS_KEY, DEFAULT_OFFLINE_INST);
+ }
+
+ logger.debug("final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
logger.debug("will return to jsp with: " + sourceMcStarter);
String destination=QaUtils.getDestination(sourceMcStarter, requestedModule);
logger.debug("destination: " + destination);
+
+
+ logger.debug("setting form properties: " + qaContent);
+
+ Map mapQuestionContentLocal=qaGeneralAuthoringDTO.getMapQuestionContent();
+ logger.debug("mapQuestionContentLocal: " + mapQuestionContentLocal);
+
+ sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent);
+
+ logger.debug("persisting sessionMap into session: " + sessionMap);
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+
+ logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
+ request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
+
return (mapping.findForward(destination));
}
/**
* retrives the existing content information from the db and prepares the data for presentation purposes.
- * ActionForward retrieveExistingContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentId)
+ * ActionForward retrieveExistingContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentID)
*
* @param request
* @param mapping
* @param qaAuthoringForm
* @param mapQuestionContent
- * @param toolContentId
+ * @param toolContentID
* @return ActionForward
*/
- protected void retrieveContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm,
- Map mapQuestionContent, long toolContentId, boolean isDefaultContent)
+ protected QaContent retrieveContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm,
+ Map mapQuestionContent, long toolContentID, boolean isDefaultContent, IQaService qaService,
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO, SessionMap sessionMap)
{
- logger.debug("contentType: " + toolContentId);
+ logger.debug("starting retrieveContent: " + qaService);
+ logger.debug("toolContentID: " + toolContentID);
logger.debug("isDefaultContent: " + isDefaultContent);
- 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("getting content with id:" + toolContentID);
+ QaContent qaContent = qaService.retrieveQa(toolContentID);
logger.debug("QaContent: " + qaContent);
- QaUtils.setDefaultSessionAttributes(request, qaContent, qaAuthoringForm);
- logger.debug("form title is: : " + qaAuthoringForm.getTitle());
+ QaUtils.populateAuthoringDTO(request, qaContent, qaGeneralAuthoringDTO);
- QaUtils.populateUploadedFilesData(request, qaContent, qaService);
- request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater()));
-
- qaAuthoringForm.setTitle(qaContent.getTitle());
- qaAuthoringForm.setInstructions(qaContent.getInstructions());
+ qaAuthoringForm.setUsernameVisible(qaContent.isUsernameVisible()?ON:OFF);
+ qaAuthoringForm.setSynchInMonitor(qaContent.isSynchInMonitor()?ON:OFF);
+ qaAuthoringForm.setQuestionsSequenced(qaContent.isQuestionsSequenced()?ON:OFF);
+ List attachmentList = qaService.retrieveQaUploadedFiles(qaContent);
+ qaGeneralAuthoringDTO.setAttachmentList(attachmentList);
+ qaGeneralAuthoringDTO.setDeletedAttachmentList(new ArrayList());
+
+ sessionMap.put(ATTACHMENT_LIST_KEY, attachmentList);
+ sessionMap.put(DELETED_ATTACHMENT_LIST_KEY, new ArrayList());
+
+
+ qaGeneralAuthoringDTO.setIsDefineLater(new Boolean(qaContent.isDefineLater()).toString());
+
if (qaContent.getTitle() == null)
{
- request.getSession().setAttribute(ACTIVITY_TITLE, "Q&A Title");
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, "Q&A Instructions");
+ qaGeneralAuthoringDTO.setActivityTitle("Q&A Title");
+ qaGeneralAuthoringDTO.setActivityInstructions("Q&A Instructions");
}
else
{
- request.getSession().setAttribute(ACTIVITY_TITLE, qaContent.getTitle());
- request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, qaContent.getInstructions());
+ qaGeneralAuthoringDTO.setActivityTitle(qaContent.getTitle());
+ qaGeneralAuthoringDTO.setActivityInstructions( qaContent.getInstructions());
+
}
+ sessionMap.put(ACTIVITY_TITLE_KEY, qaGeneralAuthoringDTO.getActivityTitle());
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, qaGeneralAuthoringDTO.getActivityInstructions());
- logger.debug("Title is: " + qaContent.getTitle());
- logger.debug("Instructions is: " + qaContent.getInstructions());
- if ((qaAuthoringForm.getTitle() == null) || (qaAuthoringForm.getTitle().equals("")))
- {
- logger.debug("resetting title");
- String activityTitle=(String)request.getSession().getAttribute(ACTIVITY_TITLE);
- logger.debug("activityTitle: " + activityTitle);
- qaAuthoringForm.setTitle(activityTitle);
- }
-
- if ((qaAuthoringForm.getInstructions() == null) || (qaAuthoringForm.getInstructions().equals("")))
- {
- logger.debug("resetting instructions");
- String activityInstructions=(String)request.getSession().getAttribute(ACTIVITY_INSTRUCTIONS);
- logger.debug("activityInstructions: " + activityInstructions);
- qaAuthoringForm.setInstructions(activityInstructions);
- }
-
-
/*
* get the existing question content
*/
- logger.debug("setting existing content data from the db");
+ logger.debug("setting content data from the db");
mapQuestionContent.clear();
Iterator queIterator=qaContent.getQaQueContents().iterator();
Long mapIndex=new Long(1);
@@ -467,7 +449,7 @@
* make the first entry the default(first) one for jsp
*/
if (mapIndex.longValue() == 1)
- request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion());
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(qaQueContent.getQuestion());
mapIndex=new Long(mapIndex.longValue()+1);
}
}
@@ -477,21 +459,16 @@
if (isDefaultContent)
{
logger.debug("overwriting default question.");
- request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, "Sample Question 1?");
+ qaGeneralAuthoringDTO.setDefaultQuestionContent("Sample Question 1?");
+
}
- logger.debug("callling presentInitialUserInterface for the existing content.");
-
- request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent);
- logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") );
+ logger.debug("mapQuestionContent is:" + mapQuestionContent);
+ qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
- logger.debug("final title: " + qaAuthoringForm.getTitle());
- logger.debug("final ins: " + qaAuthoringForm.getInstructions());
-
- /*
- * load questions page
- */
qaAuthoringForm.resetUserAction();
+ logger.debug("returning qaContent:" + qaContent);
+ return qaContent;
}
@@ -505,17 +482,10 @@
* @param mapping
* @return ActionForward
*/
- public ActionForward readSignature(HttpServletRequest request, ActionMapping mapping)
+ public ActionForward readSignature(HttpServletRequest request, ActionMapping mapping, IQaService qaService,
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO, QaAuthoringForm qaAuthoringForm)
{
- 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
*/
@@ -530,7 +500,6 @@
QaUtils.cleanUpSessionAbsolute(request);
logger.debug("default content id has not been setup");
persistError(request,"error.defaultContent.notSetup");
- request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString());
return (mapping.findForward(ERROR_LIST));
}
}
@@ -539,7 +508,6 @@
QaUtils.cleanUpSessionAbsolute(request);
logger.debug("error getting the default content id: " + e.getMessage());
persistError(request,"error.defaultContent.notSetup");
- request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString());
logger.debug("forwarding to: " + ERROR_LIST);
return (mapping.findForward(ERROR_LIST));
}
@@ -556,11 +524,10 @@
QaUtils.cleanUpSessionAbsolute(request);
logger.debug("Exception occured: No default content");
persistError(request,"error.defaultContent.notSetup");
- request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString());
return (mapping.findForward(ERROR_LIST));
}
logger.debug("using qaContent: " + qaContent);
- logger.debug("using mcContent uid: " + qaContent.getUid());
+ logger.debug("using qaContent uid: " + qaContent.getUid());
contentUID=qaContent.getUid().longValue();
logger.debug("contentUID: " + contentUID);
}
@@ -569,7 +536,6 @@
QaUtils.cleanUpSessionAbsolute(request);
logger.debug("Exception occured: No default question content");
persistError(request,"error.defaultContent.notSetup");
- request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString());
logger.debug("forwarding to: " + ERROR_LIST);
return (mapping.findForward(ERROR_LIST));
}
@@ -579,9 +545,9 @@
long queContentUID=0;
try
{
- logger.debug("retrieve the default question content based on default content UID: " + queContentUID);
+ logger.debug("retrieve the default question content based on default content UID: " + contentUID);
QaQueContent qaQueContent=qaService.getToolDefaultQuestionContent(contentUID);
- logger.debug("using mcQueContent: " + qaQueContent);
+ logger.debug("using qaQueContent: " + qaQueContent);
if (qaQueContent == null)
{
logger.debug("Exception occured: No default question content");
@@ -590,7 +556,7 @@
return (mapping.findForward(LOAD_QUESTIONS));
}
logger.debug("using qaQueContent uid: " + qaQueContent.getUid());
- request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion());
+ qaGeneralAuthoringDTO.setDefaultQuestionContent(qaQueContent.getQuestion());
}
catch(Exception e)
{
@@ -602,21 +568,23 @@
}
logger.debug("QA tool has the default content id: " + defaultContentID);
- request.getSession().setAttribute(DEFAULT_CONTENT_ID_STR, new Long(defaultContentID).toString());
+ qaGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
+ qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentID).toString());
+
return null;
}
/**
- * existsContent(long toolContentId)
- * @param long toolContentId
+ * existsContent(long toolContentID)
+ * @param long toolContentID
* @return boolean
- * determine whether a specific toolContentId exists in the db
+ * determine whether a specific toolContentID exists in the db
*/
- protected boolean existsContent(long toolContentId, IQaService qaService)
+ protected boolean existsContent(long toolContentID, IQaService qaService)
{
- QaContent qaContent=qaService.loadQa(toolContentId);
+ QaContent qaContent=qaService.loadQa(toolContentID);
if (qaContent == null)
return false;
@@ -645,8 +613,7 @@
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...");
+ logger.debug("calling execute..., qaService will be needed next.");
return execute(mapping, form, request, response);
}
Index: lams_tool_laqa/web/WEB-INF/struts-config.xml
===================================================================
diff -u -rb138a16b092c8b59e4c96ca1ece1f871c5c7ebd6 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision b138a16b092c8b59e4c96ca1ece1f871c5c7ebd6)
+++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -43,7 +43,7 @@
path="/authoringStarter"
type="org.lamsfoundation.lams.tool.qa.web.QaStarterAction"
name="QaAuthoringForm"
- scope="session"
+ scope="request"
unknown="false"
validate="false"
>
@@ -85,7 +85,7 @@
name="QaAuthoringForm"
input="/AuthoringMaincontent.jsp"
parameter="dispatch"
- scope="session"
+ scope="request"
unknown="false"
validate="false"
>
Index: lams_tool_laqa/web/authoring/AdvancedContent.jsp
===================================================================
diff -u -r3ecb833c87586c3a5ea364bbb1632c872f7011cb -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 3ecb833c87586c3a5ea364bbb1632c872f7011cb)
+++ lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -79,15 +79,15 @@
:
-
+
|
: |
-
+
|
@@ -96,7 +96,7 @@
:
-
+
|
Index: lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp
===================================================================
diff -u -rae31667a6e242fce19d51a36312269d1a7ccd1c3 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp (.../AuthoringTabsHolder.jsp) (revision ae31667a6e242fce19d51a36312269d1a7ccd1c3)
+++ lams_tool_laqa/web/authoring/AuthoringTabsHolder.jsp (.../AuthoringTabsHolder.jsp) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -58,6 +58,7 @@
document.QaAuthoringForm.submit();
}
+
var imgRoot="${lams}images/";
var themeName="aqua";
@@ -90,9 +91,9 @@
initEditor("instructions");
initEditor("questionContent0");
-
-
-
+
+
+
initEditor("");
}
@@ -120,13 +121,13 @@
@@ -137,8 +138,11 @@
+
+
-
+
+
@@ -152,13 +156,13 @@
-
+
-
+
Index: lams_tool_laqa/web/authoring/BasicContent.jsp
===================================================================
diff -u -rae31667a6e242fce19d51a36312269d1a7ccd1c3 -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision ae31667a6e242fce19d51a36312269d1a7ccd1c3)
+++ lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -27,20 +27,19 @@
<%@ taglib uri="fck-editor" prefix="FCK" %>
<%@ taglib uri="tags-lams" prefix="lams" %>
-
-
+
-
+
|
-
+
|
@@ -51,44 +50,44 @@
-
+
-
+
Index: lams_tool_laqa/web/authoring/InstructionsContent.jsp
===================================================================
diff -u -r3ecb833c87586c3a5ea364bbb1632c872f7011cb -r2327711a9c21985a1a82c5f470c05152bba8d741
--- lams_tool_laqa/web/authoring/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 3ecb833c87586c3a5ea364bbb1632c872f7011cb)
+++ lams_tool_laqa/web/authoring/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 2327711a9c21985a1a82c5f470c05152bba8d741)
@@ -24,23 +24,21 @@
@@ -102,7 +101,7 @@
-
+
|
@@ -111,15 +110,13 @@
|