Index: lams_tool_forum/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/language/lams/ApplicationResources.properties,v diff -u -r1.55.2.5 -r1.55.2.6 --- lams_tool_forum/conf/language/lams/ApplicationResources.properties 16 Feb 2015 14:16:22 -0000 1.55.2.5 +++ lams_tool_forum/conf/language/lams/ApplicationResources.properties 23 Apr 2015 12:51:42 -0000 1.55.2.6 @@ -236,6 +236,14 @@ label.latest.posting.date =Latest post on label.number.of.replies =Replies message.no.reflection.available =No notebook entry was added. +label.show.more.messages =More posts +label.loading.messages =Loading more posts +label.show.replies=Show Replies +label.hide.replies=Hide Replies +label.showhide.prompt=Show/Hide Replies +message.complete.or.cancel.reply=Please complete or cancel the current reply before starting a new reply. +message.complete.or.cancel.edit=Please complete or cancel the current edit before starting a new edit. +error.cannot.redisplay.please.refresh=Your changes have been saved but cannot be redisplayed. Please select refresh to reload the forum messages. #======= End labels: Exported 230 labels for en AU ===== Index: lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.46.2.4 -r1.46.2.5 --- lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties 16 Feb 2015 14:16:22 -0000 1.46.2.4 +++ lams_tool_forum/conf/language/lams/ApplicationResources_en_AU.properties 23 Apr 2015 12:51:42 -0000 1.46.2.5 @@ -236,6 +236,14 @@ label.latest.posting.date =Latest post on label.number.of.replies =Replies message.no.reflection.available =No notebook entry was added. +label.show.more.messages =More posts +label.loading.messages =Loading more posts +label.show.replies=Show Replies +label.hide.replies=Hide Replies +label.showhide.prompt=Show/Hide Replies +message.complete.or.cancel.reply=Please complete or cancel the current reply before starting a new reply. +message.complete.or.cancel.edit=Please complete or cancel the current edit before starting a new edit. +error.cannot.redisplay.please.refresh=Your changes have been saved but cannot be redisplayed. Please select refresh to reload the forum messages. #======= End labels: Exported 230 labels for en AU ===== 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.52.2.1 -r1.52.2.2 --- lams_tool_forum/conf/xdoclet/struts-actions.xml 19 Jan 2015 21:34:30 -0000 1.52.2.1 +++ lams_tool_forum/conf/xdoclet/struts-actions.xml 23 Apr 2015 12:51:42 -0000 1.52.2.2 @@ -177,6 +177,21 @@ parameter="viewTopic" scope="request"> + + + + + + + + + + + + + + + ? and message_level = 1"; + private static final String SQL_QUERY_FIND_NEXT_THREAD_MESSAGES = "from " + MessageSeq.class.getName() + + " where root_message_uid = ? and thread_message_uid = ? and message_level > 1"; + private static final String SQL_QUERY_GET_COMPLETE_THREAD = "from " + MessageSeq.class.getName() + + " where thread_message_uid = ?"; + private static final String SQL_QUERY_GET_SEQ_BY_MESSAGE = "from " + MessageSeq.class.getName() + + " where message_uid = ?"; private static final String SQL_QUERY_NUM_POSTS_BY_TOPIC = "select count(*) from " + MessageSeq.class.getName() + " ms where ms.message.createdBy.userId=? and ms.message.isAuthored = false and ms.rootMessage.uid=?"; private static final String SQL_QUERY_NUM_POSTS_BY_ROOT_MESSAGE_AND_DATE = "SELECT count(*) FROM " + MessageSeq.class.getName() + " seq WHERE seq.rootMessage.uid = ? AND seq.message.updated > ?"; + private static final Logger log = Logger.getLogger(MessageSeqDao.class); + + public MessageSeq getById(Long messageSeqId) { + return (MessageSeq) find(MessageSeq.class, messageSeqId); + } + + public MessageSeq getByMessageId(Long messageId) { + List list = doFind(SQL_QUERY_GET_SEQ_BY_MESSAGE, messageId); + if (list != null ) { + if ( list.size() > 1) { + log.warn("Looking up message seq by message id="+messageId+". More than one message seq found!"+list.toString()); + } + return (MessageSeq) list.get(0); + } else { + return null; + } + } + + public List getThreadByThreadId(final Long threadMessageId) { + return doFind(SQL_QUERY_GET_COMPLETE_THREAD, new Object[] { threadMessageId }); + } + + public List getNextThreadByThreadId(final Long rootTopicId, final Long previousThreadMessageId) { + Query queryObject = getSession().createQuery(SQL_QUERY_FIND_NEXT_THREAD_TOP) + .setParameter(0, rootTopicId) + .setParameter(1, previousThreadMessageId) + .setMaxResults(1); + List list = queryObject.list(); + if (list != null && list.size() > 0) { + MessageSeq threadTop = ((MessageSeq) list.get(0)); + List all = doFind(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES, new Object[] { rootTopicId, threadTop.getMessage().getUid() }); + all.add(threadTop); + return all; + } + return list; + } + /* (non-Javadoc) * @see org.lamsfoundation.lams.tool.forum.persistence.hibernate.IMessageSeqDAO#getTopicThread(java.lang.Long) */ @Override - public List getTopicThread(Long rootTopicId) { + public List getCompleteTopic(Long rootTopicId) { return getSession().createCriteria(MessageSeq.class).add(Restrictions.eq("rootMessage.uid", rootTopicId)).list(); -// return doFind(SQL_QUERY_FIND_TOPIC_THREAD, rootTopicId); } /* (non-Javadoc) 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.53.2.1 -r1.53.2.2 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java 19 Jan 2015 21:34:30 -0000 1.53.2.1 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/IForumService.java 23 Apr 2015 12:51:42 -0000 1.53.2.2 @@ -38,6 +38,7 @@ import org.lamsfoundation.lams.tool.forum.persistence.ForumToolSession; import org.lamsfoundation.lams.tool.forum.persistence.ForumUser; import org.lamsfoundation.lams.tool.forum.persistence.Message; +import org.lamsfoundation.lams.tool.forum.persistence.MessageSeq; import org.lamsfoundation.lams.tool.forum.persistence.PersistenceException; import org.lamsfoundation.lams.util.audit.IAuditService; @@ -148,7 +149,7 @@ * @return * @throws PersistenceException */ - Message replyTopic(Long parentId, Long sessionId, Message message) throws PersistenceException; + MessageSeq replyTopic(Long parentId, Long sessionId, Message message) throws PersistenceException; /** * Delete the topic by given topic ID. The function will delete all children topics under this topic. @@ -172,14 +173,33 @@ // *********************Get topic methods ********************** // ************************************************************************************ /** - * Get topic and its children list by given root topic ID. Note that the return type is DTO. + * Get a complete topic and its children list by given root topic ID. Note that the return type is DTO. * * @param rootTopicId * @return List of MessageDTO */ List getTopicThread(Long rootTopicId); + + /** + * Get topic and its children list by given root topic ID, starting from after the sequence number specified. + * Return the number of entries indicated by the paging number. Note that the return type is DTO. + * + * @param rootTopicId + * @param afterSequenceId + * @param pagingSize + * @return List of MessageDTO + */ + public List getTopicThread(Long rootTopicId, Long afterSequenceId, Long pagingSize ); /** + * Get one complete thread within a topic Note that the return type is DTO. + * + * @param threadId + * @return List of MessageDTO + */ + public List getThread(Long threadId ); + + /** * Get root topics by a given sessionID value. Simultanousely, it gets back topics, which author posted in authoring * page for this forum, which is related with the given sessionID value. * @@ -217,6 +237,15 @@ Message getMessage(Long messageUid) throws PersistenceException; /** + * Get message by given message UID, wrapped up in the usual DTO list that is used for the view code in learner. + * + * @param messageUid + * @return Message + * @throws PersistenceException + */ + List getMessageAsDTO(Long messageUid) throws PersistenceException; + + /** * Get message list posted by given user. Note that the return type is DTO. * * @param userId Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java,v diff -u -r1.85.2.2 -r1.85.2.3 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 1 Feb 2015 22:07:45 -0000 1.85.2.2 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 23 Apr 2015 12:51:42 -0000 1.85.2.3 @@ -67,6 +67,7 @@ import org.lamsfoundation.lams.tool.forum.persistence.ForumToolSession; import org.lamsfoundation.lams.tool.forum.persistence.ForumUser; import org.lamsfoundation.lams.tool.forum.persistence.Message; +import org.lamsfoundation.lams.tool.forum.persistence.MessageSeq; import org.lamsfoundation.lams.tool.forum.persistence.PersistenceException; import org.lamsfoundation.lams.tool.forum.persistence.Timestamp; import org.lamsfoundation.lams.tool.forum.service.ForumServiceProxy; @@ -109,9 +110,15 @@ } // --------------Topic Level ------------------ - if (param.equals("viewTopic")) { + if (param.equals("viewTopic") || param.equals("viewTopicNext")) { return viewTopic(mapping, form, request, response); } + if (param.equals("viewTopicThread")) { + return viewTopicThread(mapping, form, request, response); + } + if (param.equals("viewMessage")) { + return viewMessage(mapping, form, request, response); + } if (param.equals("newTopic")) { return newTopic(mapping, form, request, response); } @@ -124,12 +131,18 @@ if (param.equals("replyTopic")) { return replyTopic(mapping, form, request, response); } + if (param.equals("replyTopicInline")) { + return replyTopicInline(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("updateTopicInline")) { + return updateTopicInline(mapping, form, request, response); + } if (param.equals("deleteAttachment")) { return deleteAttachment(mapping, form, request, response); } @@ -468,7 +481,8 @@ // ========================================================================================== /** - * Display read-only page for a special topic. Topic will arrange by Tree structure. + * Display the messages for a particular topic. The Topic will arranged by Tree structure and loaded + * thread by thread (with paging). * * @param mapping * @param form @@ -491,14 +505,31 @@ ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); Forum forum = forumUser.getSession().getForum(); + Long lastMsgSeqId = WebUtil.readLongParam(request, ForumConstants.PAGE_LAST_ID, true); + Long pageSize = WebUtil.readLongParam(request, ForumConstants.PAGE_SIZE, true); + + setupViewTopicPagedDTOList(request, rootTopicId, sessionMapID, forumUser, forum, lastMsgSeqId, pageSize); + + // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed + // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. + // Need to constantly past this value on, rather than hiding just the once, as the View Forum + // screen has a refresh button. Need to pass it through the view topic screen and dependent screens + // as it has a link from the view topic screen back to View Forum screen. + boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); + sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); + + return mapping.findForward("success"); + } + + private void setupViewTopicPagedDTOList(HttpServletRequest request, Long rootTopicId, String sessionMapID, + ForumUser forumUser, Forum forum, Long lastMsgSeqId, Long pageSize) { // get root topic list - List msgDtoList = forumService.getTopicThread(rootTopicId); + List msgDtoList = forumService.getTopicThread(rootTopicId, lastMsgSeqId, pageSize); updateMesssageFlag(msgDtoList); request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - // check if we can still make posts in this topic - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), msgDtoList.get(0).getMessage() - .getUid()); + // check if we can still make posts in this topic + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), rootTopicId); boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); @@ -507,21 +538,104 @@ // transfer SessionMapID as well request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); - // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed - // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. - // Need to constantly past this value on, rather than hiding just the once, as the View Forum - // screen has a refresh button. Need to pass it through the view topic screen and dependent screens - // as it has a link from the view topic screen back to View Forum screen. - boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); - sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); - // Saving or updating user timestamp forumService.saveTimestamp(rootTopicId, forumUser); + } + /** + * Display the messages for a particular thread in a particular topic. Returns all messages for this thread - does not need paging. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward viewTopicThread(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + forumService = getForumManager(); + + Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); + Long highlightMessageUid = WebUtil.readLongParam(request, ForumConstants.ATTR_MESS_ID, true); + + String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId); + + // get forum user and forum + ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); + Forum forum = forumUser.getSession().getForum(); + + Long threadId = WebUtil.readLongParam(request, ForumConstants.ATTR_THREAD_ID, true); + List msgDtoList = forumService.getThread(threadId); + updateMesssageFlag(msgDtoList); + request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); + + // check if we can still make posts in this topic + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), rootTopicId); + boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() + && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; + request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); + request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + request.setAttribute(ForumConstants.ATTR_NO_MORE_PAGES, true); + + if ( highlightMessageUid != null ) { + request.setAttribute(ForumConstants.ATTR_MESS_ID, highlightMessageUid); + } + // transfer SessionMapID as well + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); + return mapping.findForward("success"); } /** + * Display a single message. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward viewMessage(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + forumService = getForumManager(); + + Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); + Long messageUid = WebUtil.readLongParam(request, ForumConstants.ATTR_MESS_ID, true); + + String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId); + + // get forum user and forum + ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); + Forum forum = forumUser.getSession().getForum(); + + List msgDtoList = forumService.getMessageAsDTO(messageUid); + updateMesssageFlag(msgDtoList); + request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); + + // check if we can still make posts in this topic + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), rootTopicId); + boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() + && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; + request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); + request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + request.setAttribute(ForumConstants.ATTR_NO_MORE_PAGES, true); + + if ( messageUid != null ) { + request.setAttribute(ForumConstants.ATTR_MESS_ID, messageUid); + } + // transfer SessionMapID as well + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); + + return mapping.findForward("success"); + } + + /** * Display empty page for a new topic in forum * * @param mapping @@ -661,7 +775,7 @@ * @return * @throws InterruptedException */ - private ActionForward replyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + private synchronized ActionForward replyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws InterruptedException { MessageForm messageForm = (MessageForm) form; @@ -690,35 +804,81 @@ // echo back this topic thread into page Long rootTopicId = forumService.getRootTopicId(parentId); - List msgDtoList = forumService.getTopicThread(rootTopicId); - updateMesssageFlag(msgDtoList); - request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); - // check whether allow more posts for this user ForumToolSession session = forumService.getSessionBySessionId(sessionId); Forum forum = session.getForum(); - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)) - .getMessage().getUid()); - boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() - && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; - request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); - request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); - sessionMap.remove(ForumConstants.ATTR_ORIGINAL_MESSAGE); - - // Saving or updating user timestamp - forumService.saveTimestamp(rootTopicId, forumUser); - + setupViewTopicPagedDTOList(request, rootTopicId, messageForm.getSessionMapID(), forumUser, forum, null, null); + // notify learners and teachers Long forumId = (Long) sessionMap.get(ForumConstants.ATTR_FORUM_ID); forumService.sendNotificationsOnNewPosting(forumId, sessionId, message); - + sessionMap.remove(ForumConstants.ATTR_ORIGINAL_MESSAGE); return mapping.findForward("success"); } /** + * Create a replayed topic for a parent topic. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws InterruptedException + * @throws JSONException + * @throws IOException + */ + private synchronized ActionForward replyTopicInline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws InterruptedException, JSONException, IOException { + + MessageForm messageForm = (MessageForm) form; + SessionMap sessionMap = getSessionMap(request, messageForm); + Long parentId = (Long) sessionMap.get(ForumConstants.ATTR_PARENT_TOPIC_ID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + + Message message = messageForm.getMessage(); + boolean isTestHarness = Boolean.valueOf(request.getParameter("testHarness")); + if (isTestHarness) { + message.setBody(request.getParameter("message.body__textarea")); + } + message.setIsAuthored(false); + message.setCreated(new Date()); + message.setUpdated(new Date()); + message.setLastReplyDate(new Date()); + ForumUser forumUser = getCurrentUser(request, sessionId); + message.setCreatedBy(forumUser); + message.setModifiedBy(forumUser); + setAttachment(messageForm, message); + + // save message into database + forumService = getForumManager(); + MessageSeq newMessageSeq = forumService.replyTopic(parentId, sessionId, message); + + // check whether allow more posts for this user + Long rootTopicId = forumService.getRootTopicId(parentId); + ForumToolSession session = forumService.getSessionBySessionId(sessionId); + Forum forum = session.getForum(); + + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), rootTopicId); + boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() + && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; + + JSONObject JSONObject = new JSONObject(); + JSONObject.put(ForumConstants.ATTR_MESS_ID, newMessageSeq.getMessage().getUid()); + JSONObject.put(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); + JSONObject.put(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + JSONObject.put(ForumConstants.ATTR_THREAD_ID, newMessageSeq.getThreadMessage().getUid()); + JSONObject.put(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); + JSONObject.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId); + JSONObject.put(ForumConstants.ATTR_PARENT_TOPIC_ID, newMessageSeq.getMessage().getParent().getUid()); + response.setContentType("application/json;charset=utf-8"); + response.getWriter().print(JSONObject); + return null; + } + + /** * Display a editable form for a special topic in order to update it. * * @param mapping @@ -800,6 +960,19 @@ Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID); Message message = messageForm.getMessage(); + doUpdateTopic(request, messageForm, sessionMap, topicId, message); + + // echo back this topic thread into page + Long rootTopicId = forumService.getRootTopicId(topicId); + ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); + Forum forum = forumUser.getSession().getForum(); + setupViewTopicPagedDTOList(request, rootTopicId, messageForm.getSessionMapID(), forumUser, forum, null, null); + + return mapping.findForward("success"); + } + + private void doUpdateTopic(HttpServletRequest request, MessageForm messageForm, SessionMap sessionMap, + Long topicId, Message message) { boolean makeAuditEntry = ToolAccessMode.TEACHER.equals(sessionMap.get(AttributeNames.ATTR_MODE)); String oldMessageString = null; @@ -828,29 +1001,40 @@ // save message into database // if we are in monitoring then we are probably editing some else's entry so log the change. forumService.updateTopic(messagePO); + } - // echo back this topic thread into page - Long rootTopicId = forumService.getRootTopicId(topicId); - List msgDtoList = forumService.getTopicThread(rootTopicId); - updateMesssageFlag(msgDtoList); + /** + * Update a topic. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws PersistenceException + * @throws JSONException + * @throws IOException + */ + public ActionForward updateTopicInline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws PersistenceException, JSONException, IOException { - // check if we can still make posts in this topic - ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); - Forum forum = forumUser.getSession().getForum(); - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)) - .getMessage().getUid()); - boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() - && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; - request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); - request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + forumService = getForumManager(); - request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); + MessageForm messageForm = (MessageForm) form; + SessionMap sessionMap = getSessionMap(request, messageForm); + Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID); + Message message = messageForm.getMessage(); - // Saving or updating user timestamp - forumService.saveTimestamp(rootTopicId, forumUser); + doUpdateTopic(request, messageForm, sessionMap, topicId, message); - return mapping.findForward("success"); + JSONObject JSONObject = new JSONObject(); + JSONObject.put(ForumConstants.ATTR_MESS_ID, topicId); + JSONObject.put(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); + Long rootTopicId = forumService.getRootTopicId(topicId); + JSONObject.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId); + response.setContentType("application/json;charset=utf-8"); + response.getWriter().print(JSONObject); + return null; } /** Index: lams_tool_forum/web/WEB-INF/tiles-defs.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/WEB-INF/tiles-defs.xml,v diff -u -r1.4.2.3 -r1.4.2.4 --- lams_tool_forum/web/WEB-INF/tiles-defs.xml 19 Jan 2015 21:34:30 -0000 1.4.2.3 +++ lams_tool_forum/web/WEB-INF/tiles-defs.xml 23 Apr 2015 12:51:42 -0000 1.4.2.4 @@ -79,6 +79,8 @@ + + Index: lams_tool_forum/web/WEB-INF/urlrewrite.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/WEB-INF/urlrewrite.xml,v diff -u -r1.4 -r1.4.2.1 --- lams_tool_forum/web/WEB-INF/urlrewrite.xml 20 Feb 2012 16:26:40 -0000 1.4 +++ lams_tool_forum/web/WEB-INF/urlrewrite.xml 23 Apr 2015 12:51:42 -0000 1.4.2.1 @@ -32,5 +32,15 @@ /jsps/learning/mobile/viewtopic.jsp + + + Handles the exceptional case of /jsps/learning/message/topicviewwrapper.jsp which doesn't use tiles. + + .*(android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino).*?i + ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|e\\-|e\\/|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\\-|2|g)|yas\\-|your|zeto|zte\\-).*?i + ^/jsps/learning/message/topicviewwrapper.jsp$ + /jsps/learning/mobile/message/topicviewwrapper.jsp + + Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/css/jquery.treetable.css'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/css/jquery.treetable.forum.css'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/includes/javascript/jquery.jscroll.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/includes/javascript/jquery.treetable.js'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/includes/javascript/message.js =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/includes/javascript/message.js,v diff -u -r1.3 -r1.3.14.1 --- lams_tool_forum/web/includes/javascript/message.js 11 Oct 2006 02:57:07 -0000 1.3 +++ lams_tool_forum/web/includes/javascript/message.js 23 Apr 2015 12:51:42 -0000 1.3.14.1 @@ -38,4 +38,10 @@ Element.hide(targetDiv+"_Busy"); } } + + function highlightMessage() { + $('.highlight').filter($('table')).css('background','none'); + $('.highlight').filter($('div')).effect('highlight', {color: "#fcf0ad"}, 6000); + $('.highlight').removeClass('highlight'); + } Index: lams_tool_forum/web/jsps/learning/edit.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/edit.jsp,v diff -u -r1.8.2.1 -r1.8.2.2 --- lams_tool_forum/web/jsps/learning/edit.jsp 30 Dec 2014 09:44:06 -0000 1.8.2.1 +++ lams_tool_forum/web/jsps/learning/edit.jsp 23 Apr 2015 12:51:42 -0000 1.8.2.2 @@ -1,6 +1,67 @@ <%@ include file="/common/taglibs.jsp"%> - + + + + Index: lams_tool_forum/web/jsps/learning/ratingStars.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/ratingStars.jsp,v diff -u -r1.3 -r1.3.2.1 --- lams_tool_forum/web/jsps/learning/ratingStars.jsp 24 Feb 2014 17:28:45 -0000 1.3 +++ lams_tool_forum/web/jsps/learning/ratingStars.jsp 23 Apr 2015 12:51:42 -0000 1.3.2.1 @@ -11,7 +11,7 @@
-
+
Index: lams_tool_forum/web/jsps/learning/reply.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/reply.jsp,v diff -u -r1.16.2.1 -r1.16.2.2 --- lams_tool_forum/web/jsps/learning/reply.jsp 30 Dec 2014 09:44:06 -0000 1.16.2.1 +++ lams_tool_forum/web/jsps/learning/reply.jsp 23 Apr 2015 12:51:42 -0000 1.16.2.2 @@ -1,57 +1,102 @@ <%@ include file="/common/taglibs.jsp"%> <%-- If you change this file, remember to update the copy made for CNG-28 --%> + - + + + - + +
-

