Author: xlawrence
Date: Tue Nov 6 14:00:51 2007
New Revision: 19058
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19058&repname=
=3Djahia
Log:
added attribute to zimbra inckude tag. =
Modified:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ajax/=
ZimbraInclude.java
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/a=
jax.tld
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs=
/ajax/ZimbraInclude.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/java/org/jahia/taglibs/ajax/ZimbraInclude.java&rev=3D=
19058&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ajax/=
ZimbraInclude.java (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ajax/=
ZimbraInclude.java Tue Nov 6 14:00:51 2007
@@ -25,6 +25,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
import java.util.Locale;
@@ -40,6 +41,18 @@
private static final org.apache.log4j.Logger logger =3D
org.apache.log4j.Logger.getLogger(ZimbraInclude.class);
=
+ private static final String SITEMAP_FILE_NAME =3D "sitemap.jsp";
+
+ public String getTemplateUsage() {
+ return templateUsage;
+ }
+
+ public void setTemplateUsage(final String templateUsage) {
+ this.templateUsage =3D templateUsage;
+ }
+
+ private String templateUsage;
+
/**
* Writes all the javascript and CSS imports in order to use the Zimbr=
a AjaxTK inside a HTML page.<br>
* Usage example inside a JSP:<br>
@@ -59,49 +72,51 @@
public int doStartTag() {
final JspWriter out =3D pageContext.getOut();
final HttpServletRequest request =3D (HttpServletRequest) pageCont=
ext.getRequest();
- final String zimbraPath =3D request.getContextPath() + "/jsp/jahia=
/javascript/zimbra";
- final String complexTreePath =3D request.getContextPath() + "/jsp/=
jahia/javascript/zimbra/complexTree";
- final String toolKitPath =3D zimbraPath + "/ajaxTK";
-
- final StringBuffer buff =3D new StringBuffer();
- try {
- out.print("<!-- BEGIN SCRIPT BLOCK ZIMBRA INCLUDE-->\n");
- // these lines cannot be removed because they actually call a
- // servlet that serves the messages from server-side propertie=
s files.
- buff.append("<script type=3D\"text/javascript\" src=3D\"");
- buff.append(toolKitPath);
- buff.append("/msgs/I18nMsg,AjxMsg.js");
- appendLocale(buff); =
- buff.append("\"></script>\n");
- buff.append("<style type=3D\"text/css\">\n" +
- " <!--\n" +
- " @import url( ").append(toolKitPath).append("/comm=
on/img/hiRes/dwtimgs.css );\n" +
- " -->\n" +
- "</style>\n");
- buff.append("<!-- ComplexTree CSS -->\n");
- buff.append("<style type=3D\"text/css\">\n" +
- " <!--\n" +
- " @import url( ").append(complexTreePath).append("/=
cTree.css );\n" +
- " -->\n" +
- "</style>\n");
- if (Jahia.getSettings().isDevelopmentMode()) {
- out.print(buff.toString());
- pageContext.include("/jsp/jahia/javascript/zimbra/zimbra_j=
s_build.jsp");
- } else {
+ if (templateUsage !=3D null && "true".equals(templateUsage) && req=
uest.getServletPath().endsWith(SITEMAP_FILE_NAME)) {
+ final String zimbraPath =3D request.getContextPath() + "/jsp/j=
ahia/javascript/zimbra";
+ final String complexTreePath =3D request.getContextPath() + "/=
jsp/jahia/javascript/zimbra/complexTree";
+ final String toolKitPath =3D zimbraPath + "/ajaxTK";
+
+ final StringBuffer buff =3D new StringBuffer();
+ try {
+ out.print("<!-- BEGIN SCRIPT BLOCK ZIMBRA INCLUDE-->\n");
+ // these lines cannot be removed because they actually cal=
l a
+ // servlet that serves the messages from server-side prope=
rties files.
buff.append("<script type=3D\"text/javascript\" src=3D\"");
- buff.append(zimbraPath);
- if (SetHeaderFilter.supportsGzip(request)) {
- buff.append("/zimbra_all_packed.js.zgz\"></script>");
+ buff.append(toolKitPath);
+ buff.append("/msgs/I18nMsg,AjxMsg.js");
+ appendLocale(buff);
+ buff.append("\"></script>\n");
+ buff.append("<style type=3D\"text/css\">\n" +
+ " <!--\n" +
+ " @import url( ").append(toolKitPath).append("/=
common/img/hiRes/dwtimgs.css );\n" +
+ " -->\n" +
+ "</style>\n");
+ buff.append("<!-- ComplexTree CSS -->\n");
+ buff.append("<style type=3D\"text/css\">\n" +
+ " <!--\n" +
+ " @import url( ").append(complexTreePath).appen=
d("/cTree.css );\n" +
+ " -->\n" +
+ "</style>\n");
+ if (Jahia.getSettings().isDevelopmentMode()) {
+ out.print(buff.toString());
+ pageContext.include("/jsp/jahia/javascript/zimbra/zimb=
ra_js_build.jsp");
} else {
- buff.append("/zimbra_all_packed.js\"></script>");
+ buff.append("<script type=3D\"text/javascript\" src=3D=
\"");
+ buff.append(zimbraPath);
+ if (SetHeaderFilter.supportsGzip(request)) {
+ buff.append("/zimbra_all_packed.js.zgz\"></script>=
");
+ } else {
+ buff.append("/zimbra_all_packed.js\"></script>");
+ }
+ out.print(buff.toString());
}
- out.print(buff.toString());
+ out.print("<!-- END SCRIPT BLOCK ZIMBRA INCLUDE-->\n");
+ } catch (IOException e) {
+ logger.error(e, e);
+ } catch (ServletException se) {
+ logger.error("Error dispatching to JSP", se);
}
- out.print("<!-- END SCRIPT BLOCK ZIMBRA INCLUDE-->\n");
- } catch (IOException e) {
- logger.error(e, e);
- } catch (ServletException se) {
- logger.error("Error dispatching to JSP", se);
}
return SKIP_BODY;
}
@@ -125,4 +140,10 @@
}
}
}
+
+ public int doEndTag() throws JspException {
+ // Let's reinitialize the tag variables to allow tag object reuse =
in pooling.
+ templateUsage =3D null;
+ return EVAL_PAGE;
+ }
}
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/tag=
libs/ajax.tld
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/ajax.tld&rev=3D19058&repna=
me=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/a=
jax.tld (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/a=
jax.tld Tue Nov 6 14:00:51 2007
@@ -20,6 +20,11 @@
<tagclass>org.jahia.taglibs.ajax.ZimbraInclude</tagclass>
<bodycontent>empty</bodycontent>
<info>Includes all the javascript files and css required to use th=
e Zimbra Ajax toolKit</info>
+ <attribute>
+ <name>templateUsage</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
</tag>
=
<tag>
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list