Author: chathura
Date: Fri Dec 7 01:59:59 2007
New Revision: 10689
Log:
Fix the resource view's navigation path.
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/utils/ResourceData.java
trunk/registry/modules/webapps/src/main/webapp/admin/registry-resources.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
Fri Dec 7 01:59:59 2007
@@ -19,6 +19,7 @@
import org.wso2.registry.*;
import org.wso2.registry.web.actions.utils.VersionPath;
import org.wso2.registry.web.actions.utils.Permission;
+import org.wso2.registry.web.actions.utils.ResourcePath;
import org.wso2.registry.secure.RegistryUserManager;
import org.wso2.registry.secure.SecureRegistry;
import org.wso2.usermanager.Realm;
@@ -49,6 +50,8 @@
private List userPermissions = new ArrayList();
private List rolePermissions = new ArrayList();
+ private List navigatablePaths = new ArrayList();
+
private String parentPath;
/**
@@ -72,6 +75,46 @@
path = RegistryConstants.ROOT_PATH;
}
+ if (path.equals(RegistryConstants.ROOT_PATH)) {
+
+ ResourcePath resourcePath = new ResourcePath();
+ resourcePath.setNavigateName("root");
+ resourcePath.setNavigatePath("#");
+
+ navigatablePaths.add(resourcePath);
+
+ } else {
+
+ // first add the root path
+ ResourcePath rootPath = new ResourcePath();
+ rootPath.setNavigateName("root");
+ rootPath.setNavigatePath(RegistryConstants.ROOT_PATH);
+ navigatablePaths.add(rootPath);
+
+ String preparedPath = path;
+ if (preparedPath.startsWith(RegistryConstants.PATH_SEPARATOR)) {
+ preparedPath =
preparedPath.substring(RegistryConstants.PATH_SEPARATOR.length());
+ }
+
+ if (preparedPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
+ preparedPath = preparedPath.
+ substring(0, preparedPath.length() -
RegistryConstants.PATH_SEPARATOR.length());
+ }
+
+ String[] parts =
preparedPath.split(RegistryConstants.PATH_SEPARATOR);
+ for (int i = 0; i < parts.length; i++) {
+ ResourcePath resourcePath = new ResourcePath();
+ resourcePath.setNavigateName(parts[i]);
+
+ String tempPath = "";
+ for (int j = 0; j < i + 1; j++) {
+ tempPath = tempPath + RegistryConstants.PATH_SEPARATOR +
parts[j];
+ }
+ resourcePath.setNavigatePath(tempPath);
+ navigatablePaths.add(resourcePath);
+ }
+ }
+
if (RegistryConstants.ROOT_PATH.equals(path)) {
relativePath = "";
} else {
@@ -457,4 +500,12 @@
public void setRolePermissions(List rolePermissions) {
this.rolePermissions = rolePermissions;
}
+
+ public List getNavigatablePaths() {
+ return navigatablePaths;
+ }
+
+ public void setNavigatablePaths(List navigatablePaths) {
+ this.navigatablePaths = navigatablePaths;
+ }
}
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/ResourceData.java
Fri Dec 7 01:59:59 2007
@@ -64,7 +64,7 @@
relativePath = resourcePath.substring(1,
resourcePath.length());
}
}
- }
+ }
public String getRelativePath() {
return relativePath;
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
Fri Dec 7 01:59:59 2007
@@ -42,7 +42,7 @@
<% } %>
<div class="breadcrumb">
<%
- Iterator iNavPaths = collection.getNavigatablePaths().iterator();
+ Iterator iNavPaths = details.getNavigatablePaths().iterator();
while (iNavPaths.hasNext()) {
ResourcePath resourcePath = (ResourcePath) iNavPaths.next();
%>
@@ -55,7 +55,12 @@
<!-- Display the details of main node -->
<div class="resource-head">
+ <% if (details.isCollection()) { %>
<a href="/wso2registry/web<%=details.getPath()%>" class="folder-small
headding1"><%=details.getName()%></a>
+ <% } else { %>
+ <a href="/wso2registry/web<%=details.getPath()%>" class="resource-small
headding1"><%=details.getName()%></a>
+ <% } %>
+
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><strong>Created:
</strong><%=details.getCreatedOn().toString()%><strong> Author:
</strong><%=details.getAuthor()%></td><td align="right"><div
id="ratingDiv">Rating...</div></td>
@@ -179,7 +184,7 @@
ResourceData resourceData = (ResourceData) iterator.next();
%>
<tr id="1">
- <td><a href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
class="folder-small"><%=resourceData.getName()%></a></td>
+ <td><% if (resourceData.getResourceType() == ResourceData.COLLECTION)
{ %><a href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
class="folder-small"><% } else { %><a
href="/wso2registry/web/<%=resourceData.getRelativePath()%>"
class="resource-small"><% } %><%=resourceData.getName()%></a></td>
<td><%=resourceData.getCreatedOn()%></td>
<td><%=resourceData.getAuthorUserName()%></td>
<td>
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev