Fisheye: Tag 1.1.2.3 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/AnswerDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java,v diff -u -r1.112.2.10 -r1.112.2.11 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java 19 May 2017 23:54:36 -0000 1.112.2.10 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java 26 May 2017 19:36:23 -0000 1.112.2.11 @@ -27,7 +27,7 @@ */ public interface McAppConstants { - public static final String MY_SIGNATURE = "lamc11"; + public static final String TOOL_SIGNATURE = "lamc11"; /* * Struts level constants @@ -37,12 +37,10 @@ public static final String LOAD_LEARNER = "loadLearner"; public static final String LOAD_MONITORING_CONTENT = "loadMonitoring"; public static final String ERROR_LIST = "errorList"; - public static final String LIST_QUESTION_DTOS = "listQuestionContentDTO"; + public static final String QUESTION_DTOS = "questionDtos"; public static final String LIST_DELETED_QUESTION_DTOS = "deletedQuestionDTOs"; - public static final String MC_GENERAL_AUTHORING_DTO = "mcGeneralAuthoringDTO"; - public static final String CURRENT_EDITABLE_QUESTION_INDEX = "currentEditableQuestionIndex"; public static final String MC_GENERAL_MONITORING_DTO = "mcGeneralMonitoringDTO"; - public static final String NEW_QUESTION_DTO = "newQuestionDTO"; + public static final String QUESTION_DTO = "questionDto"; public static final String REFLECTION_SUBJECT = "reflectionSubject"; public static final String REFLECTIONS_CONTAINER_DTO = "reflectionsContainerDTO"; @@ -85,7 +83,6 @@ /* learner mode contants */ public static final String LEARNER_ANSWERS_DTO_LIST = "learnerAnswersDTOList"; public static final String MC_GENERAL_LEARNER_FLOW_DTO = "mcGeneralLearnerFlowDTO"; - public static final String TOTAL_QUESTION_COUNT = "totalQuestionCount"; public static final String NOTEBOOK = "notebook"; public static final String ENTRY_TEXT = "entryText"; Fisheye: Tag 1.6.2.3 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McApplicationException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.6.2.4 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9.2.5 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralAuthoringDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.20.2.5 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralLearnerFlowDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9.2.5 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralMonitoringDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.4 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McOptionDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.5 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQuestionDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4.2.3 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSessionMarkDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.7.2.3 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.11.2.3 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUserMarkDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3.2.3 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/ReflectionDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java,v diff -u -r1.24.2.3 -r1.24.2.4 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java 11 May 2016 07:36:12 -0000 1.24.2.3 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java 26 May 2017 19:36:24 -0000 1.24.2.4 @@ -24,7 +24,7 @@ import java.util.List; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; /** Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java,v diff -u -r1.18.2.3 -r1.18.2.4 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java 11 May 2016 07:36:12 -0000 1.18.2.3 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java 26 May 2017 19:36:24 -0000 1.18.2.4 @@ -24,7 +24,7 @@ import java.util.List; -import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; +import org.lamsfoundation.lams.tool.mc.dto.McUserMarkDTO; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; /** Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java,v diff -u -r1.28.2.5 -r1.28.2.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java 11 May 2016 07:36:14 -0000 1.28.2.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java 26 May 2017 19:36:23 -0000 1.28.2.6 @@ -27,8 +27,8 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.dao.hibernate.LAMSBaseDAO; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; import org.lamsfoundation.lams.tool.mc.dao.IMcOptionsContentDAO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.springframework.stereotype.Repository; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java,v diff -u -r1.24.2.5 -r1.24.2.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java 11 May 2016 07:36:14 -0000 1.24.2.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java 26 May 2017 19:36:23 -0000 1.24.2.6 @@ -28,8 +28,8 @@ import org.hibernate.FlushMode; import org.hibernate.Query; import org.lamsfoundation.lams.dao.hibernate.LAMSBaseDAO; -import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; import org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO; +import org.lamsfoundation.lams.tool.mc.dto.McUserMarkDTO; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; import org.springframework.stereotype.Repository; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/AnswerDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/McGeneralLearnerFlowDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/McGeneralMonitoringDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/McOptionDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/McQuestionDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/McSessionMarkDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/McUserMarkDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dto/ReflectionDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java,v diff -u -r1.77.2.12 -r1.77.2.13 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 19 May 2017 23:54:35 -0000 1.77.2.12 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 26 May 2017 19:36:22 -0000 1.77.2.13 @@ -31,13 +31,12 @@ import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; -import org.lamsfoundation.lams.tool.mc.AnswerDTO; -import org.lamsfoundation.lams.tool.mc.McApplicationException; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; -import org.lamsfoundation.lams.tool.mc.McQuestionDTO; -import org.lamsfoundation.lams.tool.mc.McSessionMarkDTO; -import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; -import org.lamsfoundation.lams.tool.mc.ReflectionDTO; +import org.lamsfoundation.lams.tool.mc.dto.AnswerDTO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McQuestionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McSessionMarkDTO; +import org.lamsfoundation.lams.tool.mc.dto.McUserMarkDTO; +import org.lamsfoundation.lams.tool.mc.dto.ReflectionDTO; import org.lamsfoundation.lams.tool.mc.dto.ToolOutputDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McApplicationException.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java,v diff -u -r1.128.2.20 -r1.128.2.21 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 4 Apr 2017 12:26:45 -0000 1.128.2.20 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 26 May 2017 19:36:22 -0000 1.128.2.21 @@ -73,21 +73,19 @@ import org.lamsfoundation.lams.tool.ToolSessionManager; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; -import org.lamsfoundation.lams.tool.mc.AnswerDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McApplicationException; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; -import org.lamsfoundation.lams.tool.mc.McQuestionDTO; -import org.lamsfoundation.lams.tool.mc.McSessionMarkDTO; -import org.lamsfoundation.lams.tool.mc.McStringComparator; -import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; -import org.lamsfoundation.lams.tool.mc.ReflectionDTO; import org.lamsfoundation.lams.tool.mc.dao.IMcContentDAO; import org.lamsfoundation.lams.tool.mc.dao.IMcOptionsContentDAO; import org.lamsfoundation.lams.tool.mc.dao.IMcQueContentDAO; import org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO; import org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO; import org.lamsfoundation.lams.tool.mc.dao.IMcUsrAttemptDAO; +import org.lamsfoundation.lams.tool.mc.dto.AnswerDTO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McQuestionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McSessionMarkDTO; +import org.lamsfoundation.lams.tool.mc.dto.McUserMarkDTO; +import org.lamsfoundation.lams.tool.mc.dto.ReflectionDTO; import org.lamsfoundation.lams.tool.mc.dto.ToolOutputDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; @@ -96,6 +94,7 @@ import org.lamsfoundation.lams.tool.mc.pojos.McSession; import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt; import org.lamsfoundation.lams.tool.mc.util.McSessionComparator; +import org.lamsfoundation.lams.tool.mc.util.McStringComparator; import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -323,7 +322,7 @@ } // persist candidate answers - List optionDTOs = questionDTO.getListCandidateAnswersDTO(); + List optionDTOs = questionDTO.getOptionDtos(); Set oldOptions = question.getMcOptionsContents(); Set newOptions = new HashSet(); int displayOrderOption = 1; @@ -792,7 +791,7 @@ gradebookService.updateActivityMark(new Double(totalMark), null, userId, toolSessionId, false); // record mark change with audit service - auditService.logMarkChange(McAppConstants.MY_SIGNATURE, userAttempt.getMcQueUsr().getQueUsrId(), + auditService.logMarkChange(McAppConstants.TOOL_SIGNATURE, userAttempt.getMcQueUsr().getQueUsrId(), userAttempt.getMcQueUsr().getUsername(), "" + oldMark, "" + totalMark); } @@ -824,7 +823,7 @@ // options are different Set oldOptions = oldQuestion.getMcOptionsContents(); - List optionDTOs = questionDTO.getListCandidateAnswersDTO(); + List optionDTOs = questionDTO.getOptionDtos(); for (McOptsContent oldOption : oldOptions) { for (McOptionDTO optionDTO : optionDTOs) { if (oldOption.getUid().equals(optionDTO.getUid())) { @@ -1233,7 +1232,7 @@ if (fromContentId == null) { McServicePOJO.logger.warn("fromContentId is null."); - long defaultContentId = getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE); + long defaultContentId = getToolDefaultContentIdBySignature(McAppConstants.TOOL_SIGNATURE); fromContentId = new Long(defaultContentId); } @@ -1246,7 +1245,7 @@ if (fromContent == null) { McServicePOJO.logger.warn("fromContent is null."); - long defaultContentId = getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE); + long defaultContentId = getToolDefaultContentIdBySignature(McAppConstants.TOOL_SIGNATURE); fromContent = mcContentDAO.findMcContentById(defaultContentId); } @@ -1270,7 +1269,7 @@ for (McSession session : (Set) mcContent.getMcSessions()) { List entries = coreNotebookService.getEntry(session.getMcSessionId(), - CoreNotebookConstants.NOTEBOOK_TOOL, McAppConstants.MY_SIGNATURE); + CoreNotebookConstants.NOTEBOOK_TOOL, McAppConstants.TOOL_SIGNATURE); for (NotebookEntry entry : entries) { coreNotebookService.deleteEntry(entry); } @@ -1305,7 +1304,7 @@ mcUsrAttemptDAO.removeAllUserAttempts(user.getUid()); NotebookEntry entry = getEntry(session.getMcSessionId(), CoreNotebookConstants.NOTEBOOK_TOOL, - McAppConstants.MY_SIGNATURE, userId); + McAppConstants.TOOL_SIGNATURE, userId); if (entry != null) { mcContentDAO.delete(entry); } @@ -1326,7 +1325,7 @@ public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException { McContent toolContentObj = mcContentDAO.findMcContentById(toolContentId); if (toolContentObj == null) { - long defaultContentId = getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE); + long defaultContentId = getToolDefaultContentIdBySignature(McAppConstants.TOOL_SIGNATURE); toolContentObj = mcContentDAO.findMcContentById(defaultContentId); } if (toolContentObj == null) { @@ -1372,7 +1371,7 @@ throws ToolException { McContent content = getMcContent(toolContentId); if (content == null) { - long defaultToolContentId = getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE); + long defaultToolContentId = getToolDefaultContentIdBySignature(McAppConstants.TOOL_SIGNATURE); content = getMcContent(defaultToolContentId); } return mcOutputFactory.getToolOutputDefinitions(content, definitionType); @@ -1694,7 +1693,7 @@ for (McQueUsr user : (Set) mcSession.getMcQueUsers()) { NotebookEntry notebookEntry = this.getEntry(mcSession.getMcSessionId(), - CoreNotebookConstants.NOTEBOOK_TOOL, McAppConstants.MY_SIGNATURE, + CoreNotebookConstants.NOTEBOOK_TOOL, McAppConstants.TOOL_SIGNATURE, new Integer(user.getQueUsrId().toString())); if (notebookEntry != null) { @@ -1717,7 +1716,7 @@ McQueUsr user = (McQueUsr) userIter.next(); if (user.getQueUsrId().equals(userID)) { NotebookEntry notebookEntry = this.getEntry(mcSession.getMcSessionId(), - CoreNotebookConstants.NOTEBOOK_TOOL, McAppConstants.MY_SIGNATURE, + CoreNotebookConstants.NOTEBOOK_TOOL, McAppConstants.TOOL_SIGNATURE, new Integer(user.getQueUsrId().toString())); if (notebookEntry != null) { Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/util/McComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/util/McStringComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java,v diff -u -r1.71.2.6 -r1.71.2.7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 23 May 2017 19:55:08 -0000 1.71.2.6 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 26 May 2017 19:36:23 -0000 1.71.2.7 @@ -37,13 +37,13 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McComparator; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; -import org.lamsfoundation.lams.tool.mc.McQuestionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McQuestionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; +import org.lamsfoundation.lams.tool.mc.util.McComparator; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -53,129 +53,13 @@ * * @author Ozgur Demirtas */ -public class AuthoringUtil implements McAppConstants { +public class AuthoringUtil { private static Logger logger = Logger.getLogger(AuthoringUtil.class.getName()); - public static List removeBlankOptions(List optionDtos) { - List newList = new LinkedList(); - - for (McOptionDTO optionDTO : optionDtos) { - String optionText = optionDTO.getCandidateAnswer(); - - if ((optionText != null) && (optionText.length() > 0)) { - newList.add(optionDTO); - } - } - - return newList; - } - /** - * swappes McQuestionDTO questions in the list - */ - public static List swapQuestions(List questionDTOs, String questionIndex, - String direction) { - - int intQuestionIndex = new Integer(questionIndex).intValue(); - int intOriginalQuestionIndex = intQuestionIndex; - - int replacedQuestionIndex = 0; - if (direction.equals("down")) { - replacedQuestionIndex = ++intQuestionIndex; - } else { - replacedQuestionIndex = --intQuestionIndex; - } - - McQuestionDTO mainQuestion = AuthoringUtil.getQuestionAtDisplayOrder(questionDTOs, intOriginalQuestionIndex); - - McQuestionDTO replacedQuestion = AuthoringUtil.getQuestionAtDisplayOrder(questionDTOs, replacedQuestionIndex); - - if ((mainQuestion == null) || (replacedQuestion == null)) { - return questionDTOs; - } - - List newQuestionDtos = new LinkedList(); - - int queIndex = 0; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - McQuestionDTO questionDto = iter.next(); - queIndex++; - McQuestionDTO tempQuestion = new McQuestionDTO(); - - if ((!questionDto.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) - && !questionDto.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { - // normal copy - tempQuestion = questionDto; - - } else if (questionDto.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) { - // move type 1 - tempQuestion = replacedQuestion; - - } else if (questionDto.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { - // move type 2 - tempQuestion = mainQuestion; - } - - newQuestionDtos.add(tempQuestion); - } - - return newQuestionDtos; - } - - /** - * swaps options in the list - */ - public static List swapOptions(List optionDtos, String optionIndex, String direction) { - - int intOptionIndex = new Integer(optionIndex).intValue(); - int intOriginalOptionIndex = intOptionIndex; - - int replacedOptionIndex = 0; - if (direction.equals("down")) { - replacedOptionIndex = ++intOptionIndex; - } else { - replacedOptionIndex = --intOptionIndex; - } - - McOptionDTO mainOption = AuthoringUtil.getOptionAtDisplayOrder(optionDtos, intOriginalOptionIndex); - - McOptionDTO replacedOption = AuthoringUtil.getOptionAtDisplayOrder(optionDtos, replacedOptionIndex); - - if ((mainOption == null) || (replacedOption == null)) { - return optionDtos; - } - - List newOptionDtos = new LinkedList(); - - int queIndex = 1; - for (McOptionDTO option : optionDtos) { - - McOptionDTO tempOption = new McOptionDTO(); - if ((!new Integer(queIndex).toString().equals(new Integer(intOriginalOptionIndex).toString())) - && !new Integer(queIndex).toString().equals(new Integer(replacedOptionIndex).toString())) { - // normal copy - tempOption = option; - } else if (new Integer(queIndex).toString().equals(new Integer(intOriginalOptionIndex).toString())) { - // move type 1 - tempOption = replacedOption; - } else if (new Integer(queIndex).toString().equals(new Integer(replacedOptionIndex).toString())) { - // move type 2 - tempOption = mainOption; - } - - newOptionDtos.add(tempOption); - queIndex++; - } - - return newOptionDtos; - } - - /** * returns McQuestionDTO in the specified order of the list */ public static McQuestionDTO getQuestionAtDisplayOrder(List questionDTOs, int intOriginalQuestionIndex) { - Iterator iter = questionDTOs.iterator(); while (iter.hasNext()) { McQuestionDTO questionDto = (McQuestionDTO) iter.next(); @@ -191,7 +75,6 @@ * extractCandidateAtOrder */ public static McOptionDTO getOptionAtDisplayOrder(List options, int intOriginalCandidateIndex) { - int counter = 0; Iterator iter = options.iterator(); while (iter.hasNext()) { @@ -205,106 +88,7 @@ return null; } - public static int getTotalMark(List questionDTOs) { - - Iterator iter = questionDTOs.iterator(); - int totalMark = 0; - while (iter.hasNext()) { - McQuestionDTO questionDto = iter.next(); - - String mark = questionDto.getMark(); - - if (StringUtils.isNotBlank(mark)) { - int intMark = new Integer(mark).intValue(); - totalMark += intMark; - } - } - - return totalMark; - } - /** - * reorderSimpleListQuestionContentDTO - */ - public static List reorderSimpleQuestionDtos(List questionDTOs) { - List listFinalQuestionContentDTO = new LinkedList(); - - int queIndex = 0; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - McQuestionDTO questionDto = iter.next(); - - String question = questionDto.getQuestion(); - - String feedback = questionDto.getFeedback(); - - List optionDtos = questionDto.getListCandidateAnswersDTO(); - - String mark = questionDto.getMark(); - - if ((question != null) && (!question.equals(""))) { - ++queIndex; - - questionDto.setQuestion(question); - questionDto.setDisplayOrder(new Integer(queIndex).toString()); - questionDto.setFeedback(feedback); - questionDto.setListCandidateAnswersDTO(optionDtos); - questionDto.setMark(mark); - listFinalQuestionContentDTO.add(questionDto); - } - } - - return listFinalQuestionContentDTO; - } - - /** - * reorderUpdateListQuestionContentDTO - */ - public static List reorderUpdateQuestionDtos(List questionDTOs, McQuestionDTO mcQuestionContentDTONew, - String editableQuestionIndex) { - - List listFinalQuestionContentDTO = new LinkedList(); - - int queIndex = 0; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - McQuestionDTO questionDto = (McQuestionDTO) iter.next(); - - ++queIndex; - String question = questionDto.getQuestion(); - - String displayOrder = questionDto.getDisplayOrder(); - - String feedback = questionDto.getFeedback(); - - String mark = questionDto.getMark(); - - List optionDtos = questionDto.getListCandidateAnswersDTO(); - - if (displayOrder.equals(editableQuestionIndex)) { - questionDto.setQuestion(mcQuestionContentDTONew.getQuestion()); - questionDto.setDisplayOrder(mcQuestionContentDTONew.getDisplayOrder()); - questionDto.setFeedback(mcQuestionContentDTONew.getFeedback()); - questionDto.setMark(mcQuestionContentDTONew.getMark()); - questionDto.setListCandidateAnswersDTO(mcQuestionContentDTONew.getListCandidateAnswersDTO()); - - listFinalQuestionContentDTO.add(questionDto); - } else { - questionDto.setQuestion(question); - questionDto.setDisplayOrder(displayOrder); - questionDto.setFeedback(feedback); - questionDto.setMark(mark); - questionDto.setListCandidateAnswersDTO(optionDtos); - listFinalQuestionContentDTO.add(questionDto); - - } - - } - - return listFinalQuestionContentDTO; - } - - /** * verifies that there are no duplicate questions */ public static boolean checkDuplicateQuestions(List questionDTOs, String newQuestion) { @@ -437,6 +221,16 @@ mcContent.setReflect(reflectBoolean); mcContent.setReflectionSubject(reflectionSubject); + + //calculate total mark + int totalMark = 0; + for (McQuestionDTO questionDto: questionDTOs) { + String mark = questionDto.getMark(); + if (StringUtils.isNotBlank(mark)) { + int intMark = new Integer(mark).intValue(); + totalMark += intMark; + } + } String passmarkStr = request.getParameter("passmark"); //nullify passmark in case 'retries' option is OFF @@ -445,7 +239,6 @@ } //passmark can't be more than total mark Integer passmark = new Integer(passmarkStr); - int totalMark = AuthoringUtil.getTotalMark(questionDTOs); if (totalMark < passmark) { passmark = totalMark; } @@ -466,7 +259,7 @@ * generates a list for holding default questions and their candidate answers */ public static List buildDefaultQuestions(McContent mcContent) { - List questionDTOs = new LinkedList(); + List questionDtos = new LinkedList(); Long mapIndex = new Long(1); @@ -482,7 +275,7 @@ questionDto.setUid(question.getUid()); questionDto.setQuestion(questionText); - questionDto.setDisplayOrder(question.getDisplayOrder().toString()); + questionDto.setDisplayOrder(question.getDisplayOrder()); questionDto.setFeedback(feedback); questionDto.setMark(question.getMark().toString()); @@ -493,13 +286,12 @@ optionDtos.add(optionDTO); } - questionDto.setListCandidateAnswersDTO(optionDtos); + questionDto.setOptionDtos(optionDtos); + questionDtos.add(questionDto); - questionDTOs.add(questionDto); - mapIndex = new Long(mapIndex.longValue() + 1); } - return questionDTOs; + return questionDtos; } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java,v diff -u -r1.9.2.4 -r1.9.2.5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java 19 May 2017 23:54:36 -0000 1.9.2.4 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java 26 May 2017 19:36:23 -0000 1.9.2.5 @@ -26,7 +26,6 @@ import javax.servlet.http.HttpSession; -import org.lamsfoundation.lams.authoring.web.AuthoringConstants; import org.lamsfoundation.lams.authoring.web.LamsAuthoringFinishAction; import org.lamsfoundation.lams.tool.ToolAccessMode; @@ -37,7 +36,9 @@ @Override public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) { - session.removeAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG); + if (mode.isAuthor()) { + session.removeAttribute(customiseSessionID); + } } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java,v diff -u -r1.54.2.6 -r1.54.2.7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 19 May 2017 23:54:36 -0000 1.54.2.6 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 26 May 2017 19:36:23 -0000 1.54.2.7 @@ -28,18 +28,18 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; -import org.lamsfoundation.lams.tool.mc.AnswerDTO; -import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McGeneralLearnerFlowDTO; +import org.lamsfoundation.lams.tool.mc.dto.AnswerDTO; +import org.lamsfoundation.lams.tool.mc.dto.McGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; +import org.lamsfoundation.lams.tool.mc.web.form.McLearningForm; /** * * Keeps all operations needed for Authoring mode. * * @author Ozgur Demirtas */ -public class LearningUtil implements McAppConstants { +public class LearningUtil { static Logger logger = Logger.getLogger(LearningUtil.class.getName()); public static void saveFormRequestData(HttpServletRequest request, McLearningForm mcLearningForm) { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java,v diff -u -r1.143.2.9 -r1.143.2.10 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 23 May 2017 19:55:08 -0000 1.143.2.9 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 26 May 2017 19:36:23 -0000 1.143.2.10 @@ -48,13 +48,13 @@ import org.lamsfoundation.lams.questions.QuestionParser; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; -import org.lamsfoundation.lams.tool.mc.McQuestionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McQuestionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.tool.mc.web.form.McAuthoringForm; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -65,7 +65,7 @@ * * @author Ozgur Demirtas */ -public class McAction extends LamsDispatchAction implements McAppConstants { +public class McAction extends LamsDispatchAction { private static Logger logger = Logger.getLogger(McAction.class.getName()); /** @@ -82,108 +82,292 @@ request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); String strToolContentID = (String) sessionMap.get(AttributeNames.PARAM_TOOL_CONTENT_ID); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - ActionMessages errors = new ActionMessages(); + List questionDTOs = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); + McContent mcContent = mcService.getMcContent(new Long(strToolContentID)); + ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); + List deletedQuestionDTOs = (List) sessionMap + .get(McAppConstants.LIST_DELETED_QUESTION_DTOS); + if (questionDTOs.isEmpty()) { + ActionMessages errors = new ActionMessages(); ActionMessage error = new ActionMessage("questions.none.submitted"); errors.add(ActionMessages.GLOBAL_MESSAGE, error); saveErrors(request, errors); McAction.logger.debug("errors saved: " + errors); + return mapping.findForward(McAppConstants.LOAD_AUTHORING); } - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); + // in case request is from monitoring module - prepare for recalculate User Answers + if (mode.isTeacher()) { + Set oldQuestions = mcContent.getMcQueContents(); + mcService.releaseQuestionsFromCache(mcContent); + mcService.setDefineLater(strToolContentID, false); - String richTextTitle = request.getParameter(McAppConstants.TITLE); + // audit log the teacher has started editing activity in monitor + mcService.auditLogStartEditingActivityInMonitor(new Long(strToolContentID)); - mcAuthoringForm.setTitle(richTextTitle); + // recalculate User Answers + mcService.recalculateUserAnswers(mcContent, oldQuestions, questionDTOs, deletedQuestionDTOs); + } - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + // remove deleted questions + for (McQuestionDTO deletedQuestionDTO : deletedQuestionDTOs) { + McQueContent removeableQuestion = mcService.getQuestionByUid(deletedQuestionDTO.getUid()); + if (removeableQuestion != null) { + // Set attempts = removeableQuestion.getMcUsrAttempts(); + // Iterator iter = attempts.iterator(); + // while (iter.hasNext()) { + // McUsrAttempt attempt = iter.next(); + // iter.remove(); + // } + // mcService.updateQuestion(removeableQuestion); + mcContent.getMcQueContents().remove(removeableQuestion); + mcService.removeMcQueContent(removeableQuestion); + } + } - McContent mcContentTest = mcService.getMcContent(new Long(strToolContentID)); + // store content + mcContent = AuthoringUtil.saveOrUpdateMcContent(mcService, request, mcContent, strToolContentID, questionDTOs); - McContent mcContent = mcContentTest; - if (errors.isEmpty()) { + // store questions + mcContent = mcService.createQuestions(questionDTOs, mcContent); - ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); - request.setAttribute(AttributeNames.ATTR_MODE, mode.toString()); + if (mcContent != null) { + // sorts the questions by the display order + List sortedQuestions = mcService.getAllQuestionsSorted(mcContent.getUid().longValue()); + int displayOrder = 1; + for (McQueContent question : sortedQuestions) { + McQueContent existingQuestion = mcService.getQuestionByUid(question.getUid()); + existingQuestion.setDisplayOrder(new Integer(displayOrder)); + mcService.updateQuestion(existingQuestion); + displayOrder++; + } + } - List deletedQuestionDTOs = (List) sessionMap.get(LIST_DELETED_QUESTION_DTOS); + request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); + return mapping.findForward(McAppConstants.LOAD_AUTHORING); + } + + /** + * opens up an new screen within the current page for editing a question + */ + public ActionForward editQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapId); + request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); + List questionDtos = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); - // in case request is from monitoring module - prepare for recalculate User Answers - if (mode.isTeacher()) { - Set oldQuestions = mcContent.getMcQueContents(); - mcService.releaseQuestionsFromCache(mcContent); - mcService.setDefineLater(strToolContentID, false); + Integer questionIndex = WebUtil.readIntParam(request, "questionIndex", true); + + McQuestionDTO questionDto = null; + //editing existing question + if (questionIndex != null) { + mcAuthoringForm.setQuestionIndex("" + questionIndex); + + //find according questionDto + for (McQuestionDTO questionDtoIter : questionDtos) { + Integer displayOrder = questionDtoIter.getDisplayOrder(); - // audit log the teacher has started editing activity in monitor - mcService.auditLogStartEditingActivityInMonitor(new Long(strToolContentID)); - - // recalculate User Answers - mcService.recalculateUserAnswers(mcContent, oldQuestions, questionDTOs, deletedQuestionDTOs); - } - - // remove deleted questions - for (McQuestionDTO deletedQuestionDTO : deletedQuestionDTOs) { - McQueContent removeableQuestion = mcService.getQuestionByUid(deletedQuestionDTO.getUid()); - if (removeableQuestion != null) { -// Set attempts = removeableQuestion.getMcUsrAttempts(); -// Iterator iter = attempts.iterator(); -// while (iter.hasNext()) { -// McUsrAttempt attempt = iter.next(); -// iter.remove(); -// } -// mcService.updateQuestion(removeableQuestion); - mcContent.getMcQueContents().remove(removeableQuestion); - mcService.removeMcQueContent(removeableQuestion); + if ((displayOrder != null) && (!displayOrder.equals("")) && displayOrder.equals(questionIndex)) { + questionDto = questionDtoIter; + break; } } + + //adding new question + } else { + // prepare question for adding new question page + questionDto = new McQuestionDTO(); + List newOptions = new ArrayList(); + McOptionDTO newOption1 = new McOptionDTO(); + newOption1.setCorrect("Correct"); + McOptionDTO newOption2 = new McOptionDTO(); + newOptions.add(newOption1); + newOptions.add(newOption2); + questionDto.setOptionDtos(newOptions); + } + sessionMap.put(McAppConstants.QUESTION_DTO, questionDto); - //store content - mcContent = AuthoringUtil.saveOrUpdateMcContent(mcService, request, mcContentTest, strToolContentID, questionDTOs); + return (mapping.findForward("editQuestionBox")); + } - //store questions - mcContent = mcService.createQuestions(questionDTOs, mcContent); + /** + * removes a question from the questions map + */ + public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - if (mcContent != null) { - // sorts the questions by the display order - List sortedQuestions = mcService.getAllQuestionsSorted(mcContent.getUid().longValue()); - int displayOrder = 1; - for (McQueContent question : sortedQuestions) { - McQueContent existingQuestion = mcService.getQuestionByUid(question.getUid()); - existingQuestion.setDisplayOrder(new Integer(displayOrder)); - mcService.updateQuestion(existingQuestion); - displayOrder++; - } + String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapId); + request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); + + Integer questionIndexToDelete = WebUtil.readIntParam(request, "questionIndex"); + mcAuthoringForm.setQuestionIndex("" + questionIndexToDelete); + + List questionDTOs = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); + + //exclude Question with questionIndex From List + List tempQuestionDtos = new LinkedList(); + int queIndex = 0; + for (McQuestionDTO questionDTO : questionDTOs) { + + String questionText = questionDTO.getQuestion(); + Integer displayOrder = questionDTO.getDisplayOrder(); + if ((questionText != null) && (!questionText.isEmpty()) && !displayOrder.equals(questionIndexToDelete)) { + + ++queIndex; + questionDTO.setDisplayOrder(queIndex); + tempQuestionDtos.add(questionDTO); } + if ((questionText != null) && (!questionText.isEmpty()) && displayOrder.equals(questionIndexToDelete)) { + List deletedQuestionDTOs = (List) sessionMap + .get(McAppConstants.LIST_DELETED_QUESTION_DTOS); + deletedQuestionDTOs.add(questionDTO); + sessionMap.put(McAppConstants.LIST_DELETED_QUESTION_DTOS, deletedQuestionDTOs); + } + } + questionDTOs = tempQuestionDtos; + sessionMap.put(McAppConstants.QUESTION_DTOS, questionDTOs); - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); + return (mapping.findForward("itemList")); + } - request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); + /** + * moves a question down in the list + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward moveQuestionDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapId); + request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); + + String questionIndex = request.getParameter("questionIndex"); + mcAuthoringForm.setQuestionIndex(questionIndex); + + List questionDTOs = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); + questionDTOs = McAction.swapQuestions(questionDTOs, questionIndex, "down"); + questionDTOs = McAction.reorderQuestionDtos(questionDTOs); + sessionMap.put(McAppConstants.QUESTION_DTOS, questionDTOs); + + return (mapping.findForward("itemList")); + } + + public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapId); + request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); + + String questionIndex = request.getParameter("questionIndex"); + mcAuthoringForm.setQuestionIndex(questionIndex); + + List questionDTOs = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); + questionDTOs = McAction.swapQuestions(questionDTOs, questionIndex, "up"); + questionDTOs = McAction.reorderQuestionDtos(questionDTOs); + sessionMap.put(McAppConstants.QUESTION_DTOS, questionDTOs); + + return (mapping.findForward("itemList")); + } + + /* + * swappes McQuestionDTO questions in the list. Auxiliary method for moveQuestionDown() and moveQuestionUp() + */ + private static List swapQuestions(List questionDTOs, String questionIndex, + String direction) { + + int intQuestionIndex = new Integer(questionIndex).intValue(); + int intOriginalQuestionIndex = intQuestionIndex; + + int replacedQuestionIndex = 0; + if (direction.equals("down")) { + replacedQuestionIndex = ++intQuestionIndex; } else { - // errors is not empty + replacedQuestionIndex = --intQuestionIndex; + } - if (mcContent != null) { - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); + McQuestionDTO mainQuestion = AuthoringUtil.getQuestionAtDisplayOrder(questionDTOs, intOriginalQuestionIndex); + McQuestionDTO replacedQuestion = AuthoringUtil.getQuestionAtDisplayOrder(questionDTOs, replacedQuestionIndex); + if ((mainQuestion == null) || (replacedQuestion == null)) { + return questionDTOs; + } + + List questionDtos = new LinkedList(); + + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + McQuestionDTO questionDto = iter.next(); + McQuestionDTO tempQuestion = new McQuestionDTO(); + + if ((!questionDto.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) + && !questionDto.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { + // normal copy + tempQuestion = questionDto; + + } else if (questionDto.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) { + // move type 1 + tempQuestion = replacedQuestion; + + } else if (questionDto.getDisplayOrder().equals(new Integer(replacedQuestionIndex).toString())) { + // move type 2 + tempQuestion = mainQuestion; } + + questionDtos.add(tempQuestion); } - mcAuthoringForm.resetUserAction(); + return questionDtos; + } - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); + /* + *Auxiliary method for moveQuestionDown() and moveQuestionUp() + */ + private static List reorderQuestionDtos(List questionDTOs) { + List tempQuestionDtos = new LinkedList(); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + int queIndex = 0; + Iterator iter = questionDTOs.iterator(); + while (iter.hasNext()) { + McQuestionDTO questionDto = iter.next(); - mcAuthoringForm.setCurrentTab("1"); + String question = questionDto.getQuestion(); + String feedback = questionDto.getFeedback(); + String mark = questionDto.getMark(); - return mapping.findForward(McAppConstants.LOAD_AUTHORING); + List optionDtos = questionDto.getOptionDtos(); + if ((question != null) && (!question.equals(""))) { + ++queIndex; + + questionDto.setQuestion(question); + questionDto.setDisplayOrder(queIndex); + questionDto.setFeedback(feedback); + questionDto.setOptionDtos(optionDtos); + questionDto.setMark(mark); + tempQuestionDtos.add(questionDto); + } + } + + return tempQuestionDtos; } - public ActionForward saveSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, + public ActionForward saveQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; @@ -193,98 +377,80 @@ .getAttribute(sessionMapId); request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - boolean editQuestionBoxRequest = WebUtil.readBooleanParam(request, "editQuestionBoxRequest"); - String mark = request.getParameter("mark"); - String passmark = request.getParameter("passmark"); List options = McAction.repopulateOptionDTOs(request, false); - options = AuthoringUtil.removeBlankOptions(options); + + //remove blank options + List optionsWithoutEmptyOnes = new LinkedList(); + for (McOptionDTO optionDTO : options) { + String optionText = optionDTO.getCandidateAnswer(); + if ((optionText != null) && (optionText.length() > 0)) { + optionsWithoutEmptyOnes.add(optionDTO); + } + } + options = optionsWithoutEmptyOnes; - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); + List questionDTOs = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - mcGeneralAuthoringDTO.setMarkValue(mark); - mcGeneralAuthoringDTO.setPassMarkValue(passmark); - String newQuestion = request.getParameter("newQuestion"); String feedback = request.getParameter("feedback"); - String editableQuestionIndex = request.getParameter("editableQuestionIndex"); - mcAuthoringForm.setQuestionIndex(editableQuestionIndex); + Integer questionIndex = WebUtil.readIntParam(request, "questionIndex", true); + mcAuthoringForm.setQuestionIndex("" + questionIndex); if ((newQuestion != null) && (newQuestion.length() > 0)) { - if (!editQuestionBoxRequest) { - // request for add and save - boolean duplicates = AuthoringUtil.checkDuplicateQuestions(questionDTOs, newQuestion); + // adding new question + if (questionIndex == null) { + boolean duplicates = AuthoringUtil.checkDuplicateQuestions(questionDTOs, newQuestion); if (!duplicates) { - McQuestionDTO questionDTO = null; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - questionDTO = iter.next(); - - String displayOrder = questionDTO.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(editableQuestionIndex)) { - break; - } - + + //finding max displayOrder + int maxDisplayOrder = 1; + for (McQuestionDTO questionDTO : questionDTOs) { + int displayOrder = new Integer(questionDTO.getDisplayOrder()); + if (displayOrder > maxDisplayOrder) { + maxDisplayOrder = displayOrder; } } + McQuestionDTO questionDTO = new McQuestionDTO(); questionDTO.setQuestion(newQuestion); questionDTO.setFeedback(feedback); - questionDTO.setDisplayOrder(editableQuestionIndex); - questionDTO.setListCandidateAnswersDTO(options); + questionDTO.setDisplayOrder(maxDisplayOrder + 1); + questionDTO.setOptionDtos(options); questionDTO.setMark(mark); - questionDTOs = AuthoringUtil.reorderUpdateQuestionDtos(questionDTOs, questionDTO, - editableQuestionIndex); - // post reorderUpdateListQuestionContentDTO questionDTOs + questionDTOs.add(questionDTO); } else { // duplicate question entry, not adding } + + // updating existing question } else { - // request for edit and save - McQuestionDTO questionDTO = null; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - questionDTO = iter.next(); + McQuestionDTO questionDto = null; + for (McQuestionDTO questionDtoIter : questionDTOs) { + Integer displayOrder = questionDtoIter.getDisplayOrder(); - String displayOrder = questionDTO.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(editableQuestionIndex)) { - break; - } - + if ((displayOrder != null) && displayOrder.equals(questionIndex)) { + questionDto = questionDtoIter; + break; } } - questionDTO.setQuestion(newQuestion); - questionDTO.setFeedback(feedback); - questionDTO.setDisplayOrder(editableQuestionIndex); - questionDTO.setListCandidateAnswersDTO(options); - questionDTO.setMark(mark); - - questionDTOs = AuthoringUtil.reorderUpdateQuestionDtos(questionDTOs, questionDTO, - editableQuestionIndex); + questionDto.setQuestion(newQuestion); + questionDto.setFeedback(feedback); + questionDto.setDisplayOrder(questionIndex); + questionDto.setOptionDtos(options); + questionDto.setMark(mark); } } else { // entry blank, not adding } - mcGeneralAuthoringDTO.setMarkValue(mark); + request.setAttribute(McAppConstants.QUESTION_DTOS, questionDTOs); + sessionMap.put(McAppConstants.QUESTION_DTOS, questionDTOs); - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - return (mapping.findForward("itemList")); } @@ -294,17 +460,14 @@ @SuppressWarnings({ "unchecked", "rawtypes" }) public ActionForward saveQTI(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - // big part of code was taken from addSingleQuestion() and saveSingleQuestion() methods - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; + // big part of code was taken from addSingleQuestion() and saveQuestion() methods String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapId); request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); String contentFolderID = (String) sessionMap.get(AttributeNames.PARAM_CONTENT_FOLDER_ID); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); + List questionDtos = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); // proper parsing Question[] questions = QuestionParser.parseQuestionChoiceForm(request); @@ -319,7 +482,7 @@ questionText = QuestionParser.processHTMLField(questionText, false, contentFolderID, question.getResourcesFolderPath()); - if (AuthoringUtil.checkDuplicateQuestions(questionDTOs, questionText)) { + if (AuthoringUtil.checkDuplicateQuestions(questionDtos, questionText)) { LamsDispatchAction.log.warn("Skipping duplicate question: " + questionText); continue; } @@ -372,31 +535,22 @@ } McQuestionDTO questionDto = new McQuestionDTO(); - questionDto.setDisplayOrder(String.valueOf(questionDTOs.size() + 1)); + questionDto.setDisplayOrder(questionDtos.size() + 1); questionDto.setQuestion(questionText); questionDto.setFeedback(QuestionParser.processHTMLField(question.getFeedback(), true, null, null)); - questionDto.setListCandidateAnswersDTO(optionDtos); + questionDto.setOptionDtos(optionDtos); questionDto.setMark(correctAnswerScore.toString()); - questionDTOs.add(questionDto); + questionDtos.add(questionDto); if (LamsDispatchAction.log.isDebugEnabled()) { LamsDispatchAction.log.debug("Added question: " + questionText); } } - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); + sessionMap.put(McAppConstants.QUESTION_DTOS, questionDtos); - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - String richTextTitle = request.getParameter(McAppConstants.TITLE); - mcAuthoringForm.setTitle(richTextTitle); - mcAuthoringForm.setCurrentTab("1"); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - return mapping.findForward(McAppConstants.LOAD_AUTHORING); + return mapping.findForward("itemList"); } /** @@ -410,10 +564,10 @@ .getAttribute(sessionMapId); request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); + List questionDtos = (List) sessionMap.get(McAppConstants.QUESTION_DTOS); List questions = new LinkedList(); - for (McQuestionDTO mcQuestion : questionDTOs) { + for (McQuestionDTO mcQuestion : questionDtos) { Question question = new Question(); question.setType(Question.QUESTION_TYPE_MULTIPLE_CHOICE); @@ -422,7 +576,7 @@ question.setFeedback(mcQuestion.getFeedback()); List answers = new ArrayList(); - for (McOptionDTO mcAnswer : mcQuestion.getListCandidateAnswersDTO()) { + for (McOptionDTO mcAnswer : mcQuestion.getOptionDtos()) { Answer answer = new Answer(); answer.setText(mcAnswer.getCandidateAnswer()); answer.setScore( @@ -433,7 +587,7 @@ } // put the question in the right place - questions.add(Integer.parseInt(mcQuestion.getDisplayOrder()) - 1, question); + questions.add(mcQuestion.getDisplayOrder() - 1, question); } String title = request.getParameter("title"); @@ -443,767 +597,108 @@ return null; } - public ActionForward addSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, + public ActionForward moveCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapId); request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - McQuestionDTO newQuestionDTO = (McQuestionDTO) sessionMap.get(McAppConstants.NEW_QUESTION_DTO); - request.setAttribute(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - - int listSize = questionDTOs.size(); - - String newQuestionParam = request.getParameter("newQuestion"); - - String feedback = request.getParameter("feedback"); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - String passmark = request.getParameter("passmark"); - mcGeneralAuthoringDTO.setPassMarkValue(passmark); - - List optionDtos = McAction.repopulateOptionDTOs(request, false); - optionDtos = AuthoringUtil.removeBlankOptions(optionDtos); - - if ((newQuestionParam != null) && (newQuestionParam.length() > 0)) { - boolean duplicates = AuthoringUtil.checkDuplicateQuestions(questionDTOs, newQuestionParam); - - if (!duplicates) { - McQuestionDTO questionDto = new McQuestionDTO(); - questionDto.setDisplayOrder(new Long(listSize + 1).toString()); - questionDto.setFeedback(feedback); - questionDto.setQuestion(newQuestionParam); - questionDto.setMark(mark); - - questionDto.setListCandidateAnswersDTO(optionDtos); - - questionDTOs.add(questionDto); - } else { - // entry duplicate, not adding - } - } else { - // entry blank, not adding - } - - mcGeneralAuthoringDTO.setMarkValue(mark); - - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestionParam); - mcAuthoringForm.setFeedback(feedback); - - mcGeneralAuthoringDTO.setMarkValue(mark); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("itemList")); - } - - /** - * opens up an new screen within the current page for adding a new question - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward newQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - String richTextTitle = request.getParameter(McAppConstants.TITLE); - mcAuthoringForm.setTitle(richTextTitle); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - //prepare question for adding new question page - McQuestionDTO newQuestionDTO = new McQuestionDTO(); - List newOptions = new ArrayList(); - McOptionDTO newOption1 = new McOptionDTO(); - newOption1.setCorrect("Correct"); - McOptionDTO newOption2 = new McOptionDTO(); - newOptions.add(newOption1); - newOptions.add(newOption2); - newQuestionDTO.setListCandidateAnswersDTO(newOptions); - sessionMap.put(NEW_QUESTION_DTO, newQuestionDTO); - request.setAttribute(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - String newQuestionParam = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestionParam); - - String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - return (mapping.findForward("newQuestionBox")); - } - - /** - * opens up an new screen within the current page for editing a question - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward newEditableQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); - - request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); - - mcAuthoringForm.setEditableQuestionIndex(questionIndex); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - String editableQuestion = ""; - String editableFeedback = ""; - String editableMark = ""; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - McQuestionDTO questionDto = (McQuestionDTO) iter.next(); - String displayOrder = questionDto.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - editableFeedback = questionDto.getFeedback(); - editableQuestion = questionDto.getQuestion(); - editableMark = questionDto.getMark(); - - break; - } - } - } - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = (McGeneralAuthoringDTO) request - .getAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO); - - if (mcGeneralAuthoringDTO == null) { - mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - } - - mcGeneralAuthoringDTO.setMarkValue(editableMark); - - String richTextTitle = request.getParameter(McAppConstants.TITLE); - mcAuthoringForm.setTitle(richTextTitle); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - mcGeneralAuthoringDTO.setEditableQuestionText(editableQuestion); - mcGeneralAuthoringDTO.setEditableQuestionFeedback(editableFeedback); - mcAuthoringForm.setFeedback(editableFeedback); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - String requestNewEditableQuestionBox = (String) request.getAttribute("requestNewEditableQuestionBox"); - - String newQuestion = request.getParameter("newQuestion"); - String feedback = request.getParameter("feedback"); - if ((requestNewEditableQuestionBox != null) && requestNewEditableQuestionBox.equals("true")) { - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - mcGeneralAuthoringDTO.setEditableQuestionFeedback(feedback); - } - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - return (mapping.findForward("editQuestionBox")); - } - - /** - * removes a question from the questions map - */ - public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String questionIndexToDelete = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndexToDelete); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - //exclude Question with questionIndex From List - List listFinalQuestionContentDTO = new LinkedList(); - int queIndex = 0; - for (McQuestionDTO questionDTO : questionDTOs) { - - String questionText = questionDTO.getQuestion(); - String displayOrder = questionDTO.getDisplayOrder(); - if ((questionText != null) && (!questionText.isEmpty()) && !displayOrder.equals(questionIndexToDelete)) { - - ++queIndex; - questionDTO.setDisplayOrder(new Integer(queIndex).toString()); - listFinalQuestionContentDTO.add(questionDTO); - } - if ((questionText != null) && (!questionText.isEmpty()) && displayOrder.equals(questionIndexToDelete)) { - List deletedQuestionDTOs = (List) sessionMap - .get(LIST_DELETED_QUESTION_DTOS); - ; - deletedQuestionDTOs.add(questionDTO); - sessionMap.put(LIST_DELETED_QUESTION_DTOS, deletedQuestionDTOs); - } - } - questionDTOs = listFinalQuestionContentDTO; - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String richTextTitle = request.getParameter(McAppConstants.TITLE); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - mcAuthoringForm.setTitle(richTextTitle); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - mcAuthoringForm.setCurrentTab("1"); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("itemList")); - } - - /** - * moves a question down in the list - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward moveQuestionDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - - IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - questionDTOs = AuthoringUtil.swapQuestions(questionDTOs, questionIndex, "down"); - - questionDTOs = AuthoringUtil.reorderSimpleQuestionDtos(questionDTOs); - - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String richTextTitle = request.getParameter(McAppConstants.TITLE); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - mcAuthoringForm.setTitle(richTextTitle); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - mcAuthoringForm.setCurrentTab("1"); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - return (mapping.findForward("itemList")); - } - - public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - questionDTOs = AuthoringUtil.swapQuestions(questionDTOs, questionIndex, "up"); - - questionDTOs = AuthoringUtil.reorderSimpleQuestionDtos(questionDTOs); - - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String richTextTitle = request.getParameter(McAppConstants.TITLE); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - mcAuthoringForm.setTitle(richTextTitle); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - mcAuthoringForm.setCurrentTab("1"); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("itemList")); - } - - /** - * moves a candidate dwn in the list - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward moveCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String questionIndex = request.getParameter("questionIndex"); - request.setAttribute("questionIndex", questionIndex); - request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); - String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); List optionDtos = McAction.repopulateOptionDTOs(request, false); - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); + //moveAddedCandidateUp + McQuestionDTO questionDto = (McQuestionDTO) sessionMap.get(McAppConstants.QUESTION_DTO); + List listCandidates = new LinkedList(); + listCandidates = McAction.swapOptions(optionDtos, candidateIndex, "up"); + questionDto.setOptionDtos(listCandidates); + sessionMap.put(McAppConstants.QUESTION_DTO, questionDto); - List candidates = new LinkedList(); - List listCandidates = new LinkedList(); - String editableQuestion = ""; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - McQuestionDTO questionDto = (McQuestionDTO) iter.next(); - - String question = questionDto.getQuestion(); - String displayOrder = questionDto.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - editableQuestion = questionDto.getQuestion(); - - candidates = questionDto.getListCandidateAnswersDTO(); - // candidates found - // but we are using the repopulated optionDtos here - - listCandidates = AuthoringUtil.swapOptions(optionDtos, candidateIndex, "down"); - - questionDto.setListCandidateAnswersDTO(listCandidates); - - break; - } - - } - } - - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String newQuestion = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); return (mapping.findForward("candidateAnswersList")); } - /** - * moves a candidate up in the list - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward moveCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, + public ActionForward moveCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapId); request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - String questionIndex = request.getParameter("questionIndex"); - request.setAttribute("questionIndex", questionIndex); - request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); - String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); List optionDtos = McAction.repopulateOptionDTOs(request, false); - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); + //moveAddedCandidateDown + McQuestionDTO questionDto = (McQuestionDTO) sessionMap.get(McAppConstants.QUESTION_DTO); + List swapedOptions = new LinkedList(); + swapedOptions = McAction.swapOptions(optionDtos, candidateIndex, "down"); + questionDto.setOptionDtos(swapedOptions); + sessionMap.put(McAppConstants.QUESTION_DTO, questionDto); - List listCandidates = new LinkedList(); - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - McQuestionDTO questionDto = (McQuestionDTO) iter.next(); - - String displayOrder = questionDto.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - - listCandidates = AuthoringUtil.swapOptions(optionDtos, candidateIndex, "up"); - - questionDto.setListCandidateAnswersDTO(listCandidates); - - break; - } - - } - } - - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String newQuestion = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); return (mapping.findForward("candidateAnswersList")); } - - /** - * removes a candidate from the list - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException + + /* + * swaps options in the list */ - public ActionForward removeCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); + private static List swapOptions(List optionDtos, String optionIndex, String direction) { - String questionIndex = request.getParameter("questionIndex"); - request.setAttribute("questionIndex", questionIndex); - request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); + int intOptionIndex = new Integer(optionIndex).intValue(); + int intOriginalOptionIndex = intOptionIndex; - String optionIndexToRemove = request.getParameter("candidateIndex"); - request.setAttribute("candidateIndex", optionIndexToRemove); - - //find question - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - McQuestionDTO questionDto = null; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - questionDto = (McQuestionDTO) iter.next(); - String displayOrder = questionDto.getDisplayOrder(); - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - break; - } - } + int replacedOptionIndex = 0; + if (direction.equals("down")) { + replacedOptionIndex = ++intOptionIndex; + } else { + replacedOptionIndex = --intOptionIndex; } - //update options - List optionDtos = McAction.repopulateOptionDTOs(request, false); - List listFinalCandidatesDTO = new LinkedList(); - McOptionDTO mcOptionDTO = null; - Iterator listCaIterator = optionDtos.iterator(); - int caIndex = 0; - while (listCaIterator.hasNext()) { - caIndex++; - mcOptionDTO = (McOptionDTO) listCaIterator.next(); - if (caIndex != new Integer(optionIndexToRemove).intValue()) { - listFinalCandidatesDTO.add(mcOptionDTO); - } + McOptionDTO mainOption = AuthoringUtil.getOptionAtDisplayOrder(optionDtos, intOriginalOptionIndex); + McOptionDTO replacedOption = AuthoringUtil.getOptionAtDisplayOrder(optionDtos, replacedOptionIndex); + if ((mainOption == null) || (replacedOption == null)) { + return optionDtos; } - questionDto.setListCandidateAnswersDTO(listFinalCandidatesDTO); + List newOptionDtos = new LinkedList(); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); + int queIndex = 1; + for (McOptionDTO option : optionDtos) { - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String newQuestion = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - return (mapping.findForward("candidateAnswersList")); - } - - /** - * enables adding a new candidate answer - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward newCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String questionIndex = request.getParameter("questionIndex"); - request.setAttribute("questionIndex", questionIndex); - request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); - - String candidateIndex = request.getParameter("candidateIndex"); - request.setAttribute("candidateIndex", candidateIndex); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - List optionDtos = McAction.repopulateOptionDTOs(request, true); - - String newQuestion = request.getParameter("newQuestion"); - - String mark = request.getParameter("mark"); - - McQuestionDTO mcQuestionContentDTOLocal = null; - Iterator iter = questionDTOs.iterator(); - while (iter.hasNext()) { - mcQuestionContentDTOLocal = (McQuestionDTO) iter.next(); - - String question = mcQuestionContentDTOLocal.getQuestion(); - String displayOrder = mcQuestionContentDTOLocal.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - break; - } - + McOptionDTO tempOption = new McOptionDTO(); + if ((!new Integer(queIndex).toString().equals(new Integer(intOriginalOptionIndex).toString())) + && !new Integer(queIndex).toString().equals(new Integer(replacedOptionIndex).toString())) { + // normal copy + tempOption = option; + } else if (new Integer(queIndex).toString().equals(new Integer(intOriginalOptionIndex).toString())) { + // move type 1 + tempOption = replacedOption; + } else if (new Integer(queIndex).toString().equals(new Integer(replacedOptionIndex).toString())) { + // move type 2 + tempOption = mainOption; } - } - if (mcQuestionContentDTOLocal != null) { - mcQuestionContentDTOLocal.setListCandidateAnswersDTO(optionDtos); + newOptionDtos.add(tempOption); + queIndex++; } - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - return (mapping.findForward("candidateAnswersList")); + return newOptionDtos; } - public ActionForward moveAddedCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, + public ActionForward removeCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapId); request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - String candidateIndex = request.getParameter("candidateIndex"); - request.setAttribute("candidateIndex", candidateIndex); - - List optionDtos = McAction.repopulateOptionDTOs(request, false); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - //moveAddedCandidateUp - McQuestionDTO newQuestionDTO = (McQuestionDTO) sessionMap.get(McAppConstants.NEW_QUESTION_DTO); - List listCandidates = new LinkedList(); - listCandidates = AuthoringUtil.swapOptions(optionDtos, candidateIndex, "up"); - newQuestionDTO.setListCandidateAnswersDTO(listCandidates); - request.setAttribute(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - sessionMap.put(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String newQuestion = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("candidateAnswersAddList")); - - } - - public ActionForward moveAddedCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - - String candidateIndex = request.getParameter("candidateIndex"); - request.setAttribute("candidateIndex", candidateIndex); - - List optionDtos = McAction.repopulateOptionDTOs(request, false); - - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - //moveAddedCandidateDown - McQuestionDTO newQuestionDTO = (McQuestionDTO) sessionMap.get(McAppConstants.NEW_QUESTION_DTO); - List listCandidates = new LinkedList(); - listCandidates = AuthoringUtil.swapOptions(optionDtos, candidateIndex, "down"); - newQuestionDTO.setListCandidateAnswersDTO(listCandidates); - request.setAttribute(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - sessionMap.put(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String newQuestion = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("candidateAnswersAddList")); - } - - public ActionForward removeAddedCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(sessionMapId); - request.setAttribute(McAppConstants.ATTR_SESSION_MAP_ID, sessionMapId); - String candidateIndexToRemove = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndexToRemove); - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - // removeAddedCandidate - McQuestionDTO newQuestionDTO = (McQuestionDTO) sessionMap.get(McAppConstants.NEW_QUESTION_DTO); + McQuestionDTO questionDto = (McQuestionDTO) sessionMap.get(McAppConstants.QUESTION_DTO); List optionDtos = McAction.repopulateOptionDTOs(request, false); List listFinalCandidatesDTO = new LinkedList(); @@ -1216,31 +711,14 @@ } } - newQuestionDTO.setListCandidateAnswersDTO(listFinalCandidatesDTO); - request.setAttribute(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - sessionMap.put(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); + questionDto.setOptionDtos(listFinalCandidatesDTO); + sessionMap.put(McAppConstants.QUESTION_DTO, questionDto); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - String newQuestion = request.getParameter("newQuestion"); - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - - String mark = request.getParameter("mark"); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("candidateAnswersAddList")); + return (mapping.findForward("candidateAnswersList")); } - public ActionForward newAddedCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, + public ActionForward newCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; String sessionMapId = request.getParameter(McAppConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapId); @@ -1249,34 +727,14 @@ String candidateIndex = request.getParameter("candidateIndex"); request.setAttribute("candidateIndex", candidateIndex); - List questionDTOs = (List) sessionMap.get(McAppConstants.LIST_QUESTION_DTOS); - List optionDtos = McAction.repopulateOptionDTOs(request, true); - String newQuestion = request.getParameter("newQuestion"); - - String mark = request.getParameter("mark"); - //newAddedCandidateBox - McQuestionDTO newQuestionDTO = (McQuestionDTO) sessionMap.get(McAppConstants.NEW_QUESTION_DTO); - newQuestionDTO.setListCandidateAnswersDTO(optionDtos); - request.setAttribute(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - sessionMap.put(McAppConstants.NEW_QUESTION_DTO, newQuestionDTO); - sessionMap.put(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); + McQuestionDTO questionDto = (McQuestionDTO) sessionMap.get(McAppConstants.QUESTION_DTO); + questionDto.setOptionDtos(optionDtos); + sessionMap.put(McAppConstants.QUESTION_DTO, questionDto); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); - - setFormProperties(request, mcAuthoringForm, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_DTOS, questionDTOs); - - mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - mcGeneralAuthoringDTO.setMarkValue(mark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(questionDTOs.size())); - - return (mapping.findForward("candidateAnswersAddList")); + return (mapping.findForward("candidateAnswersList")); } /** @@ -1293,7 +751,6 @@ } List optionDtos = new LinkedList(); - for (int i = 0; i < McAppConstants.MAX_OPTION_COUNT; i++) { String optionText = request.getParameter("ca" + i); Long optionUid = WebUtil.readLongParam(request, "caUid" + i, true); @@ -1322,44 +779,5 @@ return optionDtos; } - - /** - * - */ - private static void setFormProperties(HttpServletRequest request, McAuthoringForm mcAuthoringForm, - McGeneralAuthoringDTO mcGeneralAuthoringDTO) { - String sln = request.getParameter("sln"); - mcAuthoringForm.setSln(sln); - mcGeneralAuthoringDTO.setSln(sln); - - String questionsSequenced = request.getParameter("questionsSequenced"); - mcAuthoringForm.setQuestionsSequenced(questionsSequenced); - mcGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced); - - String randomize = request.getParameter("randomize"); - mcAuthoringForm.setRandomize(randomize); - mcGeneralAuthoringDTO.setRandomize(randomize); - - String showMarks = request.getParameter("showMarks"); - mcAuthoringForm.setShowMarks(showMarks); - mcGeneralAuthoringDTO.setShowMarks(showMarks); - - String retries = request.getParameter("retries"); - mcAuthoringForm.setRetries(retries); - mcGeneralAuthoringDTO.setRetries(retries); - - String reflect = request.getParameter(REFLECT); - mcAuthoringForm.setReflect(reflect); - mcGeneralAuthoringDTO.setReflect(reflect); - - String reflectionSubject = request.getParameter(REFLECTION_SUBJECT); - mcAuthoringForm.setReflectionSubject(reflectionSubject); - mcGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); - - String passmark = request.getParameter("passmark"); - mcGeneralAuthoringDTO.setPassMarkValue(passmark); - mcAuthoringForm.setPassmark(passmark); - } - } Fisheye: Tag 1.47.2.4 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java,v diff -u -r1.82.2.8 -r1.82.2.9 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 19 May 2017 23:54:36 -0000 1.82.2.8 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 26 May 2017 19:36:23 -0000 1.82.2.9 @@ -46,10 +46,9 @@ import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; -import org.lamsfoundation.lams.tool.mc.AnswerDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McComparator; -import org.lamsfoundation.lams.tool.mc.McGeneralLearnerFlowDTO; +import org.lamsfoundation.lams.tool.mc.dto.AnswerDTO; +import org.lamsfoundation.lams.tool.mc.dto.McGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; @@ -58,6 +57,8 @@ import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.tool.mc.util.McComparator; +import org.lamsfoundation.lams.tool.mc.web.form.McLearningForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; @@ -68,7 +69,7 @@ /** * @author Ozgur Demirtas */ -public class McLearningAction extends LamsDispatchAction implements McAppConstants { +public class McLearningAction extends LamsDispatchAction { private static Logger logger = Logger.getLogger(McLearningAction.class.getName()); private static IMcService mcService; @@ -472,7 +473,7 @@ mcGeneralLearnerFlowDTO.setReflectionSubject(mcContent.getReflectionSubject()); NotebookEntry notebookEntry = mcService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, - McAppConstants.MY_SIGNATURE, new Integer(user.getQueUsrId().intValue())); + McAppConstants.TOOL_SIGNATURE, new Integer(user.getQueUsrId().intValue())); request.setAttribute("notebookEntry", notebookEntry); if (notebookEntry != null) { mcGeneralLearnerFlowDTO.setNotebookEntry(notebookEntry.getEntry()); @@ -609,14 +610,14 @@ String reflectionEntry = request.getParameter(McAppConstants.ENTRY_TEXT); NotebookEntry notebookEntry = mcService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, - McAppConstants.MY_SIGNATURE, userID.intValue()); + McAppConstants.TOOL_SIGNATURE, userID.intValue()); if (notebookEntry != null) { notebookEntry.setEntry(reflectionEntry); mcService.updateEntry(notebookEntry); } else { mcService.createNotebookEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, - McAppConstants.MY_SIGNATURE, userID.intValue(), reflectionEntry); + McAppConstants.TOOL_SIGNATURE, userID.intValue(), reflectionEntry); } return endLearning(mapping, form, request, response); @@ -655,7 +656,7 @@ // attempt getting notebookEntry NotebookEntry notebookEntry = mcService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, - McAppConstants.MY_SIGNATURE, userID.intValue()); + McAppConstants.TOOL_SIGNATURE, userID.intValue()); if (notebookEntry != null) { String notebookEntryPresentable = notebookEntry.getEntry(); Fisheye: Tag 1.31.2.7 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java,v diff -u -r1.89.2.7 -r1.89.2.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 19 May 2017 23:54:37 -0000 1.89.2.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 26 May 2017 19:36:23 -0000 1.89.2.8 @@ -46,15 +46,16 @@ import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; -import org.lamsfoundation.lams.tool.mc.AnswerDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McApplicationException; -import org.lamsfoundation.lams.tool.mc.McGeneralLearnerFlowDTO; +import org.lamsfoundation.lams.tool.mc.dto.AnswerDTO; +import org.lamsfoundation.lams.tool.mc.dto.McGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; import org.lamsfoundation.lams.tool.mc.pojos.McSession; import org.lamsfoundation.lams.tool.mc.service.IMcService; +import org.lamsfoundation.lams.tool.mc.service.McApplicationException; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.tool.mc.web.form.McLearningForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.WebUtil; @@ -68,7 +69,7 @@ * * @author Ozgur Demirtas */ -public class McLearningStarterAction extends Action implements McAppConstants { +public class McLearningStarterAction extends Action { private static Logger logger = Logger.getLogger(McLearningStarterAction.class.getName()); @@ -161,7 +162,7 @@ mcGeneralLearnerFlowDTO.setReflectionSubject(mcContent.getReflectionSubject()); NotebookEntry notebookEntry = mcService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL, - McAppConstants.MY_SIGNATURE, userID.intValue()); + McAppConstants.TOOL_SIGNATURE, userID.intValue()); if (notebookEntry != null) { // String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry()); @@ -191,11 +192,11 @@ Set groupUsers = mcSession.getMcQueUsers();// mcService.getUsersBySession(new // Long(toolSessionID).longValue()); - request.setAttribute(ATTR_GROUP_USERS, groupUsers); - request.setAttribute(TOOL_SESSION_ID, toolSessionID); - request.setAttribute(ATTR_CONTENT, mcContent); + request.setAttribute(McAppConstants.ATTR_GROUP_USERS, groupUsers); + request.setAttribute(McAppConstants.TOOL_SESSION_ID, toolSessionID); + request.setAttribute(McAppConstants.ATTR_CONTENT, mcContent); - return mapping.findForward(WAIT_FOR_LEADER); + return mapping.findForward(McAppConstants.WAIT_FOR_LEADER); } // check if leader has submitted all answers @@ -210,11 +211,11 @@ } } - sessionMap.put(ATTR_GROUP_LEADER, groupLeader); + sessionMap.put(McAppConstants.ATTR_GROUP_LEADER, groupLeader); boolean isUserLeader = mcSession.isUserGroupLeader(user); - sessionMap.put(ATTR_IS_USER_LEADER, isUserLeader); + sessionMap.put(McAppConstants.ATTR_IS_USER_LEADER, isUserLeader); sessionMap.put(AttributeNames.ATTR_MODE, mode); - sessionMap.put(ATTR_CONTENT, mcContent); + sessionMap.put(McAppConstants.ATTR_CONTENT, mcContent); request.setAttribute("sessionMapID", sessionMap.getSessionID()); /* user has already submitted response once OR it's a monitor - go to viewAnswers page. */ @@ -223,7 +224,7 @@ ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("viewAnswersRedirect")); redirect.addParameter(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionID); redirect.addParameter("userID", userID); - redirect.addParameter(MODE, mode); + redirect.addParameter(McAppConstants.MODE, mode); redirect.addParameter("httpSessionID", sessionMap.getSessionID()); return redirect; } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java,v diff -u -r1.58.2.10 -r1.58.2.11 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 19 May 2017 23:54:36 -0000 1.58.2.10 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 26 May 2017 19:36:23 -0000 1.58.2.11 @@ -48,8 +48,8 @@ import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McGeneralLearnerFlowDTO; -import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; +import org.lamsfoundation.lams.tool.mc.dto.McGeneralLearnerFlowDTO; +import org.lamsfoundation.lams.tool.mc.dto.McUserMarkDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; @@ -68,7 +68,7 @@ /** * * @author Ozgur Demirtas */ -public class McMonitoringAction extends LamsDispatchAction implements McAppConstants { +public class McMonitoringAction extends LamsDispatchAction { private static Logger logger = Logger.getLogger(McMonitoringAction.class.getName()); /** @@ -101,7 +101,7 @@ String userName = request.getParameter("userName"); String sessionId = request.getParameter("sessionId"); NotebookEntry notebookEntry = mcService.getEntry(new Long(sessionId), CoreNotebookConstants.NOTEBOOK_TOOL, - MY_SIGNATURE, new Integer(userId)); + McAppConstants.TOOL_SIGNATURE, new Integer(userId)); McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO = new McGeneralLearnerFlowDTO(); if (notebookEntry != null) { @@ -110,9 +110,9 @@ mcGeneralLearnerFlowDTO.setUserName(userName); } - request.setAttribute(MC_GENERAL_LEARNER_FLOW_DTO, mcGeneralLearnerFlowDTO); + request.setAttribute(McAppConstants.MC_GENERAL_LEARNER_FLOW_DTO, mcGeneralLearnerFlowDTO); - return mapping.findForward(LEARNER_NOTEBOOK); + return mapping.findForward(McAppConstants.LEARNER_NOTEBOOK); } /** Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java,v diff -u -r1.52.2.5 -r1.52.2.6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java 19 May 2017 23:54:36 -0000 1.52.2.5 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java 26 May 2017 19:36:23 -0000 1.52.2.6 @@ -43,13 +43,13 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McApplicationException; -import org.lamsfoundation.lams.tool.mc.McGeneralMonitoringDTO; -import org.lamsfoundation.lams.tool.mc.ReflectionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McGeneralMonitoringDTO; +import org.lamsfoundation.lams.tool.mc.dto.ReflectionDTO; import org.lamsfoundation.lams.tool.mc.dto.SessionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McSession; import org.lamsfoundation.lams.tool.mc.service.IMcService; +import org.lamsfoundation.lams.tool.mc.service.McApplicationException; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; import org.lamsfoundation.lams.tool.mc.util.McSessionComparator; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -63,7 +63,7 @@ * * @author Ozgur Demirtas */ -public class McMonitoringStarterAction extends Action implements McAppConstants { +public class McMonitoringStarterAction extends Action { private static Logger logger = Logger.getLogger(McMonitoringStarterAction.class.getName()); private static IMcService service; @@ -100,11 +100,11 @@ sessionDtos.add(sessionDto); } - request.setAttribute(SESSION_DTOS, sessionDtos); + request.setAttribute(McAppConstants.SESSION_DTOS, sessionDtos); // setting up the advanced summary - request.setAttribute(ATTR_CONTENT, mcContent); + request.setAttribute(McAppConstants.ATTR_CONTENT, mcContent); request.setAttribute("questionsSequenced", mcContent.isQuestionsSequenced()); request.setAttribute("showMarks", mcContent.isShowMarks()); request.setAttribute("useSelectLeaderToolOuput", mcContent.isUseSelectLeaderToolOuput()); @@ -143,16 +143,14 @@ boolean isGroupedActivity = service.isGroupedActivity(new Long(mcContent.getMcContentId())); request.setAttribute("isGroupedActivity", isGroupedActivity); - mcGeneralMonitoringDTO.setCurrentTab("1"); - /* this section is needed for Edit Activity screen, from here... */ mcGeneralMonitoringDTO.setDisplayAnswers(new Boolean(mcContent.isDisplayAnswers()).toString()); List reflectionsContainerDTO = service.getReflectionList(mcContent, null); - request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); + request.setAttribute(McAppConstants.REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); - request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + request.setAttribute(McAppConstants.MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); //count users int countSessionComplete = 0; @@ -163,7 +161,7 @@ if (mcSession != null) { - if (mcSession.getSessionStatus().equals(COMPLETED)) { + if (mcSession.getSessionStatus().equals(McAppConstants.COMPLETED)) { countSessionComplete++; } countAllUsers += mcSession.getMcQueUsers().size(); @@ -172,7 +170,7 @@ mcGeneralMonitoringDTO.setCountAllUsers(new Integer(countAllUsers)); mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete)); - return (mapping.findForward(LOAD_MONITORING_CONTENT)); + return (mapping.findForward(McAppConstants.LOAD_MONITORING_CONTENT)); } // ************************************************************************************* Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java,v diff -u -r1.9.2.4 -r1.9.2.5 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java 19 May 2017 23:54:36 -0000 1.9.2.4 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java 26 May 2017 19:36:23 -0000 1.9.2.5 @@ -41,12 +41,13 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessages; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McOptionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McOptionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.tool.mc.web.form.McPedagogicalPlannerForm; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.util.AttributeNames; Fisheye: Tag 1.5.2.6 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java,v diff -u -r1.99.2.7 -r1.99.2.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 23 May 2017 19:55:08 -0000 1.99.2.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 26 May 2017 19:36:23 -0000 1.99.2.8 @@ -39,12 +39,12 @@ import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McApplicationException; -import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO; -import org.lamsfoundation.lams.tool.mc.McQuestionDTO; +import org.lamsfoundation.lams.tool.mc.dto.McQuestionDTO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; +import org.lamsfoundation.lams.tool.mc.service.McApplicationException; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.tool.mc.web.form.McAuthoringForm; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -54,15 +54,14 @@ * * @author Ozgur Demirtas */ -public class McStarterAction extends Action implements McAppConstants { +public class McStarterAction extends Action { private static Logger logger = Logger.getLogger(McStarterAction.class.getName()); @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); SessionMap sessionMap = new SessionMap(); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); @@ -76,8 +75,6 @@ ToolAccessMode mode = WebUtil.readToolAccessModeAuthorDefaulted(request); sessionMap.put(AttributeNames.ATTR_MODE, mode); - mcAuthoringForm.resetRadioBoxes(); - IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); // request is from monitoring module @@ -86,80 +83,39 @@ } if ((strToolContentID == null) || (strToolContentID.equals(""))) { - return (mapping.findForward(ERROR_LIST)); + return (mapping.findForward(McAppConstants.ERROR_LIST)); } McContent mcContent = mcService.getMcContent(new Long(strToolContentID)); // if mcContent does not exist, try to use default content instead. if (mcContent == null) { - long defaultContentID = mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + long defaultContentID = mcService.getToolDefaultContentIdBySignature(McAppConstants.TOOL_SIGNATURE); mcContent = mcService.getMcContent(new Long(defaultContentID)); mcContent = McContent.newInstance(mcContent, new Long(strToolContentID)); } - prepareDTOandForm(request, mapping, mcAuthoringForm, mcContent, mcGeneralAuthoringDTO); - - List questionDtos = AuthoringUtil.buildDefaultQuestions(mcContent); - request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(questionDtos.size())); - request.setAttribute(LIST_QUESTION_DTOS, questionDtos); - sessionMap.put(LIST_QUESTION_DTOS, questionDtos); - - List listDeletedQuestionDTOs = new ArrayList(); - sessionMap.put(LIST_DELETED_QUESTION_DTOS, listDeletedQuestionDTOs); - - mcGeneralAuthoringDTO.setMarkValue("1"); - - String passMark = " "; - if ((mcContent.getPassMark() != null) && (mcContent.getPassMark().intValue() != 0)) { - passMark = mcContent.getPassMark().toString(); - } - mcGeneralAuthoringDTO.setPassMarkValue(passMark); - - request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - return (mapping.findForward(LOAD_AUTHORING)); - } - - /** - * prepares the data for presentation purposes. - * - * @param request - * @param mapping - * @param mcAuthoringForm - * @param mapQuestionContent - * @param toolContentID - * @return ActionForward - */ - protected McContent prepareDTOandForm(HttpServletRequest request, ActionMapping mapping, - McAuthoringForm mcAuthoringForm, McContent mcContent, - McGeneralAuthoringDTO mcGeneralAuthoringDTO) { - + // prepare form mcAuthoringForm.setSln(mcContent.isShowReport() ? "1" : "0"); mcAuthoringForm.setQuestionsSequenced(mcContent.isQuestionsSequenced() ? "1" : "0"); mcAuthoringForm.setRandomize(mcContent.isRandomize() ? "1" : "0"); mcAuthoringForm.setDisplayAnswers(mcContent.isDisplayAnswers() ? "1" : "0"); mcAuthoringForm.setShowMarks(mcContent.isShowMarks() ? "1" : "0"); mcAuthoringForm.setUseSelectLeaderToolOuput(mcContent.isUseSelectLeaderToolOuput() ? "1" : "0"); mcAuthoringForm.setPrefixAnswersWithLetters(mcContent.isPrefixAnswersWithLetters() ? "1" : "0"); - mcAuthoringForm.setRetries(mcContent.isRetries() ? "1" : "0"); mcAuthoringForm.setPassmark("" + mcContent.getPassMark()); mcAuthoringForm.setReflect(mcContent.isReflect() ? "1" : "0"); mcAuthoringForm.setReflectionSubject(mcContent.getReflectionSubject()); - - mcGeneralAuthoringDTO.setSln(mcContent.isShowReport() ? "1" : "0"); - mcGeneralAuthoringDTO.setQuestionsSequenced(mcContent.isQuestionsSequenced() ? "1" : "0"); - mcGeneralAuthoringDTO.setRandomize(mcContent.isRandomize() ? "1" : "0"); - mcGeneralAuthoringDTO.setDisplayAnswers(mcContent.isDisplayAnswers() ? "1" : "0"); - mcGeneralAuthoringDTO.setRetries(mcContent.isRetries() ? "1" : "0"); - mcGeneralAuthoringDTO.setReflect(mcContent.isReflect() ? "1" : "0"); - mcGeneralAuthoringDTO.setReflectionSubject(mcContent.getReflectionSubject()); - mcAuthoringForm.setTitle(mcContent.getTitle()); mcAuthoringForm.setInstructions(mcContent.getInstructions()); - mcAuthoringForm.resetUserAction(); - return mcContent; + List questionDtos = AuthoringUtil.buildDefaultQuestions(mcContent); + sessionMap.put(McAppConstants.QUESTION_DTOS, questionDtos); + + List listDeletedQuestionDTOs = new ArrayList(); + sessionMap.put(McAppConstants.LIST_DELETED_QUESTION_DTOS, listDeletedQuestionDTOs); + + return (mapping.findForward(McAppConstants.LOAD_AUTHORING)); } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/form/McAuthoringForm.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/form/McLearningForm.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/form/McPedagogicalPlannerForm.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/web/WEB-INF/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/struts-config.xml,v diff -u -r1.68.2.4 -r1.68.2.5 --- lams_tool_lamc/web/WEB-INF/struts-config.xml 19 May 2017 23:54:37 -0000 1.68.2.4 +++ lams_tool_lamc/web/WEB-INF/struts-config.xml 26 May 2017 19:36:23 -0000 1.68.2.5 @@ -4,9 +4,9 @@ - - - + + + @@ -58,12 +58,6 @@ path="/authoring/AuthoringTabsHolder.jsp" redirect="false" /> - - - - Index: lams_tool_lamc/web/WEB-INF/tags/AuthoringButton.tag =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/tags/AuthoringButton.tag,v diff -u -r1.19.2.3 -r1.19.2.4 --- lams_tool_lamc/web/WEB-INF/tags/AuthoringButton.tag 1 Mar 2017 12:36:36 -0000 1.19.2.3 +++ lams_tool_lamc/web/WEB-INF/tags/AuthoringButton.tag 26 May 2017 19:36:24 -0000 1.19.2.4 @@ -72,7 +72,7 @@