Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyQuestion.java =================================================================== diff -u -r66bda55b4291ff10c230b0ab5227dab5fa058a8a -rfc1ed3a50e6d6a3120d37c2d94b069d70d138a08 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyQuestion.java (.../SurveyQuestion.java) (revision 66bda55b4291ff10c230b0ab5227dab5fa058a8a) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/model/SurveyQuestion.java (.../SurveyQuestion.java) (revision fc1ed3a50e6d6a3120d37c2d94b069d70d138a08) @@ -47,6 +47,7 @@ import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.lamsfoundation.lams.tool.survey.util.SurveyWebUtils; +import org.lamsfoundation.lams.util.WebUtil; /** * @author Dapeng Ni @@ -216,9 +217,7 @@ /** Set the short title from the current description but strip HTML and shorten to SHORT_TITLE_LENGTH characters. */ public void updateShortTitleFromDescription() { - // strip all images first in case they are base64 otherwise the next step causes a stack overflow - // then strip out any other HTML tags - String newInput = SurveyWebUtils.removeHTMLTags(this.description); + String newInput = WebUtil.removeHTMLtags(this.description); this.shortTitle = StringUtils.abbreviate(newInput, SHORT_TITLE_LENGTH); } } \ No newline at end of file Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/util/SurveyWebUtils.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rfc1ed3a50e6d6a3120d37c2d94b069d70d138a08 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/util/SurveyWebUtils.java (.../SurveyWebUtils.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/util/SurveyWebUtils.java (.../SurveyWebUtils.java) (revision fc1ed3a50e6d6a3120d37c2d94b069d70d138a08) @@ -69,12 +69,4 @@ return choiceList.split("&"); } - - /** Remove the html tags from the input string. Used for authoring, learning, monitoring and export! */ - public static String removeHTMLTags(String input) { - // strip all images first in case they are base64 otherwise the next step causes a stack overflow - // then strip out any other HTML tags - return input.replaceAll("", "").replaceAll("<(.|\n)*?>", "").replaceAll(" ", " ") - .replaceAll("[\r\n][\r\n]+", "\n"); - } } Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/MonitoringController.java =================================================================== diff -u -r52a6369ce66a2ea70d38bfa2e627dfcde6354b10 -rfc1ed3a50e6d6a3120d37c2d94b069d70d138a08 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/MonitoringController.java (.../MonitoringController.java) (revision 52a6369ce66a2ea70d38bfa2e627dfcde6354b10) +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/controller/MonitoringController.java (.../MonitoringController.java) (revision fc1ed3a50e6d6a3120d37c2d94b069d70d138a08) @@ -266,13 +266,13 @@ // survey title row = sheet.createRow(idx++); cell = row.createCell(0); - cell.setCellValue(SurveyWebUtils.removeHTMLTags(survey.getTitle())); + cell.setCellValue(WebUtil.removeHTMLtags(survey.getTitle())); // survey instruction row = sheet.createRow(idx++); cell = row.createCell(0); cell.setCellValue( - ExcelUtil.ensureCorrectCellLength(SurveyWebUtils.removeHTMLTags(survey.getInstructions()))); + ExcelUtil.ensureCorrectCellLength(WebUtil.removeHTMLtags(survey.getInstructions()))); // display 2 empty row row = sheet.createRow(idx++); @@ -287,7 +287,7 @@ cell = row.createCell(0); cell.setCellValue(messageService.getMessage(MonitoringController.MSG_LABEL_SESSION_NAME)); cell = row.createCell(1); - cell.setCellValue(SurveyWebUtils.removeHTMLTags(session.getSessionName())); + cell.setCellValue(WebUtil.removeHTMLtags(session.getSessionName())); // begin to display question and its answers Set>> questionEntries = map.entrySet(); @@ -308,7 +308,7 @@ cell.setCellValue( messageService.getMessage(MonitoringController.MSG_LABEL_QUESTION) + " " + questionIdx); cell = row.createCell(1); - cell.setCellValue(SurveyWebUtils.removeHTMLTags(question.getDescription())); + cell.setCellValue(WebUtil.removeHTMLtags(question.getDescription())); // display options content Set options = question.getOptions(); @@ -325,7 +325,7 @@ cell.setCellValue(SurveyConstants.OPTION_SHORT_HEADER + optionIdx); cell = row.createCell(1); cell.setCellValue( - ExcelUtil.ensureCorrectCellLength(SurveyWebUtils.removeHTMLTags(option.getDescription()))); + ExcelUtil.ensureCorrectCellLength(WebUtil.removeHTMLtags(option.getDescription()))); } if (question.isAppendText() || question.getType() == SurveyConstants.QUESTION_TYPE_TEXT_ENTRY) { optionIdx++; @@ -399,7 +399,7 @@ cell = row.createCell(++cellIdx); if (answer.getAnswer() != null) { cell.setCellValue(ExcelUtil.ensureCorrectCellLength( - SurveyWebUtils.removeHTMLTags(answer.getAnswer().getAnswerText()))); + WebUtil.removeHTMLtags(answer.getAnswer().getAnswerText()))); } }