Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r9aad33f52b06632e7a8ed3705a7708338bcc00f8 -r25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/comments/CommentConstants.java =================================================================== diff -u --- lams_central/src/java/org/lamsfoundation/lams/comments/CommentConstants.java (revision 0) +++ lams_central/src/java/org/lamsfoundation/lams/comments/CommentConstants.java (revision 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16) @@ -0,0 +1,59 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.comments; + +public class CommentConstants { + + public static final String ATTR_EXTERNAL_ID = "externalID"; + public static final String ATTR_EXTERNAL_SIG = "externalSig"; + public static final String ATTR_EXTERNAL_TYPE = "externalType"; + public static final String ATTR_SESSION_MAP_ID = "sessionMapID"; + public static final String ATTR_COMMENT_THREAD = "commentThread"; + public static final String ATTR_COMMENT = "comment"; + public static final String ATTR_PARENT_COMMENT_ID = "parentUid"; + public static final String ATTR_ROOT_COMMENT_UID = "rootUid"; + public static final String ATTR_BODY = "body"; + public static final String ATTR_COMMENT_ID = "commentUid"; + public static final String ATTR_LIKE_COUNT = "likeCount"; + public static final String ATTR_THREAD_ID = "threadUid"; + public static final String ATTR_ERR_MESSAGE = "errMessage"; + public static final String ATTR_HIDE_FLAG = "hideFlag"; + public static final String ATTR_STATUS = "status"; + public static final String ATTR_LIKE_AND_DISLIKE = "likeAndDislike"; + public static final String ATTR_READ_ONLY = "readOnly"; + + // for paging long topics & inlining reply + public static final String PAGE_LAST_ID = "pageLastId"; + public static final String PAGE_SIZE = "size"; + public static final int DEFAULT_PAGE_SIZE = 2; + public static final String ATTR_NO_MORE_PAGES = "noMorePages"; + + public static final int MAX_BODY_LENGTH = 5000; + + // message keys + public static final String KEY_BODY_VALIDATION = "label.comment.body.validation"; + + +} + Index: lams_central/src/java/org/lamsfoundation/lams/comments/web/CommentAction.java =================================================================== diff -u -r000998cbc63b12bffb4959d5012679f80796823a -r25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 --- lams_central/src/java/org/lamsfoundation/lams/comments/web/CommentAction.java (.../CommentAction.java) (revision 000998cbc63b12bffb4959d5012679f80796823a) +++ lams_central/src/java/org/lamsfoundation/lams/comments/web/CommentAction.java (.../CommentAction.java) (revision 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16) @@ -40,10 +40,10 @@ import org.apache.tomcat.util.json.JSONException; import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.comments.Comment; +import org.lamsfoundation.lams.comments.CommentConstants; import org.lamsfoundation.lams.comments.CommentLike; import org.lamsfoundation.lams.comments.dto.CommentDTO; import org.lamsfoundation.lams.comments.service.ICommentService; -import org.lamsfoundation.lams.comments.util.CommentConstants; import org.lamsfoundation.lams.security.ISecurityService; import org.lamsfoundation.lams.tool.GroupedToolSession; import org.lamsfoundation.lams.tool.ToolAccessMode; @@ -139,6 +139,8 @@ int externalType; String externalSignature; String mode; + boolean likeAndDislike; + boolean readOnly; // refresh forum page, not initial enter if (sessionMapID != null) { @@ -155,16 +157,20 @@ externalId = WebUtil.readLongParam(request, CommentConstants.ATTR_EXTERNAL_ID); externalType = WebUtil.readIntParam(request, CommentConstants.ATTR_EXTERNAL_TYPE); externalSignature = WebUtil.readStrParam(request, CommentConstants.ATTR_EXTERNAL_SIG); + likeAndDislike = WebUtil.readBooleanParam(request, CommentConstants.ATTR_LIKE_AND_DISLIKE); + readOnly = WebUtil.readBooleanParam(request, CommentConstants.ATTR_READ_ONLY); sessionMap.put(CommentConstants.ATTR_EXTERNAL_ID, externalId); sessionMap.put(CommentConstants.ATTR_EXTERNAL_TYPE, externalType); sessionMap.put(CommentConstants.ATTR_EXTERNAL_SIG, externalSignature); + sessionMap.put(CommentConstants.ATTR_LIKE_AND_DISLIKE, likeAndDislike); + sessionMap.put(CommentConstants.ATTR_READ_ONLY, readOnly); mode = request.getParameter(AttributeNames.ATTR_MODE); sessionMap.put(AttributeNames.ATTR_MODE, mode != null ? mode : ToolAccessMode.LEARNER.toString()); } User user = getCurrentUser(request); - if ( externalType != CommentConstants.TYPE_TOOL ) + if ( externalType != Comment.EXTERNAL_TYPE_TOOL ) throwException("Unknown comment type ", user.getLogin(), externalId, externalType, externalSignature ); Comment rootComment = getCommentService().createOrGetRoot(externalId, externalType, externalSignature, user); @@ -223,6 +229,8 @@ Long lastMsgSeqId = WebUtil.readLongParam(request, CommentConstants.PAGE_LAST_ID, true); Integer pageSize = WebUtil.readIntParam(request, CommentConstants.PAGE_SIZE, true); + if ( pageSize == null || pageSize == 0 ) + pageSize = CommentConstants.DEFAULT_PAGE_SIZE; setupViewTopicPagedDTOList(request, externalId, externalType, externalSignature, sessionMap, user, lastMsgSeqId, pageSize); Index: lams_central/web/comments/comments.jsp =================================================================== diff -u -rf65bf8d775c89d19993d672813a4af9f95266267 -r25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 --- lams_central/web/comments/comments.jsp (.../comments.jsp) (revision f65bf8d775c89d19993d672813a4af9f95266267) +++ lams_central/web/comments/comments.jsp (.../comments.jsp) (revision 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16) @@ -51,7 +51,7 @@

- + <%@ include file="new.jsp"%> Index: lams_central/web/comments/edit.jsp =================================================================== diff -u -r46bcb6ea758a272250071d1a571d008c6745e593 -r25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 --- lams_central/web/comments/edit.jsp (.../edit.jsp) (revision 46bcb6ea758a272250071d1a571d008c6745e593) +++ lams_central/web/comments/edit.jsp (.../edit.jsp) (revision 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16) @@ -3,7 +3,7 @@ <%@ taglib uri="tags-html" prefix="html"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> -<%@ page import="org.lamsfoundation.lams.comments.util.CommentConstants"%> +<%@ page import="org.lamsfoundation.lams.comments.CommentConstants"%> Index: lams_central/web/includes/javascript/comments.js =================================================================== diff -u -rf65bf8d775c89d19993d672813a4af9f95266267 -r25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 --- lams_central/web/includes/javascript/comments.js (.../comments.js) (revision f65bf8d775c89d19993d672813a4af9f95266267) +++ lams_central/web/includes/javascript/comments.js (.../comments.js) (revision 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16) @@ -29,7 +29,12 @@ } else { var loadString = "viewTopicThread.do?&sessionMapID=" + response.sessionMapID + "&threadUid=" + threadUid+"&commentUid="+commentUid; $(threadDiv).load(loadString, function() { - $('#msg'+commentUid).focus(); + // expand up to the reply - in case it is buried down in a lot of replies + // don't need to do this if we have started a new thread. + if ( threadUid != commentUid ) { + $('#tree' + threadUid).treetable("reveal",commentUid); + $('#msg'+commentUid).focus(); + } highlightMessage(); resizeIframe(); }); Index: lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java =================================================================== diff -u -r46bcb6ea758a272250071d1a571d008c6745e593 -r25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 --- lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java (.../CommentService.java) (revision 46bcb6ea758a272250071d1a571d008c6745e593) +++ lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java (.../CommentService.java) (revision 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16) @@ -35,7 +35,6 @@ import org.lamsfoundation.lams.comments.dao.ICommentLikeDAO; import org.lamsfoundation.lams.comments.dao.ICommentSessionDAO; import org.lamsfoundation.lams.comments.dto.CommentDTO; -import org.lamsfoundation.lams.comments.util.CommentConstants; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.MessageService; @@ -52,6 +51,8 @@ private static Logger log = Logger.getLogger(CommentService.class); + private static final String MODULE_NAME = "Comments"; + // Services private IUserManagementService userService; private MessageService messageService; @@ -64,7 +65,6 @@ public List getTopicThread(Long externalId, Integer externalType, String externalSignature, Long lastCommentSeqId, Integer pageSize, Integer userId) { long lastThreadMessageUid = lastCommentSeqId != null ? lastCommentSeqId.longValue() : 0L; - Integer usePagingSize = pageSize != null ? pageSize : CommentConstants.DEFAULT_PAGE_SIZE; // hidden root of all the threads! Comment rootTopic = commentDAO.getRootTopic(externalId, externalType, externalSignature); @@ -74,7 +74,7 @@ return new ArrayList(); } - SortedSet comments = commentDAO.getNextThreadByThreadId(rootTopic.getUid(), lastThreadMessageUid, usePagingSize, userId); + SortedSet comments = commentDAO.getNextThreadByThreadId(rootTopic.getUid(), lastThreadMessageUid, pageSize, userId); return getSortedCommentDTO(comments); } @@ -197,7 +197,7 @@ userId = comment.getCreatedBy().getUserId().longValue(); loginName = comment.getCreatedBy().getLogin(); } - getAuditService().logChange(CommentConstants.MODULE_NAME, userId, loginName, + getAuditService().logChange(MODULE_NAME, userId, loginName, comment.getBody(), newBody); } Fisheye: Tag 25e1ec09bef9772ea3a274a6ba5127cbc70d4f16 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/comments/util/CommentConstants.java'. Fisheye: No comparison available. Pass `N' to diff?