1 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 pageEncoding="ISO-8859-1"%>
3 <%@ taglib prefix="s" uri="/struts-tags"%>
4 <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
6 <div id="display_comments_div">
7 <s:action name="display-comments" namespace="/study" executeResult="true" />
11 <!-- edit comment functionality -->
12 <form name="edit_comment_form" id="edit_comment_form" action="edit-comment" method="post"
13 style="display: none; position: absolute; background: white;">
14 <input type="hidden" name="commentId" id="commentToEditId" value="0"/>
15 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
17 <td width="20" height="20" align="center">
18 <img id="cancel_edit_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
19 title="<s:text name="tooltip.cancel"/>" />
22 <input type="text" name="commentTitle" id="commentToEditTitle">
23 <script language='JavaScript'>
24 displayTextEditor('commentToEditValue', '', 650, 150);
32 $("#edit_comment_form").ajaxForm({
33 target: '#display_comments_div'
37 function redrawEditor() {
38 document.getElementById('edit_comment_form').style.top =
39 $('#comment_'+commentToEditId+'_tbody').offset().top+'px';
42 function editComment(commentId) {
43 var comment = document.getElementById('comment_'+commentId+'_tbody');
44 var editor = document.getElementById('edit_comment_form');
45 editor.style.display = 'block';
47 document.getElementById('commentToEditId').value = commentId;
48 document.getElementById('commentToEditTitle').value =
49 trim(document.getElementById('comment_'+commentId+'_title').innerHTML);
50 document.getElementById('commentToEditValue').contentDocument.body.innerHTML =
51 trim(document.getElementById('comment_'+commentId+'_body').innerHTML);
53 commentToEditId = commentId;
55 document.onchange = redrawEditor;
58 function hideEditCommentEditor() {
59 document.getElementById('edit_comment_form').style.display = 'none';
62 // Bind the cancel button
63 $("#cancel_edit_comment_button").click(hideEditCommentEditor);
65 // Bind the submit event
66 $('#edit_comment_form').on('submit', hideEditCommentEditor);
69 <!-- remove comment functionality -->
70 <form name="remove_comment_form" id="remove_comment_form" action="remove-comment" method="post">
71 <input type="hidden" name="commentId" id="commentId" value="<s:property value="openStudy.index"/>"/>
75 function removeComment(commentId) {
76 document.getElementById("commentId").value=commentId;
77 $("#remove_comment_form").ajaxSubmit({
78 target: '#display_comments_div'
83 <!-- add comment functionality -->
84 <s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
85 <script type="text/javascript">
86 $(document).ready(function(){
87 $("#comments_form").ajaxForm({
88 target: '#display_comments_div'
91 function showCommentEditor(commentTitle, commentBody) {
92 document.getElementById('commentTitle').value=commentTitle;
93 document.getElementById(currentRTE).contentDocument.body.innerHTML=commentBody;
94 document.getElementById('add_comment_button_div').style.display = 'none';
95 document.getElementById('add_comment_div').style.display = 'block';
99 // Bind the add button
100 $("#add_comment_button").click(function() {showCommentEditor('','');});
102 function hideCommentEditor() {
103 document.getElementById("add_comment_button_div").style.display = 'block';
104 document.getElementById("add_comment_div").style.display = 'none';
107 // Bind the cancel button
108 $("#cancel_add_comment_button").click(hideCommentEditor);
110 // Bind the submit event
111 $('#comments_form').on('submit', hideCommentEditor);
115 <div id="add_comment_button_div">
116 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
118 <td width="20" height="20" align="center">
119 <img id="add_comment_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
120 onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>" title="<s:text name="tooltip.addcomment"/>"/>
127 <div id="add_comment_div" style="display: none;">
128 <form name="comments_form" id="comments_form" action="create-stepComment" method="post">
129 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
131 <td width="20" height="20" align="center">
132 <img id="cancel_add_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
133 title="<s:text name="tooltip.cancel"/>" />
136 <input type="text" name="commentTitle" id="commentTitle">
137 <script language='JavaScript'>
138 displayTextEditor('commentValue', '', 650, 150);