1 13 package info.magnolia.cms.taglibs; 14 15 import info.magnolia.cms.beans.config.Server; 16 17 import javax.servlet.http.HttpServletRequest ; 18 import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 19 20 21 26 public class PublicOnly extends ConditionalTagSupport { 27 28 31 private static final long serialVersionUID = 222L; 32 33 36 private boolean showInPreview; 37 38 42 public void setShowInPreview(boolean showInPreview) { 43 this.showInPreview = showInPreview; 44 } 45 46 49 protected boolean condition() { 50 HttpServletRequest request = (HttpServletRequest ) pageContext.getRequest(); 51 String prev = (String ) request.getSession().getAttribute("mgnlPreview"); if (!Server.isAdmin() || (prev != null && showInPreview)) { 54 return true; 55 } 56 return false; 57 } 58 59 62 public void release() { 63 super.release(); 64 this.showInPreview = false; 65 } 66 67 } 68 | Popular Tags |