Author: wassek
Date: Mon Nov 12 15:55:04 2007
New Revision: 19123
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19123&repname=
=3Djahia
Log:
new login Area tags
Added:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogAreaTag.java (with props)
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogButtonTag.java (with props)
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogPasswordInputTag.java (with props)
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogUserNameInputTag.java (with props)
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/login/LogAreaTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/login/LogAreaTag.j=
ava&rev=3D19123&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/LogAreaTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogAreaTag.java Mon Nov 12 15:55:04 2007
@@ -0,0 +1,310 @@
+/*
+ * 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 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.exceptions.JahiaException;
+import org.jahia.resourcebundle.JahiaResourceBundle;
+
+/**
+ * Class LogButtonTag : return the full HTML Content for login
+ * =
+ * @author Werner Assek
+ * =
+ * @jsp:tag name=3D"logArea" body-content=3D"" description=3D"Displays a c=
omplete
+ * login Area (form with: username, password, remember me, login
+ * button)."
+ * =
+ * <p>
+ * <b>Example :</b>
+ * <p>
+ * <content:logArea labelBundle=3D\"jahiatemplates.JahiaLa=
bels\"
+ * <br>
+ * labelRememberMe=3D\"rememberMe\" <br>
+ * remember=3D\"true\" <br>
+ * errorBundle=3D\"jahiatemplates.JahiaErrors\" <br>
+ * notLoginText=3D\"notLoginText\" <br>
+ * notAllowedLogin=3D\"notAllowedLogin\" <br>
+ * loginLabel=3D\"login\" <br>
+ * errorTextStyleClass=3D\"redColorStyleClass\" /> <br>
+ * <br>
+ */
+public class LogAreaTag 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 labelBundle =3D "JahiaEnginesResources";
+ private String labelRememberMe =3D
"org.jahia.engines.login.Login_Engine.=
rememberMe.label";
+ private String remember =3D "true";
+ private String errorBundle =3D "JahiaEnginesResources";
+ private String notLoginText =3D
"org.jahia.engines.login.Login_Engine.inv=
alidUsernamePassword.label";
+ private String notAllowedLogin =3D
"org.jahia.engines.login.Login_Engine.=
notAllowedToLog.label";
+ private String loginLabel =3D "";
+ private String errorTextStyleClass =3D "";
+
+ public int doStartTag()
+ {
+ JspWriter out =3D pageContext.getOut();
+ HttpServletRequest request =3D (HttpServletRequest)
pageContext.getReque=
st();
+ JahiaData jData =3D (JahiaData) request
+ .getAttribute("org.jahia.data.JahiaData");
+ if (!jData.gui().isLogged())
+ {
+ try
+ {
+ =
+ if (request.getAttribute("wrongLogin") !=3D null
+ &&
request.getAttribute("wrongLogin").equals("1")
+ ||
request.getSession().getAttribute("wrongLogin") !=3D null
+ &&
request.getSession().getAttribute("wrongLogin").equals("1"))
+ {
+ String wrongLogin =3D
JahiaResourceBundle.getResource(getErrorBundle(=
),
+ getNotLoginText(),
jData.getProcessingContext().getLocale(),
+
jData.getProcessingContext());
+ if (errorTextStyleClass !=3D null &&
errorTextStyleClass.length() > 0)
+ {
+ out.println("<div style=3D\"" +
getErrorTextStyleClass() + "\">");
+ out.println(wrongLogin);
+ out.println("</div>");
+ } else
+ {
+ out.println(wrongLogin);
+ }
+ request.removeAttribute("wrongLogin");
+
request.getSession().removeAttribute("wrongLogin");
+ }
+ if (request.getAttribute("notAllowedLogin")
!=3D null
+ &&
request.getAttribute("notAllowedLogin").equals("1")
+ ||
request.getSession().getAttribute("notAllowedLogin") !=3D null
+ &&
request.getSession().getAttribute("notAllowedLogin").equals("1"))
+ {
+ String notAllowedLogin =3D
JahiaResourceBundle.getResource(
+ getErrorBundle(),
getNotAllowedLogin(), jData
+
.getProcessingContext().getLocale(), jData
+
.getProcessingContext());
+ if (errorTextStyleClass !=3D null &&
errorTextStyleClass.length() > 0)
+ {
+ out.println("<div style=3D\"" +
getErrorTextStyleClass() + "\">");
+ out.println(notAllowedLogin);
+ out.println("</div>");
+ } else
+ {
+ out.println(notAllowedLogin);
+ }
+
request.removeAttribute("notAllowedLogin");
+
request.getSession().removeAttribute("notAllowedLogin");
+ }
+ =
+ out.println("<form name=3D\"loginForm\"
method=3D\"POST\" action=3D\""
+ + jData.gui().drawLoginUrl() +
"\">");
+ out
+ .println("<input
type=3D\"hidden\" name=3D\"loginChoice\" value=3D\"=
1\"/>");
+ out.println("<input type=3D\"hidden\"
name=3D\"screen\" value=3D\"save=
\"/>");
+ out.println("<input type=3D\"hidden\"
name=3D\"logtag\" value=3D\"1\" =
/> ");
+ =
+ =
+ =
+ } catch (IOException ioe)
+ {
+ logger.error("IO exception while trying to
display login content "
+ + "login", ioe);
+ } catch (JahiaException ex)
+ {
+ logger.error("Can not get login URL !", ex);
+ }
+ }
+ return EVAL_BODY_BUFFERED;
+ }
+
+ public int doAfterBody()
+ {
+
+ HttpServletRequest request =3D (HttpServletRequest)
pageContext.getReque=
st();
+ JahiaData jData =3D (JahiaData) request
+ .getAttribute("org.jahia.data.JahiaData");
+ if (!jData.gui().isLogged())
+ {
+
+ JspWriter out =3D bodyContent.getEnclosingWriter();
+ try
+ {
+ bodyContent.writeOut(out);
+ } catch (IOException ioe)
+ {
+ logger.error("Error:", ioe);
+ }
+ }
+ return SKIP_BODY;
+ }
+
+ public int doEndTag() throws JspException
+ {
+
+ JspWriter out =3D pageContext.getOut();
+ HttpServletRequest request =3D (HttpServletRequest)
pageContext.getReque=
st();
+ JahiaData jData =3D (JahiaData) request
+ .getAttribute("org.jahia.data.JahiaData");
+ =
+ =
+ if (!jData.gui().isLogged())
+ {
+ try
+ {
+ =
+ if(request.getAttribute("loginField") =3D=3D
null || !request.getAttri=
bute("loginField").equals("1"))
+ {
+ out.println("<input type=3D\"text\"
name=3D\"username\" tabindex=3D=
\"1\" value=3D\"username\" size=3D\"8\" onfocus=3D\"this.value=3D''\"/>");
+ }
+ if(request.getAttribute("passield") =3D=3D null
|| !request.getAttribu=
te("passield").equals("1"))
+ {
+ out.println("<input type=3D\"password\"
name=3D\"password\" tabindex=
=3D\"2\" value=3D\"voyeur\" size=3D\"8\" onfocus=3D\"this.value=3D''\"/>");
+ }
+ if(request.getAttribute("logButton") =3D=3D
null || !request.getAttrib=
ute("logButton").equals("1"))
+ {
+ String login =3D "go";
+ if (getLoginLabel() !=3D null &&
getLoginLabel().length() > 0)
+ {
+ login =3D
JahiaResourceBundle.getResource(getLabelBundle(),
+ getLoginLabel(),
jData.getProcessingContext().getLocale(), jData
+
.getProcessingContext());
+ }
+ out.println("<input type=3D\"submit\"
name=3D\"login\" tabindex=3D\"=
4\" value=3D\""
+ + login +
"\"/><br/>");
+ }
+ if (isRemember())
+ {
+ out.println("<label>");
+ out
+ .println("<input
type=3D\"checkbox\" name=3D\"useCookie\" value=3D\=
"on\" tabindex=3D\"3\"/>");
+ String remember =3D
JahiaResourceBundle.getResource(getLabelBundle(),
+ getLabelRememberMe(),
jData.getProcessingContext().getLocale(),
+
jData.getProcessingContext());
+ out.println(remember);
+ out.println("</label>");
+ }
+ out.println("</form>");
+
+ } catch (IOException ioe)
+ {
+ logger.error("IO exception while trying to
display login content "
+ + "login", ioe);
+ }
+
+ }
+ // isLogged =3D false;
+
+ return EVAL_PAGE;
+ }
+
+ public String getLabelBundle()
+ {
+ return labelBundle;
+ }
+
+ public void setLabelBundle(String labelBundle)
+ {
+ this.labelBundle =3D labelBundle;
+ }
+
+ public String getLabelRememberMe()
+ {
+ return labelRememberMe;
+ }
+
+ public void setLabelRememberMe(String labelRememberMe)
+ {
+ this.labelRememberMe =3D labelRememberMe;
+ }
+
+ public String getRemember()
+ {
+ return remember;
+ }
+
+ public void setRemember(String remember)
+ {
+ this.remember =3D remember;
+ }
+
+ public boolean isRemember()
+ {
+ return ((new Boolean(remember)).booleanValue());
+ }
+
+ public String getErrorBundle()
+ {
+ return errorBundle;
+ }
+
+ public void setErrorBundle(String errorBundle)
+ {
+ this.errorBundle =3D errorBundle;
+ }
+
+ public String getNotLoginText()
+ {
+ return notLoginText;
+ }
+
+ public void setNotLoginText(String notLoginText)
+ {
+ this.notLoginText =3D notLoginText;
+ }
+
+ public String getNotAllowedLogin()
+ {
+ return notAllowedLogin;
+ }
+
+ public void setNotAllowedLogin(String notAllowedLogin)
+ {
+ this.notAllowedLogin =3D notAllowedLogin;
+ }
+
+ public String getLoginLabel()
+ {
+ return loginLabel;
+ }
+
+ public void setLoginLabel(String loginLabel)
+ {
+ this.loginLabel =3D loginLabel;
+ }
+
+ public String getErrorTextStyleClass()
+ {
+ return errorTextStyleClass;
+ }
+
+ public void setErrorTextStyleClass(String errorTextStyleClass)
+ {
+ this.errorTextStyleClass =3D errorTextStyleClass;
+ }
+
+}
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/login/LogButtonTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/login/LogButtonTag=
.java&rev=3D19123&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/LogButtonTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogButtonTag.java Mon Nov 12 15:55:04 2007
@@ -0,0 +1,141 @@
+/*
+ * 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 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 LogPassword : returns the login button for the login Area
+ *
+ * @author Werner Assek
+ *
+ * @jsp:tag name=3D"loginButton" body-content=3D"empty"
+ * description=3D"Display a login button field for the login area."
+ * =
+ * <p><b>Example :</b>
+ * <p> <content:logUserName
+ * labelBundle=3D\"jahiatemplates.JahiaLabels\" <br>
+ * labelKey=3D\"login.button\" <br> =
+ * styleClass=3D\"cssClass\" /> <br>
+ * <br>
+ */
+public class LogButtonTag 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 "";
+ private String labelKey =3D "";
+ =
+
+
+ =
+ 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 getLabelKey() {
+ return labelKey;
+ }
+
+
+
+
+ public void setLabelKey(String labelKey) {
+ this.labelKey =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 label =3D "go";
+ if(!labelBundle.equals("") && !labelKey.equals(""))
+ {
+ label =3D JahiaResourceBundle.getResource(
+ getLabelBundle(), getLabelKey(),
+ jData.getProcessingContext().getLocale(), jData.ge=
tProcessingContext());
+ }
+ String css =3D "";
+ if(getStyleClass() !=3D null && !getStyleClass().equals(""))
+ {
+ css =3D " class=3D\"" + getStyleClass() + "\"";
+ }
+ =
+ out.println("<input type=3D\"submit\" name=3D\"login\"
tabindex=3D\"=
4\" value=3D\"" + label + "\" " + css + " />");
+ request.setAttribute("logButton", "1");
+ } catch (IOException ioe) {
+ logger.error("IO exception while trying to display login con=
tent " +
+ "login", ioe);
+ }
+
+ =
+ }
+ //isLogged =3D false;
+ =
+ return EVAL_PAGE;
+ }
+
+
+}
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/login/LogPasswordInputTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/login/LogPasswordI=
nputTag.java&rev=3D19123&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/LogPasswordInputTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogPasswordInputTag.java Mon Nov 12 15:55:04 2007
@@ -0,0 +1,142 @@
+/*
+ * 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 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 LogPassword : return the password field for the login Area
+ *
+ * @author Werner Assek
+ *
+ * @jsp:tag name=3D"logPassword" body-content=3D"empty"
+ * description=3D"Display a password field for the login area."
+ * =
+ * <p><b>Example :</b>
+ * <p> <content:logUserName
+ * labelBundle=3D\"jahiatemplates.JahiaLabels\" <br>
+ * labelKey=3D\"login.password\" <br> =
+ * styleClass=3D\"cssClass\" /> <br>
+ * <br>
+ */
+public class LogPasswordInputTag 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 "";
+ private String labelKey =3D "";
+ =
+
+
+ =
+ 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 getLabelKey() {
+ return labelKey;
+ }
+
+
+
+
+ public void setLabelKey(String labelKey) {
+ this.labelKey =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 label =3D "";
+ if(!labelBundle.equals("") && !labelKey.equals(""))
+ {
+ label =3D JahiaResourceBundle.getResource(
+ getLabelBundle(), getLabelKey(),
+ jData.getProcessingContext().getLocale(), jData.ge=
tProcessingContext());
+ if(!label.endsWith(" "))
+ label +=3D " ";
+ }
+ String css =3D "";
+ if(getStyleClass() !=3D null && !getStyleClass().equals(""))
+ {
+ css =3D " class=3D\"" + getStyleClass() + "\"";
+ }
+ out.print("<input type=3D\"password\" name=3D\"password\"
tabindex=
=3D\"2\" value=3D\"voyeur\" size=3D\"8\" onfocus=3D\"this.value=3D''\" " + =
css + " />");
+ request.setAttribute("passield", "1");
+ } catch (IOException ioe) {
+ logger.error("IO exception while trying to display login con=
tent " +
+ "login", ioe);
+ }
+
+ =
+ }
+ //isLogged =3D false;
+ =
+ return EVAL_PAGE;
+ }
+
+
+}
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/ht=
ml/login/LogUserNameInputTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/login/LogUserNameI=
nputTag.java&rev=3D19123&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/LogUserNameInputTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/html/=
login/LogUserNameInputTag.java Mon Nov 12 15:55:04 2007
@@ -0,0 +1,143 @@
+/*
+ * 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 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 LogUserName : return the username field for the login Area
+ *
+ * @author Werner Assek
+ *
+ * @jsp:tag name=3D"logUserName" body-content=3D"empty"
+ * description=3D"Display a username field for the login area."
+ * =
+ * <p><b>Example :</b>
+ * <p> <content:logUserName
+ * labelBundle=3D\"jahiatemplates.JahiaLabels\" <br>
+ * labelKey=3D\"login.username\" <br> =
+ * styleClass=3D\"cssClass\" /> <br>
+ * <br>
+ */
+public class LogUserNameInputTag 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 "";
+ private String labelKey =3D "";
+ =
+
+
+ =
+ 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 getLabelKey() {
+ return labelKey;
+ }
+
+
+
+
+ public void setLabelKey(String labelKey) {
+ this.labelKey =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 label =3D "";
+ if(!labelBundle.equals("") && !labelKey.equals(""))
+ {
+ label =3D JahiaResourceBundle.getResource(
+ getLabelBundle(), getLabelKey(),
+ jData.getProcessingContext().getLocale(), jData.ge=
tProcessingContext());
+ if(!label.endsWith(" "))
+ label +=3D " ";
+ }
+ =
+ String css =3D "";
+ if(getStyleClass() !=3D null && !getStyleClass().equals(""))
+ {
+ css =3D " class=3D\"" + getStyleClass() + "\"";
+ }
+ out.print(label + "<input type=3D\"text\" name=3D\"username\"
tabind=
ex=3D\"1\" value=3D\"username\" size=3D\"8\" onfocus=3D\"this.value=3D''\" =
" + css + " />");
+ request.setAttribute("loginField", "1");
+ } catch (IOException ioe) {
+ logger.error("IO exception while trying to display login con=
tent " +
+ "login", ioe);
+ }
+
+ =
+ }
+ //isLogged =3D false;
+ =
+ return EVAL_PAGE;
+ }
+
+
+}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list