1 package org.jahia.deprecated.taglibs.button; 2 3 import java.util.Enumeration ; 4 5 import javax.servlet.jsp.JspException ; 6 7 import org.jahia.data.JahiaData; 8 import org.jahia.data.containers.JahiaContainerList; 9 import org.jahia.deprecated.taglibs.container.ContainerListTag; 10 import org.jahia.exceptions.JahiaException; 11 import org.jahia.services.usermanager.JahiaUser; 12 13 14 21 public class ContainerListPropertiesButtonTag extends AbstractButtonTag { 22 23 private JahiaContainerList containerList = null; 24 private String title = "Properties"; 25 private String style = ""; 26 27 public void setTitle(String title) { 28 this.title = title; 29 } 30 31 public void setStyle(String style) { 32 this.style = style; 33 } 34 35 public String getTitle() { 36 return this.title; 37 } 38 39 public String getStyle() { 40 return this.style; 41 } 42 43 public boolean testRights (JahiaData jData) { 44 JahiaUser user = jData.params().getUser(); 45 ContainerListTag parent = (ContainerListTag) findAncestorWithClass(this,ContainerListTag.class); 47 if (parent != null) { 48 if (parent.isDeclarationPass()) { 49 return false; 50 } 51 containerList = parent.getContainerList(); 52 } 53 if (containerList != null) { 54 Enumeration containers = containerList.getContainers(); 55 return ( containers.hasMoreElements() && 56 containerList.checkWriteAccess(user) && 57 jData.gui().isEditMode() ); 58 } 59 return false; 60 } 61 62 public String getLauncher(JahiaData jData) throws JahiaException { 63 return "javascript:" + jData.gui().html().drawContainerListPropertiesLauncher(this.containerList); 65 } 66 67 public int doEndTag() throws JspException { 68 containerList = null; 71 title = "Properties"; 72 style = ""; 73 return EVAL_PAGE; 74 } 75 76 77 } 78 | Popular Tags |