[Yanel-commits] rev 22499 - in
public/yanel/trunk/src/resources/directory:
src/java/org/wyona/yanel/impl/resources xslt
simon at wyona.com
simon at wyona.com
Wed Feb 7 11:05:01 CET 2007
Author: simon
Date: 2007-02-07 11:05:00 +0100 (Wed, 07 Feb 2007)
New Revision: 22499
Modified:
public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java
public/yanel/trunk/src/resources/directory/xslt/dir2xhtml.xsl
Log:
fixes bug #5177. fixes parent link which failed without trailing slash.
Modified: public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java
===================================================================
--- public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java 2007-02-07 10:01:17 UTC (rev 22498)
+++ public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java 2007-02-07 10:05:00 UTC (rev 22499)
@@ -81,9 +81,9 @@
// href=\"yanel/resources/directory/xslt/dir2xhtml.xsl\"?>");
Repository contentRepo = null;
+ org.wyona.yarep.core.Path p = new org.wyona.yarep.core.Path(getPath());
try {
contentRepo = getRealm().getRepository();
- org.wyona.yarep.core.Path p = new org.wyona.yarep.core.Path(getPath());
// TODO: This doesn't seem to work ... (check on Yarep ...)
if (contentRepo.isResource(p)) {
@@ -132,6 +132,11 @@
if (getPath().endsWith("/") && !isRoot(getPath())) {
assetPath = "../";
}
+
+ String parentPath = "./";
+ if (p.toString().endsWith("/")) {
+ parentPath = "../";
+ }
TransformerFactory tfactory = TransformerFactory.newInstance();
String[] xsltTransformers = getXSLTprop();
@@ -145,6 +150,7 @@
transformerIntern.setParameter("yanel.path", getPath().toString());
transformerIntern.setParameter("yanel.back2context", backToRoot(getPath(), assetPath));
transformerIntern.setParameter("yarep.back2realm", backToRoot(getPath(), assetPath));
+ transformerIntern.setParameter("yarep.parent", parentPath);
transformerIntern.transform(orig, new StreamResult(baos));
if (xsltTransformers != null) {
@@ -157,6 +163,7 @@
transformer.setParameter("yanel.path", getPath().toString());
transformer.setParameter("yanel.back2context", backToRoot(getPath(), assetPath));
transformer.setParameter("yarep.back2realm", backToRoot(getPath(), assetPath));
+ transformer.setParameter("yarep.parent", parentPath);
transformer.transform(orig, new StreamResult(baos));
}
}
Modified: public/yanel/trunk/src/resources/directory/xslt/dir2xhtml.xsl
===================================================================
--- public/yanel/trunk/src/resources/directory/xslt/dir2xhtml.xsl 2007-02-07 10:01:17 UTC (rev 22498)
+++ public/yanel/trunk/src/resources/directory/xslt/dir2xhtml.xsl 2007-02-07 10:05:00 UTC (rev 22499)
@@ -17,6 +17,7 @@
<xsl:param name="yanel.path" select="'PATH_IS_NULL'"/>
<xsl:param name="yanel.back2context" select="'BACK2CONTEXT_IS_NULL'"/>
<xsl:param name="yarep.back2realm" select="'BACK2REALM_IS_NULL'"/>
+<xsl:param name="yarep.parent" select="'YAREPPARENT_IS_NULL'"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -35,7 +36,7 @@
</p>
<p>
-<b>Parent:</b> <a href="../">..</a>
+<b>Parent:</b> <a href="{$yarep.parent}">..</a>
</p>
<p>
More information about the Yanel-commits
mailing list