diff --git a/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl b/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl index dd87f5281bf..1aaa8d06b8d 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/extract-relations.xsl @@ -34,7 +34,7 @@ xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:util="java:org.fao.geonet.util.XslUtil" - xmlns:uuid="java:java.util.UUID" + xmlns:exslt="http://exslt.org/common" xmlns:gn-fn-rel="http://geonetwork-opensource.org/xsl/functions/relations" version="2.0" exclude-result-prefixes="#all"> @@ -86,7 +86,7 @@ - + - + + + + + + + + select="gmd:MD_BrowseGraphic/gmd:fileName"/> <xsl:apply-templates mode="get-iso19139-localized-string" - select="gmd:fileDescription"/> + select="gmd:MD_BrowseGraphic/gmd:fileDescription"/> thumbnail @@ -121,47 +127,54 @@ - - - - - - - - - - - - <xsl:apply-templates mode="get-iso19139-localized-string" - select="gmd:name"/> - - - + + + + + + + + - - - - - - - - - - - - - - - - - - onlinesrc - + + + + + + + + + <xsl:apply-templates mode="get-iso19139-localized-string" + select="gmd:CI_OnlineResource/gmd:name"/> + + + + + + + + + + + + + + + + + + + + + + onlinesrc + + diff --git a/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-add.xsl b/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-add.xsl index 6947108375b..09deafe2af6 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-add.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/process/onlinesrc-add.xsl @@ -30,6 +30,9 @@ Insert is made in first transferOptions found. xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:util="java:org.fao.geonet.util.XslUtil" + xmlns:exslt="http://exslt.org/common" version="2.0"> - + + + + + + + - + + + - - - - - - - - - - - - - - - + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + - - + + + - + gmd:CI_OnlineResource/gmd:name/gco:CharacterString)) + and ($resourceHash = '' or util:md5Hex(exslt:node-set(.)) = $resourceHash)"> + + + + + + + + + + @@ -170,7 +195,7 @@ Insert is made in first transferOptions found. + + + - + + + + + + + + + + + + + + + + + + - - - - + + + diff --git a/schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-add.xsl b/schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-add.xsl index 16b975a837c..83553d4543c 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-add.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/process/thumbnail-add.xsl @@ -27,6 +27,9 @@ xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:util="java:org.fao.geonet.util.XslUtil" + xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="#all" version="2.0"> @@ -41,55 +44,51 @@ - + + + - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + - + */gmd:fileDescription/gco:CharacterString)) + and ($resourceHash = '' or util:md5Hex(exslt:node-set(.)) = $resourceHash)"> + + + + + + + + + + + + + match="*[gmd:graphicOverview]"> + + + + + + + + + + + + + - + diff --git a/services/src/main/java/org/fao/geonet/api/records/model/related/RelatedItem.java b/services/src/main/java/org/fao/geonet/api/records/model/related/RelatedItem.java index c24ebd29d9c..a8b9b4491d2 100644 --- a/services/src/main/java/org/fao/geonet/api/records/model/related/RelatedItem.java +++ b/services/src/main/java/org/fao/geonet/api/records/model/related/RelatedItem.java @@ -40,6 +40,8 @@ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "relatedItem", propOrder = { "id", + "idx", + "hash", "url", "title", "type" @@ -52,6 +54,8 @@ public abstract class RelatedItem { protected String id; + protected String idx; + protected String hash; protected MultilingualValue url; protected String type; @@ -76,6 +80,42 @@ public void setId(String value) { this.id = value; } + /** + * Gets the value of the idx property. + * + * @return possible object is {@link String } + */ + public String getIdx() { + return idx; + } + + /** + * Sets the value of the idx property. + * + * @param value allowed object is {@link String } + */ + public void setIdx(String value) { + this.idx = value; + } + + /** + * Gets the value of the hasg property. + * + * @return possible object is {@link String } + */ + public String getHash() { + return hash; + } + + /** + * Sets the value of the hash property. + * + * @param value allowed object is {@link String } + */ + public void setHash(String value) { + this.hash = value; + } + /** * Gets the value of the url property. * 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 636ad8006ef..0856013bf6b 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 @@ -964,6 +964,8 @@ } } scope.editingKey = [keyUrl, linkToEdit.protocol, keyName].join(""); + scope.editingIdx = linkToEdit.idx; + scope.editingHash = linkToEdit.hash; scope.OGCProtocol = checkIsOgc(linkToEdit.protocol); @@ -1012,6 +1014,8 @@ }; } else { scope.editingKey = null; + scope.editingIdx = null; + scope.editingHash = null; scope.params.linkType = typeConfig; scope.params.protocol = null; scope.params.mimeType = ""; @@ -1203,6 +1207,8 @@ if (scope.isEditing) { processParams.updateKey = scope.editingKey; + processParams.resourceIdx = scope.editingIdx; + processParams.resourceHash = scope.editingHash; } // Add list of layers for WMS @@ -1944,7 +1950,12 @@ * @returns {boolean} */ scope.canEnableLinkButton = function (selectRecords) { - if (selectRecords.length < 1) return false; + if ( + !selectRecords || + !Array.isArray(selectRecords) || + selectRecords.length < 1 + ) + return false; // Check if the metadata titles are defined for (var i = 0; i < selectRecords.length; i++) { diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js index faafd0e186c..9f76534f31f 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcService.js @@ -682,17 +682,21 @@ this, setParams("thumbnail-remove", { id: gnCurrentEdit.id, - thumbnail_url: thumb.id + thumbnail_url: thumb.id, + resourceIdx: thumb.idx, + resourceHash: thumb.hash }) ); } - // It is an uploaded tumbnail + // It is an uploaded thumbnail else { return runService( "removeThumbnail", { type: thumb.title === "thumbnail" ? "small" : "large", id: gnCurrentEdit.id, + resourceIdx: thumb.idx, + resourceHash: thumb.hash, version: gnCurrentEdit.version }, this @@ -712,16 +716,7 @@ * * @param {Object} onlinesrc the online resource to remove */ - removeOnlinesrc: function (onlinesrc, onlines) { - //Passing the index of the xml/xpath into the remove process xsl - var xslIndex = -1; - for (var i = 0; i < onlines.length; i++) { - if (onlinesrc.id === onlines[i].id) { - xslIndex = i+1; - break; - } - } - + removeOnlinesrc: function (onlinesrc) { var url = onlinesrc.lUrl || onlinesrc.url; if ( url.match(".*/api/records/' + gnCurrentEdit.uuid + '/attachments/.*") != null @@ -733,7 +728,8 @@ this, setParams("onlinesrc-remove", { id: gnCurrentEdit.id, - resourceIndex: xslIndex, + resourceHash: onlinesrc.hash, + resourceIdx: onlinesrc.idx, url: url, name: $filter("gnLocalized")(onlinesrc.title) }) 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 b326c7a2b1b..bde4ba3f9aa 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 @@ -219,7 +219,7 @@ aria-label="{{'remove' | translate}} {{resource.title | gnLocalized: lang}}" data-ng-if="readonly !== true" data-gn-confirm-click="{{'removeOnlinesrcConfirm' | translate:{url: resource.lUrl} }}" - data-gn-click-and-spin="onlinesrcService.removeOnlinesrc(resource, relations.onlines)" + data-gn-click-and-spin="onlinesrcService.removeOnlinesrc(resource)" >