sessionMap = getSessionMap(request);
+ Long commentId = WebUtil.readLongParam(request, CommentConstants.ATTR_COMMENT_ID);
+ Boolean sticky = WebUtil.readBooleanParam(request, CommentConstants.ATTR_STICKY);
+ Long externalId = (Long) sessionMap.get(CommentConstants.ATTR_EXTERNAL_ID);
+
+ CommentDTO originalComment = commentService.getComment(commentId);
+ User user = getCurrentUser(request);
+
+ if ( ! monitorInToolSession(externalId, user, sessionMap))
+ throwException("Make comment sticky: User does not have the rights to make the comment stick to the top of the list "+commentId+". ", user.getLogin());
+ if ( originalComment.getComment().getCommentLevel() != 1)
+ throwException("Make comment sticky: Comment much be level 1 to stick to the top of the list "+commentId+" level "+originalComment.getLevel()+". ", user.getLogin());
+
+ Comment updatedComment = commentService.updateSticky(commentId, sticky);
+
+ JSONObject JSONObject = new JSONObject();
+ JSONObject.put(CommentConstants.ATTR_COMMENT_ID, commentId);
+ JSONObject.put(CommentConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ JSONObject.put(CommentConstants.ATTR_THREAD_ID, updatedComment.getThreadComment().getUid());
+ JSONObject.put(CommentConstants.ATTR_PARENT_COMMENT_ID, updatedComment.getParent().getUid());
+
+ response.setContentType("application/json;charset=utf-8");
+ response.getWriter().print(JSONObject);
+ return null;
+ }
+ /**
* Get login user information from system level session.
*/
private User getCurrentUser(HttpServletRequest request) {
Index: lams_central/web/comments/allview.jsp
===================================================================
diff -u
--- lams_central/web/comments/allview.jsp (revision 0)
+++ lams_central/web/comments/allview.jsp (revision 11360fc3bf2b7ed6ea197873e1b67dbf87d64d33)
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%@ include file="topicview.jsp"%>
+
+
+
\ No newline at end of file
Index: lams_central/web/comments/allviewwrapper.jsp
===================================================================
diff -u
--- lams_central/web/comments/allviewwrapper.jsp (revision 0)
+++ lams_central/web/comments/allviewwrapper.jsp (revision 11360fc3bf2b7ed6ea197873e1b67dbf87d64d33)
@@ -0,0 +1,19 @@
+
+
+
+
+<%@ taglib uri="tags-lams" prefix="lams"%>
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-html" prefix="html"%>
+<%@ taglib uri="tags-fmt" prefix="fmt"%>
+
+
+
+
+
+
+
+
+<%@ include file="allview.jsp"%>
+
+
Index: lams_central/web/comments/comments.jsp
===================================================================
diff -u -r5e63656a12c02f7476564e278b43ff4ce86ac930 -r11360fc3bf2b7ed6ea197873e1b67dbf87d64d33
--- lams_central/web/comments/comments.jsp (.../comments.jsp) (revision 5e63656a12c02f7476564e278b43ff4ce86ac930)
+++ lams_central/web/comments/comments.jsp (.../comments.jsp) (revision 11360fc3bf2b7ed6ea197873e1b67dbf87d64d33)
@@ -34,22 +34,19 @@
scrollDoneCallback();
$('#sortMenu').change(function(){
- var url = "comments/viewTopic.do?sessionMapID=${sessionMapID}&sortBy="+$(this).find("option:selected").attr('value');
- reloadScroll(url);
+ var url = "comments/viewTopic.do?pageSize=2&sessionMapID=${sessionMapID}&sticky=true&sortBy="+$(this).find("option:selected").attr('value');
+ reloadDivs(url);
});
});
function refreshComments(){
var reqIDVar = new Date();
- reloadScroll('comments/viewTopic.do?sessionMapID=${sessionMapID}&reqUid='+reqIDVar.getTime());
+ reloadDivs('comments/viewTopic.do?pageSize=2&sessionMapID=${sessionMapID}&sticky=true&reqUid='+reqIDVar.getTime());
}
- function reloadScroll(url) {
- $('#newcomments').children().remove();
- $('.scroll').load(url, function() {
- $('.scroll').data('jscroll', null);
- $('.scroll').jscroll({loadingHtml: '
${loading_words}',padding:30,autoTrigger:false,callback:scrollDoneCallback});
- });
+ function reloadDivs(url) {
+ $('.scroll').data('jscroll', null);
+ $('#commentDiv').load(url);
}
function scrollDoneCallback() {
@@ -59,7 +56,7 @@
-
+
-
- -
+
+
+
+
+
+
+
+
+
+
+
+ -
">
| ( )
-
+
+