diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js index 3a069f65163f5434f0c6b13e733b40a0c460d73e..ee54b4230439a5f63fbb8f98e564cc9137155130 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js @@ -632,7 +632,18 @@ var FormUtil = new function() { } } + this.createPropertyField = function(propertyType, propertyValue) { + if (propertyType.dataType === "CONTROLLEDVOCABULARY") { + propertyValue = this.getVocabularyLabelForTermCode(propertyType, propertyValue); + } + return this._createField(propertyType.dataType === "HYPERLINK", propertyType.label, propertyValue, propertyType.code); + } + this.getFieldForLabelWithText = function(label, text, id, postComponent, cssForText) { + return this._createField(false, label, text, id, postComponent, cssForText); + } + + this._createField = function(hyperlink, label, text, id, postComponent, cssForText) { var $fieldset = $('<div>'); var $controlGroup = $('<div>', {class : 'form-group'}); @@ -660,7 +671,8 @@ var FormUtil = new function() { if(text) { text = text.replace(/(?:\r\n|\r|\n)/g, '\n'); //Normalise carriage returns } - $component.html(html.sanitize(text)); + text = html.sanitize(text); + $component.html(hyperlink ? this.asHyperlink(text) : text); if(id) { $component.attr('id', id); @@ -669,6 +681,10 @@ var FormUtil = new function() { return $fieldset; } + + this.asHyperlink = function(text) { + $("<a>", { "href" : text, "target" : "_blank"}).append(text); + } // // Get Field from property diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js index 5d730a9a2bc39bd66bd587386772c9c94e97ecd2..39e5d47cbbd2ab80a66e0dd5ec5f42b44f0edead 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/ExperimentDataGridUtil.js @@ -79,6 +79,19 @@ var ExperimentDataGridUtil = new function() { var newVocabularyColumnFunc = getVocabularyColumn(propertyType); propertyColumnsToSort.push(newVocabularyColumnFunc()); + } else if (propertyType.dataType === "HYPERLINK") { + var getHyperlinkColumn = function(propertyType) { + return { + label : propertyType.label, + property : propertyType.code, + isExportable: true, + sortable : true, + render : function(data) { + return FormUtil.asHyperlink(data[propertyType.code]); + } + }; + } + propertyColumnsToSort.push(getHyperlinkColumn(propertyType)); } else { propertyColumnsToSort.push({ label : propertyCodesDisplayNames[idx], diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js index 5330e2396df1d6a2289a2c53ee95a81e5c1e2918..90e4cef2d10a5b9e9853ff1391b48c52c18d3240 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js @@ -289,6 +289,19 @@ var SampleDataGridUtil = new function() { var newVocabularyColumnFunc = getVocabularyColumn(propertyType); propertyColumnsToSort.push(newVocabularyColumnFunc()); + } else if (propertyType.dataType === "HYPERLINK") { + var getHyperlinkColumn = function(propertyType) { + return { + label : propertyType.label, + property : propertyType.code, + isExportable: true, + sortable : true, + render : function(data) { + return FormUtil.asHyperlink(data[propertyType.code]); + } + }; + } + propertyColumnsToSort.push(getHyperlinkColumn(propertyType)); } else { propertyColumnsToSort.push({ label : propertyType.label, diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js index 4c7e7dec799b9e9e7d3eb5fcc839b4d70d32fbd4..16305c02188adc0f4465e31c31d62673e7c5d1dc 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js @@ -650,10 +650,7 @@ function DataSetFormView(dataSetFormController, dataSetFormModel) { if(this._dataSetFormModel.mode === FormMode.VIEW) { if(Util.getEmptyIfNull(value) !== "") { //Don't show empty fields, whole empty sections will show the title - if(propertyType.dataType === "CONTROLLEDVOCABULARY") { - value = FormUtil.getVocabularyLabelForTermCode(propertyType, value); - } - var $controlGroup = FormUtil.getFieldForLabelWithText(propertyType.label, value, propertyType.code); + $controlGroup = FormUtil.createPropertyField(propertyType, value); $fieldset.append($controlGroup); } else { continue; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js index babba314421db26fa10cce73a487431d024c75cb..5c2958f79f05f741f8f035c2ad23d4dbfea8043a 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js @@ -421,10 +421,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { if(this._experimentFormModel.mode === FormMode.VIEW) { //Show values without input boxes if the form is in view mode if(Util.getEmptyIfNull(value) !== "") { //Don't show empty fields, whole empty sections will show the title - if(propertyType.dataType === "CONTROLLEDVOCABULARY") { - value = FormUtil.getVocabularyLabelForTermCode(propertyType, value); - } - $controlGroup = FormUtil.getFieldForLabelWithText(propertyType.label, value); + $controlGroup = FormUtil.createPropertyField(propertyType, value); } else { continue; } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js index 812b8d51f7e01cd0d09642ea2aca34717aba3413..b7bc8398bd3e7ed8f0a5892d68eb065852f22abb 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js @@ -658,10 +658,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { if(this._sampleFormModel.mode === FormMode.VIEW) { //Show values without input boxes if the form is in view mode if(Util.getEmptyIfNull(value) !== "") { //Don't show empty fields, whole empty sections will show the title - if(propertyType.dataType === "CONTROLLEDVOCABULARY") { - value = FormUtil.getVocabularyLabelForTermCode(propertyType, value); - } - $controlGroup = FormUtil.getFieldForLabelWithText(propertyType.label, value, propertyType.code); + $controlGroup = FormUtil.createPropertyField(propertyType, value); } else { continue; }