Merged BRANCHES/DEV/THOR1_SPRINTS to HEAD:

36882: THOR-1424: WebDAV via HTML/browser view: "Up a level" link does not work if at the network level 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@36883 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-05-24 12:54:35 +00:00
parent eca0a129ef
commit eb0004fce5

View File

@@ -430,8 +430,8 @@ public class GetMethod extends WebDAVMethod
writer.write("<td colspan='4' class='textData'><a href=\"");
// Strip the last folder from the path
String[] paths = getDAVHelper().splitPath(rootURL.substring(0, rootURL.length() - 1));
writer.write(paths[0]);
String parentFolderUrl = parentFolder(rootURL);
writer.write(parentFolderUrl);
writer.write("\">");
writer.write("[");
@@ -553,6 +553,29 @@ public class GetMethod extends WebDAVMethod
}
}
/**
* Given a path, will return the parent path. For example: /a/b/c
* will return /a/b and /a/b will return /a.
*
* @param path The path to return the parent of - must be non-null.
* @return String - parent path.
*/
private String parentFolder(String path)
{
if (path.endsWith(WebDAVHelper.PathSeperator))
{
// Strip trailing slash.
path = path.substring(0, path.length() - 1);
}
String[] paths = getDAVHelper().splitPath(path);
String parent = paths[0];
if (parent.equals(""))
{
parent = WebDAVHelper.PathSeperator;
}
return parent;
}
/**
* Formats the given size for display in a directory listing
*