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 @@