Index: lams_tool_forum/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/build.xml,v diff -u -r1.29 -r1.30 --- lams_tool_forum/build.xml 20 Oct 2005 04:21:52 -0000 1.29 +++ lams_tool_forum/build.xml 31 Oct 2005 23:49:35 -0000 1.30 @@ -256,10 +256,9 @@ - + - Index: lams_tool_forum/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/xdoclet/struts-actions.xml,v diff -u -r1.7 -r1.8 --- lams_tool_forum/conf/xdoclet/struts-actions.xml 27 Oct 2005 07:25:35 -0000 1.7 +++ lams_tool_forum/conf/xdoclet/struts-actions.xml 31 Oct 2005 23:49:35 -0000 1.8 @@ -79,10 +79,32 @@ + name="messageForm" + validate="false" + parameter="viewTopic" + scope="request"> + + + + + + + + + tags-bean - /WEB-INF/struts/struts-bean.tld + /WEB-INF/struts/tlds/struts-bean.tld tags-html - /WEB-INF/struts/struts-html.tld + /WEB-INF/struts/tlds/struts-html.tld tags-logic - /WEB-INF/struts/struts-logic.tld + /WEB-INF/struts/tlds/struts-logic.tld tags-tiles - /WEB-INF/struts/struts-tiles.tld + /WEB-INF/struts/tlds/struts-tiles.tld tags-bean-el - /WEB-INF/struts/struts-bean-el.tld + /WEB-INF/struts/tlds/struts-bean-el.tld tags-html-el - /WEB-INF/struts/struts-html-el.tld + /WEB-INF/struts/tlds/struts-html-el.tld tags-logic-el - /WEB-INF/struts/struts-logic-el.tld + /WEB-INF/struts/tlds/struts-logic-el.tld tags-tiles-el - /WEB-INF/struts/struts-tiles-el.tld + /WEB-INF/struts/tlds/struts-tiles-el.tld + + tags-c + /WEB-INF/struts/tlds/c.tld + + - http://java.sun.com/jstl/fmt - /WEB-INF/JSTL/fmt.tld + tags-fmt + /WEB-INF/jstl/tlds/fmt.tld - http://java.sun.com/jstl/fmt-rt - /WEB-INF/JSTL/fmt-rt.tld + tags-fmt-rt + /WEB-INF/jstl/tlds/fmt-rt.tld - http://java.sun.com/jstl/core - /WEB-INF/JSTL/c.tld + tags-core + /WEB-INF/jstl/tlds/c.tld - http://java.sun.com/jstl/core-rt - /WEB-INF/JSTL/c-rt.tld + tags-core-rt + /WEB-INF/jstl/tlds/c-rt.tld + + + + + tags-fck-editor + /WEB-INF/fckeditor/tlds/FCKeditor.tld + + @@ -78,10 +90,3 @@ forum /WEB-INF/forum.tld - - - datetime - /WEB-INF/taglibs-datetime.tld - - - \ No newline at end of file Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dto/MessageDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dto/MessageDTO.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dto/MessageDTO.java 31 Oct 2005 23:49:36 -0000 1.1 @@ -0,0 +1,85 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + *USA + * + *http://www.gnu.org/licenses/gpl.txt + */ +package org.lamsfoundation.lams.tool.forum.dto; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.lamsfoundation.lams.tool.forum.persistence.Message; + +public class MessageDTO { + + private Message message; + private String author; + private boolean hasAttachment; + public static MessageDTO getMessageDTO(Message msg, String authorName){ + if(msg == null) + return null; + + MessageDTO dto = new MessageDTO(); + dto.setMessage(msg); + dto.setAuthor(authorName); + if(msg.getAttachments() == null || msg.getAttachments().isEmpty()) + dto.setHasAttachment(false); + else + dto.setHasAttachment(true); + return dto; + } + public static Set getMessageDTO(Set msgSet,String authorName){ + Set retSet = new HashSet(); + if(msgSet == null || msgSet.isEmpty()) + return retSet; + + Iterator iter = msgSet.iterator(); + while(iter.hasNext()){ + Message msg = (Message) iter.next(); + MessageDTO msgDto = new MessageDTO(); + if(msg.getAttachments() == null || msg.getAttachments().isEmpty()) + msgDto.setHasAttachment(false); + else + msgDto.setHasAttachment(true); + msgDto.setMessage(msg); + msgDto.setAuthor(authorName); + retSet.add(msgDto); + } + return retSet; + } + public String getAuthor() { + return author; + } + public void setAuthor(String author) { + this.author = author; + } + public boolean getHasAttachment() { + return hasAttachment; + } + public void setHasAttachment(boolean isAttachment) { + this.hasAttachment = isAttachment; + } + public Message getMessage() { + return message; + } + public void setMessage(Message message) { + this.message = message; + } + +} Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java,v diff -u -r1.7 -r1.8 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 28 Oct 2005 00:52:35 -0000 1.7 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 31 Oct 2005 23:49:35 -0000 1.8 @@ -3,7 +3,6 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; @@ -18,6 +17,7 @@ import org.lamsfoundation.lams.contentrepository.NodeKey; import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; import org.lamsfoundation.lams.tool.ToolContentManager; @@ -52,10 +52,6 @@ private ForumToolContentHandler toolContentHandler; private IRepositoryService repositoryService; - public Forum createForum(Forum forum) throws PersistenceException { - forumDao.save(forum); - return forum; - } public Forum editForum(Forum forum) throws PersistenceException { forumDao.saveOrUpdate(forum); @@ -316,4 +312,18 @@ public void setRepositoryService(IRepositoryService repositoryService) { this.repositoryService = repositoryService; } + + public Attachment uploadAttachment(FormFile uploadFile) throws PersistenceException { + if(uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) + throw new ForumException("Could not find upload file: " + uploadFile); + + NodeKey nodeKey = processFile(uploadFile,IToolContentHandler.TYPE_ONLINE); + Attachment file = new Attachment(); + file.setFileType(IToolContentHandler.TYPE_ONLINE); + file.setFileUuid(nodeKey.getUuid()); + file.setFileVersionId(nodeKey.getVersion()); + file.setFileName(uploadFile.getFileName()); + + return file; + } } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java,v diff -u -r1.5 -r1.6 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java 28 Oct 2005 00:52:36 -0000 1.5 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java 31 Oct 2005 23:49:35 -0000 1.6 @@ -1,7 +1,6 @@ package org.lamsfoundation.lams.tool.forum.service; import java.util.List; -import java.util.Set; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.tool.forum.core.PersistenceException; @@ -18,7 +17,6 @@ */ public interface IForumService { - public Forum createForum(Forum forum) throws PersistenceException; public Forum editForum(Forum forum) throws PersistenceException; public Forum getForum(Long forumId) throws PersistenceException; public Forum getForumByContentId(Long contentID) throws PersistenceException; @@ -32,6 +30,15 @@ public void deleteMessage(Long messageId) throws PersistenceException; public Message replyToMessage(Long parentId, Message message) throws PersistenceException; public Attachment uploadInstructionFile(Long contentId, FormFile file, String type) throws PersistenceException; + /** + * This method only upload the given file into system repository. It does not execute any database operation. + * + * @param file + * @return Attachment + * A new instance of attachment has uploaded file VersionID and UUID information. + * @throws PersistenceException + */ + public Attachment uploadAttachment(FormFile file) throws PersistenceException; public void deleteInstructionFile(Long contentID, Long uuID, Long versionID, String type) throws PersistenceException; public void deleteFromRepository(Long uuID, Long versionID) throws PersistenceException; Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java,v diff -u -r1.7 -r1.8 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java 27 Oct 2005 05:29:52 -0000 1.7 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java 31 Oct 2005 23:49:35 -0000 1.8 @@ -15,6 +15,9 @@ public static final String AUTHORING_DTO = "authoring"; public static final String AUTHORING_TOPICS_LIST = "topicList"; + public static final String AUTHORING_TOPICS_INDEX = "topicIndex"; + public static final String AUTHORING_TOPICS = "topic"; + public static final String DEFAULT_TITLE = "Forum"; //TODO:hard code!!! need to read from config public static final String TOOL_URL_BASE = "/lams/tool/lafrum11/"; Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/Attic/ApplicationResources.properties,v diff -u -r1.4 -r1.5 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/ApplicationResources.properties 19 Oct 2005 05:55:59 -0000 1.4 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/ApplicationResources.properties 31 Oct 2005 23:49:36 -0000 1.5 @@ -27,6 +27,14 @@ label.authoring.online.delete=Delete label.authoring.offline.delete=Delete +lable.topic.title.subject=Subject +lable.topic.title.body=Body +lable.topic.title.update=Last post +lable.topic.title.author=Author +lable.topic.title.startedby=Start by +lable.topic.title.replies=Replies +lable.topic.subject.by=By + authoring.exception= There is a problem in forum authoring page, the reason is {0} #-------------------------END Authoring Labels END-----------------# @@ -72,6 +80,7 @@ title.message.open = View Message title.message.reply = Reply Message title.message.edit = Edit Message +title.message.view=View Message message.label.subject = Subject message.label.body = Body message.label.attachment = Attachment @@ -84,11 +93,13 @@ label.delete = Delete label.download = Download label.view = View - +label.edit = Edit +label.reply = Reply +label.done = Done ##Buttons -button.upload = upload -button.done = done -button.submit = submit +button.upload = Upload +button.done = Done +button.submit = Submit button.on = On button.off = Off Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java,v diff -u -r1.7 -r1.8 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java 28 Oct 2005 02:04:43 -0000 1.7 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java 31 Oct 2005 23:49:35 -0000 1.8 @@ -32,6 +32,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang.StringUtils; @@ -44,14 +45,18 @@ import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.forum.core.PersistenceException; +import org.lamsfoundation.lams.tool.forum.dto.MessageDTO; import org.lamsfoundation.lams.tool.forum.persistence.Attachment; import org.lamsfoundation.lams.tool.forum.persistence.Forum; import org.lamsfoundation.lams.tool.forum.persistence.Message; +import org.lamsfoundation.lams.tool.forum.persistence.MessageDao; import org.lamsfoundation.lams.tool.forum.service.IForumService; import org.lamsfoundation.lams.tool.forum.util.ForumConstants; import org.lamsfoundation.lams.tool.forum.web.forms.ForumForm; import org.lamsfoundation.lams.tool.forum.web.forms.MessageForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -83,6 +88,12 @@ if (param.equals("viewTopic")) { return viewTopic(mapping, form, request, response); } + if (param.equals("editTopic")) { + return editTopic(mapping, form, request, response); + } + if (param.equals("updateTopic")) { + return updateTopic(mapping, form, request, response); + } if (param.equals("finishTopic")) { return finishTopic(mapping, form, request, response); } @@ -121,13 +132,18 @@ ForumForm forumForm = (ForumForm)form; //get back the topic list and display them on page forumService = getForumManager(); + //get login user (author) + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); List topics = null; Forum forum = null; try { forum = forumService.getForumByContentId(contentId); if(forum != null){ - topics = new ArrayList(forum.getMessages()); + topics = new ArrayList(MessageDTO.getMessageDTO(forum.getMessages(), user.getFirstName() + " " + + user.getLastName())); forumForm.setForum(forum); } forumForm.setToolContentID(contentId); @@ -154,16 +170,33 @@ HttpServletResponse response) throws IOException, ServletException, PersistenceException { List topics = (List) request.getSession().getAttribute(ForumConstants.AUTHORING_TOPICS_LIST); + //get login user (author) + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + MessageForm messageForm = (MessageForm) form; Message message = messageForm.getMessage(); message.setIsAuthored(true); message.setCreated(new Date()); -// TODO: get user from shared session -// message.setCreatedBy(); + message.setUpdated(new Date()); + Set attSet = null; + if(messageForm.getAttachmentFile() != null + && !StringUtils.isEmpty(messageForm.getAttachmentFile().getFileName())){ + forumService = getForumManager(); + Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile()); + //only allow one attachment, so replace whatever + attSet = new HashSet(); + attSet.add(att); + } + message.setAttachments(attSet); + message.setCreatedBy(new Long(user.getUserID().intValue())); + if (topics == null) { topics = new ArrayList(); } - topics.add(message); + + topics.add(MessageDTO.getMessageDTO(message,user.getFirstName()+" "+user.getLastName())); request.getSession().setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, topics); return mapping.findForward("success"); @@ -173,12 +206,13 @@ HttpServletResponse response) throws PersistenceException { List topics = (List) request.getSession().getAttribute(ForumConstants.AUTHORING_TOPICS_LIST); - String topicIndex = (String) request.getParameter("topicIndex"); + String topicIndex = (String) request.getParameter(ForumConstants.AUTHORING_TOPICS_INDEX); int topicIdx = NumberUtils.stringToInt(topicIndex,-1); + if(topicIdx != -1){ - Message topic = (Message) topics.remove(topicIdx); - if (topic != null && topic.getUid() != null) { - getForumManager().deleteMessage(topic.getUid()); + MessageDTO topic = (MessageDTO) topics.remove(topicIdx); + if (topic != null && topic.getMessage() != null && topic.getMessage().getUid() != null) { + getForumManager().deleteMessage(topic.getMessage().getUid()); } request.getSession().setAttribute(ForumConstants.AUTHORING_TOPICS_LIST,topics); } @@ -191,17 +225,23 @@ sb.append(""); Iterator iter = topics.iterator(); for(int idx=0;iter.hasNext();idx++){ - Message msg = (Message) iter.next(); - sb.append(""); - sb.append(""); - sb.append(msg.getSubject()); - sb.append(""); - sb.append("Delete"); - sb.append(""); +// MessageDTO msg = (MessageDTO) iter.next(); +// sb.append(""); +// sb.append(""); +// sb.append(msg.getSubject()); +// sb.append(""); +// sb.append("Delete"); +// sb.append(""); } sb.append(""); try { @@ -215,18 +255,90 @@ } public ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws PersistenceException { - //TODO - return null; + List topics = (List) request.getSession().getAttribute(ForumConstants.AUTHORING_TOPICS_LIST); + String topicIndex = (String) request.getParameter(ForumConstants.AUTHORING_TOPICS_INDEX); + int topicIdx = NumberUtils.stringToInt(topicIndex,-1); + if(topicIdx == -1){ + topicIndex = (String) request.getAttribute(ForumConstants.AUTHORING_TOPICS_INDEX); + topicIdx = NumberUtils.stringToInt(topicIndex,-1); + } + if(topicIdx != -1){ + MessageDTO topic = (MessageDTO) topics.get(topicIdx); + request.setAttribute(ForumConstants.AUTHORING_TOPICS_INDEX,topicIndex); + request.setAttribute(ForumConstants.AUTHORING_TOPICS,topic); + } + + return mapping.findForward("success"); + } + public ActionForward editTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws PersistenceException { + MessageForm msgForm = (MessageForm)form; + List topics = (List) request.getSession().getAttribute(ForumConstants.AUTHORING_TOPICS_LIST); + String topicIndex = (String) request.getParameter(ForumConstants.AUTHORING_TOPICS_INDEX); + int topicIdx = NumberUtils.stringToInt(topicIndex,-1); + if(topicIdx != -1){ + MessageDTO topic = (MessageDTO) topics.get(topicIdx); + if (topic != null) { + msgForm.setMessage(topic.getMessage()); + } + } + request.setAttribute(ForumConstants.AUTHORING_TOPICS_INDEX,topicIndex); + return mapping.findForward("success"); + } + public ActionForward updateTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws PersistenceException { + List topics = (List) request.getSession().getAttribute(ForumConstants.AUTHORING_TOPICS_LIST); + String topicIndex = (String) request.getParameter(ForumConstants.AUTHORING_TOPICS_INDEX); + int topicIdx = NumberUtils.stringToInt(topicIndex,-1); + + if(topicIdx != -1){ + MessageForm messageForm = (MessageForm) form; + Message message = messageForm.getMessage(); + MessageDTO oldMsg = (MessageDTO) topics.get(topicIdx); + if(oldMsg.getMessage()== null) + oldMsg.setMessage(new Message()); + oldMsg.getMessage().setSubject(message.getSubject()); + oldMsg.getMessage().setBody(message.getBody()); + oldMsg.getMessage().setUpdated(new Date()); + oldMsg.setHasAttachment(false); + Set attSet = null; + if(messageForm.getAttachmentFile() != null + && !StringUtils.isEmpty(messageForm.getAttachmentFile().getFileName())){ + forumService = getForumManager(); + Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile()); + //only allow one attachment, so replace whatever + attSet = new HashSet(); + attSet.add(att); + oldMsg.setHasAttachment(true); + } + oldMsg.getMessage().setAttachments(attSet); + } + + request.setAttribute(ForumConstants.AUTHORING_TOPICS_INDEX,topicIndex); + request.getSession().setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, topics); + + return mapping.findForward("success"); + } + + public ActionForward finishTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws PersistenceException { List topics = (List) request.getSession().getAttribute(ForumConstants.AUTHORING_TOPICS_LIST); ForumForm forumForm = (ForumForm)form; Forum forum = forumForm.getForum(); - forum.setMessages(new HashSet(topics)); + Set msgSet = new HashSet(); + if(topics != null){ + Iterator iter = topics.iterator(); + while(iter.hasNext()){ + MessageDTO dto = (MessageDTO) iter.next(); + msgSet.add(dto.getMessage()); + } + } + forum.setMessages(msgSet); return mapping.findForward("success"); Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java,v diff -u -r1.4 -r1.5 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java 20 Oct 2005 04:21:52 -0000 1.4 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java 31 Oct 2005 23:49:36 -0000 1.5 @@ -1,9 +1,10 @@ package org.lamsfoundation.lams.tool.forum.web.forms; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.upload.FormFile; import org.apache.struts.validator.ValidatorForm; import org.lamsfoundation.lams.tool.forum.persistence.Message; @@ -17,12 +18,15 @@ * Time: 15:44:47 */ public class MessageForm extends ValidatorForm { + private static final long serialVersionUID = -9054365604649146734L; + private static Logger logger = Logger.getLogger(ForumForm.class.getName()); protected Message message; protected Long forumId; protected Long parentId; protected Long topicId; private String attachmentName; + private FormFile attachmentFile; public MessageForm() { message = new Message(); @@ -63,14 +67,13 @@ public ActionErrors validate(ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { ActionErrors errors = super.validate(mapping, request); - ActionError ae; try{ if ("".equals(message.getSubject())) { - ActionError error = new ActionError("error.valueReqd"); + ActionMessage error = new ActionMessage("error.valueReqd"); errors.add("message.subject", error); } if ("".equals(message.getBody())) { - ActionError error = new ActionError("error.valueReqd"); + ActionMessage error = new ActionMessage("error.valueReqd"); errors.add("message.body", error); } } catch (Exception e) { @@ -87,4 +90,14 @@ this.attachmentName = attachmentName; } + public FormFile getAttachmentFile() { + return attachmentFile; + } + + public void setAttachmentFile(FormFile attachmentFile) { + this.attachmentFile = attachmentFile; + } + + + } Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/Attic/ForumManagerImplTest.java,v diff -u -r1.13 -r1.14 --- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java 28 Oct 2005 00:58:27 -0000 1.13 +++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java 31 Oct 2005 23:49:36 -0000 1.14 @@ -31,7 +31,7 @@ Forum inForum = this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"); inForum.setAttachments(attachments); - Forum forum = forumManager.createForum(inForum); + Forum forum = forumManager.editForum(inForum); assertNotNull("Forum Id is null", forum.getUid()); Forum reloadedForum = forumManager.getForum(forum.getUid()); assertEquals(reloadedForum.getTitle(), "TEST"); @@ -56,7 +56,7 @@ } public void testCreateAndDeleteForumWithNullAttachments() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS")); + Forum forum = forumManager.editForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS")); assertNotNull("Forum Id is null", forum.getUid()); Forum reloadedForum = forumManager.getForum(forum.getUid()); assertEquals(reloadedForum.getTitle(), "TEST"); @@ -80,7 +80,7 @@ } public void testCreateAndDeleteForumWithNullInstructions() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), false, false , false, "", "", "")); + Forum forum = forumManager.editForum(this.getForum("TEST", new Long("1002"), false, false , false, "", "", "")); assertNotNull("Forum Id is null", forum.getUid()); Forum reloadedForum = forumManager.getForum(forum.getUid()); assertEquals(reloadedForum.getTitle(), "TEST"); @@ -104,7 +104,7 @@ } public void testCreateModifyAndDeleteMessage() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS")); + Forum forum = forumManager.editForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS")); Message message = forumManager.createMessage(forum.getUid(), this.getMessage(new Long("1002"), "TEST", "TEST", true, true)); assertNotNull("Message Id is null", message.getUid()); @@ -143,7 +143,7 @@ } public void testReplyToMessage() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS")); + Forum forum = forumManager.editForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS")); Message message = forumManager.createMessage(forum.getUid(), this.getMessage(new Long("1002"), "TEST", "TEST", true, true)); assertNotNull("Message Id is null", message.getUid()); Message reloaded = forumManager.getMessage(message.getUid()); Index: lams_tool_forum/web/WEB-INF/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/WEB-INF/Attic/struts-config.xml,v diff -u -r1.13 -r1.14 --- lams_tool_forum/web/WEB-INF/struts-config.xml 27 Oct 2005 07:25:35 -0000 1.13 +++ lams_tool_forum/web/WEB-INF/struts-config.xml 31 Oct 2005 23:49:36 -0000 1.14 @@ -116,9 +116,29 @@ + name="messageForm" + validate="false" + parameter="viewTopic" + scope="request"> + + + + + + + /403.html - + tags-bean - /WEB-INF/struts/struts-bean.tld + /WEB-INF/struts/tlds/struts-bean.tld tags-html - /WEB-INF/struts/struts-html.tld + /WEB-INF/struts/tlds/struts-html.tld tags-logic - /WEB-INF/struts/struts-logic.tld + /WEB-INF/struts/tlds/struts-logic.tld tags-tiles - /WEB-INF/struts/struts-tiles.tld + /WEB-INF/struts/tlds/struts-tiles.tld tags-bean-el - /WEB-INF/struts/struts-bean-el.tld + /WEB-INF/struts/tlds/struts-bean-el.tld tags-html-el - /WEB-INF/struts/struts-html-el.tld + /WEB-INF/struts/tlds/struts-html-el.tld tags-logic-el - /WEB-INF/struts/struts-logic-el.tld + /WEB-INF/struts/tlds/struts-logic-el.tld tags-tiles-el - /WEB-INF/struts/struts-tiles-el.tld + /WEB-INF/struts/tlds/struts-tiles-el.tld + + tags-c + /WEB-INF/struts/tlds/c.tld + + - http://java.sun.com/jstl/fmt - /WEB-INF/JSTL/fmt.tld + tags-fmt + /WEB-INF/jstl/tlds/fmt.tld - http://java.sun.com/jstl/fmt-rt - /WEB-INF/JSTL/fmt-rt.tld + tags-fmt-rt + /WEB-INF/jstl/tlds/fmt-rt.tld - http://java.sun.com/jstl/core - /WEB-INF/JSTL/c.tld + tags-core + /WEB-INF/jstl/tlds/c.tld - http://java.sun.com/jstl/core-rt - /WEB-INF/JSTL/c-rt.tld + tags-core-rt + /WEB-INF/jstl/tlds/c-rt.tld + + + + + tags-fck-editor + /WEB-INF/fckeditor/tlds/FCKeditor.tld + + @@ -218,11 +231,6 @@ forum /WEB-INF/forum.tld - - - datetime - /WEB-INF/taglibs-datetime.tld - Index: lams_tool_forum/web/includes/taglibs.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/includes/Attic/taglibs.jsp,v diff -u -r1.4 -r1.5 --- lams_tool_forum/web/includes/taglibs.jsp 20 Oct 2005 04:21:51 -0000 1.4 +++ lams_tool_forum/web/includes/taglibs.jsp 31 Oct 2005 23:49:35 -0000 1.5 @@ -1,7 +1,7 @@ -<%@ taglib uri="/WEB-INF/struts/struts-bean.tld" prefix="bean" %> -<%@ taglib uri="/WEB-INF/struts/struts-logic.tld" prefix="logic" %> -<%@ taglib uri="/WEB-INF/struts/struts-tiles.tld" prefix="tiles" %> +<%@ taglib uri="tags-bean" prefix="bean" %> +<%@ taglib uri="tags-logic" prefix="logic" %> +<%@ taglib uri="tags-tiles" prefix="tiles" %> <%@ taglib uri="tags-html-el" prefix="html" %> -<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> -<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> Index: lams_tool_forum/web/jsps/authoring/message/create.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/authoring/message/create.jsp,v diff -u -r1.8 -r1.9 --- lams_tool_forum/web/jsps/authoring/message/create.jsp 27 Oct 2005 07:25:35 -0000 1.8 +++ lams_tool_forum/web/jsps/authoring/message/create.jsp 31 Oct 2005 23:49:35 -0000 1.9 @@ -1,17 +1,10 @@ <%@ include file="/includes/taglibs.jsp" %> -
+ onsubmit="return validateMessageForm(this);" enctype="multipart/form-data">
<%@ include file="/jsps/message/topiclist.jsp" %> <%@ include file="/jsps/message/form.jsp" %> Index: lams_tool_forum/web/jsps/authoring/message/edit.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/authoring/message/edit.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/web/jsps/authoring/message/edit.jsp 31 Oct 2005 23:49:35 -0000 1.1 @@ -0,0 +1,12 @@ +<%@ include file="/includes/taglibs.jsp" %> + + +
+ +
+ "> + <%@ include file="/jsps/message/form.jsp" %> +
+
+
Index: lams_tool_forum/web/jsps/authoring/message/view.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/authoring/message/Attic/view.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/web/jsps/authoring/message/view.jsp 31 Oct 2005 23:49:35 -0000 1.1 @@ -0,0 +1,8 @@ +<%@ include file="/includes/taglibs.jsp" %> + + +
+
+ <%@ include file="/jsps/message/topicview.jsp" %> +
+
Index: lams_tool_forum/web/jsps/message/form.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/message/Attic/form.jsp,v diff -u -r1.3 -r1.4 --- lams_tool_forum/web/jsps/message/form.jsp 27 Oct 2005 07:25:35 -0000 1.3 +++ lams_tool_forum/web/jsps/message/form.jsp 31 Oct 2005 23:49:35 -0000 1.4 @@ -3,20 +3,20 @@ * + tabindex="1" property="message.subject" /> +    + tabindex="2" property="message.body" /> +
   @@ -26,7 +26,7 @@ - + Index: lams_tool_forum/web/jsps/message/topiclist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/message/Attic/topiclist.jsp,v diff -u -r1.3 -r1.4 --- lams_tool_forum/web/jsps/message/topiclist.jsp 27 Oct 2005 05:29:53 -0000 1.3 +++ lams_tool_forum/web/jsps/message/topiclist.jsp 31 Oct 2005 23:49:35 -0000 1.4 @@ -1,25 +1,54 @@ -