- -

-

- -

- -

- -

- - - - - - - - - - - -
- -
- - - - - - -
- -
-
- -

- -

Index: lams_tool_forum/web/jsps/learning/viewforum.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/viewforum.jsp,v diff -u -r1.43.2.1 -r1.43.2.2 --- lams_tool_forum/web/jsps/learning/viewforum.jsp 4 Mar 2015 20:31:56 -0000 1.43.2.1 +++ lams_tool_forum/web/jsps/learning/viewforum.jsp 23 Apr 2015 12:51:42 -0000 1.43.2.2 @@ -140,7 +140,7 @@

- +

@@ -153,7 +153,7 @@

- +
+<%@ page import="org.lamsfoundation.lams.tool.forum.util.ForumConstants"%> + <%@ include file="/common/taglibs.jsp"%> + @@ -9,6 +12,7 @@ + @@ -24,6 +28,8 @@ + + @@ -36,10 +42,16 @@ + + @@ -82,6 +94,15 @@
+ + + + + + + @@ -166,12 +187,21 @@
+
+
<%@ include file="message/topicview.jsp"%> +
+
+ + - -
- + +
- -
+ +
Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/learning/message/msgview.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/learning/message/msgviewwrapper.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/jsps/learning/message/topiceditform.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/message/topiceditform.jsp,v diff -u -r1.18.2.4 -r1.18.2.5 --- lams_tool_forum/web/jsps/learning/message/topiceditform.jsp 4 Mar 2015 20:31:56 -0000 1.18.2.4 +++ lams_tool_forum/web/jsps/learning/message/topiceditform.jsp 23 Apr 2015 12:51:42 -0000 1.18.2.5 @@ -30,13 +30,7 @@
- - - - + Index: lams_tool_forum/web/jsps/learning/message/topiclist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/message/topiclist.jsp,v diff -u -r1.20.2.1 -r1.20.2.2 --- lams_tool_forum/web/jsps/learning/message/topiclist.jsp 4 Mar 2015 20:31:56 -0000 1.20.2.1 +++ lams_tool_forum/web/jsps/learning/message/topiclist.jsp 23 Apr 2015 12:51:42 -0000 1.20.2.2 @@ -1,8 +1,9 @@ +<%@ page import="org.lamsfoundation.lams.tool.forum.util.ForumConstants"%> <%@ include file="/common/taglibs.jsp"%> <%-- If you change this file, remember to update the copy made for CNG-28 --%> - - + +
@@ -30,7 +31,7 @@
- + Index: lams_tool_forum/web/jsps/learning/message/topicreplyform.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/message/topicreplyform.jsp,v diff -u -r1.18.2.4 -r1.18.2.5 --- lams_tool_forum/web/jsps/learning/message/topicreplyform.jsp 4 Mar 2015 20:31:56 -0000 1.18.2.4 +++ lams_tool_forum/web/jsps/learning/message/topicreplyform.jsp 23 Apr 2015 12:51:42 -0000 1.18.2.5 @@ -31,16 +31,12 @@
- - - - - +
Index: lams_tool_forum/web/jsps/learning/message/topicview.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/message/topicview.jsp,v diff -u -r1.38.2.1 -r1.38.2.2 --- lams_tool_forum/web/jsps/learning/message/topicview.jsp 4 Mar 2015 20:31:56 -0000 1.38.2.1 +++ lams_tool_forum/web/jsps/learning/message/topicview.jsp 23 Apr 2015 12:51:42 -0000 1.38.2.2 @@ -1,175 +1,122 @@ +<%@ page import="org.lamsfoundation.lams.tool.forum.util.ForumConstants"%> <%@ include file="/common/taglibs.jsp"%> <%-- If you change this file, remember to update the copy made for CNG-28 --%> + + + + + + +expandable:true,initialState:'expanded', + expanderTemplate:'    ${prompt}', + stringCollapse:'${hide}',stringExpand:'${show}', + clickableNodeNames:true,indent:${indent}, + onNodeInitialized:function() { + if (this.level() >= 2) { + this.collapse(); + } + } + + + + - + -
em;"> - - - - - - - - - - + + + + - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - -
-
- " class="space-left float-left"> - - - - - - - - - - - - -
-
- - -
- -
- - -
- - - - - - - - -
-
- - <%@ include file="/jsps/learning/ratingStars.jsp"%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + <%-- same test & command appears at bottom of script --%> + +
+ +
+ + +
+ + + - - - - - - - - - - - - - - - - - - - - - - - - -
+ + +
+ + + + <%@ include file="msgview.jsp"%> + + +
-
+ +
+ +
+ + + + + + Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `lams_tool_forum/web/jsps/learning/message/topicviewwrapper.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_forum/web/jsps/learning/mobile/viewtopic.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/mobile/viewtopic.jsp,v diff -u -r1.9.2.1 -r1.9.2.2 --- lams_tool_forum/web/jsps/learning/mobile/viewtopic.jsp 30 Dec 2014 09:44:06 -0000 1.9.2.1 +++ lams_tool_forum/web/jsps/learning/mobile/viewtopic.jsp 23 Apr 2015 12:51:42 -0000 1.9.2.2 @@ -12,12 +12,13 @@ - + + <fmt:message key="activity.title" /> - + @@ -35,6 +36,8 @@ + +
Index: lams_tool_forum/web/jsps/learning/mobile/message/topiclist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/mobile/message/topiclist.jsp,v diff -u -r1.6 -r1.6.2.1 --- lams_tool_forum/web/jsps/learning/mobile/message/topiclist.jsp 7 Apr 2014 15:43:24 -0000 1.6 +++ lams_tool_forum/web/jsps/learning/mobile/message/topiclist.jsp 23 Apr 2015 12:51:42 -0000 1.6.2.1 @@ -1,5 +1,7 @@ +<%@ page import="org.lamsfoundation.lams.tool.forum.util.ForumConstants"%> <%@ include file="/common/taglibs.jsp"%> +