1 31 32 package org.opencms.setup.xml; 33 34 import org.opencms.configuration.CmsConfigurationManager; 35 import org.opencms.configuration.CmsWorkplaceConfiguration; 36 37 import java.util.Collections ; 38 import java.util.List ; 39 40 import org.dom4j.Document; 41 import org.dom4j.Node; 42 43 52 public class CmsXmlAddPublishButtonAppearance extends A_CmsXmlWorkplace { 53 54 55 private List m_xpaths; 56 57 60 public String getName() { 61 62 return "Add new Publish button appearance node"; 63 } 64 65 68 protected boolean executeUpdate(Document document, String xpath) { 69 70 Node node = document.selectSingleNode(xpath); 71 if (node == null) { 72 CmsSetupXmlHelper.setValue(document, xpath, "always"); 73 return true; 74 } 75 return false; 76 } 77 78 81 protected String getCommonPath() { 82 83 StringBuffer xp = new StringBuffer (256); 85 xp.append("/").append(CmsConfigurationManager.N_ROOT); 86 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACE); 87 xp.append("/").append(CmsWorkplaceConfiguration.N_DEFAULTPREFERENCES); 88 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEPREFERENCES); 89 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS); 90 return xp.toString(); 91 } 92 93 96 protected List getXPathsToUpdate() { 97 98 if (m_xpaths == null) { 99 StringBuffer xp = new StringBuffer (256); 101 xp.append("/").append(CmsConfigurationManager.N_ROOT); 102 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACE); 103 xp.append("/").append(CmsWorkplaceConfiguration.N_DEFAULTPREFERENCES); 104 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEPREFERENCES); 105 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACEGENERALOPTIONS); 106 xp.append("/").append(CmsWorkplaceConfiguration.N_PUBLISHBUTTONAPPEARANCE); 107 m_xpaths = Collections.singletonList(xp.toString()); 108 } 109 return m_xpaths; 110 } 111 } | Popular Tags |