Index: lams_build/lib/lams/lams.jar
===================================================================
RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v
diff -u -r1.479 -r1.480
Binary files differ
Index: lams_central/src/java/org/lamsfoundation/lams/comments/CommentConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/comments/CommentConstants.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_central/src/java/org/lamsfoundation/lams/comments/CommentConstants.java 5 Jan 2016 05:43:46 -0000 1.1
@@ -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: CommentConstants.java,v 1.1 2016/01/05 05:43:46 fionam Exp $ */
+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
===================================================================
RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/comments/web/CommentAction.java,v
diff -u -r1.2 -r1.3
--- lams_central/src/java/org/lamsfoundation/lams/comments/web/CommentAction.java 17 Dec 2015 13:54:57 -0000 1.2
+++ lams_central/src/java/org/lamsfoundation/lams/comments/web/CommentAction.java 5 Jan 2016 05:43:46 -0000 1.3
@@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/comments/comments.jsp,v
diff -u -r1.3 -r1.4
--- lams_central/web/comments/comments.jsp 16 Dec 2015 11:15:22 -0000 1.3
+++ lams_central/web/comments/comments.jsp 5 Jan 2016 05:43:46 -0000 1.4
@@ -51,7 +51,7 @@
-
+
<%@ include file="new.jsp"%>
Index: lams_central/web/comments/edit.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/comments/edit.jsp,v
diff -u -r1.1 -r1.2
--- lams_central/web/comments/edit.jsp 15 Dec 2015 10:20:53 -0000 1.1
+++ lams_central/web/comments/edit.jsp 5 Jan 2016 05:43:46 -0000 1.2
@@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/comments.js,v
diff -u -r1.2 -r1.3
--- lams_central/web/includes/javascript/comments.js 16 Dec 2015 11:15:22 -0000 1.2
+++ lams_central/web/includes/javascript/comments.js 5 Jan 2016 05:43:46 -0000 1.3
@@ -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
===================================================================
RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java,v
diff -u -r1.1 -r1.2
--- lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java 15 Dec 2015 10:17:27 -0000 1.1
+++ lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java 5 Jan 2016 05:43:47 -0000 1.2
@@ -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 1.4 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?
Index: lams_tool_nb/conf/language/lams/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/language/lams/ApplicationResources.properties,v
diff -u -r1.22 -r1.23
--- lams_tool_nb/conf/language/lams/ApplicationResources.properties 15 Dec 2015 13:31:14 -0000 1.22
+++ lams_tool_nb/conf/language/lams/ApplicationResources.properties 5 Jan 2016 05:53:45 -0000 1.23
@@ -59,5 +59,7 @@
message.no.reflection.available =No notebook entry has been added.
advanced.allow.comments=Allow learner comments
label.view.comments=View Comments
+advanced.comments.like.only=Like Button Only
+advanced.comments.like.and.dislike=Like and Dislike Buttons
#======= End labels: Exported 51 labels for en AU =====
Index: lams_tool_nb/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/conf/language/lams/ApplicationResources_en_AU.properties,v
diff -u -r1.22 -r1.23
--- lams_tool_nb/conf/language/lams/ApplicationResources_en_AU.properties 15 Dec 2015 13:31:14 -0000 1.22
+++ lams_tool_nb/conf/language/lams/ApplicationResources_en_AU.properties 5 Jan 2016 05:53:45 -0000 1.23
@@ -59,6 +59,8 @@
message.no.reflection.available =No notebook entry has been added.
advanced.allow.comments=Allow learner comments
label.view.comments=View Comments
+advanced.comments.like.only=Like Button Only
+advanced.comments.like.and.dislike=Like and Dislike Buttons
#======= End labels: Exported 51 labels for en AU =====
Index: lams_tool_nb/db/sql/tool_insert.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/db/sql/tool_insert.sql,v
diff -u -r1.27 -r1.28
--- lams_tool_nb/db/sql/tool_insert.sql 5 May 2014 11:14:44 -0000 1.27
+++ lams_tool_nb/db/sql/tool_insert.sql 5 Jan 2016 05:53:45 -0000 1.28
@@ -25,7 +25,9 @@
help_url,
language_file,
create_date_time,
-modified_date_time
+modified_date_time,
+allow_comments,
+comments_like_dislike
)
VALUES
(
@@ -52,5 +54,7 @@
'http://wiki.lamsfoundation.org/display/lamsdocs/lanb11',
'org.lamsfoundation.lams.tool.noticeboard.ApplicationResources',
NOW(),
-NOW()
+NOW(),
+0,
+0
);
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java,v
diff -u -r1.22 -r1.23
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java 15 Dec 2015 13:31:14 -0000 1.22
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardContent.java 5 Jan 2016 05:53:45 -0000 1.23
@@ -76,7 +76,10 @@
/** nullable persistent field */
private boolean allowComments;
-
+
+ /** nullable persistent field */
+ private boolean commentsLikeAndDislike;
+
/** persistent field */
private Set nbSessions = new HashSet();
@@ -87,7 +90,7 @@
/** full constructor */
public NoticeboardContent(Long nbContentId, String title, String content, boolean defineLater,
boolean reflectOnActivity, String reflectInstructions, boolean contentInUse, Long creatorUserId,
- Date dateCreated, Date dateUpdated, boolean allowComments) {
+ Date dateCreated, Date dateUpdated, boolean allowComments, boolean commentsLikeAndDislike) {
this.nbContentId = nbContentId;
this.title = title;
this.content = content;
@@ -99,6 +102,7 @@
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.allowComments = allowComments;
+ this.commentsLikeAndDislike = commentsLikeAndDislike;
}
/**
@@ -118,6 +122,7 @@
this.dateCreated = dateCreated;
this.dateUpdated = null;
this.allowComments = false;
+ this.commentsLikeAndDislike = false;
}
/**
@@ -218,6 +223,22 @@
}
/**
+ * @hibernate.property column="comments_like_dislike" length="1"
+ */
+
+ public boolean isCommentsLikeAndDislike() {
+ return commentsLikeAndDislike;
+ }
+
+ /**
+ * @param commentsLikeAndDislike
+ * The commentsLikeAndDislike to set.
+ */
+ public void setCommentsLikeAndDislike(boolean commentsLikeAndDislike) {
+ this.commentsLikeAndDislike = commentsLikeAndDislike;
+ }
+
+ /**
* @hibernate.property column="nb_content_id" length="20" not-null="true"
*/
@@ -298,7 +319,7 @@
RepositoryCheckedException {
NoticeboardContent newContent = new NoticeboardContent(toContentId, nb.getTitle(), nb.getContent(),
nb.isDefineLater(), nb.getReflectOnActivity(), nb.getReflectInstructions(), nb.isContentInUse(),
- nb.getCreatorUserId(), nb.getDateCreated(), nb.getDateUpdated(), nb.isAllowComments());
+ nb.getCreatorUserId(), nb.getDateCreated(), nb.getDateUpdated(), nb.isAllowComments(), nb.isCommentsLikeAndDislike());
return newContent;
}
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dbupdates/patch20160105.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dbupdates/patch20160105.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dbupdates/patch20160105.sql 5 Jan 2016 05:53:45 -0000 1.1
@@ -0,0 +1,16 @@
+-- Turn off autocommit, so nothing is committed if there is an error
+SET AUTOCOMMIT = 0;
+SET FOREIGN_KEY_CHECKS=0;
+----------------------Put all sql statements below here-------------------------
+
+-- LDEV-3631 Use simple commenting widget
+ALTER TABLE tl_lanb11_content ADD COLUMN comments_like_dislike TINYINT(1) DEFAULT 0;
+
+UPDATE lams_tool SET tool_version='20160105' WHERE tool_signature='lanb11';
+
+----------------------Put all sql statements above here-------------------------
+
+-- If there were no errors, commit and restore autocommit to on
+COMMIT;
+SET AUTOCOMMIT = 1;
+SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java,v
diff -u -r1.27 -r1.28
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java 15 Dec 2015 13:31:14 -0000 1.27
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringForm.java 5 Jan 2016 05:53:45 -0000 1.28
@@ -78,6 +78,7 @@
private String defineLater;
private boolean allowComments;
+ private boolean commentsLikeAndDislike;
private boolean reflectOnActivity;
private String reflectInstructions;
@@ -102,6 +103,12 @@
public void setAllowComments(boolean allowComments) {
this.allowComments = allowComments;
}
+ public boolean isCommentsLikeAndDislike() {
+ return commentsLikeAndDislike;
+ }
+ public void setCommentsLikeAndDislike(boolean commentsLikeAndDislike) {
+ this.commentsLikeAndDislike = commentsLikeAndDislike;
+ }
public boolean getReflectOnActivity() {
return reflectOnActivity;
}
@@ -202,6 +209,7 @@
setTitle(nbContent.getTitle());
setBasicContent(nbContent.getContent());
setAllowComments(nbContent.isAllowComments());
+ setCommentsLikeAndDislike(nbContent.isCommentsLikeAndDislike());
setReflectOnActivity(nbContent.getReflectOnActivity());
setReflectInstructions(nbContent.getReflectInstructions());
}
@@ -211,6 +219,7 @@
nbContent.setTitle(getTitle());
nbContent.setContent(getBasicContent());
nbContent.setAllowComments(isAllowComments());
+ nbContent.setCommentsLikeAndDislike(isCommentsLikeAndDislike());
if (defineLater == null || defineLater.length() == 0) {
// ie. If defineLater is null or empty, this means we are in authoring
nbContent.setReflectOnActivity(getReflectOnActivity());
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerAction.java,v
diff -u -r1.22 -r1.23
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerAction.java 9 Apr 2013 12:46:33 -0000 1.22
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerAction.java 5 Jan 2016 05:53:45 -0000 1.23
@@ -204,6 +204,8 @@
NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID);
request.setAttribute("reflectInstructions", nbContent.getReflectInstructions());
request.setAttribute("title", nbContent.getTitle());
+ request.setAttribute("allowComments", nbContent.isAllowComments());
+ request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike());
// get the existing reflection entry
NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, NoticeboardConstants.TOOL_SIGNATURE, getUserID(request).intValue());
Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerStarterAction.java,v
diff -u -r1.30 -r1.31
--- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerStarterAction.java 15 Dec 2015 13:31:14 -0000 1.30
+++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbLearnerStarterAction.java 5 Jan 2016 05:53:45 -0000 1.31
@@ -185,10 +185,11 @@
request.setAttribute("reflectEntry", notebookEntry.getEntry());
}
request.setAttribute("reflectInstructions", nbContent.getReflectInstructions());
- request.setAttribute("reflectOnActivity", nbContent.getReflectOnActivity());
- request.setAttribute("allowComments", nbContent.isAllowComments());
+ request.setAttribute("reflectOnActivity", nbContent.getReflectOnActivity());
+ request.setAttribute("allowComments", nbContent.isAllowComments());
+ request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike());
- Boolean userFinished = (nbUser!=null && NoticeboardUser.COMPLETED.equals(nbUser.getUserStatus()));
+ Boolean userFinished = (nbUser!=null && NoticeboardUser.COMPLETED.equals(nbUser.getUserStatus()));
request.setAttribute("userFinished", userFinished);
LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, getServlet()
Index: lams_tool_nb/web/learnerContent.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_nb/web/learnerContent.jsp,v
diff -u -r1.32 -r1.33
--- lams_tool_nb/web/learnerContent.jsp 15 Dec 2015 13:31:14 -0000 1.32
+++ lams_tool_nb/web/learnerContent.jsp 5 Jan 2016 05:53:45 -0000 1.33
@@ -67,7 +67,7 @@
-
+