Author: xlawrence
Date: Tue Nov 13 15:38:40 2007
New Revision: 19138

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19138&repname=
=3Djahia
Log:
added 2 tags in order to generate full links or only URL to the jahia login=
 engine and the jahia sitemap.

Existing tags (logButton and sitemap button) can still be used in order to =
get a full button, but these 2 tags were necessary for template developers =
only wanting to get a url or a link to one of these 2 engines

Added:
    branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
links/
    branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
links/LoginLink.java
    branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
links/SiteMapLinkTag.java

Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/links/LoginLink.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/links/LoginLink.ja=
va&rev=3D19138&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/html/=
links/LoginLink.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
links/LoginLink.java Tue Nov 13 15:38:40 2007
@@ -0,0 +1,77 @@
+package org.jahia.taglibs.html.links;
+
+import org.jahia.taglibs.AbstractJahiaTag;
+import org.jahia.data.JahiaData;
+import org.jahia.exceptions.JahiaException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+/**
+ * Simple tags that generates a full link in order to access the Jahia Sit=
e Map engine.
+ *
+ * @author Xavier Lawrence
+ */
+public class LoginLink extends AbstractJahiaTag {
+
+    private static final org.apache.log4j.Logger logger =3D
+            org.apache.log4j.Logger.getLogger(LoginLink.class);
+
+    private int destinationPageID =3D -1;
+    private boolean urlonly;
+
+    public int doStartTag() throws JspException {
+        try {
+            final HttpServletRequest request =3D (HttpServletRequest) page=
Context.getRequest();
+            final JahiaData jData =3D (JahiaData) request.getAttribute("or=
g.jahia.data.JahiaData");
+
+            final JspWriter out =3D pageContext.getOut();
+
+            if (urlonly) {
+                if (destinationPageID > 0) {
+                    out.print(jData.gui().drawPopupLoginUrl(destinationPag=
eID));
+                } else {
+                    out.print(jData.gui().drawPopupLoginUrl());
+                }
+            } else {
+                if (destinationPageID > 0) {
+                    out.print(jData.gui().html().drawLoginLauncher(destina=
tionPageID));
+                } else {
+                    out.print(jData.gui().html().drawLoginLauncher());
+                }
+            }
+
+        } catch (final IOException e) {
+            logger.error("IOException in doStartTag", e);
+
+        } catch (final JahiaException je) {
+            logger.error("JahiaException in doStartTag", je);
+        }
+
+        return SKIP_BODY;
+    }
+
+    public int doEndTag() throws JspException {
+        destinationPageID =3D -1;
+        urlonly =3D false;
+        return EVAL_PAGE;
+    }
+
+    public int getDestinationPageID() {
+        return destinationPageID;
+    }
+
+    public void setDestinationPageID(int destinationPageID) {
+        this.destinationPageID =3D destinationPageID;
+    }
+
+    public boolean isUrlonly() {
+        return urlonly;
+    }
+
+    public void setUrlonly(boolean urlonly) {
+        this.urlonly =3D urlonly;
+    }
+}

Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/links/SiteMapLinkTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/links/SiteMapLinkT=
ag.java&rev=3D19138&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/html/=
links/SiteMapLinkTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
links/SiteMapLinkTag.java Tue Nov 13 15:38:40 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.html.links;
+
+import org.jahia.data.JahiaData;
+import org.jahia.exceptions.JahiaException;
+import org.jahia.taglibs.AbstractJahiaTag;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import java.io.IOException;
+
+/**
+ * Simple tags that generates a full link in order to access the Jahia Sit=
e Map engine.
+ *
+ * @author Xavier Lawrence
+ */
+public class SiteMapLinkTag extends AbstractJahiaTag {
+
+    private static final org.apache.log4j.Logger logger =3D
+            org.apache.log4j.Logger.getLogger(SiteMapLinkTag.class);
+
+    private boolean urlonly;
+
+    public int doStartTag() throws JspException {
+        try {
+            final HttpServletRequest request =3D (HttpServletRequest) page=
Context.getRequest();
+            final JahiaData jData =3D (JahiaData) request.getAttribute("or=
g.jahia.data.JahiaData");
+
+            final JspWriter out =3D pageContext.getOut();
+
+            if (urlonly) {
+                out.print(jData.gui().drawSiteMapUrl());
+            } else {
+                out.print(jData.gui().html().drawSiteMapLauncher());
+            }
+
+        } catch (final IOException e) {
+            logger.error("IOException in doStartTag", e);
+
+        } catch (final JahiaException je) {
+            logger.error("JahiaException in doStartTag", je);
+        }
+
+        return SKIP_BODY;
+    }
+
+    public int doEndTag() throws JspException {
+        urlonly =3D false;
+        return EVAL_PAGE;
+    }
+
+    public boolean isUrlonly() {
+        return urlonly;
+    }
+
+    public void setUrlonly(boolean urlonly) {
+        this.urlonly =3D urlonly;
+    }
+}

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to