1 package org.jahia.taglibs.button; 2 3 import javax.servlet.jsp.JspException ; 4 5 import org.jahia.data.JahiaData; 6 import org.jahia.exceptions.JahiaException; 7 8 9 15 public class LogButtonTag extends AbstractButtonTag { 16 17 private String loginTitle = "Login"; 18 private String logoutTitle = "Logout"; 19 private String style = ""; 20 21 private boolean isLogged = false; 22 23 public void setLoginTitle(String title) { 24 this.loginTitle = title; 25 } 26 27 public void setLogoutTitle(String title) { 28 this.logoutTitle = title; 29 } 30 31 public void setStyle(String style) { 32 this.style = style; 33 } 34 35 public String getTitle() { 36 return isLogged ? logoutTitle : loginTitle; 37 } 38 39 public String getStyle() { 40 return this.style; 41 } 42 43 public boolean testRights (JahiaData jData) { 44 return true; 46 } 47 48 public String getLauncher(JahiaData jData) throws JahiaException { 49 if (jData.gui().isLogged()) { 51 this.isLogged = true; 52 return jData.gui().html().drawLogoutLauncher(); 53 } else { 54 this.isLogged = false; 55 return "javascript:" + jData.gui().html().drawLoginLauncher() ; 56 } 57 } 58 59 public int doEndTag() throws JspException { 60 loginTitle = "Login"; 63 logoutTitle = "Logout"; 64 style = ""; 65 66 isLogged = false; 67 return EVAL_PAGE; 68 } 69 70 71 } 72 | Popular Tags |