Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -87,7 +87,6 @@ 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()); @@ -107,17 +106,36 @@ } } + logger.debug("mapQuestionContent: " + mapQuestionContent); qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + qaAuthoringForm.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); qaGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); - qaGeneralAuthoringDTO.setActivityTitle(qaContent.getTitle()); - qaGeneralAuthoringDTO.setActivityInstructions(qaContent.getInstructions()); + + if (qaContent.getTitle() == null) + { + qaGeneralAuthoringDTO.setActivityTitle("Q&A Title"); + } + else + { + qaGeneralAuthoringDTO.setActivityTitle(qaContent.getTitle()); + } + if (qaContent.getInstructions() == null) + { + qaGeneralAuthoringDTO.setActivityInstructions("Q&A Instructions"); + } + else + { + qaGeneralAuthoringDTO.setActivityInstructions(qaContent.getInstructions()); + } + + qaGeneralAuthoringDTO.setReportTitle(qaContent.getReportTitle()); qaGeneralAuthoringDTO.setMonitoringReportTitle(qaContent.getMonitoringReportTitle()); qaGeneralAuthoringDTO.setEndLearningMessage(qaContent.getEndLearningMessage()); @@ -131,6 +149,7 @@ 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); @@ -157,6 +176,7 @@ qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); qaAuthoringForm.setActiveModule(activeModule); + qaGeneralAuthoringDTO.setActiveModule(activeModule); String synchInMonitor=request.getParameter(SYNC_IN_MONITOR); logger.debug("synchInMonitor: " + synchInMonitor); @@ -198,9 +218,14 @@ logger.debug("onlineInstructions: " + onlineInstructions); qaAuthoringForm.setOnlineInstructions(onlineInstructions); qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String defineLaterInEditMode=request.getParameter(DEFINE_LATER_IN_EDIT_MODE); + logger.debug("defineLaterInEditMode: " + defineLaterInEditMode); + qaAuthoringForm.setDefineLaterInEditMode(defineLaterInEditMode); + qaGeneralAuthoringDTO.setDefineLaterInEditMode(defineLaterInEditMode); - logger.debug("ending setFormProperties qaAuthoringForm: " + qaAuthoringForm); - logger.debug("ending setFormProperties qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + logger.debug("ending setFormProperties with qaAuthoringForm: " + qaAuthoringForm); + logger.debug("ending setFormProperties with qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); } @@ -215,10 +240,10 @@ /** - * 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 */ public static boolean existsContent(long toolContentID, IQaService qaService) { @@ -527,10 +552,10 @@ /** - * setDefineLater(HttpServletRequest request, boolean value, String toolContentId) + * setDefineLater(HttpServletRequest request, boolean value, String toolContentID) * @param request * @param value - * @param toolContentId + * @param toolContentID */ public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IQaService qaService) { Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== diff -u -r8f690879a75ab70b6948682ae6d5c3400dcc3dad -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 8f690879a75ab70b6948682ae6d5c3400dcc3dad) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -178,11 +178,11 @@ } - public QaContent retrieveQa(long toolContentId) throws QaApplicationException + public QaContent retrieveQa(long toolContentID) throws QaApplicationException { try { - return qaDAO.getQaById(toolContentId); + return qaDAO.getQaById(toolContentID); } catch (DataAccessException e) { @@ -210,11 +210,11 @@ /** * returns null if not found */ - public QaContent loadQa(long toolContentId) throws QaApplicationException + public QaContent loadQa(long toolContentID) throws QaApplicationException { try { - return qaDAO.loadQaById(toolContentId); + return qaDAO.loadQaById(toolContentID); } catch (DataAccessException e) { @@ -1019,7 +1019,7 @@ * default content (or author created content) already goes. * ToolContentManager CONTRACT * - * similar to public void removeToolContent(Long toolContentId) + * similar to public void removeToolContent(Long toolContentID) * gets called by Container+Flash * */ @@ -1187,16 +1187,16 @@ } - public void unsetAsDefineLater(Long toolContentId) throws QaApplicationException + public void unsetAsDefineLater(Long toolContentID) throws QaApplicationException { - logger.debug("request for unsetAsDefineLater with toolContentId: " + toolContentId); - if (toolContentId == null) + logger.debug("request for unsetAsDefineLater with toolContentID: " + toolContentID); + if (toolContentID == null) { - logger.debug("WARNING!: retrieved toolContentId is null."); + logger.debug("WARNING!: retrieved toolContentID is null."); throw new QaApplicationException("Fail to setAsDefineLater" - + " based on null toolContentId."); + + " based on null toolContentID."); } - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); if (qaContent == null) { logger.debug("WARNING!!!: retrieved qaContent is null."); @@ -1210,20 +1210,20 @@ /** - * setAsDefineLater(Long toolContentId) throws DataMissingException, ToolException + * setAsDefineLater(Long toolContentID) throws DataMissingException, ToolException * - * @param toolContentId + * @param toolContentID * return void */ - public void setAsDefineLater(Long toolContentId) throws DataMissingException, ToolException + public void setAsDefineLater(Long toolContentID) throws DataMissingException, ToolException { - logger.debug("request for setAsDefineLater with toolContentId: " + toolContentId); - if (toolContentId == null) + logger.debug("request for setAsDefineLater with toolContentID: " + toolContentID); + if (toolContentID == null) { - logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentId is null."); - throw new DataMissingException("toolContentId is missing"); + logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentID is null."); + throw new DataMissingException("toolContentID is missing"); } - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); if (qaContent == null) { logger.debug("throwing DataMissingException: WARNING!: retrieved qaContent is null."); @@ -1235,21 +1235,21 @@ } /** - * setAsRunOffline(Long toolContentId) throws DataMissingException, ToolException + * setAsRunOffline(Long toolContentID) throws DataMissingException, ToolException * set the runOffline to true on this content * - * @param toolContentId + * @param toolContentID * return void */ - public void setAsRunOffline(Long toolContentId) throws DataMissingException, ToolException + public void setAsRunOffline(Long toolContentID) throws DataMissingException, ToolException { - logger.debug("request for setAsRunOffline with toolContentId:" + toolContentId); - if (toolContentId == null) + logger.debug("request for setAsRunOffline with toolContentID:" + toolContentID); + if (toolContentID == null) { - logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentId is null."); - throw new DataMissingException("toolContentId is missing"); + logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentID is null."); + throw new DataMissingException("toolContentID is missing"); } - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); if (qaContent == null) { logger.debug("throwing DataMissingException: WARNING!: retrieved qaContent is null."); @@ -1263,18 +1263,18 @@ /** * - * removeToolContent(Long toolContentId) + * removeToolContent(Long toolContentID) * gets automatically called only in monitoring mode when the author chooses to delete a lesson. * * The idea is to remove content + its relevant sessions + in q/a tools's case the question's content from the db. * ToolContentManager CONTRACT * this gets called automatically by Flash when a deletion is detected in the tool interface. */ - public void removeToolContent(Long toolContentId) + public void removeToolContent(Long toolContentID) { - logger.debug("start of removeToolContent with toolContentId: " + toolContentId); + logger.debug("start of removeToolContent with toolContentID: " + toolContentID); - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); logger.debug("retrieving qaContent: " + qaContent); if (qaContent != null) @@ -1302,16 +1302,16 @@ } } - logger.debug("removed all existing responses of toolContent with toolContentId:" + - toolContentId); - qaDAO.removeQa(toolContentId); + logger.debug("removed all existing responses of toolContent with toolContentID:" + + toolContentID); + qaDAO.removeQa(toolContentID); logger.debug("removed qaContent:" + qaContent); } } - public void removeQuestions(Long toolContentId) throws QaApplicationException + public void removeQuestions(Long toolContentID) throws QaApplicationException { - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); qaContent.setQaQueContents(new TreeSet()); if (qaContent != null) @@ -1343,22 +1343,22 @@ /** - * removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException + * removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException * Will need an update on the core tool signature: reason : when qaContent is null throw an exception * */ - public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException + public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException { - logger.debug("start of: removeToolContent(Long toolContentId, boolean removeSessionData"); - logger.debug("start of removeToolContent with toolContentId: " + toolContentId + "removeSessionData: " + removeSessionData); + logger.debug("start of: removeToolContent(Long toolContentID, boolean removeSessionData"); + logger.debug("start of removeToolContent with toolContentID: " + toolContentID + "removeSessionData: " + removeSessionData); - if (toolContentId == null) + if (toolContentID == null) { - logger.debug("toolContentId is null"); - throw new ToolException("toolContentId is missing"); + logger.debug("toolContentID is null"); + throw new ToolException("toolContentID is missing"); } - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); logger.debug("retrieving qaContent: " + qaContent); if (qaContent != null) @@ -1392,15 +1392,15 @@ } } - logger.debug("removed all existing responses of toolContent with toolContentId:" + - toolContentId); - qaDAO.removeQa(toolContentId); + logger.debug("removed all existing responses of toolContent with toolContentID:" + + toolContentID); + qaDAO.removeQa(toolContentID); logger.debug("removed qaContent:" + qaContent); } else { logger.debug("Warning!!!, We should have not come here. qaContent is null."); - throw new ToolException("toolContentId is missing"); + throw new ToolException("toolContentID is missing"); } } @@ -1411,14 +1411,14 @@ * @throws ToolException if any other error occurs */ - public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException { - QaContent toolContentObj = qaDAO.getQaById(toolContentId); + public void exportToolContent(Long toolContentID, String rootPath) throws DataMissingException, ToolException { + QaContent toolContentObj = qaDAO.getQaById(toolContentID); if(toolContentObj == null) - throw new DataMissingException("Unable to find tool content by given id :" + toolContentId); + throw new DataMissingException("Unable to find tool content by given id :" + toolContentID); try { //set ToolContentHandler as null to avoid copy file node in repository again. - toolContentObj = QaContent.newInstance(null,toolContentObj,toolContentId); + toolContentObj = QaContent.newInstance(null,toolContentObj,toolContentID); //don't export following fields value toolContentObj.setQaSessions(null); @@ -1435,7 +1435,7 @@ } exportContentService.registerFileClassForExport(QaUploadedFile.class.getName(),"uuid",null); - exportContentService.exportToolContent( toolContentId, toolContentObj,qaToolContentHandler, rootPath); + exportContentService.exportToolContent( toolContentID, toolContentObj,qaToolContentHandler, rootPath); } catch (ExportToolContentException e) { throw new ToolException(e); } catch (ItemNotFoundException e) { @@ -1450,7 +1450,7 @@ * for the content. * @throws ToolException if any other error occurs */ - public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath) throws ToolException { + public void importToolContent(Long toolContentID, Integer newUserUid, String toolContentPath) throws ToolException { try { exportContentService.registerFileClassForImport(QaUploadedFile.class.getName(),"uuid",null,"fileName","fileProperty",null,null); @@ -1459,8 +1459,8 @@ throw new ImportToolContentException("Import QA tool content failed. Deserialized object is " + toolPOJO); QaContent toolContentObj = (QaContent) toolPOJO; -// reset it to new toolContentId - toolContentObj.setQaContentId(toolContentId); +// reset it to new toolContentID + toolContentObj.setQaContentId(toolContentID); toolContentObj.setCreatedBy(newUserUid); //set back the tool content @@ -1504,16 +1504,16 @@ } /** - * createToolSession(Long toolSessionId,String toolSessionName, Long toolContentId) throws ToolException + * createToolSession(Long toolSessionId,String toolSessionName, Long toolContentID) throws ToolException * ToolSessionManager CONTRACT : creates a tool session with the incoming toolSessionId in the tool session table * * gets called only in the Learner mode. * All the learners in the same group have the same toolSessionId. * */ - public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException + public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentID) throws ToolException { - logger.debug("start of createToolSession with ids: " + toolSessionId + " and " + toolContentId); + logger.debug("start of createToolSession with ids: " + toolSessionId + " and " + toolContentID); logger.debug("toolSessionName: " + toolSessionName); if (toolSessionId == null) @@ -1523,26 +1523,26 @@ } long defaultContentId=0; - if (toolContentId == null) + if (toolContentID == null) { - logger.debug("toolContentId is null."); + logger.debug("toolContentID is null."); logger.debug("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE); try { defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE); - toolContentId=new Long(defaultContentId); - logger.debug("updated toolContentId to: " + toolContentId); + toolContentID=new Long(defaultContentId); + logger.debug("updated toolContentID to: " + toolContentID); } catch(Exception e) { logger.debug("default content id has not been setup for signature: " + MY_SIGNATURE); throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!"); } } - logger.debug("final toolSessionId and toolContentId: " + toolSessionId + " " + toolContentId); + logger.debug("final toolSessionId and toolContentID: " + toolSessionId + " " + toolContentID); - QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue()); logger.debug("retrieved qaContent: " + qaContent); if (qaContent == null) @@ -1553,16 +1553,16 @@ try { defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE); - toolContentId=new Long(defaultContentId); - logger.debug("updated toolContentId to: " + toolContentId); + toolContentID=new Long(defaultContentId); + logger.debug("updated toolContentID to: " + toolContentID); } catch(Exception e) { logger.debug("default content id has not been setup for signature: " + MY_SIGNATURE); throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!"); } - qaContent = qaDAO.loadQaById(toolContentId.longValue()); + qaContent = qaDAO.loadQaById(toolContentID.longValue()); } logger.debug("final - retrieved qaContent: " + qaContent); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -88,13 +88,10 @@ logger.debug("pre-delete map content: " + mapQuestionContent); logger.debug("questionIndex: " + questionIndex); - //String defLater=(String)request.getSession().getAttribute(ACTIVE_MODULE); - //logger.debug("defLater: " + defLater); - + // watch here and remove request.getSession().getAttribute(REMOVABLE_QUESTION_INDEX); String removableQuestionIndex=null; 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; @@ -114,7 +111,6 @@ logger.debug("returning mapQuestionContent:" + mapQuestionContent); return mapQuestionContent; - //request.getSession().setAttribute("mapQuestionContent", mapQuestionContent); } @@ -155,14 +151,6 @@ 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); @@ -175,7 +163,6 @@ String candidateQuestionEntry =request.getParameter("questionContent" + i); if (i==0) { - //request.getSession().setAttribute("defaultQuestionContent", candidateQuestionEntry); logger.debug("defaultQuestionContent set to: " + candidateQuestionEntry); } if ((candidateQuestionEntry != null) && (candidateQuestionEntry.length() > 0)) @@ -196,62 +183,32 @@ boolean isQuestionsSequenced=false; boolean isSynchInMonitor=false; boolean isUsernameVisible=false; - //String reportTitle = qaAuthoringForm.getReportTitle(); - //String richTextTitle = qaAuthoringForm.getTitle(); - 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); - 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 activeModule=request.getParameter("activeModule"); + String synchInMonitor=request.getParameter(SYNC_IN_MONITOR); + String usernameVisible=request.getParameter(USERNAME_VISIBLE); + String questionsSequenced=request.getParameter(QUESTIONS_SEQUENCED); + String reportTitle=request.getParameter(REPORT_TITLE); + String monitoringReportTitle=request.getParameter(MONITORING_REPORT_TITLE); + String endLearningMessage=request.getParameter(END_LEARNING_MESSAGE); + String richTextOfflineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + String richTextOnlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + String activeModule=request.getParameter(ACTIVE_MODULE); 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 questionsSequenced = qaAuthoringForm.getQuestionsSequenced(); - //logger.debug("questionsSequenced: " + questionsSequenced); - - //String synchInMonitor = qaAuthoringForm.getSynchInMonitor(); - //logger.debug("synchInMonitor: " + synchInMonitor); - - //String usernameVisible = qaAuthoringForm.getUsernameVisible(); - //logger.debug("usernameVisible: " + usernameVisible); - boolean setCommonContent=true; if ((questionsSequenced == null) || (synchInMonitor == null) || (usernameVisible == null)) { setCommonContent=false; } logger.debug("setCommonContent: " + setCommonContent); - //String activeModule=(String)request.getSession().getAttribute(ACTIVE_MODULE); - - boolean questionsSequencedBoolean=false; boolean synchInMonitorBoolean=false; boolean usernameVisibleBoolean=false; @@ -291,17 +248,6 @@ } } logger.debug("userId: " + userId); - - - //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); - - //QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue()); logger.debug("qaContent: " + qaContent); boolean newContent=false; @@ -325,7 +271,6 @@ if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent)) { logger.debug("setting other content values..."); - //qaContent.setUsernameVisible(isUsernameVisible); qaContent.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/ qaContent.setSynchInMonitor(isSynchInMonitor); qaContent.setOnlineInstructions(richTextOnlineInstructions); @@ -373,11 +318,8 @@ { logger.debug("removing unused entries... "); logger.debug("mapQuestionContent: " + mapQuestionContent); - - //String toolContentID=qaAuthoringForm.getToolContentId(); logger.debug("toolContentID: " + toolContentID); - QaContent qaContent=qaService.loadQa( new Long(toolContentID).longValue()); logger.debug("qaContent: " + qaContent); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== diff -u -r97ebe40dad2731256147d74073b541245be53871 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 97ebe40dad2731256147d74073b541245be53871) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -293,14 +293,14 @@ return userFeedback; } - public void setContentInUse(long toolContentId, IQaService qaService) + public void setContentInUse(long toolContentID, IQaService qaService) { - QaContent qaContent=qaService.loadQa(toolContentId); + QaContent qaContent=qaService.loadQa(toolContentID); logger.debug("retrieve qaContent: " + qaContent); qaContent.setContentLocked(true); - logger.debug("content with id : " + toolContentId + "has been marked LOCKED"); + logger.debug("content with id : " + toolContentID + "has been marked LOCKED"); qaService.updateQa(qaContent); - logger.debug("content with id : " + toolContentId + "has been marked LOCKED and updated in the db"); + logger.debug("content with id : " + toolContentID + "has been marked LOCKED and updated in the db"); } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java =================================================================== diff -u -r86a3e0e50e5bb605b4c9a062996ed1a752e422f9 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 86a3e0e50e5bb605b4c9a062996ed1a752e422f9) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -444,6 +444,7 @@ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); qaGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, qaGeneralAuthoringDTO, request); sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent); @@ -768,12 +769,6 @@ logger.debug("activeModule: " + activeModule); - String onlineInstructions=(String) sessionMap.get(ONLINE_INSTRUCTIONS_KEY); - logger.debug("onlineInstructions: " + onlineInstructions); - - String offlineInstructions=(String) sessionMap.get(OFFLINE_INSTRUCTIONS); - logger.debug("offlineInstructions: " + offlineInstructions); - String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); logger.debug("strToolContentID: " + strToolContentID); @@ -795,9 +790,6 @@ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm); logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); - - qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); - qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); qaGeneralAuthoringDTO.setSbmtSuccess( new Integer(0).toString()); @@ -817,7 +809,16 @@ qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + String onlineInstructions=(String) sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + String offlineInstructions=(String) sessionMap.get(OFFLINE_INSTRUCTIONS); + logger.debug("offlineInstructions: " + offlineInstructions); + + qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + String richTextTitle = (String)sessionMap.get(ACTIVITY_TITLE_KEY); String richTextInstructions = (String)sessionMap.get(ACTIVITY_INSTRUCTIONS_KEY); @@ -1270,12 +1271,6 @@ 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); @@ -1298,11 +1293,22 @@ QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm); logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + Map mapQuestionContent=qaAuthoringForm.getMapQuestionContent(); + logger.debug("mapQuestionContent: " + mapQuestionContent); + if ((mapQuestionContent != null) && (mapQuestionContent.size() > 0)) + { + String defaultQuestionContent = (String)mapQuestionContent.get("1"); + logger.debug("defaultQuestionContent: " + defaultQuestionContent); + qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent); + } + + /* determine whether the request is from Monitoring url Edit Activity*/ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER); logger.debug("sourceMcStarter: " + sourceMcStarter); + qaAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString()); qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); qaGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(false).toString()); @@ -1319,20 +1325,21 @@ QaUtils.setDefineLater(request, true, strToolContentID, qaService); - QaUtils.setFormProperties(request, qaService, qaContent, - qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + //QaUtils.setFormProperties(request, qaService, qaContent, + // qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); - + qaGeneralAuthoringDTO.setToolContentID(strToolContentID); - qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + //qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); qaGeneralAuthoringDTO.setActiveModule(activeModule); qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); qaAuthoringForm.setToolContentID(strToolContentID); - qaAuthoringForm.setHttpSessionID(httpSessionID); + //qaAuthoringForm.setHttpSessionID(httpSessionID); qaAuthoringForm.setActiveModule(activeModule); qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); qaAuthoringForm.setCurrentTab("1"); + logger.debug("before fwding to jsp, qaAuthoringForm: " + qaAuthoringForm); logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -23,9 +23,12 @@ package org.lamsfoundation.lams.tool.qa.web; /* ActionForm for the Authoring environment*/ +import java.util.Map; + import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.service.IQaService; /** * @author Ozgur Demirtas @@ -80,8 +83,12 @@ protected String edit; + protected String defineLaterInEditMode; protected String defaultContentIdStr; + protected Map mapQuestionContent; + protected IQaService qaService; + public void resetUserAction() { this.addContent=null; @@ -160,6 +167,7 @@ .append("usernameVisible: ", usernameVisible) .append("synchInMonitor: ", synchInMonitor) .append("questionsSequenced: ", questionsSequenced) + .append("defineLaterInEditMode: ", defineLaterInEditMode) .toString(); } @@ -597,4 +605,43 @@ this.defaultContentIdStr = defaultContentIdStr; } + /** + * @return Returns the qaService. + */ + public IQaService getQaService() { + return qaService; + } + /** + * @param qaService The qaService to set. + */ + public void setQaService(IQaService qaService) { + this.qaService = qaService; + } + + /** + * @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 defineLaterInEditMode. + */ + public String getDefineLaterInEditMode() { + return defineLaterInEditMode; + } + /** + * @param defineLaterInEditMode The defineLaterInEditMode to set. + */ + public void setDefineLaterInEditMode(String defineLaterInEditMode) { + this.defineLaterInEditMode = defineLaterInEditMode; + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java =================================================================== diff -u -r86a3e0e50e5bb605b4c9a062996ed1a752e422f9 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java (.../QaDLStarterAction.java) (revision 86a3e0e50e5bb605b4c9a062996ed1a752e422f9) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaDLStarterAction.java (.../QaDLStarterAction.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -105,9 +105,14 @@ QaUtils.cleanUpSessionAbsolute(request); logger.debug("init defineLater mode. removed attributes..."); + QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; + logger.debug("qaAuthoringForm: " + qaAuthoringForm); + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + qaAuthoringForm.setQaService(qaService); + QaStarterAction qaStarterAction= new QaStarterAction(); - return qaStarterAction.executeDefineLater(mapping, form, request, response, qaService); + return qaStarterAction.executeDefineLater(mapping, qaAuthoringForm, request, response, qaService); } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -301,7 +301,10 @@ ServletException { logger.debug("dispatching editActivity..."); + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + logger.debug("qaMonitoringForm: " + qaMonitoringForm); + IQaService qaService = (IQaService)request.getSession().getAttribute(TOOL_SERVICE); logger.debug("qaService: " + qaService); if (qaService == null) @@ -336,7 +339,9 @@ request.getSession().setAttribute(ACTIVITY_TITLE, qaContent.getTitle()); request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, qaContent.getInstructions()); - return qaStarterAction.executeDefineLater(mapping, form, request, response, qaService); + /* note that we are casting monitoring form subclass into Authoring form*/ + logger.debug("watch here: note that we are casting monitoring form subclass into Authoring form"); + return qaStarterAction.executeDefineLater(mapping, qaMonitoringForm, request, response, qaService); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -186,9 +186,19 @@ qaAuthoringForm.resetRadioBoxes(); - IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext()); + IQaService qaService =null; + if ((getServlet() == null) || (getServlet().getServletContext() == null)) + { + logger.debug("obtaining qaService from the form"); + qaService=qaAuthoringForm.getQaService(); + } + else + { + logger.debug("obtaining qaService via proxy"); + qaService =QaServiceProxy.getQaService(getServlet().getServletContext()); + } logger.debug("qaService: " + qaService); - + qaGeneralAuthoringDTO.setCurrentTab("1"); logger.debug("setting currrent tab to 1:"); @@ -357,9 +367,6 @@ String destination=QaUtils.getDestination(sourceMcStarter, requestedModule); logger.debug("destination: " + destination); - - logger.debug("setting form properties: " + qaContent); - Map mapQuestionContentLocal=qaGeneralAuthoringDTO.getMapQuestionContent(); logger.debug("mapQuestionContentLocal: " + mapQuestionContentLocal); @@ -368,6 +375,7 @@ logger.debug("persisting sessionMap into session: " + sessionMap); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + logger.debug("before fwding to jsp, qaAuthoringForm : " + qaAuthoringForm); logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); @@ -609,12 +617,11 @@ * @throws ServletException * @throws QaApplicationException */ - public ActionForward executeDefineLater(ActionMapping mapping, ActionForm form, + public ActionForward executeDefineLater(ActionMapping mapping, QaAuthoringForm qaAuthoringForm, HttpServletRequest request, HttpServletResponse response, IQaService qaService) throws IOException, ServletException, QaApplicationException { - logger.debug("passed qaService: " + qaService); logger.debug("calling execute..., qaService will be needed next."); - return execute(mapping, form, request, response); + return execute(mapping, qaAuthoringForm, request, response); } Index: lams_tool_laqa/web/WEB-INF/struts-config.xml =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -252,7 +252,7 @@ path="/defineLaterStarter" type="org.lamsfoundation.lams.tool.qa.web.QaDLStarterAction" name="QaAuthoringForm" - scope="session" + scope="request" input="/index.jsp"> + Index: lams_tool_laqa/web/authoring/BasicContent.jsp =================================================================== diff -u -r2327711a9c21985a1a82c5f470c05152bba8d741 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 2327711a9c21985a1a82c5f470c05152bba8d741) +++ lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -99,7 +99,7 @@ - + Index: lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp =================================================================== diff -u -r86a3e0e50e5bb605b4c9a062996ed1a752e422f9 -r0fb4d41712e31bd525abb02f100373875b1c7fc6 --- lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp (.../BasicContentViewOnly.jsp) (revision 86a3e0e50e5bb605b4c9a062996ed1a752e422f9) +++ lams_tool_laqa/web/authoring/BasicContentViewOnly.jsp (.../BasicContentViewOnly.jsp) (revision 0fb4d41712e31bd525abb02f100373875b1c7fc6) @@ -57,7 +57,7 @@ - : + :