Index: messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java =================================================================== --- messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java (revision 128475) +++ messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java (working copy) @@ -1085,12 +1085,8 @@ setErrorMessage(getResourceBundleString(INSUFFICIENT_PRIVILEGES_TO_DELETE_FORUM)); return gotoMain(); } - //in case XSS was slipped in, make sure we remove it: StringBuilder alertMsg = new StringBuilder(); selectedForum.getForum().setExtendedDescription(FormattedText.processFormattedText(selectedForum.getForum().getExtendedDescription(), alertMsg)); - selectedForum.getForum().setTitle(FormattedText.processFormattedText(selectedForum.getForum().getTitle(), alertMsg)); - selectedForum.getForum().setShortDescription(FormattedText.processFormattedText(selectedForum.getForum().getShortDescription(), alertMsg)); - selectedForum.setMarkForDeletion(true); return FORUM_SETTING; } @@ -1305,9 +1301,7 @@ if(selectedForum.getForum()!=null && (selectedForum.getForum().getShortDescription()!=null)) { - StringBuilder alertMsg = new StringBuilder(); - String formattedShortDesc = FormattedText.processFormattedText(selectedForum.getForum().getShortDescription(), alertMsg); - if(formattedShortDesc.length() > 255){ + if(selectedForum.getForum().getShortDescription().length() > 255){ setErrorMessage(getResourceBundleString(SHORT_DESC_TOO_LONG)); return null; } @@ -1381,9 +1375,7 @@ if(selectedForum.getForum()!=null && (selectedForum.getForum().getShortDescription()!=null)) { - StringBuilder alertMsg = new StringBuilder(); - String formattedShortDesc = FormattedText.processFormattedText(selectedForum.getForum().getShortDescription(), alertMsg); - if(formattedShortDesc.length() > 255){ + if(selectedForum.getForum().getShortDescription().length() > 255){ setErrorMessage(getResourceBundleString(SHORT_DESC_TOO_LONG)); return null; } @@ -1434,9 +1426,7 @@ if(selectedForum.getForum()!=null && (selectedForum.getForum().getShortDescription()!=null)) { - StringBuilder alertMsg = new StringBuilder(); - String formattedShortDesc = FormattedText.processFormattedText(selectedForum.getForum().getShortDescription(), alertMsg); - if(formattedShortDesc.length() > 255){ + if(selectedForum.getForum().getShortDescription().length() > 255){ setErrorMessage(getResourceBundleString(SHORT_DESC_TOO_LONG)); return null; } @@ -1491,13 +1481,11 @@ StringBuilder alertMsg = new StringBuilder(); forum.setExtendedDescription(FormattedText.processFormattedText(forum.getExtendedDescription(), alertMsg)); - forum.setTitle(FormattedText.processFormattedText(forum.getTitle(), alertMsg)); - String shortDescFormatted = FormattedText.processFormattedText(forum.getShortDescription(), alertMsg); - if(shortDescFormatted!=null && shortDescFormatted.length() > 255){ - shortDescFormatted = shortDescFormatted.substring(0, 255); + if(forum.getShortDescription()!=null && forum.getShortDescription().length() > 255){ + forum.setShortDescription(forum.getShortDescription().substring(0, 255)); } - forum.setShortDescription(shortDescFormatted); + if ("
".equals(forum.getExtendedDescription())) { forum.setExtendedDescription(""); @@ -1773,9 +1761,7 @@ if(selectedTopic!=null && selectedTopic.getTopic()!=null && (selectedTopic.getTopic().getShortDescription()!=null)) { - StringBuilder alertMsg = new StringBuilder(); - String formattedShortDesc = FormattedText.processFormattedText(selectedTopic.getTopic().getShortDescription(), alertMsg); - if(formattedShortDesc.length() > 255){ + if(selectedTopic.getTopic().getShortDescription().length() > 255){ setErrorMessage(getResourceBundleString(SHORT_DESC_TOO_LONG)); return null; } @@ -1859,9 +1845,7 @@ if(selectedTopic!=null && selectedTopic.getTopic()!=null && (selectedTopic.getTopic().getShortDescription()!=null)) { - StringBuilder alertMsg = new StringBuilder(); - String formattedShortDesc = FormattedText.processFormattedText(selectedTopic.getTopic().getShortDescription(), alertMsg); - if(formattedShortDesc.length() > 255){ + if(selectedTopic.getTopic().getShortDescription().length() > 255){ setErrorMessage(getResourceBundleString(SHORT_DESC_TOO_LONG)); return null; } @@ -1946,9 +1930,7 @@ if(selectedTopic!=null && selectedTopic.getTopic()!=null && (selectedTopic.getTopic().getShortDescription()!=null)) { - StringBuilder alertMsg = new StringBuilder(); - String formattedShortDesc = FormattedText.processFormattedText(selectedTopic.getTopic().getShortDescription(), alertMsg); - if(formattedShortDesc.length() > 255){ + if(selectedTopic.getTopic().getShortDescription().length() > 255){ setErrorMessage(getResourceBundleString(SHORT_DESC_TOO_LONG)); return null; } @@ -2004,13 +1986,11 @@ beforeChangeHM = SynopticMsgcntrManagerCover.getUserToNewMessagesForForumMap(getSiteId(), topic.getBaseForum().getId(), topic.getId()); } + if(topic.getShortDescription()!=null && topic.getShortDescription().length() > 255){ + topic.setShortDescription(topic.getShortDescription().substring(0, 255)); + } + StringBuilder alertMsg = new StringBuilder(); - topic.setTitle(FormattedText.processFormattedText(topic.getTitle(), alertMsg)); - String shortDescFormatted = FormattedText.processFormattedText(topic.getShortDescription(), alertMsg); - if(shortDescFormatted!=null && shortDescFormatted.length() > 255){ - shortDescFormatted = shortDescFormatted.substring(0, 255); - } - topic.setShortDescription(shortDescFormatted); topic.setExtendedDescription(FormattedText.processFormattedText(topic.getExtendedDescription(), alertMsg)); if ("
".equals(topic.getExtendedDescription())) @@ -2110,8 +2090,6 @@ //in case XSS was slipped in, make sure we remove it: StringBuilder alertMsg = new StringBuilder(); selectedTopic.getTopic().setExtendedDescription(FormattedText.processFormattedText(selectedTopic.getTopic().getExtendedDescription(), alertMsg)); - selectedTopic.getTopic().setTitle(FormattedText.processFormattedText(selectedTopic.getTopic().getTitle(), alertMsg)); - selectedTopic.getTopic().setShortDescription(FormattedText.processFormattedText(selectedTopic.getTopic().getShortDescription(), alertMsg)); selectedTopic.setMarkForDeletion(true); return TOPIC_SETTING; } @@ -3821,7 +3799,7 @@ if (aMsg != null) { StringBuilder alertMsg = new StringBuilder(); - aMsg.setTitle(FormattedText.processFormattedText(getComposeTitle(), alertMsg)); + aMsg.setTitle(getComposeTitle()); aMsg.setBody(FormattedText.processFormattedText(getComposeBody(), alertMsg)); if(getUserNameOrEid()!=null){ @@ -4722,7 +4700,7 @@ } StringBuilder alertMsg = new StringBuilder(); - dMsg.setTitle(FormattedText.processFormattedText(getComposeTitle(), alertMsg)); + dMsg.setTitle(getComposeTitle()); dMsg.setBody(FormattedText.processFormattedText(currentBody, alertMsg)); dMsg.setDraft(Boolean.FALSE); dMsg.setModified(new Date()); @@ -8303,8 +8281,7 @@ //in case XSS was slipped in, make sure we remove it: StringBuilder alertMsg = new StringBuilder(); selectedForum.getForum().setExtendedDescription(FormattedText.processFormattedText(selectedForum.getForum().getExtendedDescription(), alertMsg)); - selectedForum.getForum().setTitle(FormattedText.processFormattedText(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object [] {selectedForum.getForum().getTitle()} ), alertMsg)); - selectedForum.getForum().setShortDescription(FormattedText.processFormattedText(selectedForum.getForum().getShortDescription(), alertMsg)); + selectedForum.getForum().setTitle(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object [] {selectedForum.getForum().getTitle()} )); selectedForum.setMarkForDuplication(true); return FORUM_SETTING; @@ -8323,8 +8300,7 @@ String forumId = getExternalParameterByKey(FORUM_ID); DiscussionForum forum = forumManager.getForumById(Long.valueOf(forumId)); selectedForum = new DiscussionForumBean(forum, uiPermissionsManager, forumManager); - StringBuilder alertMsg = new StringBuilder(); - selectedForum.getForum().setTitle(FormattedText.processFormattedText(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object[] {selectedForum.getForum().getTitle()}), alertMsg)); + selectedForum.getForum().setTitle(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object[] {selectedForum.getForum().getTitle()})); selectedForum.setMarkForDuplication(true); return FORUM_SETTING; } @@ -8382,8 +8358,7 @@ //in case XSS was slipped in, make sure we remove it: StringBuilder alertMsg = new StringBuilder(); selectedTopic.getTopic().setExtendedDescription(FormattedText.processFormattedText(selectedTopic.getTopic().getExtendedDescription(), alertMsg)); - selectedTopic.getTopic().setTitle(FormattedText.processFormattedText(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object[] {selectedTopic.getTopic().getTitle()}), alertMsg)); - selectedTopic.getTopic().setShortDescription(FormattedText.processFormattedText(selectedTopic.getTopic().getShortDescription(), alertMsg)); + selectedTopic.getTopic().setTitle(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object[] {selectedTopic.getTopic().getTitle()})); selectedTopic.setMarkForDuplication(true); return TOPIC_SETTING; } @@ -8414,7 +8389,7 @@ } selectedTopic = new DiscussionTopicBean(topic, selectedForum.getForum(),uiPermissionsManager, forumManager); StringBuilder alertMsg = new StringBuilder(); - selectedTopic.getTopic().setTitle(FormattedText.processFormattedText(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object[] {selectedTopic.getTopic().getTitle()}), alertMsg)); + selectedTopic.getTopic().setTitle(getResourceBundleString(DUPLICATE_COPY_TITLE, new Object[] {selectedTopic.getTopic().getTitle()})); selectedTopic.setMarkForDuplication(true); return TOPIC_SETTING; } @@ -8474,8 +8449,7 @@ newTitle = fromTopic.getTitle(); newTopic.setSortIndex(fromTopic.getSortIndex()); } else { - StringBuilder alertMsg = new StringBuilder(); - newTitle = FormattedText.processFormattedText(selectedTopic.getTopic().getTitle(), alertMsg); + newTitle = selectedTopic.getTopic().getTitle(); } newTopic.setTitle(newTitle); LOG.debug("New Topic Title = " + newTopic.getTitle()); @@ -8589,8 +8563,7 @@ forum.setModerated(oldForum.getModerated()); forum.setPostFirst(oldForum.getPostFirst()); forum.setAutoMarkThreadsRead(oldForum.getAutoMarkThreadsRead()); // default to template setting - StringBuilder alertMsg = new StringBuilder(); - String oldTitle = FormattedText.processFormattedText(selectedForum.getForum().getTitle(), alertMsg); + String oldTitle = selectedForum.getForum().getTitle(); selectedForum = null; selectedForum = new DiscussionForumBean(forum, uiPermissionsManager, forumManager); if("true".equalsIgnoreCase(ServerConfigurationService.getString("mc.defaultLongDescription")))