diff --git a/schemas/dublin-core/src/main/plugin/dublin-core/layout/config-editor.xml b/schemas/dublin-core/src/main/plugin/dublin-core/layout/config-editor.xml index 9a234c424ad..70484726a72 100644 --- a/schemas/dublin-core/src/main/plugin/dublin-core/layout/config-editor.xml +++ b/schemas/dublin-core/src/main/plugin/dublin-core/layout/config-editor.xml @@ -54,8 +54,21 @@ + + + + + + data-types="parent"/>
@@ -68,8 +81,21 @@ + + + + + + data-types="parent"/>
@@ -79,8 +105,21 @@ + + + + + + data-types="parent"/> diff --git a/schemas/dublin-core/src/main/plugin/dublin-core/process/thumbnail-add.xsl b/schemas/dublin-core/src/main/plugin/dublin-core/process/thumbnail-add.xsl new file mode 100644 index 00000000000..b430b19e703 --- /dev/null +++ b/schemas/dublin-core/src/main/plugin/dublin-core/process/thumbnail-add.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/config/associated-panel/default.json b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/config/associated-panel/default.json index c15c53fc2b5..85d23855aed 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/config/associated-panel/default.json +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/config/associated-panel/default.json @@ -3,7 +3,7 @@ "display": "select", "types": [ { - "group": "onlineDiscover", + "group": "overview", "label": "onlineDiscoverThumbnail", "sources": { "filestore": true, @@ -15,38 +15,44 @@ "fields": { "url": { "isMultilingual": false, - "param": "thumbnail_url" + "param": "thumbnail_url", + "label": "overviewUrl" }, "name": { + "label": "overviewDescription", "param": "thumbnail_desc" } } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverInApp", - "copyLabel": "name", + "group": "API", + "label": "onlineDiscoverWMS", + "copyLabel": "desc", + "icon": "fa gn-icon-onlinesrc", "sources": { "metadataStore": { - "label": "searchAnApplication", + "label": "searchAservice", "params": { - "resourceType": "application", + "serviceType": ["OGC:WMS", "WMS", "view"], "isTemplate": "n" } } }, - "icon": "fa gn-icon-map", "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { - "value": "WWW:LINK", + "value": "OGC:WMS", "hidden": true, "isMultilingual": false }, - "name": {}, + "name": { + "label": "layerName", + "tooltip": "layerNameTooltip" + }, "desc": {}, "function": { "value": "browsing", @@ -56,15 +62,15 @@ } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverWMS", + "group": "API", + "label": "onlineDiscoverINSPIREView", "copyLabel": "desc", "icon": "fa gn-icon-onlinesrc", "sources": { "metadataStore": { "label": "searchAservice", "params": { - "serviceType": ["OGC:WMS", "WMS", "view"], + "serviceType": "view", "isTemplate": "n" } } @@ -72,7 +78,8 @@ "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { "value": "OGC:WMS", @@ -85,19 +92,24 @@ "value": "browsing", "hidden": true, "isMultilingual": false + }, + "applicationProfile": { + "value": "inspire-view", + "hidden": true, + "isMultilingual": false } } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverINSPIREView", + "group": "API", + "label": "onlineDiscoverWMTS", "copyLabel": "desc", "icon": "fa gn-icon-onlinesrc", "sources": { "metadataStore": { "label": "searchAservice", "params": { - "serviceType": "view", + "serviceType": ["OGC:WMTS", "WMTS"], "isTemplate": "n" } } @@ -105,10 +117,11 @@ "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { - "value": "OGC:WMS", + "value": "OGC:WMTS", "hidden": true, "isMultilingual": false }, @@ -118,24 +131,19 @@ "value": "browsing", "hidden": true, "isMultilingual": false - }, - "applicationProfile": { - "value": "inspire-view", - "hidden": true, - "isMultilingual": false } } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverWMTS", + "group": "API", + "label": "onlineDiscoverArcGIS", "copyLabel": "desc", "icon": "fa gn-icon-onlinesrc", "sources": { "metadataStore": { "label": "searchAservice", "params": { - "serviceType": ["OGC:WMTS", "WMTS"], + "serviceType": "ESRI:REST", "isTemplate": "n" } } @@ -146,7 +154,7 @@ "isMultilingual": false }, "protocol": { - "value": "OGC:WMTS", + "value": "ESRI:REST", "hidden": true, "isMultilingual": false }, @@ -160,8 +168,8 @@ } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverArcGIS", + "group": "API", + "label": "onlineDiscoverArcGISTiled", "copyLabel": "desc", "icon": "fa gn-icon-onlinesrc", "sources": { @@ -179,7 +187,7 @@ "isMultilingual": false }, "protocol": { - "value": "ESRI:REST", + "value": "ESRI:REST-TILED", "hidden": true, "isMultilingual": false }, @@ -193,15 +201,15 @@ } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverArcGISTiled", + "group": "API", + "label": "OGC API Maps", "copyLabel": "desc", "icon": "fa gn-icon-onlinesrc", "sources": { "metadataStore": { "label": "searchAservice", "params": { - "serviceType": "ESRI:REST", + "serviceType": ["OGC API Maps"], "isTemplate": "n" } } @@ -209,10 +217,11 @@ "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { - "value": "ESRI:REST-TILED", + "value": "OGC API Maps", "hidden": true, "isMultilingual": false }, @@ -226,20 +235,52 @@ } }, { - "group": "onlineDiscover", - "label": "onlineDiscoverMap", - "copyLabel": "name", + "group": "API", + "label": "OGC API Records", + "copyLabel": "desc", + "icon": "fa gn-icon-onlinesrc", "sources": { - "filestore": true + "metadataStore": { + "label": "searchAservice", + "params": { + "serviceType": ["OGC API Records"], + "isTemplate": "n" + } + } }, - "icon": "fa gn-icon-map", "process": "onlinesrc-add", "fields": { "url": { + "isMultilingual": false, + "label": "ogcServiceUrl" + }, + "protocol": { + "value": "OGC API Records", + "hidden": true, "isMultilingual": false }, + "name": {}, + "desc": {}, + "function": { + "value": "search", + "hidden": true, + "isMultilingual": false + } + } + }, + { + "group": "API", + "label": "REST API", + "copyLabel": "name", + "icon": "fa gn-icon-onlinesrc", + "process": "onlinesrc-add", + "fields": { + "url": { + "isMultilingual": false, + "label": "restApiUrl" + }, "protocol": { - "value": "WWW:LINK", + "value": "REST", "hidden": true, "isMultilingual": false }, @@ -324,7 +365,8 @@ "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { "value": "OGC:WFS", @@ -357,7 +399,8 @@ "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { "value": "OGC:WCS", @@ -390,7 +433,8 @@ "process": "onlinesrc-add", "fields": { "url": { - "isMultilingual": false + "isMultilingual": false, + "label": "ogcServiceUrl" }, "protocol": { "value": "OGC:WFS", @@ -449,6 +493,74 @@ } } }, + { + "group": "onlineDownload", + "label": "OGC API Features", + "copyLabel": "desc", + "icon": "fa gn-icon-onlinesrc", + "sources": { + "metadataStore": { + "label": "searchAservice", + "params": { + "serviceType": ["OGC API Features"], + "isTemplate": "n" + } + } + }, + "process": "onlinesrc-add", + "fields": { + "url": { + "isMultilingual": false, + "label": "ogcServiceUrl" + }, + "protocol": { + "value": "OGC API Features", + "hidden": true, + "isMultilingual": false + }, + "name": {}, + "desc": {}, + "function": { + "value": "download", + "hidden": true, + "isMultilingual": false + } + } + }, + { + "group": "onlineDownload", + "label": "OGC API Coverages", + "copyLabel": "desc", + "icon": "fa gn-icon-onlinesrc", + "sources": { + "metadataStore": { + "label": "searchAservice", + "params": { + "serviceType": ["OGC API Coverages"], + "isTemplate": "n" + } + } + }, + "process": "onlinesrc-add", + "fields": { + "url": { + "isMultilingual": false, + "label": "ogcServiceUrl" + }, + "protocol": { + "value": "OGC API Coverages", + "hidden": true, + "isMultilingual": false + }, + "name": {}, + "desc": {}, + "function": { + "value": "download", + "hidden": true, + "isMultilingual": false + } + } + }, { "group": "localNetwork", "label": "localNetworkVectorFile", @@ -562,12 +674,13 @@ } }, { - "group": "onlineUse", + "group": "onlineUseFcats", "label": "onlineUseFcats", "copyLabel": "name", "sources": { "filestore": true }, + "fileStoreFilter": "*.{pdf,PDF,xls,XLS,ods,ODS,csv,CSV,txt,TXT}", "icon": "fa fa-table", "process": "fcats-file-add", "fields": { @@ -588,12 +701,13 @@ } }, { - "group": "onlineUse", + "group": "quality", "label": "onlineUseDQReport", "copyLabel": "name", "sources": { "filestore": true }, + "fileStoreFilter": "*.{pdf,PDF}", "icon": "fa fa-table", "process": "dq-report-add", "fields": { @@ -620,12 +734,13 @@ } }, { - "group": "onlineUse", + "group": "quality", "label": "onlineUseDQTOR", "copyLabel": "name", "sources": { "filestore": true }, + "fileStoreFilter": "*.{pdf,PDF}", "icon": "fa fa-table", "process": "dq-report-add", "fields": { @@ -652,12 +767,13 @@ } }, { - "group": "onlineUse", + "group": "quality", "label": "onlineUseDQProdReport", "copyLabel": "name", "sources": { "filestore": true }, + "fileStoreFilter": "*.{pdf,PDF}", "icon": "fa fa-table", "process": "dq-report-add", "fields": { @@ -684,7 +800,7 @@ } }, { - "group": "onlineUse", + "group": "onlineUseLegend", "label": "onlineUseLegendLYR", "copyLabel": "name", "sources": { @@ -711,7 +827,7 @@ } }, { - "group": "onlineUse", + "group": "onlineUseLegend", "label": "onlineUseStyleSLD", "copyLabel": "name", "sources": { @@ -738,7 +854,7 @@ } }, { - "group": "onlineUse", + "group": "onlineUseLegend", "label": "onlineUseStyleQML", "copyLabel": "name", "sources": { @@ -765,7 +881,67 @@ } }, { - "group": "onlineMore", + "group": "links", + "label": "onlineDiscoverInApp", + "copyLabel": "name", + "sources": { + "metadataStore": { + "label": "searchAnApplication", + "params": { + "resourceType": "application", + "isTemplate": "n" + } + } + }, + "icon": "fa gn-icon-map", + "process": "onlinesrc-add", + "fields": { + "url": { + "isMultilingual": false + }, + "protocol": { + "value": "WWW:LINK", + "hidden": true, + "isMultilingual": false + }, + "name": {}, + "desc": {}, + "function": { + "value": "browsing", + "hidden": true, + "isMultilingual": false + } + } + }, + { + "group": "links", + "label": "onlineDiscoverMap", + "copyLabel": "name", + "sources": { + "filestore": true + }, + "icon": "fa gn-icon-map", + "process": "onlinesrc-add", + "fields": { + "url": { + "isMultilingual": false + }, + "protocol": { + "value": "WWW:LINK", + "hidden": true, + "isMultilingual": false + }, + "name": {}, + "desc": {}, + "function": { + "value": "browsing", + "hidden": true, + "isMultilingual": false + } + } + }, + { + "group": "links", "label": "onlineMoreWWW", "copyLabel": "name", "icon": "fa gn-icon-onlinesrc", @@ -789,7 +965,7 @@ } }, { - "group": "onlineMore", + "group": "links", "label": "onlineMoreFile", "copyLabel": "name", "sources": { diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml index 1378384db9f..59e1efc251b 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml @@ -903,11 +903,38 @@ - + + data-types="sibling|associated|source|dataset|service|fcats"/> - + + + + + data-types="sibling|associated|source|dataset|service|fcats"/> + + + + @@ -3674,13 +3737,49 @@ - + + + + + data-types="sibling|associated|source|dataset|service|fcats"/> + + + + diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/add-info-from-wms.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/add-info-from-wms.xsl index b2b1bbc91d6..81b658f1007 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/add-info-from-wms.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/add-info-from-wms.xsl @@ -62,14 +62,10 @@ WMS service - is described in online resource section. Run to update extent, CRS, connect point or - graphic overview - for this WMS service for the layer named: + is described in online resource section. Run to update extent, CRS or graphic overview for this WMS service for the layer named: Le service de visualisation - est décrit dans la section resource en ligne. Exécuter cette action - pour mettre à jour l'étendue, les systèmes de projection, l'adresse de connexion - ou les aperçus pour ce service et la couche nommée : + est décrit dans la section resource en ligne. Exécuter cette action pour mettre à jour l'étendue, les systèmes de projection ou les aperçus pour ce service et la couche nommée : Er is een verwijzing gevonden naar de WMS service . Gebruik deze functie om de dekking, de projectie of thumbnail af te leiden of bij te werken vanuit deze WMS-service voor de laag met de naam: @@ -87,6 +83,7 @@ + @@ -100,8 +97,7 @@ - + select="//cit:CI_OnlineResource[contains(cit:protocol/gco:CharacterString, 'OGC:WMS') and normalize-space(cit:linkage/*[1]/text()) = $wmsServiceUrl]"/> @@ -132,13 +128,15 @@ + + target="link#{cit:protocol/gco:CharacterString}#{$url}#{$layerName}"> . + select="$layerName"/>. true { @@ -157,7 +155,9 @@ "defaultValue":""}, "wmsServiceUrl":{"type":"string", "defaultValue":""} + select="$url"/>"}, + "wmsLayerName":{"type":"string", "defaultValue":""} } @@ -211,42 +211,43 @@ + - - - - + + + + + + - - - + + + + + + + + - - - - - - - - - @@ -254,16 +255,16 @@ + and $wmsLayerName != ''"> + select="$capabilitiesDoc//Layer[Name=$wmsLayerName]/LatLonBoundingBox"/> @@ -412,8 +413,6 @@ - - @@ -426,8 +425,20 @@ - + + + + + + @@ -436,8 +447,6 @@ - - diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/create-featurecatalogue-from-wfs.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/create-featurecatalogue-from-wfs.xsl index 8c4f3dfa9a2..bc2f6cfd34b 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/create-featurecatalogue-from-wfs.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/process/create-featurecatalogue-from-wfs.xsl @@ -64,21 +64,23 @@ + select="$root[count(.//srv:SV_ServiceIdentification) = 0]//mdb:distributionInfo//mrd:onLine/*[contains(cit:protocol/*, 'WFS') or contains(cit:protocol/*, 'ESRI:REST')]"/> + + + - + target="link#{$protocol}#{$url[1]}#{$featureType[1]}"> + true - {"featureCatWfsUrl":{"type":"text", "defaultValue":""}, - "featureCatWfsFeatureType":{"type":"text", "defaultValue":""}, + {"featureCatWfsUrl":{"type":"text", "defaultValue":""}, + "featureCatWfsFeatureType":{"type":"text", "defaultValue":""}, "featureCatReplace":{"type":"boolean", "defaultValue":""}} @@ -109,7 +111,6 @@ mdb:defaultLocale| mdb:parentMetadata| mdb:metadataScope| - mdb:contact| mdb:dateInfo| mdb:metadataStandard| mdb:metadataProfile| diff --git a/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl b/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl index 82b2fa89ece..dea611efe42 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl @@ -1111,7 +1111,9 @@ else if (starts-with(gmd:protocol/gco:CharacterString, 'WWW:DOWNLOAD:')) then util:escapeForJson(replace(gmd:protocol/gco:CharacterString, 'WWW:DOWNLOAD:', '')) else ''"/>", - "urlObject":{"default": ""}, + "urlObject":{ + "default": "", + "lang": ""}, "nameObject": , diff --git a/schemas/iso19139/src/main/plugin/iso19139/layout/config-editor.xml b/schemas/iso19139/src/main/plugin/iso19139/layout/config-editor.xml index 36f1b0be42b..1960dec2f57 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/layout/config-editor.xml +++ b/schemas/iso19139/src/main/plugin/iso19139/layout/config-editor.xml @@ -518,12 +518,37 @@ + - + + + + + + + + @@ -3176,31 +3201,39 @@ - + + - + + data-types="parent|dataset|service|source|sibling|associated|fcats"/> - - - @@ -3305,12 +3338,37 @@ class="gn-label-above-input gn-indent-bluescale"> + - + + + + + + + + @@ -3381,12 +3439,37 @@ + - + + + + + + + + diff --git a/schemas/iso19139/src/main/plugin/iso19139/process/add-info-from-wms.xsl b/schemas/iso19139/src/main/plugin/iso19139/process/add-info-from-wms.xsl index 5ebfc4bc509..f70c6d75919 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/process/add-info-from-wms.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/process/add-info-from-wms.xsl @@ -35,14 +35,10 @@ WMS service - is described in online resource section. Run to update extent, CRS or - graphic overview - for this WMS service for the layer named: + is described in online resource section. Run to update extent, CRS or graphic overview for this WMS service for the layer named: Le service de visualisation - est décrit dans la section resource en ligne. Exécuter cette action - pour mettre à jour l'étendue, les systèmes de projection - ou les aperçus pour ce service et la couche nommée : + est décrit dans la section resource en ligne. Exécuter cette action pour mettre à jour l'étendue, les systèmes de projection ou les aperçus pour ce service et la couche nommée : Er is een verwijzing gevonden naar de WMS service . Gebruik deze functie om de dekking, de projectie of thumbnail af te leiden of bij te werken vanuit deze WMS-service voor de laag met de naam: @@ -60,6 +56,7 @@ + @@ -74,7 +71,7 @@ --> - + @@ -105,13 +102,15 @@ + + target="link#{gmd:protocol/gco:CharacterString}#{$url}#{$layerName}"> . + select="$layerName"/>. true {"setExtent":{"type":"boolean", "defaultValue":""}, @@ -128,7 +127,9 @@ "defaultValue":""}, "wmsServiceUrl":{"type":"string", "defaultValue":""} + select="$url"/>"}, + "wmsLayerName":{"type":"string", "defaultValue":""} } @@ -173,26 +174,21 @@ gmd:graphicOverview "/> - + + select="$capabilitiesDoc//Layer[Name=$wmsLayerName]/LatLonBoundingBox"/> + - - - - - - @@ -415,8 +411,6 @@ - - @@ -429,7 +423,7 @@ - diff --git a/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java b/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java index e6959df7a56..09081260770 100644 --- a/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java @@ -115,15 +115,22 @@ public static String getFileContentType(Path file) throws IOException { case "png": case "gif": case "bmp": + contentType = "image/" + ext; + break; case "tif": case "tiff": + contentType = "image/tiff"; + break; case "jpg": case "jpeg": - contentType = "image/" + ext; + contentType = "image/jpeg"; break; case "txt": + contentType = "text/plain"; + break; + case "htm": case "html": - contentType = "text/" + ext; + contentType = "text/html"; break; default: contentType = "application/" + ext; diff --git a/web-ui/src/main/resources/catalog/components/doi/DoiService.js b/web-ui/src/main/resources/catalog/components/doi/DoiService.js index 87d9457c1d7..e21427f8c31 100644 --- a/web-ui/src/main/resources/catalog/components/doi/DoiService.js +++ b/web-ui/src/main/resources/catalog/components/doi/DoiService.js @@ -31,14 +31,49 @@ */ module.service("gnDoiService", [ "$http", - function ($http) { + "gnConfig", + function ($http, gnConfig) { + function check(id) { + return $http.get("../api/records/" + id + "/doi/checkPreConditions"); + } + function create(id) { + return $http.put("../api/records/" + id + "/doi"); + } + + function isDoiApplicableForMetadata(md) { + return ( + gnConfig["system.publication.doi.doienabled"] && + md.isTemplate === "n" && + md.isPublished() && + JSON.parse(md.isHarvested) === false + ); + } + + /** + * Doi can be published for a resource if: + * - Doi publication is enabled. + * - The resource matches doi.org url + * - The workflow is not enabled for the metadata and + * the metadata is published. + * + */ + function canPublishDoiForResource(md, resource) { + var doiKey = gnConfig["system.publication.doi.doikey"]; + var isMdWorkflowEnableForMetadata = + gnConfig["metadata.workflow.enable"] && md.draft === "y"; + return ( + isDoiApplicableForMetadata(md) && + resource.lUrl !== null && + resource.lUrl.match("doi.org/" + doiKey) !== null && + !isMdWorkflowEnableForMetadata + ); + } + return { - check: function (id) { - return $http.get("../api/records/" + id + "/doi/checkPreConditions"); - }, - create: function (id) { - return $http.put("../api/records/" + id + "/doi"); - } + check: check, + create: create, + isDoiApplicableForMetadata: isDoiApplicableForMetadata, + canPublishDoiForResource: canPublishDoiForResource }; } ]); diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js index 51bf5e22257..442de2e4d12 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js @@ -179,6 +179,15 @@ "gn_urlutils_service", "gn_related_directive" ]) + .directive("gnUrlValidator", [ + function () { + return { + restrict: "A", + templateUrl: + "../../catalog/components/edit/onlinesrc/partials/urlValidator.html" + }; + } + ]) .directive("gnRemoteRecordSelector", [ "$http", "gnGlobalSettings", @@ -397,13 +406,15 @@ "gnConfigService", "$filter", "gnConfig", + "gnDoiService", function ( gnOnlinesrc, gnCurrentEdit, gnRelatedResources, gnConfigService, $filter, - gnConfig + gnConfig, + gnDoiService ) { return { restrict: "A", @@ -425,11 +436,10 @@ scope.isMdWorkflowEnableForMetadata = gnConfig["metadata.workflow.enable"] && scope.gnCurrentEdit.metadata.draft === "y"; - scope.isDoiApplicableForMetadata = - gnConfig["system.publication.doi.doienabled"] && - scope.gnCurrentEdit.metadata.isTemplate === "n" && - scope.gnCurrentEdit.metadata.isPublished() && - JSON.parse(scope.gnCurrentEdit.metadata.isHarvested) === false; + scope.isDoiApplicableForMetadata = gnDoiService.isDoiApplicableForMetadata( + scope.gnCurrentEdit.metadata + ); + scope.canPublishDoiForResource = gnDoiService.canPublishDoiForResource; /** * Calls service 'relations.get' to load @@ -453,24 +463,6 @@ : category.match(scope.types) !== null; }; - /** - * Doi can be published for a resource if: - * - Doi publication is enabled. - * - The resource matches doi.org url - * - The workflow is not enabled for the metadata and - * the metadata is published. - * - */ - scope.canPublishDoiForResource = function (resource) { - var doiKey = gnConfig["system.publication.doi.doikey"]; - return ( - scope.isDoiApplicableForMetadata && - resource.lUrl !== null && - resource.lUrl.match("doi.org/" + doiKey) !== null && - !scope.isMdWorkflowEnableForMetadata - ); - }; - /** * Builds metadata url checking if the resource points to internal or external url. * @@ -589,7 +581,7 @@ return { restrict: "A", templateUrl: - "../../catalog/components/edit/onlinesrc/" + "partials/addOnlinesrc.html", + "../../catalog/components/edit/onlinesrc/partials/addOnlinesrc.html", link: { pre: function preLink(scope) { scope.searchObj = { @@ -612,7 +604,7 @@ scope.config = null; scope.linkType = null; - + scope.linkTypeGroupFilter = null; scope.loaded = false; scope.layers = null; scope.capabilitiesLayers = null; @@ -628,6 +620,13 @@ } }; + scope.filterTypeChoices = function (type) { + if (!scope.linkTypeGroupFilter) { + return true; + } + return type.group.match(new RegExp(scope.linkTypeGroupFilter)) != null; + }; + // This object is used to share value between this // directive and the SearchFormController scope that // is contained by the directive @@ -742,8 +741,8 @@ } } ) - .then(function () { - $rootScope.$broadcast("gnFileStoreUploadDone"); + .then(function (response) { + $rootScope.$broadcast("gnFileStoreUploadDone", response.data.url); }); }; @@ -873,6 +872,7 @@ gnOnlinesrc.register("onlinesrc", function (linkToEditOrType) { var linkToEdit = undefined, linkType = undefined; + if (angular.isDefined(linkToEditOrType)) { if (angular.isObject(linkToEditOrType)) { linkToEdit = linkToEditOrType; @@ -882,6 +882,14 @@ } scope.isEditing = angular.isDefined(linkToEdit); + + // In edit mode or in add mode when the link type is provided and + // it's not the default addOnlinesrc value, can't be edited + scope.isEditableLinkType = + !scope.isEditing && + (!angular.isDefined(linkType) || + linkType.indexOf("addOnlinesrc") === 0); + // Flag used when editing an online resource to prevent the watcher to update the online // resource description when loading the dialog. scope.processSelectedWMSLayer = false; @@ -900,7 +908,14 @@ return t; } } - return scope.config.types[0]; + return scope.config.types.filter(scope.filterTypeChoices)[0]; + } + + // LinkType may describe an additional group filter + if (linkType && linkType.indexOf("#")) { + var linkTypeConfig = linkType.split("#"); + linkType = linkTypeConfig[0]; + scope.linkTypeGroupFilter = linkTypeConfig[1]; } var typeConfig = linkToEdit @@ -1237,6 +1252,14 @@ scope.onlinesrcService.reload = true; }; + scope.isUrlEmpty = function () { + var url = scope.params.url; + if (angular.isObject(url)) { + url = url[scope.ctrl.urlCurLang]; + } + return (url || "") === ""; + }; + /** * loadCurrentLink * @@ -1578,10 +1601,9 @@ scope.selectUploadedResource = function (res) { if (res && res.url) { var o = { - name: decodeURI(res.id.split("/").splice(2).join("/")), url: res.url }; - ["url", "name"].forEach(function (pName) { + ["url"].forEach(function (pName) { setParameterValue(pName, o[pName]); }); scope.params.protocol = scope.params.protocol || "WWW:DOWNLOAD"; diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/addOnlinesrc.html b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/addOnlinesrc.html index 405682e079b..b344fc0f810 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/addOnlinesrc.html +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/addOnlinesrc.html @@ -18,7 +18,7 @@ @@ -36,8 +36,8 @@
url{{(params.linkType.fields.url.label || 'url') | translate}}
+ +
+
+ +
+
@@ -300,7 +321,8 @@ class="col-sm-2 control-label" data-translate="" data-gn-field-tooltip="{{schema}}|{{params.linkType.fields.name.tooltip}}" - >onlineResourceName{{(params.linkType.fields.name.label || 'onlineResourceName') | + translate}}
description + {{(params.linkType.fields.desc.label || 'description') | translate}} +
applicationProfile + {{(params.linkType.fields.applicationProfile.label || + 'applicationProfile') | translate}} +
-
-
- fileStore - - - -
-
-
-
-
-
+ +
+
+ fileStore + + + +
+
+
+
+
@@ -620,21 +644,5 @@
data-gn-need-help="linking-documents" class="pull-right" >
-
-
- areYouSureToAddALinkWithError - - {{params.url[ctrl.urlCurLang]}} - -
diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html index 2358a75f8ca..5557a6bde50 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/onlinesrcList.html @@ -229,7 +229,7 @@
orUseRemoteRecordUrl -
+
+ +
+ remoteRecordUrlReturnedError + + {{remoteRecord.remoteUrl}} + +
+
+ remoteRecordPropertiesError + + {{remoteRecord.remoteUrl}} + +
+ remoteRecordUrl-help @@ -31,7 +53,7 @@
-
+
  • ({{remoteRecord.uuid}})
  • -
- -
- remoteRecordUrlReturnedError - - {{remoteRecord.remoteUrl}} - -
-
- remoteRecordPropertiesError - - {{remoteRecord.remoteUrl}} - -
+
diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/urlValidator.html b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/urlValidator.html new file mode 100644 index 00000000000..bf84194e9cf --- /dev/null +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/urlValidator.html @@ -0,0 +1,14 @@ +
+ areYouSureToAddALinkWithError + + {{params.url || params.url[ctrl.urlCurLang]}} + +
diff --git a/web-ui/src/main/resources/catalog/components/edit/suggestion/SuggestionDirective.js b/web-ui/src/main/resources/catalog/components/edit/suggestion/SuggestionDirective.js index 660c2d15fac..041c3ec9b18 100644 --- a/web-ui/src/main/resources/catalog/components/edit/suggestion/SuggestionDirective.js +++ b/web-ui/src/main/resources/catalog/components/edit/suggestion/SuggestionDirective.js @@ -109,12 +109,11 @@ params: "@", name: "@", help: "@", - icon: "@" + icon: "@", + target: "@?" }, templateUrl: - "../../catalog/components/edit/" + - "suggestion/partials/" + - "suggestbutton.html", + "../../catalog/components/edit/suggestion/partials/suggestbutton.html", link: function (scope, element, attrs) { scope.sugg = undefined; scope.gnSuggestion = gnSuggestion; @@ -125,8 +124,15 @@ scope.suggestions = data; for (var i = 0; i < data.length; i++) { if (data[i].process === scope.processId) { - scope.sugg = data[i]; - break; + if (scope.target) { + if (data[i].target === scope.target) { + scope.sugg = data[i]; + break; + } + } else { + scope.sugg = data[i]; + break; + } } } } @@ -142,7 +148,7 @@ return { restrict: "A", templateUrl: - "../../catalog/components/edit/suggestion/" + "partials/runprocess.html", + "../../catalog/components/edit/suggestion/partials/runprocess.html", link: function (scope, element, attrs) { scope.gnSuggestion = gnSuggestion; // Indicate if processing is running diff --git a/web-ui/src/main/resources/catalog/components/edit/suggestion/partials/list.html b/web-ui/src/main/resources/catalog/components/edit/suggestion/partials/list.html index 4231c64b298..586cec2c9a9 100644 --- a/web-ui/src/main/resources/catalog/components/edit/suggestion/partials/list.html +++ b/web-ui/src/main/resources/catalog/components/edit/suggestion/partials/list.html @@ -1,6 +1,6 @@
-   suggestions  +   suggestions