From c3dc63518a8b57ccffb7d6a5068b76ef932505cc Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Thu, 25 Jun 2015 15:06:55 +0000
Subject: [PATCH] SSDM-2032 : ELN: Dataset form

SVN: 34294
---
 .../eln-lims/1/as/initialize-master-data.py   |  4 ++
 .../js/views/DataSetForm/DataSetFormView.js   | 37 +++++++++++++++++--
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/plasmid/source/core-plugins/eln-lims/1/as/initialize-master-data.py b/plasmid/source/core-plugins/eln-lims/1/as/initialize-master-data.py
index 1d8f3c314df..7db70d75937 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/initialize-master-data.py
+++ b/plasmid/source/core-plugins/eln-lims/1/as/initialize-master-data.py
@@ -505,22 +505,26 @@ def initELNMasterData():
 	## DataSet Types
 	##
 	createDataSetTypeWithProperties("ELN_PREVIEW", "PHYSICAL", "ELN Preview image", [
+		["NAME", "General", "Name", DataType.VARCHAR, None,	"Name", None, None],
 		["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset", None, None],
 		["XMLCOMMENTS",	"Comments","Comments List",	DataType.XML,	None,	"Several comments can be added by different users", commentsDatasetScriptName, None]
 	]);
 	
 	createDataSetTypeWithProperties("SEQ_FILE", "PHYSICAL", "", [
+		["NAME", "General", "Name", DataType.VARCHAR, None,	"Name", None, None],
 		["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset", None, None],
 		["XMLCOMMENTS",	"Comments","Comments List",	DataType.XML,	None,	"Several comments can be added by different users", commentsDatasetScriptName, None]
 		
 	]);
 	
 	createDataSetTypeWithProperties("RAW_DATA", "PHYSICAL", "", [
+		["NAME", "General", "Name", DataType.VARCHAR, None,	"Name", None, None],
 		["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset", None, None],
 		["XMLCOMMENTS",	"Comments","Comments List",	DataType.XML,	None,	"Several comments can be added by different users", commentsDatasetScriptName, None]
 	]);
 	
 	createDataSetTypeWithProperties("ANALYZED_DATA", "PHYSICAL", "", [
+		["NAME", "General", "Name", DataType.VARCHAR, None,	"Name", None, None],
 		["NOTES", "General information", "Notes", DataType.MULTILINE_VARCHAR, None, "Notes regarding the dataset", None, None],
 		["XMLCOMMENTS",	"Comments","Comments List",	DataType.XML,	None,	"Several comments can be added by different users", commentsDatasetScriptName, None]
 	]);
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js
index 1533536642b..e992cd53146 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js
@@ -26,17 +26,46 @@ function DataSetFormView(dataSetFormController, dataSetFormModel) {
 		var $wrapper = $('<form>', { class : 'form-horizontal ', 'id' : 'mainDataSetForm', 'role' : 'form'});
 		$wrapper.submit(function(event) {_this._dataSetFormController.submitDataSet(); event.preventDefault();});
 		
-		//Title
+		//
+		// Title
+		//
+		var $title = $('<div>');
+		var nameLabel = this._dataSetFormModel.dataSet.properties[profile.propertyReplacingCode]; //sample.properties[profile.propertyReplacingCode];
+		var entityPath = null;
+		if(this._dataSetFormModel.sample && this._dataSetFormModel.sample.experimentIdentifierOrNull) { //Both Sample and Experiment exist
+			entityPath = this._dataSetFormModel.sample.experimentIdentifierOrNull + "/" + this._dataSetFormModel.sample.code + "/" + this._dataSetFormModel.dataSet.code;
+		} else { //Only Experiment exists (Not Supported on the ELN Yet)
+			entityPath = this._dataSetFormModel.dataSet.code;
+		}
+		
 		var titleText = null;
 		if(this._dataSetFormModel.mode === FormMode.CREATE) {
 			titleText = 'Create Dataset';
 		} else if(this._dataSetFormModel.mode === FormMode.EDIT) {
-			titleText = 'Update Dataset ' + this._dataSetFormModel.dataSet.code;
+			titleText = 'Update Dataset '; //+ this._dataSetFormModel.dataSet.code;
 		} else if(this._dataSetFormModel.mode === FormMode.VIEW) {
-			titleText = 'Dataset ' + this._dataSetFormModel.dataSet.code;
+			titleText = 'Dataset '; //+ this._dataSetFormModel.dataSet.code;
+		}
+		
+		var isName = (nameLabel)?true:false;
+		if(isName) {
+			titleText += nameLabel;
+			$title
+				.append($("<h2>").append(titleText))
+				.append($("<h4>", { "style" : "font-weight:normal;" } ).append(entityPath));
+		} else {
+			if(this._dataSetFormModel.mode !== FormMode.CREATE) {
+				titleText += entityPath;
+			}
+			
+			$title
+				.append($("<h2>").append(titleText));
 		}
-		var $title = $('<h2>').text(titleText);
 		$wrapper.append($title);
+		
+		//
+		// Toolbar
+		//
 		var $toolbar = $('<div>');
 		$wrapper.append($toolbar);
 		
-- 
GitLab