Index: lams_admin/web/WEB-INF/tags/Comments.tag =================================================================== diff -u -r1bf70a335f5b30a1907ccae506908b05374c6c8c -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_admin/web/WEB-INF/tags/Comments.tag (.../Comments.tag) (revision 1bf70a335f5b30a1907ccae506908b05374c6c8c) +++ lams_admin/web/WEB-INF/tags/Comments.tag (.../Comments.tag) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -9,6 +9,7 @@ <%@ attribute name="width" required="false" rtexprvalue="true"%> <%@ attribute name="mode" required="false" rtexprvalue="true"%> <%@ attribute name="likeAndDislike" required="false" rtexprvalue="true"%> +<%@ attribute name="anonymous" required="false" rtexprvalue="true"%> <%@ attribute name="readOnly" required="false" rtexprvalue="true"%> <%@ attribute name="pageSize" required="false" rtexprvalue="true"%> <%@ attribute name="sortBy" required="false" rtexprvalue="true"%> @@ -33,6 +34,10 @@ + + + + @@ -67,7 +72,7 @@ + + Index: lams_central/web/comments/edit.jsp =================================================================== diff -u -r67f128090c1d1c1e8ec3b987477c17c7df8d6bdd -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_central/web/comments/edit.jsp (.../edit.jsp) (revision 67f128090c1d1c1e8ec3b987477c17c7df8d6bdd) +++ lams_central/web/comments/edit.jsp (.../edit.jsp) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -73,14 +73,33 @@ -
- - -   - - - +
+ + + + + <%-- Post Anonymously? --%> +
+ + + <%@include file="anonymouscheckbox.jsp" %> +
+ + <%-- Cancel / Edit Buttons --%> +
+ + +
+ + + + +   + + +
+
Index: lams_central/web/comments/msgview.jsp =================================================================== diff -u -r9946788a0f2d89cd298e289eddbf59d3b38ba197 -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_central/web/comments/msgview.jsp (.../msgview.jsp) (revision 9946788a0f2d89cd298e289eddbf59d3b38ba197) +++ lams_central/web/comments/msgview.jsp (.../msgview.jsp) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -1,6 +1,7 @@ <%-- commentDto, commentUid, msgLevel needs to be in the session elsewhere --%> + @@ -26,12 +27,37 @@

- - - - -   - + + <%-- authors name --%> + + +   + + + + + + ${msgAuthor} () + + + ${msgAuthor} + + + + + + + + + + + + + ${msgAuthor} + + + + @@ -65,9 +91,12 @@

