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 6817d94a0aa..4f16a40a6d2 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 @@ -270,14 +270,12 @@ // No UUID can be easily extracted. try { scope.remoteRecord.title = doc.replace( - /(.|[\r\n])*(.*)<\/title>(.|[\r\n])*/, - "$2" + /(.|[\r\n])*<title(.*)>(.*)<\/title>(.|[\r\n])*/, + "$3" ); + scope.remoteRecord.uuid = scope.remoteRecord.remoteUrl; - if (scope.remoteRecord.title === "") { - return false; - } // Looking for schema.org tags or json+ld format could also be an option. } catch (e) { console.warn(e); @@ -1939,6 +1937,24 @@ scope.searchObj.params.any = scope.searchObj.any; }; + /** + * Checks if there are selected records and the selected records have a title. + * + * @param selectRecords + * @returns {boolean} + */ + scope.canEnableLinkButton = function (selectRecords) { + if (selectRecords.length < 1) return false; + + // Check if the metadata titles are defined + for (var i = 0; i < selectRecords.length; i++) { + if (!selectRecords[i].title && !selectRecords[i].resourceTitle) + return false; + } + + return true; + }; + /** * Register a method on popup open to reset * the search form and trigger a search. 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 7b84fd16691..405682e079b 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 @@ -395,7 +395,8 @@ /> </div> </div> - <div class="col-sm-9 col-xs-9 " + <div + class="col-sm-9 col-xs-9" data-ng-if="params.linkType.fields.desc.directive === 'gn-multientry-combiner-online-resources-description'" > <div diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/linkToMd.html b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/linkToMd.html index 62d98906c18..3fbc27150ff 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/linkToMd.html +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/linkToMd.html @@ -35,7 +35,7 @@ type="button" class="btn navbar-btn btn-success" data-gn-click-and-spin="gnOnlinesrc.linkToMd(mode, selectRecords[0], popupid)" - ng-disabled="(selectRecords.length < 1)" + ng-disabled="!canEnableLinkButton(selectRecords)" > <i class="fa gn-icon-{{mode}}" /> <i class="icon-external-link"></i>  {{btn.label}} diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/remote-record-selector.html b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/remote-record-selector.html index ed54f9ee990..de05ed00e16 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/remote-record-selector.html +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/partials/remote-record-selector.html @@ -1,4 +1,4 @@ -<div data-ng-if="allowRemoteRecordLink"> +<div data-ng-if="allowRemoteRecordLink" xmlns="http://www.w3.org/1999/html"> <form class="form-horizontal"> <div class="form-group"> <label for="gnRemoteRecordUrl" class="control-label col-sm-2" data-translate="" @@ -28,13 +28,18 @@ </div> </form> - <div class="list-group" data-ng-if="remoteRecord.title"> + <div class="list-group" data-ng-if="remoteRecord.uuid"> <li class="list-group-item" data-ng-click="updateSelection();triggerSearch();" data-ng-class="{'active' : selectionList[0].uuid === remoteRecord.uuid}" > - {{remoteRecord.title}} ({{remoteRecord.uuid}}) + <input + type="text" + class="form-control" + data-ng-model="remoteRecord.title" + placeholder="{{'remoteAssociatedMetadataTitlePlaceholder' | translate}}" + /> </li> </div> diff --git a/web-ui/src/main/resources/catalog/locales/en-editor.json b/web-ui/src/main/resources/catalog/locales/en-editor.json index 827c0fb3f6e..9870ce39cf6 100644 --- a/web-ui/src/main/resources/catalog/locales/en-editor.json +++ b/web-ui/src/main/resources/catalog/locales/en-editor.json @@ -428,5 +428,6 @@ "confirmCancelEdit": "Do you want to cancel all changes and close the editor?", "allowEditGroupMembers": "Allow group editors to edit", "wmsSelectedLayers": "Selected layers", - "wmsSelectedLayersNone": "No layers selected" + "wmsSelectedLayersNone": "No layers selected", + "remoteAssociatedMetadataTitlePlaceholder": "Remote associated metadata title" }