Esri / geoportal-server-catalog

Esri Geoportal Server is a next generation open-source metadata catalog and editor, based on elasticsearch.
https://www.esri.com/en-us/arcgis/products/geoportal-server/overview
Apache License 2.0
97 stars 61 forks source link

Customizing metadata editor #8

Closed MapZombie closed 8 years ago

MapZombie commented 8 years ago

Hi, I would like to request that a wiki be created to detail how to make custom edits to the Metadata editor (GXE). The previous version has a very useful wiki that would be great for use with the new 2.0.1 https://github.com/Esri/geoportal-server/wiki/GXE-Crash-Course

MapZombie commented 8 years ago

It would seem that many of the javascript files are pointed to an ESRI hosted site. This is likely causing slow load times when opening the metadata editor. Can we have these files hosted locally with Geoportal server? Also making any customization to the Metadata editor will require these to be hosted within the organization. image

Thanks

mhogeweg commented 8 years ago

hi, the references you see are to the ArcGIS JS API. these are hosted in the cloud and accessible through content delivery networks and should not pose significant performance issues. we do build (server-side) the editors when Geoportal Server is started. first user loading the editor after a start will notice this. only way to improve this is to remove unused schemas.

You can host the ArcGIS JS API locally. Please see: https://developers.arcgis.com/javascript/3/jshelp/intro_accessapi.html

Customizing the editor does not require the JS API to be hosted within your organization.

MapZombie commented 8 years ago

Thanks so much for the clarification @mhogeweg. Would you mind giving me a basic example on how I could change available values for users in the metadata editor?

For example giving the user a drop down of English, Spanish, Tamil, in the Metadata>Identifier>Metadata Language tab.

I was under the impression that these would have to be build somewhere inside codelistData.js or along those lines.

mhogeweg commented 8 years ago

have you read the wiki topics on customizing the metadata editor?

https://github.com/Esri/geoportal-server/wiki/Geoportal-XML-Editor

umacgillivray commented 8 years ago

We'll need to create wiki topics for the 2.* metadata editor.

MapZombie commented 8 years ago

I've read over that wiki and been able to implement changes with the 1.2.6 version line. But the 2.x line structure seems to be significantly different, a wiki would be very helpful! Thanks.

mhogeweg commented 8 years ago

agreed and we're working on documenting that. please submit version 2.x questions on the 2.x forum (as you have already started): https://github.com/Esri/geoportal-server-catalog/issues

MapZombie commented 8 years ago

I looked through all of the files inside \webapps\geoportal\WEB-INF\classes\metadata\details\iso-details

and wasn't able to find the file that deals with the metadata editor's fields. I also checked out metadata-editor.js but this seems to just point to the JS API definition files. If you could tell me where to look to edit metadata fields that would be great. Thanks.

umacgillivray commented 8 years ago

The files defining the metadata editor are part of the ArcGIS API for JavaScript. Are you looking to make extensive changes or some minor updates?

MapZombie commented 8 years ago

Looking to make a number of changes, such as modifying which fields are available and the options available for certain fields.

Is the best course to download the API locally and link to that?

umacgillivray commented 8 years ago

You could download the 3.17 api and host it locally, but you'll be dealing with a compacted version of the code. Maybe we can get a full version published on GitHub. You probably want your own profile of iso that extends the existing, I'll put together a sample on how to do that.

MapZombie commented 8 years ago

I was able to get the full version from https://developers.arcgis.com/downloads/

Got it hosted locally and connected to the Geoportal.

When delving into the JavaScript, I noticed that some entries appear to be encoded? Is there a better way for me to read these "x3c/div/x3e\r\n" etc. Is this due to copyrights from ArcGIS JS? I would like to customize the editor, see below for an example.

MetadataLanguage.js

// All material copyright ESRI, All Rights Reserved, unless otherwise specified. // See http://js.arcgis.com/3.17/esri/copyright.txt for details. //>>built require({ cache: { **"url:esri/dijit/metadata/types/iso/gmd/metadataEntity/templates/MetadataLanguage.html": '\x3cdiv data-dojo-attach-point\x3d"containerNode"\x3e\r\n\r\n \x3cdiv data-dojo-type\x3d"esri/dijit/metadata/form/Element"\r\n data-dojo-props\x3d"target:\'gmd:language\',minOccurs:0,preferOpen:true,\r\n label:\'${i18nIso.MD_Metadata.language}\'"\x3e\r\n \x3cdiv data-dojo-type\x3d"esri/dijit/metadata/form/iso/GcoElement"\r\n data-dojo-props\x3d"target:\'gco:CharacterString\',value:\'en\'"\x3e\r\n \x3cdiv data-dojo-type\x3d"esri/dijit/metadata/form/InputText" data-dojo-props\x3d"small:true"\x3e\x3c/div\x3e\r\n \x3c/div\x3e\r\n \x3c/div\x3e\r\n \r\n\x3c/div\x3e'** } }); define("esri/dijit/metadata/types/iso/gmd/metadataEntity/MetadataLanguage", "dojo/_base/declare dojo/_base/lang dojo/has ../../../../base/Descriptor ../../../../form/Element ../../../../form/InputText ../../../../form/iso/GcoElement dojo/text!./templates/MetadataLanguage.html ../../../../../../kernel".split(" "), function (a, b, c, d, g, h, k, e, f) { a = a(d, { templateString: e }); c("extend-esri") && b.setObject("dijit.metadata.types.iso.gmd.metadataEntity.MetadataLanguage", a, f); return a });

mhogeweg commented 8 years ago

you really (no: REALLY) do not want to or even need to modify the ArcGIS JS API in order to change "which fields are available and the options available for certain fields"

MapZombie commented 8 years ago

@mhogeweg @umacgillivray I understand we don't need to modify the ArcGIS js API in order to change fields and options. What are some basic steps to change a field?

One example would help me immensely. Thanks.

umacgillivray commented 8 years ago

I've added a sample metadata editor profile, https://github.com/Esri/geoportal-server-catalog/tree/master/geoportal/src/main/webapp/app/gxe/types/myprofile There are some examples of simple profile changes within https://github.com/Esri/geoportal-server-catalog/blob/master/geoportal/src/main/webapp/app/gxe/types/myprofile/base/MyProfileDocumentType.js An example of the app configuration change for the new profile is found within https://github.com/Esri/geoportal-server-catalog/blob/master/geoportal/src/main/webapp/app/context/xx-metadata-editor-example.js

More complex changes would follow the INSPIRE and GEMIMI patterns within esri/dijit/metadata/types , we'll publish a non-compressed version of esri/dijit/metadata on GitHub.

MapZombie commented 8 years ago

@umacgillivray Awesome, thank you. I will take a look today and report back.

MapZombie commented 8 years ago

Thanks this helped a lot.