13 | | This proposal aims to provide the capability to handle sub-templates. Sub-templates are XML fragment of metadata records. |
14 | | |
15 | | Example for a point of contact in ISO19139: |
| 13 | This proposal aims to provide the capability to handle sub-templates. Sub-templates are XML fragments of metadata records. A set of fragments compose a directory (ie. contact directory, extent directory). |
| 14 | |
| 15 | Sub-templates are designed to be inserted into existing metadata records using two modes: |
| 16 | * copy/paste mode which insert once the fragment. |
| 17 | * permanent link mode which insert an XLink to the fragment. |
| 18 | |
| 19 | The copy/pase mode allows user to add a fragment which could be modified after insertion. This mode provides default values or editing instructions which could be helpful to fill in the appropriate values (eg. a default quality report). It extends the suggestion mechanism which only expand element and does not provide sample values. It allows also to add a fragment with real value and change them. |
| 20 | |
| 21 | The XLink mode create a dynamic link between the metadata record and the fragment. Editor can't edit such a fragment from the editor. The sub-template manager should be used and the cache of XLinks cleared from the administration panel. |
| 22 | |
| 23 | |
| 24 | [[Image(sub-template-using-xlinks-disabled.png)]] |
| 25 | |
| 26 | |
| 27 | |
| 28 | === Example === |
| 29 | |
| 30 | |
| 31 | For example, a sub-template for a contact in ISO19139 standard is: |
67 | | * root element is stored in the root column. It allows us to know the type of sub-templates (and where it could be inserted in an existing record) |
68 | | * schema is defined like metadata or template documents |
69 | | * indexed using Lucene identified by field _isTemplate='s' |
70 | | * imported through the metadata record import administration page ? |
| 75 | * root element is stored in the root column. It allows us to know the type of sub-templates. This information is used to define where this element could be inserted. |
| 76 | * schema is defined like metadata or template documents (only iso19139 supported for now) |
| 77 | * indexed using Lucene |
| 78 | * field _isTemplate='s' |
| 79 | * field _root= root column |
| 80 | * full text indexing for search |
| 81 | * imported through the metadata record import administration or the directory manager page (TODO) |
77 | | Types of sub-templates: |
78 | | * contact |
79 | | * ... extent ? |
80 | | |
81 | | === Manage sub-templates === |
82 | | |
83 | | A service is added to return the list of available sub-templates available. |
84 | | * getTypes method: return the list of available sub-templates available |
85 | | |
86 | | Sub-templates actions: |
87 | | * insert : Use the metadata insert form to create a sub-template |
88 | | * update/delete : Use the sub-template manager |
89 | | * search : Use any search services with _isTemplate='s' |
90 | | * privileges : Define privileges for the sub-template. |
| 91 | |
| 92 | ==== Manage sub-templates in the directory manager ==== |
| 93 | |
| 94 | The directory manager is accessible to all editors. It is composed of 2 parts: |
| 95 | * a search form to find sub-templates |
| 96 | * an editor to edit sub-templates |
| 97 | |
| 98 | |
| 99 | The search form is composed of: |
| 100 | * a list of type of directory (eg. contact, extent, keywords) (TODO : translate) |
| 101 | * a full text criteria for search |
| 102 | |
| 103 | Sub-templates found are displayed in a grid where editors could select one. |
| 104 | Once selected, the current sub-template is open in the editor. Editors could click: |
| 105 | * the duplicate button to create a copy |
| 106 | * the delete button to delete it |
| 107 | * the privileges button to set privileges. |
| 108 | |
| 109 | Privileges allows to share sub-template across a group of users. Therefore, the sub-template |
| 110 | needs to be publicly available for all while used through XLink mode. |
96 | | === Using sub-templates in the editor === |
97 | | |
98 | | TODO : basically using similar popup like CRS or Thesaurus |
99 | | * full text search |
100 | | * select one or more elements |
101 | | * add (as XLink or using simple copy) |
102 | | * could this be generic ? |
103 | | * add selector according to the types available in the catalogue (using the _root info) ? |
| 116 | |
| 117 | ==== Using sub-templates in the editor ==== |
| 118 | |
| 119 | From the editor, a new button is added to access the sub-template selector. The selector panel provides a similar interface like CRS or Thesaurus selector. Editors could: |
| 120 | * search, |
| 121 | * drag-and-drop the elements to add to the record |
| 122 | * select the mode (copy/paste or linked) |
| 123 | * add |
| 124 | |
| 125 | For some kind of sub-template, another option is available. In case of contact directory, editor could also select the role of the contact. This will override the role defined in the directory manager (a same contact could be a point of contact in a record and a distributor in another record). |
| 126 | |
| 127 | |
| 128 | [[Image(sub-template-selector.png)]] |
| 129 | |
| 130 | |
| 131 | === Sub-template configuration === |
| 132 | |
| 133 | In config-gui.xml, a mapping define for each type of sub-template the list of element where this type could be use. This is used then in the XSL to display or not an extra button to open the sub-template selector. |
| 134 | {{{ |
| 135 | <editor-subtemplate> |
| 136 | <mapping> |
| 137 | <subtemplate type="gmd:CI_ResponsibleParty"> |
| 138 | <type id="gmd:pointOfContact"/> |
| 139 | <type id="gmd:userContactInfo"/> |
| 140 | <type id="gmd:distributorContact"/> |
| 141 | <type id="gmd:citedResponsibleParty"/> |
| 142 | <type id="gmd:contact"/> |
| 143 | <type id="gmd:source"/> |
| 144 | <type id="gmd:processor"/> |
| 145 | <type id="gmd:responsibleParty"/> |
| 146 | </subtemplate> |
| 147 | <subtemplate type="gmd:EX_Extent"> |
| 148 | <type id="gmd:extent"/> |
| 149 | </subtemplate> |
| 150 | <subtemplate type="gmd:MD_Keywords"> |
| 151 | <type id="gmd:descriptiveKeywords"/> |
| 152 | </subtemplate> |
| 153 | <subtemplate type="gmd:DQ_FormatConsistency"> |
| 154 | <type id="gmd:report"/> |
| 155 | </subtemplate> |
| 156 | </mapping> |
| 157 | </editor-subtemplate> |
| 158 | }}} |
| 159 | |
| 160 | In order to have some information when searching for sub-template, a brief mode has been added for sub-templates. |
| 161 | This brief mode defines at least a title. |
| 162 | This is defined in schema present XSL. Example for contact : |
| 163 | {{{ |
| 164 | <xsl:template mode="iso19139-subtemplate" match="gmd:CI_ResponsibleParty"> |
| 165 | <xsl:variable name="langId"> |
| 166 | <xsl:call-template name="getLangId"> |
| 167 | <xsl:with-param name="langGui" select="/root/gui/language"/> |
| 168 | <xsl:with-param name="md" select="."/> |
| 169 | </xsl:call-template> |
| 170 | </xsl:variable> |
| 171 | <title> |
| 172 | <xsl:apply-templates mode="localised" select="gmd:organisationName"> |
| 173 | <xsl:with-param name="langId" select="$langId"></xsl:with-param> |
| 174 | </xsl:apply-templates> - |
| 175 | <xsl:apply-templates mode="localised" select="gmd:individualName"> |
| 176 | <xsl:with-param name="langId" select="$langId"></xsl:with-param> |
| 177 | </xsl:apply-templates> |
| 178 | </title> |
| 179 | </xsl:template> |
| 180 | }}} |
| 181 | |
| 182 | |
| 183 | === Sub-template services === |
| 184 | |
| 185 | A new package is added : org.fao.geonet.services.subtemplate. |
| 186 | |
| 187 | 2 services are added: |
| 188 | * "subtemplate.type" to return the list of available sub-templates available. |
| 189 | * "subtemplate" to return a subtemplate |
| 190 | * Sub template are all public - no privileges check. Parameter "uuid" is mandatory. |
| 191 | * One or more "process" parameters could be added in order to alter the template extracted. This parameter is composed of one XPath expression pointing to a single {@link Element} or {@link Attribute} and a text value separated by "{@value #SEPARATOR}". For example, to return a contact template with a custom role use "&process=gmd:role/gmd:CI_RoleCode/@codeListValue~updatedRole". |
| 192 | |
| 193 | |
| 194 | === TODO === |
| 195 | * load codelist in sub-template selector |
| 196 | * translate sub-template type in directory manager |