1 31 32 package org.opencms.setup.xml; 33 34 import org.opencms.configuration.CmsConfigurationManager; 35 import org.opencms.configuration.CmsWorkplaceConfiguration; 36 import org.opencms.configuration.I_CmsXmlConfiguration; 37 import org.opencms.file.types.CmsResourceTypeBinary; 38 import org.opencms.file.types.CmsResourceTypeFolder; 39 import org.opencms.file.types.CmsResourceTypeImage; 40 import org.opencms.file.types.CmsResourceTypeJsp; 41 import org.opencms.file.types.CmsResourceTypePlain; 42 import org.opencms.file.types.CmsResourceTypePointer; 43 import org.opencms.file.types.CmsResourceTypeXmlPage; 44 import org.opencms.util.CmsStringUtil; 45 46 import java.util.ArrayList ; 47 import java.util.List ; 48 49 import org.dom4j.Document; 50 import org.dom4j.Node; 51 52 61 public class CmsXmlAddAutoSetFeatures extends A_CmsXmlWorkplace { 62 63 64 private List m_xpaths; 65 66 69 public String getName() { 70 71 return "Add auto set features in new dialog"; 72 } 73 74 77 protected boolean executeUpdate(Document document, String xpath) { 78 79 Node node = document.selectSingleNode(xpath); 80 if (node == null) { 81 CmsSetupXmlHelper.setValue(document, xpath, Boolean.FALSE.toString()); 82 return true; 83 } 84 return false; 85 } 86 87 90 protected String getCommonPath() { 91 92 return new StringBuffer ("/").append(CmsConfigurationManager.N_ROOT).append("/").append( 94 CmsWorkplaceConfiguration.N_WORKPLACE).append("/").append(CmsWorkplaceConfiguration.N_EXPLORERTYPES).toString(); 95 } 96 97 100 protected List getXPathsToUpdate() { 101 102 if (m_xpaths == null) { 103 StringBuffer xp = new StringBuffer (256); 105 xp.append("/").append(CmsConfigurationManager.N_ROOT); 106 xp.append("/").append(CmsWorkplaceConfiguration.N_WORKPLACE); 107 xp.append("/").append(CmsWorkplaceConfiguration.N_EXPLORERTYPES); 108 xp.append("/").append(CmsWorkplaceConfiguration.N_EXPLORERTYPE); 109 xp.append("[@").append(I_CmsXmlConfiguration.N_NAME); 110 xp.append("='${etype}']/").append(CmsWorkplaceConfiguration.N_NEWRESOURCE); 111 xp.append("/@"); 112 m_xpaths = new ArrayList (); 113 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeFolder.getStaticTypeName()) 116 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 117 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "imagegallery") 118 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 119 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "downloadgallery") 120 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 121 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "xmlcontent") 122 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 123 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeXmlPage.getStaticTypeName()) 124 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 125 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypePlain.getStaticTypeName()) 126 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 127 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeImage.getStaticTypeName()) 128 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 129 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeJsp.getStaticTypeName()) 130 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 131 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeBinary.getStaticTypeName()) 132 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 133 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "XMLTemplate") 134 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 135 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypePointer.getStaticTypeName()) 136 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 137 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "link") 138 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 139 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "upload") 140 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 141 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "extendedfolder") 142 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 143 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "structurecontent") 144 + CmsWorkplaceConfiguration.A_AUTOSETNAVIGATION); 145 146 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeFolder.getStaticTypeName()) 147 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 148 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "imagegallery") 149 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 150 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "downloadgallery") 151 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 152 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "xmlcontent") 153 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 154 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeXmlPage.getStaticTypeName()) 155 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 156 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypePlain.getStaticTypeName()) 157 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 158 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeImage.getStaticTypeName()) 159 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 160 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeJsp.getStaticTypeName()) 161 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 162 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypeBinary.getStaticTypeName()) 163 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 164 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "XMLTemplate") 165 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 166 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", CmsResourceTypePointer.getStaticTypeName()) 167 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 168 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "link") 169 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 170 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "upload") 171 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 172 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "extendedfolder") 173 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 174 m_xpaths.add(CmsStringUtil.substitute(xp.toString(), "${etype}", "structurecontent") 175 + CmsWorkplaceConfiguration.A_AUTOSETTITLE); 176 } 177 return m_xpaths; 178 } 179 180 } | Popular Tags |