Author: xlawrence
Date: Mon Jan 14 09:36:17 2008
New Revision: 19500
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19500&repname=
=3Djahia
Log:
Added Logger tag =
corrected tag descriptions in tld file
Added:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/util/=
LoggerTag.java
Modified:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/j=
ahia-components.tld
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ut=
il/LoggerTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/util/LoggerTag.java&rev=
=3D19500&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/util/=
LoggerTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/util/=
LoggerTag.java Mon Jan 14 09:36:17 2008
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2002-2006 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL),
+ * Version 1.0 (the "License"), or (at your option) any later version; you=
may
+ * not use this file except in compliance with the License. You should have
+ * received a copy of the License along with this program; if not, you may=
obtain
+ * a copy of the License at
+ *
+ * http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jahia.taglibs.util;
+
+import org.apache.log4j.Logger;
+import org.jahia.taglibs.AbstractJahiaTag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+
+/**
+ * Simple tag in order to allow the template developper to output some inf=
ormation without having to wirte scriptlet
+ * code in his/her jsp files.
+ *
+ * @author Xavier Lawrence
+ */
+public class LoggerTag extends AbstractJahiaTag {
+
+ public static final String LOGGER_NAME =3D "jsp.jahia.templates.Logger=
";
+ private static final Logger logger =3D Logger.getLogger(LOGGER_NAME);
+
+ private String level;
+ private String value;
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level =3D level;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value =3D value;
+ }
+
+ public int doStartTag() throws JspException {
+ final String lowerCaseLevel =3D level.toLowerCase();
+
+ if (lowerCaseLevel.equals("debug")) {
+ logger.debug(value);
+
+ } else if (lowerCaseLevel.equals("info")) {
+ logger.info(value);
+
+ } else if (lowerCaseLevel.equals("warn")) {
+ logger.warn(value);
+
+ } else if (lowerCaseLevel.equals("error")) {
+ logger.error(value);
+
+ } else if (lowerCaseLevel.equals("fatal")) {
+ logger.fatal(value);
+
+ } else {
+ throw new JspTagException("Unknown value for attribute 'level'=
: " +
+ level + ". Allowed values are 'debug', 'info', 'warn',=
'error' and 'fatal'");
+ }
+
+ return SKIP_BODY;
+ }
+
+ public int doEndTag() {
+ level =3D null;
+ value =3D null;
+ return EVAL_PAGE;
+ }
+
+}
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/tag=
libs/jahia-components.tld
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/jahia-components.tld&rev=
=3D19500&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/webapp/WEB-INF/etc/taglibs/j=
ahia-components.tld (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/j=
ahia-components.tld Mon Jan 14 09:36:17 2008
@@ -294,7 +294,7 @@
<tag>
<name>declare-box-list</name>
<tagclass>org.jahia.taglibs.declarations.DeclareBoxListTag</tagcla=
ss>
- <info>Decalres the default boxes provided by Jahia</info>
+ <info>Declares the actual box list that will allow the user to sel=
ect which box he/she wants to use</info>
<attribute>
<name>name</name>
<required>true</required>
@@ -320,7 +320,7 @@
<tag>
<name>declare-box</name>
<tagclass>org.jahia.taglibs.declarations.DeclareBoxTag</tagclass>
- <info>Decalres the default boxes provided by Jahia</info>
+ <info>Declares a custom box, provided by the template developper</=
info>
<attribute>
<name>view</name>
<required>true</required>
@@ -346,7 +346,7 @@
<tag>
<name>box-list</name>
<tagclass>org.jahia.taglibs.box.BoxListTag</tagclass>
- <info>Decalres the default boxes provided by Jahia</info>
+ <info>Loads and displays a box list. Very similar to tag content:c=
ontentContainerList</info>
<attribute>
<name>name</name>
<required>true</required>
@@ -362,7 +362,7 @@
<tag>
<name>box</name>
<tagclass>org.jahia.taglibs.box.BoxTag</tagclass>
- <info>Decalres the default boxes provided by Jahia</info>
+ <info>Displays the actual box. This tag dispatches the request to =
the JSP file of the box</info>
<attribute>
<name>id</name>
<required>false</required>
@@ -370,4 +370,20 @@
</attribute>
</tag>
=
+ <tag>
+ <name>box</name>
+ <tagclass>org.jahia.taglibs.util.LoggerTag</tagclass>
+ <info>Utility tag in order to use a log4j Logger in a template</in=
fo>
+ <attribute>
+ <name>level</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
</taglib>
\ No newline at end of file
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list