我正在学习Alfresco 5.0.d:的"内容建模"教程
http://docs.alfresco.com/5.0/tasks/dev-extensions-content-models-tutorials-create-custom-content.html
本教程的一部分是创建一个"自定义类型"。
问题:我在Alfresco Share中看不到任何"类型"。
复制步骤:
-
登录Alfresco(http://localhost:8080/share)
-
点击我用演示创建的文档
-
选择"更改类型"<=下拉是完全空的
这是教程指导我们创建的customModel.xml
文件:
<model name="my:custommodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
...
<namespaces>
<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="my"/>
...
<types>
<type name="my:doc">
<title>MyCompany Generic Document</title>
<parent>cm:content</parent>
...
<type name="my:marketingDoc">
<title>MyCompany Marketing Document</title>
<parent>my:doc</parent>
...
<type name="my:whitepaper">
<title>MyCompany Whitepaper</title>
<parent>my:marketingDoc</parent>
...
以下是我的配置文件$ALFRESCO/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml
:中的一个片段
<config evaluator="model-type" condition="my:whitepaper">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
...
<config evaluator="node-type" condition="my:whitepaper">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
...
<types>
<type name="cm:content">
<!-- Custom sub-type added for whitepapers -->
<subtype name="my:whitepaper" />
...
<type name="cm:folder">
</type>
<type name="trx:transferTarget">
<subtype name="trx:fileTransferTarget" />
</type>
</types>
解决方案:
为了使自定义类型可见,我需要编辑$ALFRESCO/tomcat/webapps/share/WEB-INF/classes/alfresco/messages/slingshot.properties
:
...
# Types
type.cm_content=Content Base Type
type.cm_folder=Folder Base Type
type.trx_transferTarget=Transfer Target
type.trx_fileTransferTarget=File Transfer Target
type.my_doc=Tutorial Doctype
type.my_marketingdoc=Tutorial Marketing Doctype
type.my_whitepaper=Tutorial Whitepaper Doctype
<= This will make the types visible in the
"Alfresco Share > My Documents > Change Type" pull-down
默认情况下,您上传的文档类型为cm:content。
如果您想更改其类型,请在存储库内容模型中定义自己的类型,如下所示:
<type name="my:subtype"> <title>My subtype</title> <parent>cm:content</parent> </type>
然后将其添加为share-config-custom.xml中cm:content的子类型,如下所示:
<type name="cm:content"> <subtype name="my:subtype" /> </type>