Author: chathura
Date: Wed Jan 23 21:38:44 2008
New Revision: 12796
Log:
Implemented resource rename in the UI.
Added:
trunk/registry/modules/webapps/src/main/webapp/admin/ajax/entry-list.jsp
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/UIConstants.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java
trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.jsp
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
Wed Jan 23 21:38:44 2008
@@ -61,6 +61,8 @@
versionNumber = Long.parseLong(parts[1]);
}
+ plainPath = getPreparedPath(plainPath);
+
Connection conn ;
try {
conn = dataSource.getConnection();
@@ -342,4 +344,24 @@
public boolean importChild(String childPath, String sourceURL) throws
RegistryException {
return true;
}
+
+ private String getPreparedPath(String resourcePath) {
+
+ String preparedPath = resourcePath;
+ if (preparedPath.equals(RegistryConstants.ROOT_PATH)) {
+ return preparedPath;
+
+ } else {
+
+ if (!preparedPath.startsWith(RegistryConstants.ROOT_PATH)) {
+ preparedPath = RegistryConstants.ROOT_PATH + preparedPath;
+ }
+
+ if (preparedPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+ preparedPath = preparedPath.substring(0, preparedPath.length()
- 1);
+ }
+ }
+
+ return preparedPath;
+ }
}
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
Wed Jan 23 21:38:44 2008
@@ -165,6 +165,12 @@
} catch (SQLException e) {
String msg = "Could not delete the comment with the path: " + path;
throw new RegistryException(msg, e);
+ } finally {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException ignore) {}
+ }
}
return true;
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
Wed Jan 23 21:38:44 2008
@@ -146,17 +146,12 @@
// if the user has permission to the current version, he will get
permission to all
// previous versions of the same resource
- String authorizationPath = path;
- if (path.indexOf("?") > 0) {
- authorizationPath = path.split("\\?")[0];
- } else if (path.indexOf(";") > 0) {
- authorizationPath = path.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(path);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg = "Attempted to perform unauthorized operation (" +
ActionConstants.GET +
- ") on " + authorizationPath + " by " + userID;
+ ") on " + authorizationPath + " by " + userID;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -270,11 +265,26 @@
public void delete(String path) throws RegistryException {
+ String authPath = getAuthorizationPath(path);
+
try {
- if (!authorizer.isUserAuthorized(userID, path,
ActionConstants.DELETE)) {
- String msg = "Attempted to perform unauthorized operation.";
- log.info(msg);
- throw new AuthorizationFailedException(msg);
+ if (path.indexOf(";") > 0) {
+
+ // user is trying to perform a delete on resource metadata. so
put permission
+ // is sufficient.
+ if (!authorizer.isUserAuthorized(userID, authPath,
ActionConstants.PUT)) {
+ String msg = "Attempted to perform unauthorized
operation.";
+ log.info(msg);
+ throw new AuthorizationFailedException(msg);
+ }
+
+ } else {
+
+ if (!authorizer.isUserAuthorized(userID, authPath,
ActionConstants.DELETE)) {
+ String msg = "Attempted to perform unauthorized
operation.";
+ log.info(msg);
+ throw new AuthorizationFailedException(msg);
+ }
}
} catch (UserManagerException e) {
String msg = "Could not check authorization. \nCaused by " +
e.getMessage();
@@ -290,7 +300,9 @@
public String rename(String currentPath, String newPath) throws
RegistryException {
if (resourceExists(currentPath)) {
try {
- if (!authorizer.isUserAuthorized(userID, currentPath,
ActionConstants.DELETE)) {
+
+ String authPath = getAuthorizationPath(currentPath);
+ if (!authorizer.isUserAuthorized(userID, authPath,
ActionConstants.DELETE)) {
String msg = "Attempted to perform unauthorized
operation.";
log.info(msg);
throw new AuthorizationFailedException(msg);
@@ -310,20 +322,13 @@
public String[] getVersions(String resourcePath) throws RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg =
"User: " + userID + " is not authorized to get
versions of the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -339,19 +344,12 @@
public void restoreVersion(String versionPath) throws RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = versionPath;
- if (versionPath.indexOf("?") > 0) {
- authorizationPath = versionPath.split("\\?")[0];
- } else if (versionPath.indexOf(";") > 0) {
- authorizationPath = versionPath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(versionPath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.PUT)) {
String msg = "User: " + userID + " is not authorized to
restore the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -367,19 +365,12 @@
public void applyTag(String resourcePath, String tag) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg = "User: " + userID + " is not authorized to tag on
the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -400,20 +391,13 @@
public Tag[] getTags(String resourcePath) throws RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg =
"User: " + userID + " is not authorized to get tags of
the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -429,20 +413,13 @@
public void removeTag(String resourcePath, String tag) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg =
"User: " + userID + " is not authorized to remove tags
of the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -458,19 +435,12 @@
public String addComment(String resourcePath, Comment comment) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg = "User: " + userID + " is not authorized to
comment on the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -486,17 +456,13 @@
public void editComment(String commentPath, String text) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = commentPath;
- if (commentPath.indexOf(";") > 0) {
- authorizationPath = commentPath.split(";")[0];
- }
+
+ String authorizationPath = getAuthorizationPath(commentPath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg = "User: " + userID + " is not authorized to
comment on the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -517,19 +483,12 @@
public void rateResource(String resourcePath, int rating) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg = "User: " + userID + " is not authorized to rate
the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -545,20 +504,13 @@
public float getAverageRating(String resourcePath) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg = "User: " + userID +
- " is not authorized to get average rating of the
resource: " +
- authorizationPath;
+ " is not authorized to get average rating of the
resource: " +
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -574,20 +526,13 @@
public int getRating(String resourcePath, String userName) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";") > 0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
+ String authorizationPath = getAuthorizationPath(resourcePath);
try {
if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
String msg =
"User: " + userID + " is not authorized to get ratings
of the resource: " +
- authorizationPath;
+ authorizationPath;
log.info(msg);
throw new AuthorizationFailedException(msg);
}
@@ -624,16 +569,44 @@
for (LogEntry allEntry : allEntries) {
try {
if (authorizer.isUserAuthorized(userID,
allEntry.getResourcePath(),
- ActionConstants.GET)) {
+ ActionConstants.GET)) {
authorizedEnListList.add(allEntry);
}
} catch (UserManagerException e) {
log.error("Could not check permissions for resource: " +
allEntry.getResourcePath(),
- e);
+ e);
}
}
return (LogEntry[])authorizedEnListList.toArray(new
LogEntry[authorizedEnListList.size()]);
}
+ private String getAuthorizationPath(String resourcePath) {
+
+ // if the user has permission to the current version, he will get
permission to all
+ // previous versions of the same resource
+
+ String preparedPath = resourcePath;
+ if (resourcePath.indexOf("?") > 0) {
+ preparedPath = resourcePath.split("\\?")[0];
+ } else if (resourcePath.indexOf(";") > 0) {
+ preparedPath = resourcePath.split("\\;")[0];
+ }
+
+ if (preparedPath.equals(RegistryConstants.ROOT_PATH)) {
+ return preparedPath;
+
+ } else {
+
+ if (!preparedPath.startsWith(RegistryConstants.ROOT_PATH)) {
+ preparedPath = RegistryConstants.ROOT_PATH + preparedPath;
+ }
+
+ if (preparedPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+ preparedPath = preparedPath.substring(0, preparedPath.length()
- 1);
+ }
+ }
+
+ return preparedPath;
+ }
}
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
Wed Jan 23 21:38:44 2008
@@ -230,6 +230,16 @@
request.getSession().setAttribute(UIConstants.AJAX_RATING_BEAN,
ajaxRatingAction);
request.getRequestDispatcher(UIConstants.AJAX_RATING_JSP).forward(request,
response);
+ } else if (command.equals("/renameResource")) {
+
+ try {
+ ResourcesUtil.renameResource(request, response);
+ } catch (Exception e) {
+ // todo: implement a general AJAX error segment
+ setErrorMessage(request, e.getMessage());
+ forwardToResources(request, response, path);
+ }
+
} else if (command.equals("/addComment")) {
try {
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/UIConstants.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/UIConstants.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/UIConstants.java
Wed Jan 23 21:38:44 2008
@@ -59,6 +59,7 @@
public static final String AJAX_USER_FRIENDLY_NAME_JSP =
"/admin/ajax/user-friendly-name.jsp";
public static final String AJAX_USER_PASSWORD_JSP =
"/admin/ajax/user-password-edit.jsp";
public static final String AJAX_COMMENTS_JSP =
"/admin/ajax/comment-list.jsp";
+ public static final String AJAX_ENTRY_LIST_JSP =
"/admin/ajax/entry-list.jsp";
public static final String RESOURCE_DETAILS_JSP =
"/admin/resources_details.jsp";
public static final String ERROR_JSP = "/admin/error.jsp";
}
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
Wed Jan 23 21:38:44 2008
@@ -33,6 +33,7 @@
private String path;
private String relativePath;
private String contentPath;
+ private String permalink;
private String name;
private String author;
private String lastUpdater;
@@ -168,6 +169,15 @@
Resource resource = registry.get(path);
+ if (!versionView) {
+ String[] versionPaths = registry.getVersions(path);
+ if (versionPaths.length > 0) {
+ permalink = versionPaths[0];
+ }
+ } else {
+ permalink = path;
+ }
+
if (resource.getAuthorUserName() != null) {
this.author = resource.getAuthorUserName();
}
@@ -665,4 +675,12 @@
public boolean isVersionView() {
return versionView;
}
+
+ public String getPermalink() {
+ return permalink;
+ }
+
+ public void setPermalink(String permalink) {
+ this.permalink = permalink;
+ }
}
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/utils/ResourcesUtil.java
Wed Jan 23 21:38:44 2008
@@ -17,12 +17,21 @@
package org.wso2.registry.web.utils;
import org.wso2.registry.secure.SecureRegistry;
+import org.wso2.registry.secure.AuthorizationFailedException;
import org.wso2.registry.RegistryException;
import org.wso2.registry.Resource;
+import org.wso2.registry.RegistryConstants;
+import org.wso2.registry.Registry;
import org.wso2.registry.web.beans.VersionsBean;
import org.wso2.registry.web.actions.utils.VersionPath;
+import org.wso2.registry.web.actions.ResourceDetailsAction;
+import org.wso2.registry.web.actions.CollectionViewAction;
+import org.wso2.registry.web.UIConstants;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
public class ResourcesUtil {
@@ -80,4 +89,52 @@
String versionPath = request.getParameter("versionPath");
secureRegistry.restoreVersion(versionPath);
}
+
+ public static void renameResource(HttpServletRequest request,
HttpServletResponse response)
+ throws ServletException, IOException {
+
+ String parentPath = request.getParameter("parentPath");
+ if (!parentPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+ parentPath = parentPath + RegistryConstants.PATH_SEPARATOR;
+ }
+
+ String oldResourcePath = request.getParameter("oldResourcePath");
+ String newName = request.getParameter("newName");
+
+ String newResourcePath;
+ if (newName.startsWith(RegistryConstants.ROOT_PATH)) {
+ newResourcePath = newName;
+ } else {
+ newResourcePath = parentPath + newName;
+ }
+
+ ResourceDetailsAction resourceAction = null;
+ CollectionViewAction collectionView = null;
+ try {
+ Registry registry = CommonUtil.getUserRegistry(request);
+ registry.rename(oldResourcePath, newResourcePath);
+
+ resourceAction = new ResourceDetailsAction();
+ resourceAction.setPath(parentPath);
+ resourceAction.execute(request);
+
+ collectionView = new CollectionViewAction();
+ collectionView.setPath(parentPath);
+ collectionView.execute(request);
+
+ } catch (RegistryException e) {
+ String msg = "Failed to rename the resource: " + oldResourcePath +
" to name: " +
+ newResourcePath + ". Caused by: " + e.getMessage();
+ setErrorMessage(request, msg);
+ }
+
+ request.getSession().setAttribute(UIConstants.RESOURCE_BEAN,
resourceAction);
+ request.getSession().setAttribute(UIConstants.COLLECTION_BEAN,
collectionView);
+
+
request.getRequestDispatcher(UIConstants.AJAX_ENTRY_LIST_JSP).forward(request,
response);
+ }
+
+ private static void setErrorMessage(HttpServletRequest request, String
message) {
+ request.getSession().setAttribute(UIConstants.ERROR_MESSAGE, message);
+ }
}
Added: trunk/registry/modules/webapps/src/main/webapp/admin/ajax/entry-list.jsp
==============================================================================
--- (empty file)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/ajax/entry-list.jsp
Wed Jan 23 21:38:44 2008
@@ -0,0 +1,81 @@
+<%@ page import="org.wso2.registry.web.actions.CollectionViewAction" %>
+<%@ page import="org.wso2.registry.web.UIConstants" %>
+<%@ page import="org.wso2.registry.web.actions.ResourceDetailsAction" %>
+<%@ page import="org.wso2.registry.web.actions.utils.ResourceData" %>
+<%@ page import="java.util.Iterator" %>
+<%--
+ Created by IntelliJ IDEA.
+ User: chathura
+ Date: Jan 24, 2008
+ Time: 9:57:51 AM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+<%
+ CollectionViewAction collection = (CollectionViewAction)
request.getSession().getAttribute(UIConstants.COLLECTION_BEAN);
+ ResourceDetailsAction details = (ResourceDetailsAction)
request.getSession().getAttribute(UIConstants.RESOURCE_BEAN);
+ String errorMessage = (String)
request.getSession().getAttribute(UIConstants.ERROR_MESSAGE);
+ if (errorMessage != null) {
+ request.getSession().removeAttribute(UIConstants.ERROR_MESSAGE);
+ }
+%>
+
+<% if (errorMessage != null) { %>
+<div class="error-message"><%=errorMessage%></div>
+<% } %>
+
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%"
class="data-table">
+ <%
+ if(!collection.getResourceDataList().isEmpty()) {
+ %>
+ <tr>
+ <th></th>
+ <th>Created Date</th>
+ <th>Author</th>
+ <th>Rating</th>
+ <th colspan="2" style="width:50px;">Action</th>
+
+ </tr>
+ <%
+ }
+ Iterator iterator = collection.getResourceDataList().iterator();
+ while (iterator.hasNext()) {
+ ResourceData resourceData = (ResourceData) iterator.next();
+ %>
+ <tr id="1">
+ <td>
+ <% if (resourceData.getResourceType() ==
ResourceData.COLLECTION) { %>
+ <img
src="/wso2registry/admin/images/icon-folder-small.gif"
style="margin-right:5px;" /><a
href="/wso2registry/web/<%=resourceData.getRelativePath()%>"><%=resourceData.getName()%></a>
+ <% } else { %>
+ <div style="margin-left:20px;">
+ <a
href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
id="resourceView"><%=resourceData.getName()%></a>
+ <input type="text" id="resourceEdit"
style="display:none" value="<%=resourceData.getName()%>" />
+ | <a
href="/wso2registry/resources<%=resourceData.getResourcePath()%>"
target="_blank" title="Download" ><img
src="/wso2registry/admin/images/icon-download.jpg" border="0" align="top" /></a>
+ | <a href="#" title="Edit Resource Name"
onclick="showHideCommon('resourceEdit');showHideCommon('resourceView');
showHideCommon('resourceSaveButton');showHideCommon('resourceEditButton');"
id="resourceEditButton"><img src="/wso2registry/admin/images/icon-edit.gif"
border="0" align="top" id="resourceEditButton" /></a>
+ <a href="#"
onclick="renameResource('<%=details.getPath()%>',
'<%=resourceData.getResourcePath()%>');showHideCommon('resourceEdit');showHideCommon('resourceView');
showHideCommon('resourceSaveButton');showHideCommon('resourceEditButton');"
id="resourceSaveButton" style="display:none;"><img border="0" align="top"
title="Save" src="/wso2registry/admin/images/save-button.gif" /></a>
+ </div>
+ <% } %>
+ </td>
+ <td><%=resourceData.getCreatedOn()%></td>
+ <td><%=resourceData.getAuthorUserName()%></td>
+ <td>
+ <img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[0]%>.gif"
align="top" />
+ <img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[1]%>.gif"
align="top" />
+ <img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[2]%>.gif"
align="top" />
+ <img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[3]%>.gif"
align="top" />
+ <img
src="/wso2registry/admin/images/r<%=resourceData.getAverageStars()[4]%>.gif"
align="top" />
+ (<%=resourceData.getAverageRating()%>)
+ </td>
+ <td><a href="/wso2registry/atom<%=resourceData.getResourcePath()%>"
target="_blank"><img border="0"
src="/wso2registry/admin/images/icon-feed-small.gif"/></a>
+ </td>
+ <td>
+ <% if (resourceData.isDeleteAllowed() && !details.isVersionView())
{ %><a
href="/wso2registry/system/deleteResource?resourcePath=<%=resourceData.getResourcePath()%>"
title="Delete" style="margin-left:5px;"><img
src="/wso2registry/admin/images/icon-trash.gif" border="0" /></a> <% } %>
+ </td>
+
+ </tr>
+
+
+ <% } %>
+
+</table>
\ No newline at end of file
Modified: trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js Wed Jan
23 21:38:44 2008
@@ -347,6 +347,12 @@
new Ajax.Updater('resourceProperties',
'/wso2registry/system/removeProperty', { method: 'post', parameters:
{resourcePath: resourcePath, propertyName: propertyName} });
}
+function renameResource(parentPath, oldResourcePath) {
+
+ var newName = document.getElementById('resourceEdit').value;
+ new Ajax.Updater('entryList', '/wso2registry/system/renameResource', {
method: 'post', parameters: {parentPath: parentPath, oldResourcePath:
oldResourcePath, newName: newName} });
+}
+
function saveFriendlyName(userName) {
var friendlyName = document.getElementById('friendlyName').value;
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
Wed Jan 23 21:38:44 2008
@@ -54,7 +54,7 @@
<div class="content">
<% if (errorMessage != null) { %>
-<div><%=errorMessage%></div>
+<div class="error-message"><%=errorMessage%></div>
<% } %>
<div style="height:40px;" class="top-toolbar-back">
<% if (details.isCollection()) { %>
@@ -100,6 +100,12 @@
<table cellpadding="0" cellspacing="0" border="0"
class="simple-data-table">
<tr><th style="width:140px;">Created:</th><td
style="width:170px;"><%=details.getCreatedOn().toString()%></td><th>Author:</th><td><%=details.getAuthor()%></td></tr>
<tr><th>Last
Updated:</th><td><%=details.getLastModified().toString()%></td><th>By:</th><td><%=details.getLastUpdater()%></td></tr>
+ <tr><th>Media Type:</th><td colspan="3"><% if (details.getMediaType()
!= null) { %><%=details.getMediaType()%><% } else { %>Unknown<% } %></td> </tr>
+ <% if (details.isCollection()) { %>
+ <tr><th>Permalink</th><td colspan="3"><a
href="/wso2registry/web<%=details.getPermalink()%>"><%=details.getPermalink()%></a></td></tr>
+ <% } else { %>
+ <tr><th>Permalink</th><td colspan="3"><a target="_blank"
href="/wso2registry/resources<%=details.getPermalink()%>"><%=details.getPermalink()%></a></td></tr>
+ <% } %>
<% if (!details.isVersionView()) { %><tr><th>Versions</th><td
colspan="3"><a href="/wso2registry/versions<%=details.getPath()%>">View
versions</a></td> </tr><% } %>
</table>
<div id="ratingDiv"><img src="/wso2registry/admin/images/ajax-loader.gif"
/></div>
@@ -361,7 +367,7 @@
</form>
</div>
-
+<div id="entryList">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%"
class="data-table">
<%
if(!collection.getResourceDataList().isEmpty()) {
@@ -390,7 +396,7 @@
<input type="text" id="resourceEdit"
style="display:none" value="<%=resourceData.getName()%>" />
| <a
href="/wso2registry/resources<%=resourceData.getResourcePath()%>"
target="_blank" title="Download" ><img
src="/wso2registry/admin/images/icon-download.jpg" border="0" align="top" /></a>
| <a href="#" title="Edit Resource Name"
onclick="showHideCommon('resourceEdit');showHideCommon('resourceView');
showHideCommon('resourceSaveButton');showHideCommon('resourceEditButton');"
id="resourceEditButton"><img src="/wso2registry/admin/images/icon-edit.gif"
border="0" align="top" id="resourceEditButton" /></a>
- <a href="#"
onclick="showHideCommon('resourceEdit');showHideCommon('resourceView');
showHideCommon('resourceSaveButton');showHideCommon('resourceEditButton');"
id="resourceSaveButton" style="display:none;"><img border="0" align="top"
title="Save" src="/wso2registry/admin/images/save-button.gif" /></a>
+ <a href="#"
onclick="renameResource('<%=details.getPath()%>',
'<%=resourceData.getResourcePath()%>');showHideCommon('resourceEdit');showHideCommon('resourceView');
showHideCommon('resourceSaveButton');showHideCommon('resourceEditButton');"
id="resourceSaveButton" style="display:none;"><img border="0" align="top"
title="Save" src="/wso2registry/admin/images/save-button.gif" /></a>
</div>
<% } %>
</td>
@@ -416,6 +422,7 @@
<% } %>
</table>
+</div>
<% } else { %>
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev