Author: chathura
Date: Tue Dec 4 04:56:25 2007
New Revision: 10485
Log:
Integrated the comments to the UI.
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/CommentAction.java
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
Tue Dec 4 04:56:25 2007
@@ -169,6 +169,20 @@
forwardToResources(request, response, path);
+ } else if (command.equals("/addComment")) {
+
+ CommentAction commentAction = new CommentAction();
+ commentAction.setPath(path);
+ commentAction.setCommentText(request.getParameter("comment"));
+
+ try {
+ commentAction.execute(request);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ forwardToResources(request, response, path);
+
} else if (command.equals("/addCollection")) {
AddCollectionAction addCollectionAction = new
AddCollectionAction();
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/CommentAction.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/CommentAction.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/CommentAction.java
Tue Dec 4 04:56:25 2007
@@ -20,13 +20,17 @@
import org.wso2.registry.Comment;
import org.wso2.registry.RegistryException;
+import javax.servlet.http.HttpServletRequest;
+
public class CommentAction extends AbstractRegistryAction {
private String path;
private String commentText;
- public String execute() throws Exception {
+ public String execute(HttpServletRequest request) throws Exception {
+ setRequest(request);
+
if (path == null || path.length() == 0) {
return ERROR;
}
Modified:
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Tue Dec 4 04:56:25 2007
@@ -5,6 +5,7 @@
<%@ page import="org.wso2.registry.web.UIConstants" %>
<%@ page import="org.wso2.registry.web.actions.utils.VersionPath" %>
<%@ page import="org.wso2.registry.Tag" %>
+<%@ page import="org.wso2.registry.Comment" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
@@ -182,36 +183,37 @@
<h2>Comments</h2>
<!-- START comment box -->
- <div class="comments-header">
- <h3>Comment Headding 1</h3>
- <strong>Added:</strong>21/12/2007 - 12:30 <strong>By:</strong>
<a href="#">Chanaka</a>
- </div>
- <div class="comments-bottom">
- Comment content goes here..,, ,,,
- </div>
+<%
+ Iterator iComments = details.getComments().iterator();
+ while (iComments.hasNext()) {
+ Comment comment = (Comment) iComments.next();
+%>
+<div class="comments-bottom">
+ <%=comment.getCommentText()%>
+</div>
+<div class="comments-header">
+ <strong>Commented on
</strong><%=comment.getCommentedTime().toString()%><strong> by</strong> <a
href="#"><%=comment.getCommentedUser()%></a>
+</div>
+<% } %>
<!-- END comment box -->
<a href="#" class="add-comment" onclick="showHide('add-comment-div')">Add
Comment</a>
<!-- START add comment box -->
- <div id="add-comment-div">
- <table cellpadding="0" cellspacing="0" border="0"
class="form-table">
- <tr>
- <td style="width:150px;" valign="top">Comment
Title</td>
- <td><input type="text" /></td>
- </tr>
- <tr>
- <td valign="top">Comment</td>
- <td><textarea>test</textarea></td>
- </tr>
- <tr>
- <td valign="top"></td>
- <td><input type="submit" class="button"
value="Add" /> <input type="submit" class="button" value="Cancel" /></td>
- </tr>
- </table>
-
-
- </div>
+<div id="add-comment-div">
+ <form action="/wso2registry/system/addComment" method="post">
+ <table cellpadding="0" cellspacing="0" border="0" class="form-table">
+ <tr>
+ <td valign="top">Comment</td>
+ <td><textarea name="comment"></textarea></td>
+ </tr>
+ <tr>
+ <td valign="top"></td>
+ <td><input type="submit" class="button" value="Add" /> <input
type="submit" class="button" value="Cancel" /></td>
+ </tr>
+ </table>
+ </form>
+</div>
<!-- END add comment box -->
<h2>Permisions</h2>
@@ -225,7 +227,7 @@
<%
Iterator iTags = details.getTags().iterator();
while (iTags.hasNext()) {
- Tag tag = (Tag) iTags.next();
+ Tag tag = (Tag) iTags.next();
%>
<span style="font-size:19px;"><%=tag.getTagName()%></span>
<% } %>
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev