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;
54 document.getElementById('commentToEditTitle').focus();
56 window.onresize = redrawEditor;
59 function hideEditCommentEditor() {
60 document.getElementById('edit_comment_form').style.display = 'none';
63 // Bind the cancel button
64 $("#cancel_edit_comment_button").click(hideEditCommentEditor);
66 // Bind the submit event
67 $('#edit_comment_form').on('submit', hideEditCommentEditor);
70 <!-- remove comment functionality -->
71 <form name="remove_comment_form" id="remove_comment_form" action="remove-comment" method="post">
72 <input type="hidden" name="commentId" id="commentId" value="<s:property value="openStudy.index"/>"/>
76 function removeComment(commentId) {
77 document.getElementById("commentId").value=commentId;
78 $("#remove_comment_form").ajaxSubmit({
79 target: '#display_comments_div'
84 <!-- add comment functionality -->
85 <s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
86 <script type="text/javascript">
87 $(document).ready(function(){
88 $("#comments_form").ajaxForm({
89 target: '#display_comments_div'
92 function showCommentEditor() {
93 document.getElementById('commentTitle').value='';
94 document.getElementById(currentRTE).contentDocument.body.innerHTML='';
95 document.getElementById('add_comment_button_div').style.display = 'none';
96 document.getElementById('add_comment_div').style.display = 'block';
97 document.getElementById('commentTitle').focus();
100 // Bind the add button
101 $("#add_comment_button").click(showCommentEditor);
103 function hideCommentEditor() {
104 document.getElementById("add_comment_button_div").style.display = 'block';
105 document.getElementById("add_comment_div").style.display = 'none';
108 // Bind the cancel button
109 $("#cancel_add_comment_button").click(hideCommentEditor);
111 // Bind the submit event
112 $('#comments_form').on('submit', hideCommentEditor);
116 <div id="add_comment_button_div">
117 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
119 <td width="20" height="20" align="center">
120 <img id="add_comment_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
121 onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>" title="<s:text name="tooltip.addcomment"/>"/>
128 <div id="add_comment_div" style="display: none;">
129 <form name="comments_form" id="comments_form" action="create-stepComment" method="post">
130 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
132 <td width="20" height="20" align="center">
133 <img id="cancel_add_comment_button" src="<s:url value="/skin/icon.undo.png"/>"
134 title="<s:text name="tooltip.cancel"/>" />
137 <input type="text" name="commentTitle" id="commentTitle">
138 <script language='JavaScript'>
139 displayTextEditor('commentValue', '', 650, 150);