try { I_CmsXmlContentHandler contentHandler = schemaType.getContentDefinition().getContentHandler(); I_CmsWidget widget = contentHandler.getWidget(schemaType); configuredType = contentHandler.getDisplayType(schemaType); if (configuredType.equals(DisplayType.none) && schemaType.isSimpleType()) { } else if (contentHandler.getComplexWidget(schemaType) != null) { I_CmsComplexWidget complexWidget = contentHandler.getComplexWidget(schemaType); CmsComplexWidgetData widgetData = complexWidget.getWidgetData(m_cms); CmsExternalWidgetConfiguration externalConfig = widgetData.getExternalWidgetConfiguration(); boolean visible = !m_contentHandler.hasVisibilityHandlers() || m_contentHandler.isVisible(cms, schemaType, path.substring(1), m_file, m_locale); if (!visible) { boolean localeSynchronized = (m_contentHandler.hasSynchronizedElements() && m_contentHandler.getSynchronizations().contains(path.substring(1))) || schemaType.getTypeName().equals(CmsXmlDynamicCategoryValue.TYPE_NAME);
/** * Reads the default value for the given type.<p> * * @param schemaType the schema type * @param path the element path * * @return the default value */ private String readDefaultValue(I_CmsXmlSchemaType schemaType, String path) { return m_contentHandler.getDefault(getCmsObject(), m_file, schemaType, path, m_locale); }
/** * Generates the HTML form for the XML content editor.<p> * * @return the HTML that generates the form for the XML editor */ public String getXmlEditorForm() { // set "editor mode" attribute (required for link replacement in the root site) getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE); // add customized message bundle eventually specified in XSD of XML content addMessages(m_content.getHandler().getMessages(getLocale())); ((CmsMultiMessages)getMessages()).setFallbackHandler(m_content.getHandler().getMessageKeyHandler()); // initialize tab lists for error handling before generating the editor form m_errorTabs = new ArrayList<CmsXmlContentTab>(); m_warningTabs = new ArrayList<CmsXmlContentTab>(); return getXmlEditorForm(m_content.getContentDefinition(), "", true, false).toString(); }
/** * Checks if the content value widget is compatible with the new content editor.<p> * * @param schemaType the content value type * * @return <code>true</code> if the content value widget is compatible with the new content editor * * @throws CmsXmlException if something goes wrong reading the type widget */ private boolean isEditorCompatible(A_CmsXmlContentValue schemaType) throws CmsXmlException { boolean result = false; I_CmsXmlContentHandler contentHandler = schemaType.getContentDefinition().getContentHandler(); I_CmsWidget widget = contentHandler.getWidget(schemaType); result = (widget == null) || (widget instanceof I_CmsADEWidget); return result; }
useTabs = contentDefinition.getContentHandler().getTabs().size() > 0; if (useTabs) { for (Iterator<CmsXmlContentTab> i = contentDefinition.getContentHandler().getTabs().iterator(); i.hasNext();) { CmsXmlContentTab tab = i.next(); result.append("\t<li id=\"OcmsTabTab").append(tab.getIdName()).append("\"><a href=\"#OcmsTab"); for (int tabIndex = 0; tabIndex < contentDefinition.getContentHandler().getTabs().size(); tabIndex++) { CmsXmlContentTab checkTab = contentDefinition.getContentHandler().getTabs().get(tabIndex); if (checkTab.getStartName().equals(type.getName())) { ? contentDefinition.getContentHandler().getWidget(value) : null;
localeItems.put(xpath, extracted); if (value.getContentDefinition().getContentHandler().isSearchable(value) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(extracted)) { List<String> mappings = xmlContent.getHandler().getMappings(value.getPath()); if (mappings.size() > 0) { for (String xpath : xpaths) { List<String> mappings = xmlContent.getHandler().getMappings(CmsXmlUtils.createXpath(xpath, 1)); for (String mapping : mappings) { || mapping.equals( I_CmsXmlContentHandler.MAPTO_PROPERTY + CmsPropertyDefinition.PROPERTY_TITLE)) { String defaultValue = xmlContent.getHandler().getDefault( cms, xmlContent.getFile(),
/** * Returns the relation type for the given path.<p> * * @param path the element path * * @return the relation type */ protected CmsRelationType getRelationType(String path) { CmsRelationType result = getContentDefinition().getContentHandler().getRelationType(path); I_CmsXmlDocument document = getDocument(); if (document != null) { // the relations set in the main content definition override relations set in the nested definition result = document.getContentDefinition().getContentHandler().getRelationType(getPath(), result); } else { LOG.warn("Missing document while evaluating relation type for " + path); } return result; }
String previewUri = m_content.getContentDefinition().getContentHandler().getPreview( getCms(), m_content,
/** * Generates the HTML form for the XML content editor.<p> * * @return the HTML that generates the form for the XML editor */ public String getXmlEditorForm() { // set "editor mode" attribute (required for link replacement in the root site) getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE); // add customized message bundle eventually specified in XSD of XML content addMessages(m_content.getContentDefinition().getContentHandler().getMessages(getLocale())); // initialize tab lists for error handling before generating the editor form m_errorTabs = new ArrayList(); m_warningTabs = new ArrayList(); return getXmlEditorForm(m_content.getContentDefinition(), "", true, false).toString(); }
if (m_content.getContentDefinition().getContentHandler().getTabs().size() > 0) {
if (handler.isSearchable(value)) {
/** * Initializes an XML document based on the provided document, encoding and content definition.<p> * * Checks the links and removes invalid ones in the initialized document.<p> * * @param cms the current users OpenCms content * @param document the base XML document to use for initializing * @param encoding the encoding to use when marshalling the document later * @param definition the content definition to use */ protected void initDocument(CmsObject cms, Document document, String encoding, CmsXmlContentDefinition definition) { initDocument(document, encoding, definition); // check invalid links if (cms != null) { // this will remove all invalid links getHandler().invalidateBrokenLinks(cms, this); } }
/** * Returns the possible model files for the new resource.<p> * * @param cms the current users context to work with * @param currentFolder the folder * @param newResourceTypeName the resource type name for the new resource to create * @return the possible model files for the new resource */ public static List getModelFiles(CmsObject cms, String currentFolder, String newResourceTypeName) { try { I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(newResourceTypeName); // get the schema for the resource type to create String schema = (String)resType.getConfiguration().get(CmsResourceTypeXmlContent.CONFIGURATION_SCHEMA); CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema); // get the content handler for the resource type to create I_CmsXmlContentHandler handler = contentDefinition.getContentHandler(); String masterFolder = handler.getModelFolder(cms, currentFolder); if (CmsStringUtil.isNotEmpty(masterFolder) && cms.existsResource(masterFolder)) { // folder for master files exists, get all files of the same resource type CmsResourceFilter filter = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(resType.getTypeId()); return cms.readResources(masterFolder, filter, false); } else { // no master folder found return Collections.EMPTY_LIST; } } catch (Throwable t) { // error determining resource type, should never happen return Collections.EMPTY_LIST; } }
contentHandler.initialize(appInfoElement, result); result.m_contentHandler = contentHandler;
/** * * @see org.opencms.xml.content.I_CmsXmlContentValueVisitor#visit(org.opencms.xml.types.I_CmsXmlContentValue) */ public void visit(I_CmsXmlContentValue value) { // only add simple types if (value.isSimpleType()) { String locale = value.getLocale().toString(); if (!m_locales.contains(locale)) { m_buffer.append("\n\n[").append(locale).append(']'); m_locales.add(locale); } m_buffer.append("\n\n[").append(value.getPath()).append("]\n\n"); try { I_CmsWidget widget = value.getDocument().getContentDefinition().getContentHandler().getWidget(value); m_buffer.append(widget.getWidgetStringValue( getCms(), new CmsResourceInfoDialog(getJsp()), (I_CmsWidgetParameter)value)); } catch (CmsXmlException e) { LOG.error(e.getMessage(), e); } } } }
useTabs = contentDefinition.getContentHandler().getTabs().size() > 0; if (useTabs) { for (Iterator i = contentDefinition.getContentHandler().getTabs().iterator(); i.hasNext();) { CmsXmlContentTab tab = (CmsXmlContentTab)i.next(); result.append("\t<li id=\"OcmsTabTab").append(tab.getStartName()).append( for (int tabIndex = 0; tabIndex < contentDefinition.getContentHandler().getTabs().size(); tabIndex++) { CmsXmlContentTab checkTab = contentDefinition.getContentHandler().getTabs().get(tabIndex); if (checkTab.getStartName().equals(type.getName())) { I_CmsWidget widget = null; if (type.isSimpleType()) { widget = contentDefinition.getContentHandler().getWidget(value);
/** * Fills a {@link CmsXmlVfsFileValue} with the resource identified by the given id.<p> * * @param cms the current CMS context * @param element the XML element to fill * @param res the resource to use */ protected void fillResource(CmsObject cms, Element element, CmsResource res) { String xpath = element.getPath(); int pos = xpath.lastIndexOf("/" + XmlNode.GroupContainers.name() + "/"); if (pos > 0) { xpath = xpath.substring(pos + 1); } CmsRelationType type = getHandler().getRelationType(xpath); CmsXmlVfsFileValue.fillEntry(element, res.getStructureId(), res.getRootPath(), type); }
String previewUri = m_content.getHandler().getPreview(getCms(), m_content, getParamTempfile());
/** * Creates a new instance.<p> * * @param cms the CMS context to use for VFS operations * @param content the content to use for macro value lookup * @param locale the locale to use for macro value lookup */ public CmsGalleryNameMacroResolver(CmsObject cms, A_CmsXmlDocument content, Locale locale) { setCmsObject(cms); CmsMultiMessages message = new CmsMultiMessages(locale); message.addMessages(OpenCms.getWorkplaceManager().getMessages(locale)); message.addMessages(content.getContentDefinition().getContentHandler().getMessages(locale)); setMessages(message); m_content = content; m_contentLocale = locale; }
if (m_content.getHandler().getTabs().size() > 0) {