Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralLearnerFlowDTO.java =================================================================== diff -u -rdacf1ee355d21928e50734b6bb5d378ed4ce8f9b -ra5f41e7f6fc1ca084d687da6d36cf710e6138ddc --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralLearnerFlowDTO.java (.../McGeneralLearnerFlowDTO.java) (revision dacf1ee355d21928e50734b6bb5d378ed4ce8f9b) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralLearnerFlowDTO.java (.../McGeneralLearnerFlowDTO.java) (revision a5f41e7f6fc1ca084d687da6d36cf710e6138ddc) @@ -107,9 +107,23 @@ protected String totalUserMark; protected String totalMarksPossible; + + protected Map mapFeedbackContent; /** + * @return Returns the mapFeedbackContent. + */ + public Map getMapFeedbackContent() { + return mapFeedbackContent; + } + /** + * @param mapFeedbackContent The mapFeedbackContent to set. + */ + public void setMapFeedbackContent(Map mapFeedbackContent) { + this.mapFeedbackContent = mapFeedbackContent; + } + /** * @return Returns the totalUserMark. */ public String getTotalUserMark() { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== diff -u -r475e17b638d786c744a3d0c46eefb55ac57319ee -ra5f41e7f6fc1ca084d687da6d36cf710e6138ddc --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 475e17b638d786c744a3d0c46eefb55ac57319ee) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision a5f41e7f6fc1ca084d687da6d36cf710e6138ddc) @@ -38,6 +38,7 @@ import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO; import org.lamsfoundation.lams.tool.mc.McComparator; import org.lamsfoundation.lams.tool.mc.McQuestionContentDTO; +import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; @@ -302,7 +303,56 @@ return mapQuestionsContent; } - + + public static Map rebuildFeedbackMapfromDB(HttpServletRequest request, Long toolContentId, IMcService mcService) + { + Map map= new TreeMap(new McComparator()); + logger.debug("toolContentId:" + toolContentId); + + McContent mcContent=mcService.retrieveMc(toolContentId); + logger.debug("mcContent:" + mcContent); + + List list=mcService.refreshQuestionContent(mcContent.getUid()); + logger.debug("refreshed list:" + list); + + Iterator listIterator=list.iterator(); + Long mapIndex=new Long(1); + while (listIterator.hasNext()) + { + McQueContent mcQueContent=(McQueContent)listIterator.next(); + logger.debug("mcQueContent:" + mcQueContent); + + String feedback=mcQueContent.getFeedback(); + logger.debug("feedback:" + feedback); + + + boolean isFeedbackTextMarkup=LearningUtil.isTextMarkup(feedback); + logger.debug("isFeedbackTextMarkup: " + isFeedbackTextMarkup); + + String newFeedbackText=feedback; + if (!isFeedbackTextMarkup) + { + newFeedbackText= LearningUtil.getWrappedText(feedback, false); + logger.debug("wrapped newFeedbackText: " + newFeedbackText); + } + logger.debug("post warp newFeedbackText: " + newFeedbackText); + + + newFeedbackText=McUtils.replaceNewLines(newFeedbackText); + logger.debug("newFeedbackText after procesing new lines: " + newFeedbackText); + + + map.put(mapIndex.toString(),newFeedbackText); + mapIndex=new Long(mapIndex.longValue()+1); + } + + logger.debug("refreshed Map:" + map); + return map; + } + + + + /** * builds a map to hold persisted uid values for questions * rebuildQuestionUidMapfromDB(HttpServletRequest request, Long toolContentId) @@ -1835,7 +1885,28 @@ logger.debug("feedback now: " + mcQueContent.getFeedback()); - mcQuestionContentDTO.setQuestion(mcQueContent.getQuestion()); + String question=mcQueContent.getQuestion(); + logger.debug("question: " + question); + + /* + boolean isTextMarkup=LearningUtil.isTextMarkup(question); + logger.debug("isTextMarkup: " + isTextMarkup); + + String newQuestionText=question; + if (!isTextMarkup) + { + newQuestionText= LearningUtil.getWrappedText(question, true); + logger.debug("wrapped newQuestionText: " + newQuestionText); + } + logger.debug("post warp newQuestionText: " + newQuestionText); + + + newQuestionText=McUtils.replaceNewLines(newQuestionText); + logger.debug("newQuestionText after procesing new lines: " + newQuestionText); + */ + + + mcQuestionContentDTO.setQuestion(question); mcQuestionContentDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString()); mcQuestionContentDTO.setFeedback(feedback); mcQuestionContentDTO.setMark(mcQueContent.getMark().toString()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java =================================================================== diff -u -radb09a70c5f6e06556e11745cb8266861c03c07b -ra5f41e7f6fc1ca084d687da6d36cf710e6138ddc --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision adb09a70c5f6e06556e11745cb8266861c03c07b) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision a5f41e7f6fc1ca084d687da6d36cf710e6138ddc) @@ -764,7 +764,26 @@ Map mapCandidateAnswerUids=convertToStringMap(listCandidateAnswerUids); logger.debug("mapCandidateAnswerUids: " + mapCandidateAnswerUids); - mcLearnerAnswersDTO.setQuestion(mcQueContent.getQuestion()); + + String question=mcQueContent.getQuestion(); + logger.debug("question: " + question); + + boolean isTextMarkup=LearningUtil.isTextMarkup(question); + logger.debug("isTextMarkup: " + isTextMarkup); + + String newQuestionText=question; + if (!isTextMarkup) + { + newQuestionText= LearningUtil.getWrappedText(question, false); + logger.debug("wrapped newQuestionText: " + newQuestionText); + } + logger.debug("post warp newQuestionText: " + newQuestionText); + + + newQuestionText=McUtils.replaceNewLines(newQuestionText); + logger.debug("newQuestionText after procesing new lines: " + newQuestionText); + + mcLearnerAnswersDTO.setQuestion(newQuestionText); mcLearnerAnswersDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString()); mcLearnerAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); @@ -1083,5 +1102,67 @@ logger.debug("returning mapWeightsExcludeHighestWeight: " + mapMarksExcludeHighestMark); return mapMarksExcludeHighestMark; } + + public static boolean isTextMarkup(String text) + { + logger.debug("starting isTextMarkup: " + text); + + int markupSignPos=text.indexOf("<"); + logger.debug("markupSignPos: " + markupSignPos); + + int markupSignPos2=text.indexOf(">"); + logger.debug("markupSignPos2: " + markupSignPos2); + + if ((markupSignPos != -1) && (markupSignPos2) != -1) + { + logger.debug("text has markup in it: " + text); + return true; + } + return false; + } + + public static String getWrappedText(String text, boolean authoring) + { + + logger.debug("starting getWrappedText: " + text); + logger.debug("authoring: " + authoring); + + String newText=""; + int breakPos=50; + + if (authoring) + breakPos=30; + + if (text.length() > breakPos) + { + int counter=0; + while (counter < 100) + { + counter++; + logger.debug("using text: " + text); + + if (text.length() > breakPos) + { + newText += text.substring(0, breakPos+1) + "
" ; + text=text.substring(breakPos+1); + + } + else + { + newText +=text; + break; + } + } + + } + else + { + newText=text; + } + + logger.debug("returning newText: " + newText); + return newText; + } + } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java =================================================================== diff -u -radb09a70c5f6e06556e11745cb8266861c03c07b -ra5f41e7f6fc1ca084d687da6d36cf710e6138ddc --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java (.../McLearningAction.java) (revision adb09a70c5f6e06556e11745cb8266861c03c07b) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java (.../McLearningAction.java) (revision a5f41e7f6fc1ca084d687da6d36cf710e6138ddc) @@ -582,8 +582,26 @@ logger.debug("mcQueContent: " + mcQueContent); logger.debug("mcQueContent text: " + mcQueContent.getQuestion()); + String question=mcQueContent.getQuestion(); + logger.debug("question: " + question); - mcLearnerAnswersDTO.setQuestion(mcQueContent.getQuestion()); + boolean isTextMarkup=LearningUtil.isTextMarkup(question); + logger.debug("isTextMarkup: " + isTextMarkup); + + String newQuestionText=question; + if (!isTextMarkup) + { + newQuestionText= LearningUtil.getWrappedText(question, false); + logger.debug("wrapped newQuestionText: " + newQuestionText); + } + logger.debug("post warp newQuestionText: " + newQuestionText); + + + newQuestionText=McUtils.replaceNewLines(newQuestionText); + logger.debug("newQuestionText after procesing new lines: " + newQuestionText); + + + mcLearnerAnswersDTO.setQuestion(newQuestionText); mcLearnerAnswersDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString()); mcLearnerAnswersDTO.setQuestionUid(mcQueContent.getUid().toString()); mcLearnerAnswersDTO.setMark(mcQueContent.getMark().toString()); @@ -597,11 +615,23 @@ if (feedback == null) feedback=""; logger.debug("feedback: " + feedback); - feedback=McUtils.replaceNewLines(feedback); - logger.debug("feedback after procesing new lines: " + feedback); + boolean isFeedbackTextMarkup=LearningUtil.isTextMarkup(feedback); + logger.debug("isFeedbackTextMarkup: " + isFeedbackTextMarkup); + + String newFeedbackText=feedback; + if (!isFeedbackTextMarkup) + { + newFeedbackText= LearningUtil.getWrappedText(feedback, false); + logger.debug("wrapped newFeedbackText: " + newFeedbackText); + } + logger.debug("post warp newFeedbackText: " + newFeedbackText); - mcLearnerAnswersDTO.setFeedback(feedback); + newFeedbackText=McUtils.replaceNewLines(newFeedbackText); + logger.debug("newFeedbackText after procesing new lines: " + newFeedbackText); + + mcLearnerAnswersDTO.setFeedback(newFeedbackText); + Map caMap= new TreeMap(new McStringComparator()); Map caIdsMap= new TreeMap(new McStringComparator()); Long mapIndex=new Long(1); @@ -1294,8 +1324,12 @@ Map mapQuestionsContent=AuthoringUtil.rebuildQuestionMapfromDB(request, new Long(toolContentId), mcService); logger.debug("mapQuestionsContent:" + mapQuestionsContent); mcGeneralLearnerFlowDTO.setMapQuestionsContent(mapQuestionsContent); + + Map mapFeedbackContent=AuthoringUtil.rebuildFeedbackMapfromDB(request, new Long(toolContentId), mcService); + logger.debug("mapFeedbackContent:" + mapFeedbackContent); + mcGeneralLearnerFlowDTO.setMapFeedbackContent(mapFeedbackContent); + - boolean learnerProgressOn=false; if (learnerProgressUserId != null) { @@ -1990,5 +2024,8 @@ logger.debug("fwd'ing to: " + NOTEBOOK); return (mapping.findForward(NOTEBOOK)); } + + + } \ No newline at end of file Index: lams_tool_lamc/web/learning/ViewAnswers.jsp =================================================================== diff -u -r8b5fd331984013fa4afe645a4753ae7562b0dc84 -ra5f41e7f6fc1ca084d687da6d36cf710e6138ddc --- lams_tool_lamc/web/learning/ViewAnswers.jsp (.../ViewAnswers.jsp) (revision 8b5fd331984013fa4afe645a4753ae7562b0dc84) +++ lams_tool_lamc/web/learning/ViewAnswers.jsp (.../ViewAnswers.jsp) (revision a5f41e7f6fc1ca084d687da6d36cf710e6138ddc) @@ -161,6 +161,19 @@ + + + + + + + + + + + + +