From edfe58fb6c81a5640ed5bc691ce045eb551bf23a Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Wed, 27 Jul 2016 12:33:34 +0000 Subject: [PATCH] SSDM-2732 : Ordering System, sample for extensions for more friendly ordering. SVN: 36843 --- .../core-plugins/eln-lims/1/as/elnTypes.py | 10 ++-- .../html/js/config/StandardProfile.js | 31 +++++++++++- .../js/views/SampleForm/SampleFormView.js | 47 +++++++++++++------ .../SampleForm/widgets/LinksController.js | 4 +- .../js/views/SampleForm/widgets/LinksModel.js | 3 +- .../js/views/SampleForm/widgets/LinksView.js | 10 +++- 6 files changed, 81 insertions(+), 24 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py index 99db494e5c4..ecdc8cfb8fa 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py @@ -899,7 +899,8 @@ SUPPLIER = ["SUPPLIER", "", [ ["ACCOUNT_NUMBER", "General", "Account number", DataType.VARCHAR, None, "Account number", None, None], ["PREFERRED_ORDER_METHOD", "General", "Preferred Order Method", DataType.CONTROLLEDVOCABULARY, "PREFERRED_ORDER_METHOD", "Preferred Order Method", None, None], ["URL", "General", "URL", DataType.VARCHAR, None, "URL", None, None], - ["ADDITIONAL_INFORMATION", "General", "Additional Information", DataType.MULTILINE_VARCHAR, None, "Additional Information", None, None] + ["ADDITIONAL_INFORMATION", "General", "Additional Information", DataType.MULTILINE_VARCHAR, None, "Additional Information", None, None], + ["ANNOTATIONS_STATE", "Comments", "Annotations State", DataType.XML, None, "Annotations State", None, None] ]]; PRODUCT = ["PRODUCT", "", [ @@ -912,7 +913,8 @@ PRODUCT = ["PRODUCT", "", [ ["HAZARD_STATEMENT", "General", "Hazard Statement", DataType.VARCHAR, None, "Hazard Statement", None, None], ["PRICE_PER_UNIT", "General", "Price Per Unit", DataType.REAL, None, "Price Per Unit", None, None], ["CURRENCY", "General", "Currency", DataType.CONTROLLEDVOCABULARY, "CURRENCY", "Currency", None, None], - ["SIZE_OF_ITEM", "General", "Size of Item", DataType.VARCHAR, None, "Size of Item", None, None] + ["SIZE_OF_ITEM", "General", "Size of Item", DataType.VARCHAR, None, "Size of Item", None, None], + ["ANNOTATIONS_STATE", "Comments", "Annotations State", DataType.XML, None, "Annotations State", None, None] ]]; REQUEST = ["REQUEST", "", [ @@ -921,7 +923,7 @@ REQUEST = ["REQUEST", "", [ ["BUYER", "General", "Buyer", DataType.VARCHAR, None, "Buyer", None, None], ["REQUEST_MANAGER", "General", "Request Manager", DataType.VARCHAR, None, "Request Manager", None, None], ["REQUEST_MANAGER_CONTACT_DETAILS", "General", "Request Manager Contact Details", DataType.MULTILINE_VARCHAR, None, "Request Manager Contact Details", None, None], - ["PRODUCTS", "General", "Products", DataType.XML, None, "Products", None, None] + ["ANNOTATIONS_STATE", "Comments", "Annotations State", DataType.XML, None, "Annotations State", None, None] ]]; ORDER = ["ORDER", "", [ @@ -930,5 +932,5 @@ ORDER = ["ORDER", "", [ ["ORDER_STATUS", "General", "Order Status", DataType.CONTROLLEDVOCABULARY, "ORDER_STATUS", "Order Status", None, None], ["TOTAL_PRICE", "General", "Total Price", DataType.VARCHAR, None, "Total Price", None, None], ["ADDITIONAL_INFORMATION", "General", "Additional Information", DataType.MULTILINE_VARCHAR, None, "Additional Information", None, None], - ["REQUESTS", "General", "Requests", DataType.XML, None, "Requests", None, None] + ["ANNOTATIONS_STATE", "Comments", "Annotations State", DataType.XML, None, "Annotations State", None, None] ]]; \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js index 406cb57e89f..142a6c852da 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js @@ -268,7 +268,36 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { } ], }, - + "REQUEST" : { + "SAMPLE_PARENTS_TITLE" : "Products", + "SAMPLE_PARENTS_ANY_TYPE_DISABLED" : true, + "SAMPLE_CHILDREN_DISABLED" : true, + "SAMPLE_PARENTS_HINT" : [{ + "LABEL" : "Products", + "TYPE": "PRODUCT", + "MIN_COUNT" : 0, + "ANNOTATION_PROPERTIES" : [{"TYPE" : "QUANTITY", "MANDATORY" : false }, {"TYPE" : "COMMENTS", "MANDATORY" : false }] + }] + }, + "ORDER" : { + "SAMPLE_PARENTS_TITLE" : "Requests", + "SAMPLE_PARENTS_ANY_TYPE_DISABLED" : true, + "SAMPLE_CHILDREN_DISABLED" : true, + "SAMPLE_PARENTS_HINT" : [{ + "LABEL" : "Requests", + "TYPE": "REQUEST", + "MIN_COUNT" : 0, + "ANNOTATION_PROPERTIES" : [{"TYPE" : "QUANTITY", "MANDATORY" : false }, {"TYPE" : "COMMENTS", "MANDATORY" : false }] + }] + }, + "SUPPLIER" : { + "SAMPLE_CHILDREN_DISABLED" : true, + "SAMPLE_PARENTS_DISABLED" : true, + }, + "PRODUCT" : { + "SAMPLE_CHILDREN_DISABLED" : true, + "SAMPLE_PARENTS_DISABLED" : true, + }, "EXPERIMENTAL_STEP" : { "SAMPLE_PARENTS_HINT" : [ { 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 81451f32a43..7933dadf7cc 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 @@ -277,13 +277,21 @@ function SampleFormView(sampleFormController, sampleFormModel) { var isDisabled = this._sampleFormModel.mode === FormMode.VIEW; var currentParentsLinks = (this._sampleFormModel.sample)?this._sampleFormModel.sample.parents:null; - - this._sampleFormModel.sampleLinksParents = new LinksController("Parents", - requiredParents, - isDisabled, - currentParentsLinks, - this._sampleFormModel.mode === FormMode.CREATE || this._sampleFormModel.mode === FormMode.EDIT); - this._sampleFormModel.sampleLinksParents.init($sampleParentsWidget); + var parentsTitle = "Parents"; + if(sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_PARENTS_TITLE"]) { + parentsTitle = sampleTypeDefinitionsExtension["SAMPLE_PARENTS_TITLE"]; + } + var parentsAnyTypeDisabled = sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_PARENTS_ANY_TYPE_DISABLED"]; + this._sampleFormModel.sampleLinksParents = new LinksController(parentsTitle, + requiredParents, + isDisabled, + currentParentsLinks, + this._sampleFormModel.mode === FormMode.CREATE || this._sampleFormModel.mode === FormMode.EDIT, + parentsAnyTypeDisabled); + if(!sampleTypeDefinitionsExtension || !sampleTypeDefinitionsExtension["SAMPLE_PARENTS_DISABLED"]) { + this._sampleFormModel.sampleLinksParents.init($sampleParentsWidget); + } + // // LINKS TO CHILDREN // @@ -291,19 +299,28 @@ function SampleFormView(sampleFormController, sampleFormModel) { if(sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_HINT"]) { requiredChildren = sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_HINT"]; } - + var sampleChildrenWidgetId = "sampleChildrenWidgetId"; var $sampleChildrenWidget = $("<div>", { "id" : sampleChildrenWidgetId }); $formColumn.append($sampleChildrenWidget); - + var currentChildrenLinks = (this._sampleFormModel.sample)?this._sampleFormModel.sample.children:null; - this._sampleFormModel.sampleLinksChildren = new LinksController("Children", - requiredChildren, - isDisabled, - currentChildrenLinks, - this._sampleFormModel.mode === FormMode.CREATE); - this._sampleFormModel.sampleLinksChildren.init($sampleChildrenWidget); + var childrenTitle = "Children"; + if(sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_TITLE"]) { + childrenTitle = sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_TITLE"]; + } + var childrenAnyTypeDisabled = sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_ANY_TYPE_DISABLED"]; + this._sampleFormModel.sampleLinksChildren = new LinksController(childrenTitle, + requiredChildren, + isDisabled, + currentChildrenLinks, + this._sampleFormModel.mode === FormMode.CREATE, + childrenAnyTypeDisabled); + if(!sampleTypeDefinitionsExtension || !sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_DISABLED"]) { + this._sampleFormModel.sampleLinksChildren.init($sampleChildrenWidget); + } + // // GENERATE CHILDREN // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js index 4249c75eef3..ccf8fe3629a 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js @@ -14,8 +14,8 @@ * limitations under the License. */ -function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, showAnnotableTypes) { - var linksModel = new LinksModel(title, sampleTypeHints, isDisabled, showAnnotableTypes); +function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, showAnnotableTypes, disableAddAnyType) { + var linksModel = new LinksModel(title, sampleTypeHints, isDisabled, showAnnotableTypes, disableAddAnyType); var linksView = new LinksView(this, linksModel); this.init = function($container) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksModel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksModel.js index fc1081fe3c3..5e73e70bcda 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksModel.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksModel.js @@ -14,11 +14,12 @@ * limitations under the License. */ -function LinksModel(title, sampleTypeHints, isDisabled, showInfo) { +function LinksModel(title, sampleTypeHints, isDisabled, showInfo, disableAddAnyType) { this.title = title; this.sampleTypeHints = sampleTypeHints; this.isDisabled = isDisabled; this.showInfo = showInfo; + this.disableAddAnyType = disableAddAnyType; this.samplesRemoved = []; this.samplesByType = {}; this.stateObj = {}; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js index 81c33c449db..c5b5fe63a4f 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js @@ -131,7 +131,15 @@ function LinksView(linksController, linksModel) { this.repaint = function($container) { $savedContainer = $container; $container.empty(); - $container.append($("<legend>").append(linksModel.title).append(" ").append(linksView.getAddAnyBtn()).css("margin-top", "20px").css("margin-bottom", "20px")); + + var addAnyBtn = null; + if(linksModel.disableAddAnyType) { + addAnyBtn = ""; + } else { + addAnyBtn = linksView.getAddAnyBtn(); + } + + $container.append($("<legend>").append(linksModel.title).append(" ").append(addAnyBtn).css("margin-top", "20px").css("margin-bottom", "20px")); $container.append($samplePicker); } -- GitLab