+
+ +
- - - - - +
+
Topic -
- - + + - -
- - - - - - - Topic
+ + + + + + + + + + + + + + + + + + "> + + + + + + + + + + + + +
Index: lams_tool_forum/web/jsps/message/topicview.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/message/Attic/topicview.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_forum/web/jsps/message/topicview.jsp 31 Oct 2005 23:49:35 -0000 1.1 @@ -0,0 +1,61 @@ +
+
+
+
+ + + + + + + + + + + + + + + + +
+ +
+ - + + +
+
+ +
+
+ + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+
+
+
Index: lams_tool_forum/web/jsps/sharing/share.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/sharing/Attic/share.jsp,v diff -u -r1.2 -r1.3 --- lams_tool_forum/web/jsps/sharing/share.jsp 27 Oct 2005 05:29:52 -0000 1.2 +++ lams_tool_forum/web/jsps/sharing/share.jsp 31 Oct 2005 23:49:36 -0000 1.3 @@ -2,9 +2,9 @@ <%@ page language="java"%> <%@ taglib uri="tags-html-el" prefix="html" %> -<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> -<%@ taglib uri="http://java.sun.com/jstl/core-rt" prefix="c_rt"%> -<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-core-rt" prefix="c_rt"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> <% String LAMS_WEB_ROOT="/lams"; %>