+ +
- + + + Index: lams_central/web/comments/new.jsp =================================================================== diff -u -r1bf70a335f5b30a1907ccae506908b05374c6c8c -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_central/web/comments/new.jsp (.../new.jsp) (revision 1bf70a335f5b30a1907ccae506908b05374c6c8c) +++ lams_central/web/comments/new.jsp (.../new.jsp) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -79,6 +79,7 @@ function clearNewForm() { $('#newFormBody').val(''); + $('#commentAnonymousNew').prop('checked',false); enableButton(btnName); return false; } @@ -96,20 +97,28 @@ --%>
-
+ + + - - + + + +
+ + + <%@include file="anonymouscheckbox.jsp" %> +
+
+ + -   Index: lams_central/web/comments/reply.jsp =================================================================== diff -u -r67f128090c1d1c1e8ec3b987477c17c7df8d6bdd -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_central/web/comments/reply.jsp (.../reply.jsp) (revision 67f128090c1d1c1e8ec3b987477c17c7df8d6bdd) +++ lams_central/web/comments/reply.jsp (.../reply.jsp) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -85,14 +85,33 @@ value="${sessionMapID}" /> -
- -   - +
+ + + + + <%-- Post Anonymously? --%> +
+ + + <%@include file="anonymouscheckbox.jsp" %> +
+ + <%-- Cancel / Edit Buttons --%> +
+ + +
+ + + +   +
+
Index: lams_central/web/css/_learner_base.scss =================================================================== diff -u -rbe48c7dd8438a3e7f038876851f7a3b740c8f4f4 -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_central/web/css/_learner_base.scss (.../_learner_base.scss) (revision be48c7dd8438a3e7f038876851f7a3b740c8f4f4) +++ lams_central/web/css/_learner_base.scss (.../_learner_base.scss) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -212,6 +212,11 @@ margin-top: 0px; margin-bottom: 0px; } + +.comment-entry .checkbox { + margin-top: 5px; + margin-bottom: 0px; +} .panel-heading-sm { padding: 3px 5px; Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/comments/Comment.hbm.xml =================================================================== diff -u -r8620cb3f29c4710a0ddfd597fdc1b676d4b2b4b0 -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/comments/Comment.hbm.xml (.../Comment.hbm.xml) (revision 8620cb3f29c4710a0ddfd597fdc1b676d4b2b4b0) +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/comments/Comment.hbm.xml (.../Comment.hbm.xml) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -153,6 +153,15 @@ column="monitor" /> + + + Index: lams_common/src/java/org/lamsfoundation/lams/comments/Comment.java =================================================================== diff -u -r045ebfd1d11d9ed0a1f81a00abb1a2ea373e8d93 -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_common/src/java/org/lamsfoundation/lams/comments/Comment.java (.../Comment.java) (revision 045ebfd1d11d9ed0a1f81a00abb1a2ea373e8d93) +++ lams_common/src/java/org/lamsfoundation/lams/comments/Comment.java (.../Comment.java) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -54,6 +54,7 @@ private boolean hideFlag; private boolean sticky; private boolean monitor; + private boolean anonymous; private Comment rootComment; private Comment threadComment; @@ -191,6 +192,14 @@ this.sticky = sticky; } + public boolean isAnonymous() { + return anonymous; + } + + public void setAnonymous(boolean anonymous) { + this.anonymous = anonymous; + } + public Comment getParent() { return parent; } Index: lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java =================================================================== diff -u -r045ebfd1d11d9ed0a1f81a00abb1a2ea373e8d93 -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java (.../CommentService.java) (revision 045ebfd1d11d9ed0a1f81a00abb1a2ea373e8d93) +++ lams_common/src/java/org/lamsfoundation/lams/comments/service/CommentService.java (.../CommentService.java) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -155,13 +155,14 @@ } @Override - public Comment createReply(Comment parent, String replyText, User user, boolean isMonitor) { + public Comment createReply(Comment parent, String replyText, User user, boolean isMonitor, boolean isAnonymous) { Comment replyMessage = new Comment(); replyMessage.setBody(replyText); replyMessage.setHideFlag(false); replyMessage.updateModificationData(user); replyMessage.setMonitor(isMonitor); + replyMessage.setAnonymous(isAnonymous); replyMessage.setParent(parent); replyMessage.setSession(parent.getSession()); @@ -221,15 +222,16 @@ } @Override - public Comment createReply(Long parentId, String replyText, User user, boolean isMonitor) { + public Comment createReply(Long parentId, String replyText, User user, boolean isMonitor, boolean isAnonymous) { Comment parent = commentDAO.getById(parentId); - return (createReply(parent, replyText, user, isMonitor)); + return (createReply(parent, replyText, user, isMonitor, isAnonymous)); } @Override - public Comment updateComment(Long commentUid, String newBody, User user, boolean makeAuditEntry) { + // if isAnonymous is null, do not update the field. + public Comment updateComment(Long commentUid, String newBody, User user, Boolean isAnonymous, boolean makeAuditEntry) { Comment comment = commentDAO.getById(commentUid); if (comment != null && user != null) { @@ -247,6 +249,8 @@ comment.setBody(newBody); comment.updateModificationData(user); + if ( isAnonymous != null ) + comment.setAnonymous(isAnonymous); commentDAO.saveOrUpdate(comment); return comment; Index: lams_common/src/java/org/lamsfoundation/lams/comments/service/ICommentService.java =================================================================== diff -u -r1bf70a335f5b30a1907ccae506908b05374c6c8c -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_common/src/java/org/lamsfoundation/lams/comments/service/ICommentService.java (.../ICommentService.java) (revision 1bf70a335f5b30a1907ccae506908b05374c6c8c) +++ lams_common/src/java/org/lamsfoundation/lams/comments/service/ICommentService.java (.../ICommentService.java) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -48,9 +48,9 @@ String externalSignature, Integer sortBy, String extraSortParam, Integer userId); /** Saves a comment - either creating a whole tree one if there is no parent or saving under the given parent. */ - Comment createReply(Long parentId, String replyText, User user, boolean isMonitor); + Comment createReply(Long parentId, String replyText, User user, boolean isMonitor, boolean isAnonymous); - Comment createReply(Comment parent, String replyText, User user, boolean isMonitor); + Comment createReply(Comment parent, String replyText, User user, boolean isMonitor, boolean isAnonymous); /** Gets the dummy root for the comment system and if one doesn't exist for this session then set it up! */ Comment createOrGetRoot(Long externalId, Long externalSecondaryId, Integer externalIdType, String externalSignature, @@ -67,8 +67,9 @@ /** Get a single comment. Note that the return type is DTO */ CommentDTO getComment(Long commentUid); - /** Update the body in a comment, and update the modified time, who by, etc, etc */ - Comment updateComment(Long commentUid, String newBody, User user, boolean makeAuditEntry); + /** Update the body in a comment, and update the modified time, who by, etc, etc. + * If isAnonymous is null, do not update. Used to ensure monitoring changes do not accidently change the value. */ + Comment updateComment(Long commentUid, String newBody, User user, Boolean isAnonymous, boolean makeAuditEntry); /** Update the sticky flag for a comment */ Comment updateSticky(Long commentUid, Boolean newSticky); Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180508.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180508.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180508.sql (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -0,0 +1,15 @@ +-- 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-4559 Option to allow students to post anonymously +ALTER TABLE lams_comment +ADD COLUMN anonymous SMALLINT(6) NULL DEFAULT 0; + +----------------------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_gradebook/web/WEB-INF/tags/Comments.tag =================================================================== diff -u -r1bf70a335f5b30a1907ccae506908b05374c6c8c -r500ae45f4243aa718eac7436bc903b4f137a3aa7 --- lams_gradebook/web/WEB-INF/tags/Comments.tag (.../Comments.tag) (revision 1bf70a335f5b30a1907ccae506908b05374c6c8c) +++ lams_gradebook/web/WEB-INF/tags/Comments.tag (.../Comments.tag) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) @@ -9,6 +9,7 @@ <%@ attribute name="width" required="false" rtexprvalue="true"%> <%@ attribute name="mode" required="false" rtexprvalue="true"%> <%@ attribute name="likeAndDislike" required="false" rtexprvalue="true"%> +<%@ attribute name="anonymous" required="false" rtexprvalue="true"%> <%@ attribute name="readOnly" required="false" rtexprvalue="true"%> <%@ attribute name="pageSize" required="false" rtexprvalue="true"%> <%@ attribute name="sortBy" required="false" rtexprvalue="true"%> @@ -33,6 +34,10 @@ + + + + @@ -67,7 +72,7 @@