Revision: 13885
Author: aschrijvers
Date: 2008-10-10 11:18:53 +0200 (Fri, 10 Oct 2008)
Log Message:
-----------
HSTTWO-80 support for relative static sources. instead of location="" in a linktag, you now use static="" in a linktag
Modified Paths:
--------------
experimental/hst2/trunk/core/src/main/java/org/hippoecm/hst/core/template/tag/LinkTag.java
experimental/hst2/trunk/core/src/main/resources/META-INF/hst-template.tld
Modified: experimental/hst2/trunk/core/src/main/java/org/hippoecm/hst/core/template/tag/LinkTag.java
===================================================================
--- experimental/hst2/trunk/core/src/main/java/org/hippoecm/hst/core/template/tag/LinkTag.java 2008-10-10 09:15:03 UTC (rev 13884)
+++ experimental/hst2/trunk/core/src/main/java/org/hippoecm/hst/core/template/tag/LinkTag.java 2008-10-10 09:18:53 UTC (rev 13885)
@@ -38,6 +38,7 @@
private String var;
private String location;
+ private String staticattr;
private ELNode item;
@Override
@@ -51,10 +52,14 @@
href = urlMapping.rewriteLocation(item.getJcrNode());
} else if(location != null ) {
href = urlMapping.rewriteLocation(location);
+ } else if(staticattr != null ) {
+ href = urlMapping.getLocation(staticattr);
}
Link link = new Link();
link.setHref(href);
+ link.setSrc(href);
+ link.setLocation(href);
pageContext.setAttribute(getVar(), link);
}
@@ -79,13 +84,43 @@
return location;
}
+ public void setStatic(String staticattr) {
+ this.staticattr = staticattr;
+ }
+
+ public String getStatic() {
+ return staticattr;
+ }
+
public void setLocation(String location) {
this.location = location;
}
public class Link {
+ /*
+ * three link attributes, all returning the same value.
+ * in jsp, you can use link.href, link.src or link.location
+ */
private String href;
+ private String src;
+ private String location;
+
+ public String getSrc() {
+ return src;
+ }
+ public void setSrc(String src) {
+ this.src = src;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
public String getHref() {
return href;
}
Modified: experimental/hst2/trunk/core/src/main/resources/META-INF/hst-template.tld
===================================================================
--- experimental/hst2/trunk/core/src/main/resources/META-INF/hst-template.tld 2008-10-10 09:15:03 UTC (rev 13884)
+++ experimental/hst2/trunk/core/src/main/resources/META-INF/hst-template.tld 2008-10-10 09:18:53 UTC (rev 13885)
@@ -164,11 +164,17 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
- <description>If you have a static link, use this one to translate to correct link</description>
+ <description>If you have a link to a sitemap item, use this one to translate to correct link</description>
<name>location</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
+ <attribute>
+ <description>If you have a static link, use this one to translate to correct link</description>
+ <name>static</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
</tag>
<tag>
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@...
http://lists.hippo.nl/mailman/listinfo/hippocms-svn