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