Author: wassek
Date: Fri Nov 16 11:18:56 2007
New Revision: 19175
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19175&repname=
=3Djahia
Log:
logGoToHomepage tag initial version
Added:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogGoToHomeTag.java (with props)
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/login/LogGoToHomeTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/login/LogGoToHomeT=
ag.java&rev=3D19175&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/=
login/LogGoToHomeTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogGoToHomeTag.java Fri Nov 16 11:18:56 2007
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2002-2007 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 hav=
e =
+ * 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.login;
+
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+
+import org.jahia.data.JahiaData;
+import org.jahia.resourcebundle.JahiaResourceBundle;
+
+/**
+ * Class LogGoToHome : returns a select box (go to Homepage) for the login=
Area
+ *
+ * @author Werner Assek
+ *
+ * @jsp:tag name=3D"logGoToHome" body-content=3D"empty"
+ * description=3D"Display a select box for the login area."
+ * =
+ * <p><b>Example :</b>
+ * <p> <content:logGoToHome
+ * labelBundle=3D\"jahiatemplates.JahiaLabels\" <br>
+ * labelKeys=3D\"goToHome,StayOnSite\" <br> =
+ * styleClass=3D\"cssClass\" /> <br>
+ * <br>
+ */
+public class LogGoToHomeTag extends BodyTagSupport {
+
+
+
+ private static org.apache.log4j.Logger logger =3D
+ org.apache.log4j.Logger.getLogger(LogAreaTag.class);
+ private static final long serialVersionUID =3D 1L;
+ //private boolean isLogged =3D false;
+ =
+ =
+ private String styleClass =3D "";
+ private String labelBundle =3D "JahiaEnginesResources";
+ private String labelKeys =3D
"org.jahia.engines.login.Login_Engine.stayAt=
CurrentPage.label,org.jahia.engines.login.Login_Engine.jumpToHomePage.label=
";
+ =
+
+
+ =
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+
+
+
+ public void setStyleClass(String styleClass) {
+ this.styleClass =3D styleClass;
+ }
+
+
+
+
+ public String getLabelBundle() {
+ return labelBundle;
+ }
+
+
+
+
+ public void setLabelBundle(String labelBundle) {
+ this.labelBundle =3D labelBundle;
+ }
+
+
+
+
+ public String getLabelKeys() {
+ return labelKeys;
+ }
+
+
+
+
+ public void setLabelKeys(String labelKey) {
+ this.labelKeys =3D labelKey;
+ }
+
+
+
+
+ public int doEndTag ()
+ throws JspException {
+
+ JspWriter out =3D pageContext.getOut();
+ HttpServletRequest request =3D (HttpServletRequest)pageContext.getReq=
uest();
+ JahiaData jData =3D (JahiaData) request.getAttribute("org.jahia.data.=
JahiaData");
+ if (!jData.gui().isLogged()) =
+ {
+ try
+ {
+ String css =3D "";
+ if(getStyleClass() !=3D null && !getStyleClass().equals(""))
+ {
+ css =3D " class=3D\"" + getStyleClass() + "\"";
+ }
+ =
+ out.println("<br/><select name=3D\"loginChoice\"
tabindex=3D\"3\"=
>");
+ StringTokenizer token =3D new StringTokenizer(getLabelKeys(), "=
,");
+ int i =3D 1;
+ while(token.hasMoreElements())
+ {
+ String el =3D token.nextToken();
+ String text =3D JahiaResourceBundle.getResource(getLabelBundle=
(),
+ el,
jData.getProcessingContext().getLocale(),
+
jData.getProcessingContext());
+ out.println("<option value=3D\"" + i + "\" " + css + "" +">" +=
text + "</option>");
+ }
+ out.println("</select>");
+ }catch (IOException ioe) =
+ {
+ logger.error("IO exception while trying to display login conte=
nt " +
+ "login", ioe);
+ }
+
+ =
+ }
+ //isLogged =3D false;
+ =
+ return EVAL_PAGE;
+ }
+
+
+}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list