1 13 package info.magnolia.cms.taglibs; 14 15 import info.magnolia.cms.beans.config.Server; 16 import info.magnolia.cms.util.Resource; 17 18 import javax.servlet.http.HttpServletRequest ; 19 import javax.servlet.jsp.jstl.core.ConditionalTagSupport; 20 21 22 27 public class AdminOnly extends ConditionalTagSupport { 28 29 32 private static final long serialVersionUID = 222L; 33 34 37 private boolean showInPreview; 38 39 43 public void setShowInPreview(boolean showInPreview) { 44 this.showInPreview = showInPreview; 45 } 46 47 50 protected boolean condition() { 51 HttpServletRequest request = (HttpServletRequest ) pageContext.getRequest(); 52 if (Server.isAdmin() && (!Resource.showPreview(request) || showInPreview)) { 53 return true; 54 } 55 return false; 56 } 57 58 61 public void release() { 62 this.showInPreview = false; 63 super.release(); 64 } 65 } 66 | Popular Tags |