自定义编辑器(可选)¶
每个架构可以配置不同的编辑器视图。这些配置可以在layout/config文件中找到-编辑器.xml每种模式。
此文件有四个主要块:
领域:
<!-- Form field type configuration. Default is text. --> <fields> <for name="gmd:abstract" use="textarea"/> <for name="gco:Distance" use="number"/> <for name="gmd:onLine" addDirective="data-gn-directory-entry-selector"> <directiveAttributes data-template-add-action="true" data-template-type="onLine" data-filter='{"_root": "gmd:CI_OnlineResource"}'/> </for> </fields>
这为每个XSD定义的类型定义,使用哪种类型的输入。就像gmd:在线,可以定义自定义的角度输入类型。
在定义了所有简单字段之后,我们定义了一个字段集列表,编辑器将其识别为要组合在一起的内容:
<fieldsWithFieldset> <name>gmd:MD_Metadata</name> <name>gmd:identificationInfo</name> </fieldsWithFieldset>
现在我们定义哪些字段是多语言字段。通常大多数字段是多语言的,所以我们可以定义排除哪些字段。
<multilingualFields> <!-- In multilingual mode, define which mode the widget should have. If expanded, then one field per language is displayed. --> <expanded> <name>gmd:title</name> <name>gmd:abstract</name> </expanded> <exclude> <name>gmd:identifier</name> </exclude> </multilingualFields>
最后,我们定义视图,它将自定义编辑元数据时将显示哪些字段。我们可以为每个模式定义多个视图,这样编辑器用户可以选择在编辑元数据时使用哪个视图。
在视图上定义非最终字段时,编辑器将自动生成其中的所有输入字段。所以,您不必显式地定义要显示的所有字段。最简单的视图是基于模式的XSD的视图。
xml视图也可以很容易地定义:
<view name="xml"> <tab id="xml" default="true"/> </view>
如果视图太大,我们还可以在编辑器中定义一组选项卡,因此并非所有字段都同时显示。请记住,当用户更改选项卡时,内容将被保存。所以我们应该将相关字段放在同一个选项卡中。
请记住,每次修改此文件时,都必须重新启动应用程序容器(Tomcat)。
查看更多信息 自定义编辑器 .