]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/WebContent/jsp/commentPane.jsp
Salome HOME
Show description: pen is displayed near the description text;
[tools/siman.git] / Workspace / Siman / WebContent / jsp / commentPane.jsp
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"%>
5
6 <div id="display_comments_div">
7     <s:action name="display-comments" namespace="/study" executeResult="true" />
8 </div>
9
10
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">
16         <tr valign="top">
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"/>" />
20           </td>
21           <td>
22             <input type="text" name="commentTitle" id="commentToEditTitle">
23             <script language='JavaScript'>
24                 displayTextEditor('commentToEditValue', '', 650, 150);
25             </script>   
26           </td>
27         </tr>
28   </table> 
29 </form>
30
31 <script>
32     $("#edit_comment_form").ajaxForm({
33         target: '#display_comments_div'
34     });
35     
36     var commentToEditId;
37     function redrawEditor() {
38         document.getElementById('edit_comment_form').style.top = 
39             $('#comment_'+commentToEditId+'_tbody').offset().top+'px';
40     }
41
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';
46         
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);
52
53         commentToEditId = commentId;
54         document.getElementById('commentToEditTitle').focus();
55         redrawEditor();
56         window.onresize = redrawEditor;
57     }
58
59     function hideEditCommentEditor() {
60         document.getElementById('edit_comment_form').style.display = 'none';
61     }
62     
63     // Bind the cancel button
64     $("#cancel_edit_comment_button").click(hideEditCommentEditor);
65     
66     // Bind the submit event
67     $('#edit_comment_form').on('submit', hideEditCommentEditor);
68 </script>
69
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"/>"/>
73 </form>
74
75 <script>
76     function removeComment(commentId) {
77         document.getElementById("commentId").value=commentId;
78         $("#remove_comment_form").ajaxSubmit({
79                    target: '#display_comments_div'
80               });
81     }
82 </script>
83
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'
90                 });
91                 
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();
98             }
99             
100                 // Bind the add button
101                     $("#add_comment_button").click(showCommentEditor);
102                     
103                     function hideCommentEditor() {
104                   document.getElementById("add_comment_button_div").style.display = 'block';
105                   document.getElementById("add_comment_div").style.display = 'none';
106                 }
107                     
108                     // Bind the cancel button
109                     $("#cancel_add_comment_button").click(hideCommentEditor);
110                     
111                     // Bind the submit event
112                 $('#comments_form').on('submit', hideCommentEditor);
113             });
114         </script>
115         
116         <div id="add_comment_button_div">
117           <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
118             <tr>
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"/>"/>
122                </td>
123               <td>&nbsp;</td>
124             </tr>
125           </table>
126         </div>
127         
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">
131             <tr valign="top">
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"/>" />
135               </td>
136               <td>
137             <input type="text" name="commentTitle" id="commentTitle">
138                 <script language='JavaScript'>
139                     displayTextEditor('commentValue', '', 650, 150);
140                 </script>   
141               </td>
142             </tr>
143           </table> 
144         </form>
145         </div>
146 </s:if>