cm:folder 的 Alfresco 自定义子类型不起作用
Alfresco custom subtypes for cm:folder not working
我试图创建一个新的文件夹类型,它继承了 cm:folder 的所有内容,因此我在 tomcat/shared/classes/alfresco/extension/models 下为 myModel.xml 创建了一个 xml 文件,并添加了以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" -->
<model name="my:custmodel"
xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<description>custom folder test</description>
<author>Max Mustermann</author>
<published>2015-11-24</published>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<namespace uri="http://www.alfresco.org/model/rendition/1.0" prefix="rn"/>
<namespace uri="http://www.alfresco.org/model/exif/1.0" prefix="exif"/>
<namespace uri="http://www.alfresco.org/model/audio/1.0" prefix="audio"/>
<namespace uri="http://www.alfresco.org/model/webdav/1.0" prefix="webdav"/>
<namespace uri="http://www.example.com/model/content/1.0" prefix="my" />
</namespaces>
<types>
<type name="my:folder1">
<title>folder1</title>
<parent>cm:folder</parent>
<archive>true</archive>
</type>
<type name="my:folder2">
<title>folder2</title>
<parent>cm:folder</parent>
<archive>true</archive>
</type>
</types>
然后我将以下行添加到 tomcat/shared/classes/alfresco/extension/custom-model-context。xml
<value>alfresco/extension/models/myModel.xml</value>
最后在 tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml:
<type name="cm:folder">
<subtype name="my:folder1" />
<subtype name="my:folder2" />
</type>
现在在 details->change Typ 下,我的子类型出现了,但是当我尝试应用它们时,我得到 "cannot change type of document ..."
您在上下文文件中的模型文件名被提及为
<value>alfresco/extension/models/custModel.xml</value>
在您的描述中,您说的名字是 "myModel.xml" 这是一个错字吗?否则你的文件条目看起来不错。希望您正确放置了这些条目。
此条目
<namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
应该是 <imports>
标签的一部分而不是 <namespaces>
像这样
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
我试图创建一个新的文件夹类型,它继承了 cm:folder 的所有内容,因此我在 tomcat/shared/classes/alfresco/extension/models 下为 myModel.xml 创建了一个 xml 文件,并添加了以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" -->
<model name="my:custmodel"
xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<description>custom folder test</description>
<author>Max Mustermann</author>
<published>2015-11-24</published>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>
<namespaces>
<namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<namespace uri="http://www.alfresco.org/model/rendition/1.0" prefix="rn"/>
<namespace uri="http://www.alfresco.org/model/exif/1.0" prefix="exif"/>
<namespace uri="http://www.alfresco.org/model/audio/1.0" prefix="audio"/>
<namespace uri="http://www.alfresco.org/model/webdav/1.0" prefix="webdav"/>
<namespace uri="http://www.example.com/model/content/1.0" prefix="my" />
</namespaces>
<types>
<type name="my:folder1">
<title>folder1</title>
<parent>cm:folder</parent>
<archive>true</archive>
</type>
<type name="my:folder2">
<title>folder2</title>
<parent>cm:folder</parent>
<archive>true</archive>
</type>
</types>
然后我将以下行添加到 tomcat/shared/classes/alfresco/extension/custom-model-context。xml
<value>alfresco/extension/models/myModel.xml</value>
最后在 tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml:
<type name="cm:folder">
<subtype name="my:folder1" />
<subtype name="my:folder2" />
</type>
现在在 details->change Typ 下,我的子类型出现了,但是当我尝试应用它们时,我得到 "cannot change type of document ..."
您在上下文文件中的模型文件名被提及为
<value>alfresco/extension/models/custModel.xml</value>
在您的描述中,您说的名字是 "myModel.xml" 这是一个错字吗?否则你的文件条目看起来不错。希望您正确放置了这些条目。
此条目
<namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
应该是 <imports>
标签的一部分而不是 <namespaces>
像这样
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>