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;">
15 <div id="commentToEditTiltleErrorMessage" class="errorMessage" style="display: none" align="center">
16 <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.commentTitle"))}'/>
19 <input type="hidden" name="commentId" id="commentToEditId" value="0"/>
20 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
22 <td width="20" height="20" align="center">
23 <img id="cancel_edit_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
24 title="<s:text name="tooltip.cancel"/>" />
27 <input type="text" name="commentTitle" id="commentToEditTitle">
28 <script language='JavaScript'>
29 displayTextEditor('commentToEditValue', '', 650, 150);
30 enableRTEvalidation('commentToEditValue');
38 $("#edit_comment_form").ajaxForm({
39 target: '#display_comments_div',
40 beforeSubmit: function(event) {
42 var message = document.getElementById('commentToEditTiltleErrorMessage');
43 message.style.display = 'none';
44 field = document.getElementById('commentToEditTitle');
45 if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
46 message.style.display = 'block';
49 hideEditCommentEditor();
55 function redrawEditor() {
56 document.getElementById('edit_comment_form').style.top =
57 $('#comment_'+commentToEditId+'_tbody').offset().top+'px';
60 function editComment(commentId) {
61 var comment = document.getElementById('comment_'+commentId+'_tbody');
62 var editor = document.getElementById('edit_comment_form');
63 editor.style.display = 'block';
65 document.getElementById('commentToEditId').value = commentId;
66 document.getElementById('commentToEditTitle').value =
67 trim(document.getElementById('comment_'+commentId+'_title').innerHTML);
68 document.getElementById('commentToEditValue').contentDocument.body.innerHTML =
69 trim(document.getElementById('comment_'+commentId+'_body').innerHTML);
71 commentToEditId = commentId;
72 document.getElementById('commentToEditTitle').focus();
74 window.onresize = redrawEditor;
75 $('.editCommentIcon').hide();
78 function hideEditCommentEditor() {
79 document.getElementById('edit_comment_form').style.display = 'none';
80 $('.editCommentIcon').show();
83 // Bind the cancel button
84 $("#cancel_edit_comment_button").click(hideEditCommentEditor);
87 <!-- remove comment functionality -->
88 <form name="remove_comment_form" id="remove_comment_form" action="remove-comment" method="post">
89 <input type="hidden" name="commentId" id="commentId" value="<s:property value="openStudy.index"/>"/>
93 function removeComment(commentId) {
94 document.getElementById("commentId").value=commentId;
95 $("#remove_comment_form").ajaxSubmit({
96 target: '#display_comments_div'
101 <!-- add comment functionality -->
102 <s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
103 <script type="text/javascript">
104 $(document).ready(function(event){
105 $("#comments_form").ajaxForm({
106 target: '#display_comments_div',
107 beforeSubmit: function(event) {
109 var message = document.getElementById('commentToAddTiltleErrorMessage');
110 message.style.display = 'none';
111 field = document.getElementById('commentTitle');
112 if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
113 message.style.display = 'block';
121 function showCommentEditor() {
122 document.getElementById('commentTitle').value='';
123 document.getElementById(currentRTE).contentDocument.body.innerHTML='';
124 document.getElementById('add_comment_button_div').style.display = 'none';
125 document.getElementById('add_comment_div').style.display = 'block';
126 document.getElementById('commentTitle').focus();
127 document.getElementById('commentToAddTiltleErrorMessage').style.display = 'none';
128 $('.editCommentIcon').hide();
131 // Bind the add button
132 $("#add_comment_button").click(showCommentEditor);
134 function hideCommentEditor() {
135 document.getElementById("add_comment_button_div").style.display = 'block';
136 document.getElementById("add_comment_div").style.display = 'none';
137 $('.editCommentIcon').show();
140 // Bind the cancel button
141 $("#cancel_add_comment_button").click(hideCommentEditor);
145 <div id="add_comment_button_div">
146 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
148 <td width="20" height="20" align="center">
149 <img id="add_comment_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
150 onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>" title="<s:text name="tooltip.addcomment"/>"/>
157 <div id="add_comment_div" style="display: none;">
158 <div id="commentToAddTiltleErrorMessage" class="errorMessage" style="display: none" align="center">
159 <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.commentTitle"))}'/>
161 <form name="comments_form" id="comments_form" action="create-stepComment" method="post">
162 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
164 <td width="20" height="20" align="center">
165 <img id="cancel_add_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
166 title="<s:text name="tooltip.cancel"/>" />
169 <input type="text" name="commentTitle" id="commentTitle">
170 <script language='JavaScript'>
171 displayTextEditor('commentValue', '', 650, 150);
172 enableRTEvalidation('commentValue');