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 7ced917fdfc..a3737f52a6f 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); @@ -1937,6 +1935,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/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..102ea62e8be 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 @@ -28,13 +28,18 @@ </div> </form> - <div class="list-group" data-ng-if="remoteRecord.title"> + <div class="col-md-offset-2 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}}" + /> ({{remoteRecord.uuid}}) </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 30f2996010a..ebe4bb18463 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" }