From 6152f16c4524c0b02f21548dc335bc2d129b1e62 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Fri, 9 Dec 2016 10:24:34 +0000 Subject: [PATCH] SSDM-4454 : MULTILINE_VARCHAR fields can now be configured to be forced to plain text SVN: 37462 --- .../eln-lims/html/js/config/Profile.js | 6 +++++ .../webapps/eln-lims/html/js/util/FormUtil.js | 26 +++++++++++-------- .../js/views/DataSetForm/DataSetFormView.js | 2 +- .../ExperimentForm/ExperimentFormView.js | 2 +- .../js/views/ProjectForm/ProjectFormView.js | 2 +- .../js/views/SampleForm/SampleFormView.js | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js index 17077297ffc..388bc19b4b4 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js @@ -113,6 +113,12 @@ $.extend(DefaultProfile.prototype, { } this.isAdmin = false; + + this.forcedDisableRTF = ["NAME", "SEQUENCE"]; + this.isForcedDisableRTF = function(propertytype) { + return (propertytype && $.inArray(propertytype.code, this.forcedDisableRTF) !== -1); + } + this.searchDomains = [ { "@id" : -1, "@type" : "GobalSearch", label : "Global", name : "global"}]; this.inventorySpaces = ["MATERIALS", "METHODS"]; //"STOCK_CATALOG" this.inventorySpacesReadOnly = []; //"STOCK_ORDERS" 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 81b6775270e..ffaa033c6cc 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 @@ -733,20 +733,24 @@ var FormUtil = new function() { // // Rich Text Editor Support - (CKEditor) // - var isCKEditorConfigured = false; - this.activateRichTextProperties = function($component, componentOnChange) { - if(!isCKEditorConfigured) { - CKEDITOR.on( 'instanceReady', function( ev ) { - ev.editor.dataProcessor.writer.selfClosingEnd = ' />'; + CKEDITOR.on( 'instanceReady', function( ev ) { + ev.editor.dataProcessor.writer.selfClosingEnd = ' />'; + }); + + this.activateRichTextProperties = function($component, componentOnChange, propertyType) { + + if(profile.isForcedDisableRTF(propertyType)) { + $component.change(function(event) { + componentOnChange(event, $(this).val()); + }); + } else { + var editor = $component.ckeditor().editor; + editor.on('change', function(event) { + var value = event.editor.getData(); + componentOnChange(event, value); }); - isCKEditorConfigured = true; } - var editor = $component.ckeditor().editor; - editor.on('change', function(event) { - var value = event.editor.getData(); - componentOnChange(event, value); - }); return $component; } 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 134bd6acb21..423352ac3e0 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 @@ -496,7 +496,7 @@ function DataSetFormView(dataSetFormController, dataSetFormModel) { } if(propertyType.dataType === "MULTILINE_VARCHAR") { - $component = FormUtil.activateRichTextProperties($component, changeEvent(propertyType)); + $component = FormUtil.activateRichTextProperties($component, changeEvent(propertyType), propertyType); } else if(propertyType.dataType === "TIMESTAMP") { $component.on("dp.change", changeEvent(propertyType)); } else { 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 242ef4802bb..9153d0d344d 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 @@ -445,7 +445,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { } if(propertyType.dataType === "MULTILINE_VARCHAR") { - $component = FormUtil.activateRichTextProperties($component, changeEvent(propertyType)); + $component = FormUtil.activateRichTextProperties($component, changeEvent(propertyType), propertyType); } else if(propertyType.dataType === "TIMESTAMP") { $component.on("dp.change", changeEvent(propertyType)); } else { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js index 3b761705d72..fa9d1c38ae4 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js @@ -152,7 +152,7 @@ function ProjectFormView(projectFormController, projectFormModel) { _this._projectFormModel.isFormDirty = true; }; $textBox.val(description); - $textBox = FormUtil.activateRichTextProperties($textBox, textBoxEvent); + $textBox = FormUtil.activateRichTextProperties($textBox, textBoxEvent, null); $formColumn.append(FormUtil.getFieldForComponentWithLabel($textBox, "Description")); } else { $formColumn.append(FormUtil.getFieldForLabelWithText("Description", description)); 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 305efc525d6..47b71c52682 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 @@ -572,7 +572,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { } if(propertyType.dataType === "MULTILINE_VARCHAR") { - $component = FormUtil.activateRichTextProperties($component, changeEvent(propertyType)); + $component = FormUtil.activateRichTextProperties($component, changeEvent(propertyType), propertyType); } else if(propertyType.dataType === "TIMESTAMP") { $component.on("dp.change", changeEvent(propertyType)); } else { -- GitLab