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.deprecated.taglibs.container.ContainerTag; 8 import org.jahia.exceptions.JahiaException; 9 import org.jahia.services.usermanager.JahiaUser; 10 11 12 18 public class UpdateContainerButtonTag extends AbstractButtonTag { 19 20 private JahiaContainer container = null; 21 22 private String title = "Update"; 23 private String style = ""; 24 25 public void setTitle(String title) { 26 this.title = title; 27 } 28 29 public void setStyle(String style) { 30 this.style = style; 31 } 32 33 public String getTitle() { 34 return this.title; 35 } 36 37 public String getStyle() { 38 return this.style; 39 } 40 41 public boolean testRights (JahiaData jData) { 42 43 ContainerTag parent = (ContainerTag) findAncestorWithClass(this, ContainerTag.class); 44 if (parent != null) { 45 if (parent.isDeclarationPass()) { 46 return false; 47 } 48 this.container = parent.getContainer(); 49 } 50 if (this.container != null) { 51 JahiaUser user = jData.params().getUser(); 52 return ( this.container.checkWriteAccess(user) 53 && jData.gui().isEditMode() ); 54 } 55 return false; 56 } 57 58 public String getLauncher(JahiaData jData) throws JahiaException { 59 return "javascript:" + jData.gui().html().drawUpdateContainerLauncher(this.container); 61 } 62 63 public int doEndTag() throws JspException { 64 container = null; 67 68 title = "Update"; 69 style = ""; 70 return EVAL_PAGE; 71 } 72 73 74 } 75 | Popular Tags |