Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/AuthoringController.java =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/AuthoringController.java (.../AuthoringController.java) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -441,9 +441,9 @@ * author posted before. */ @RequestMapping("/newTopic") - public String newTopic(@ModelAttribute MessageForm messageForm, HttpServletRequest request) { + public String newTopic(@ModelAttribute("topicFormId") MessageForm topicFormId, HttpServletRequest request) { String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - messageForm.setSessionMapID(sessionMapID); + topicFormId.setSessionMapID(sessionMapID); return "jsps/authoring/message/create"; } @@ -452,12 +452,12 @@ * Create a topic in memory. This topic will be saved when user save entire authoring page. */ @RequestMapping("/createTopic") - public String createTopic(@ModelAttribute MessageForm messageForm, HttpServletRequest request) + public String createTopic(@ModelAttribute("topicFormId") MessageForm topicFormId, HttpServletRequest request) throws IOException, ServletException, PersistenceException { SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(messageForm.getSessionMapID()); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); + .getAttribute(topicFormId.getSessionMapID()); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, topicFormId.getSessionMapID()); SortedSet topics = getTopics(sessionMap); // get login user (author) @@ -466,7 +466,7 @@ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); // get message info from web page - Message message = messageForm.getMessage(); + Message message = topicFormId.getMessage(); // init some basic variables for first time create message.setIsAuthored(true); message.setCreated(new Date()); @@ -494,10 +494,10 @@ // set attachment of this topic Set attSet = null; - if (messageForm.getAttachmentFile() != null - && !StringUtils.isEmpty(messageForm.getAttachmentFile().getOriginalFilename())) { + if (topicFormId.getAttachmentFile() != null + && !StringUtils.isEmpty(topicFormId.getAttachmentFile().getOriginalFilename())) { forumService = getForumManager(); - Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile()); + Attachment att = forumService.uploadAttachment(topicFormId.getAttachmentFile()); // only allow one attachment, so replace whatever attSet = new HashSet(); attSet.add(att); @@ -568,15 +568,15 @@ * ready for user update this topic. */ @RequestMapping("/editTopic") - public String editTopic(@ModelAttribute MessageForm messageForm, HttpServletRequest request) + public String editTopic(@ModelAttribute("topicFormId") MessageForm topicFormId, HttpServletRequest request) throws PersistenceException { // get SessionMAP String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); - messageForm.setSessionMapID(sessionMapID); + topicFormId.setSessionMapID(sessionMapID); String topicIndex = request.getParameter(ForumConstants.AUTHORING_TOPICS_INDEX); int topicIdx = NumberUtils.stringToInt(topicIndex, -1); @@ -586,7 +586,7 @@ MessageDTO topic = rList.get(topicIdx); if (topic != null) { // update message to HTML Form to echo back to web page: for subject, body display - messageForm.setMessage(topic.getMessage()); + topicFormId.setMessage(topic.getMessage()); } // echo back to web page: for attachment display request.setAttribute(ForumConstants.AUTHORING_TOPIC, topic); @@ -601,19 +601,19 @@ * whole authoring page. */ @RequestMapping("/updateTopic") - public String updateTopic(@ModelAttribute MessageForm messageForm, HttpServletRequest request) + public String updateTopic(@ModelAttribute("topicFormId") MessageForm topicFormId, HttpServletRequest request) throws PersistenceException { SessionMap sessionMap = (SessionMap) request.getSession() - .getAttribute(messageForm.getSessionMapID()); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); + .getAttribute(topicFormId.getSessionMapID()); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, topicFormId.getSessionMapID()); // get param from HttpServletRequest String topicIndex = request.getParameter(ForumConstants.AUTHORING_TOPICS_INDEX); int topicIdx = NumberUtils.stringToInt(topicIndex, -1); if (topicIdx != -1) { - Message message = messageForm.getMessage(); + Message message = topicFormId.getMessage(); Set topics = getTopics(sessionMap); List rList = new ArrayList(topics); @@ -626,16 +626,16 @@ newMsg.getMessage().setBody(message.getBody()); newMsg.getMessage().setUpdated(new Date()); // update attachment - if (messageForm.getAttachmentFile() != null - && !StringUtils.isEmpty(messageForm.getAttachmentFile().getOriginalFilename())) { + if (topicFormId.getAttachmentFile() != null + && !StringUtils.isEmpty(topicFormId.getAttachmentFile().getOriginalFilename())) { forumService = getForumManager(); - Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile()); + Attachment att = forumService.uploadAttachment(topicFormId.getAttachmentFile()); // only allow one attachment, so replace whatever Set attSet = new HashSet(); attSet.add(att); newMsg.setHasAttachment(true); newMsg.getMessage().setAttachments(attSet); - } else if (!messageForm.isHasAttachment()) { + } else if (!topicFormId.isHasAttachment()) { Set att = newMsg.getMessage().getAttachments(); if (att != null && att.size() > 0) { List delTopicAtt = getTopicDeletedAttachmentList(sessionMap); Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/LearningController.java =================================================================== diff -u -r05f1961fd1d7e74738595255cfdb13e344c40123 -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/LearningController.java (.../LearningController.java) (revision 05f1961fd1d7e74738595255cfdb13e344c40123) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/controller/LearningController.java (.../LearningController.java) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -820,20 +820,20 @@ * Display a editable form for a special topic in order to update it. */ @RequestMapping("/editTopic") - public String editTopic(@ModelAttribute MessageForm messageForm, HttpServletRequest request) + public String editTopic(@ModelAttribute("editForm") MessageForm editForm, HttpServletRequest request) throws PersistenceException { Long topicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); MessageDTO topic = getTopic(topicId); // echo current topic content to web page if (topic != null) { - messageForm.setMessage(topic.getMessage()); + editForm.setMessage(topic.getMessage()); request.setAttribute(ForumConstants.AUTHORING_TOPIC, topic); } // cache this topicID, using in Update topic - SessionMap sessionMap = getSessionMap(request, messageForm); + SessionMap sessionMap = getSessionMap(request, editForm); sessionMap.put(ForumConstants.ATTR_TOPIC_ID, topicId); // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java (.../MessageForm.java) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java (.../MessageForm.java) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -77,23 +77,22 @@ */ public MultiValueMap validate(HttpServletRequest request) { - Forum forum = null; MultiValueMap errorMap = new LinkedMultiValueMap<>(); try { if (StringUtils.isBlank(message.getSubject())) { - errorMap.add("message.subject" + forum.getUid(), messageService.getMessage("error.subject.required")); + errorMap.add("message.subject", messageService.getMessage("error.subject.required")); } boolean isTestHarness = Boolean.valueOf(request.getParameter("testHarness")); if (!isTestHarness && StringUtils.isBlank(message.getBody())) { - errorMap.add("message.body" + forum.getUid(), messageService.getMessage("error.body.required")); + errorMap.add("message.body", messageService.getMessage("error.body.required")); } // validate item size boolean largeFile = true; if (request.getRequestURI().indexOf("/learning/") != -1) { if ((this.getAttachmentFile() != null) && FileUtil.isExecutableFile(this.getAttachmentFile().getOriginalFilename())) { - errorMap.add("message.attachment" + forum.getUid(), messageService.getMessage("error.attachment.executable")); + errorMap.add("message.attachment", messageService.getMessage("error.attachment.executable")); } largeFile = false; } Index: lams_tool_forum/web/jsps/authoring/basic.jsp =================================================================== diff -u -r05f1961fd1d7e74738595255cfdb13e344c40123 -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/web/jsps/authoring/basic.jsp (.../basic.jsp) (revision 05f1961fd1d7e74738595255cfdb13e344c40123) +++ lams_tool_forum/web/jsps/authoring/basic.jsp (.../basic.jsp) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -131,13 +131,13 @@ } showBusy("itemAttachmentArea"); - var formData = new FormData(document.getElementById("messageForm")); + var formData = new FormData(document.getElementById("topicFormId")); $.ajax({ // create an AJAX call... data: formData, processData: false, // tell jQuery not to process the data contentType: false, // tell jQuery not to set contentType - type: $("#messageForm").attr('method'), - url: $("#messageForm").attr('action'), + type: $("#topicFormId").attr('method'), + url: $("#topicFormId").attr('action'), success: function(data) { $('#messageArea').html(data); hideBusy("itemAttachmentArea"); Index: lams_tool_forum/web/jsps/authoring/message/create.jsp =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/web/jsps/authoring/message/create.jsp (.../create.jsp) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/web/jsps/authoring/message/create.jsp (.../create.jsp) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -18,31 +18,31 @@ <%@ include file="/common/messages.jsp"%> - + - +
- +
- - + + - +
- +
- +
Index: lams_tool_forum/web/jsps/authoring/message/edit.jsp =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/web/jsps/authoring/message/edit.jsp (.../edit.jsp) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/web/jsps/authoring/message/edit.jsp (.../edit.jsp) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -15,7 +15,7 @@ <%@ include file="/common/messages.jsp"%> - + "> @@ -24,20 +24,20 @@
- +
- - + + - +
- +
Index: lams_tool_forum/web/jsps/authoring/parts/msgattachment.jsp =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/web/jsps/authoring/parts/msgattachment.jsp (.../msgattachment.jsp) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/web/jsps/authoring/parts/msgattachment.jsp (.../msgattachment.jsp) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -7,7 +7,7 @@ - +
  • Index: lams_tool_forum/web/jsps/learning/edit.jsp =================================================================== diff -u -re062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/web/jsps/learning/edit.jsp (.../edit.jsp) (revision e062c5aeec4bd7e7f970ae5e907e8a7e59edaeaf) +++ lams_tool_forum/web/jsps/learning/edit.jsp (.../edit.jsp) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -116,10 +116,10 @@ + focus="message.subject" enctype="multipart/form-data" id="editForm" modelAttribute="editForm"> - +
    Index: lams_tool_forum/web/jsps/learning/message/bodyarea.jsp =================================================================== diff -u -r05f1961fd1d7e74738595255cfdb13e344c40123 -r82bfa2d1d62378051c32cff20a826607fdf7a8e5 --- lams_tool_forum/web/jsps/learning/message/bodyarea.jsp (.../bodyarea.jsp) (revision 05f1961fd1d7e74738595255cfdb13e344c40123) +++ lams_tool_forum/web/jsps/learning/message/bodyarea.jsp (.../bodyarea.jsp) (revision 82bfa2d1d62378051c32cff20a826607fdf7a8e5) @@ -12,7 +12,7 @@ <%-- Does not user general tag because this field need keep compatible with CKEditor's content --%> - + @@ -40,7 +40,7 @@ var counter = function(evt) { var value = isCkeditor ? ckeditor.getSnapshot() - : $('textarea[id="message.body__lamstextarea"]').val(); + : $('textarea#messageBody').val(); var charactersCount = getNumberOfCharacters(value, isCkeditor); //limit is not exceeded @@ -74,8 +74,7 @@ this.value = this.value.substring(0, limit); //fix a bug: when change "this.value", onchange event won't be fired any more. So this will //manually handle onchange event. It is a kind of crack coding! - filterData(document.getElementById('message.body__lamstextarea'), - document.getElementById('message.body__lamshidden')); + filterData(document.getElementById('messageBody')); } }; @@ -93,7 +92,7 @@ ckeditor.on('instanceReady', counter); } else { - $('textarea[id="message.body__lamstextarea"]').on('change keydown keypress keyup paste', counter); + $('textarea#messageBody').on('change keydown keypress keyup paste', counter); //count characters initially counter(); } @@ -135,7 +134,7 @@ ckeditor.on('instanceReady', counter); } else { - $('textarea[id="message.body__lamstextarea"]').on('change keydown keypress keyup paste', counter); + $('textarea#messageBody').on('change keydown keypress keyup paste', counter); //count characters initially counter(); } @@ -168,5 +167,4 @@
    - - +