diff --git a/main/webapp/modules/core/langs/translation-en.json b/main/webapp/modules/core/langs/translation-en.json index dffddfe4d..3cfd081ed 100644 --- a/main/webapp/modules/core/langs/translation-en.json +++ b/main/webapp/modules/core/langs/translation-en.json @@ -674,7 +674,11 @@ "rows": "rows", "records": "records", "show": "Show", - "hide": "Hide" + "hide": "Hide", + "use-values-as-identifiers": "Use values as identifiers", + "use-values-as-identifiers2": "Mark cells as reconciled with their values as identifiers", + "choose-reconciliation-service": "Choose a reconciliation service", + "choose-reconciliation-service-alert": "Please choose a reconciliation service first." }, "core-buttons": { "cancel": "Cancel", diff --git a/main/webapp/modules/core/scripts/views/data-table/menu-reconcile.js b/main/webapp/modules/core/scripts/views/data-table/menu-reconcile.js index 3c20e1d57..1f20d7510 100644 --- a/main/webapp/modules/core/scripts/views/data-table/menu-reconcile.js +++ b/main/webapp/modules/core/scripts/views/data-table/menu-reconcile.js @@ -126,6 +126,61 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) { input.focus().data("suggest").textchange(); }; + var doUseValuesAsIdentifiers = function() { + var frame = DialogSystem.createDialog(); + frame.width("400px"); + + var header = $('
').addClass("dialog-header").text($.i18n._('core-views')["use-values-as-identifiers"]).appendTo(frame); + var body = $('').addClass("dialog-body").appendTo(frame); + var footer = $('').addClass("dialog-footer").appendTo(frame); + + $('').text($.i18n._('core-views')["choose-reconciliation-service"]).appendTo(body); + var select = $('').appendTo(body); + var services = ReconciliationManager.getAllServices(); + for (var i = 0; i < services.length; i++) { + var service = services[i]; + console.log(service); + $('').attr('value', service.url) + .text(service.name) + .appendTo(select); + }; + + $('').text($.i18n._('core-buttons')["cancel"]).click(function() { + DialogSystem.dismissUntil(level - 1); + }).appendTo(footer); + $('').html($.i18n._('core-buttons')["ok"]).click(function() { + + var service = select.val(); + var identifierSpace = null; + var schemaSpace = null; + for(var i = 0; i < services.length; i++) { + if(services[i].url === service) { + identifierSpace = services[i].identifierSpace; + schemaSpace = services[i].schemaSpace; + } + } + if (identifierSpace === null) { + alert($.i18n._('core-views')["choose-reconciliation-service-alert"]); + } else { + Refine.postCoreProcess( + "recon-use-values-as-identifiers", + { + columnName: column.name, + service: service, + identifierSpace: identifierSpace, + schemaSpace: schemaSpace + }, + null, + { cellsChanged: true, columnStatsChanged: true } + ); + } + DialogSystem.dismissUntil(level - 1); + }).appendTo(footer); + + var level = DialogSystem.showDialog(frame); + } + + var doCopyAcrossColumns = function() { var frame = $(DOM.loadHTML("core", "scripts/views/data-table/copy-recon-across-columns-dialog.html")); var elmts = DOM.bind(frame); @@ -402,6 +457,12 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) { label: $.i18n._('core-views')["copy-recon"], tooltip: $.i18n._('core-views')["copy-recon2"], click: doCopyAcrossColumns + }, + { + id: "core/use-values-as-identifiers", + label: $.i18n._('core-views')["use-values-as-identifiers"], + tooltip: $.i18n._('core-views')['use-values-as-identifiers2'], + click: doUseValuesAsIdentifiers } ]); });