From 036150424df68ef9a4997dbd7cae7b708e738554 Mon Sep 17 00:00:00 2001
From: "Fuentes Serna  Juan Mariano (ID SIS)" <juanf@bs-mbpr28.d.ethz.ch>
Date: Tue, 20 Feb 2018 11:20:40 +0100
Subject: [PATCH] SSDM-6198 : storage improvements to maximize usage of screen
 space + other fixes

---
 .../eln-lims/html/js/util/PrintUtil.js        |  5 +--
 .../StorageManager/StorageManagerView.js      |  3 +-
 .../views/StorageManager/widgets/GridView.js  |  8 ++--
 .../StorageManager/widgets/StorageView.js     | 40 ++++++++++++++++---
 4 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
index 6a7cc3d05d7..36a712097a5 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
@@ -97,6 +97,7 @@ var PrintUtil = new function() {
 			for(code in extraProperties) {
 				var extraProp = extraProperties[code];
 				var propLabel = extraProp.label;
+				extraProp.value = FormUtil.sanitizeRichHTMLText(extraProp.value);
 				if(propLabel.length > 25) {
 					propLabel = propLabel.substring(0, 23) + "..."; 
 				}
@@ -134,9 +135,7 @@ var PrintUtil = new function() {
 				} else {
 					propertyContent = entity.properties[propertyCode];
 					propertyContent = Util.getEmptyIfNull(propertyContent);
-					if(propertyType.dataType === "MULTILINE_VARCHAR") {
-						propertyContent = FormUtil.sanitizeRichHTMLText(propertyContent);
-					}
+					propertyContent = FormUtil.sanitizeRichHTMLText(propertyContent);
 					propertyContent = Util.replaceURLWithHTMLLinks(propertyContent);
 				}
 				
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js
index 85d703add3b..1cc28e0bd66 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js
@@ -77,7 +77,8 @@ function StorageManagerView(storageManagerController, storageManagerModel, stora
 		
 		$containerColumn.append(this._$storageFromContainer);
 		$containerColumn.append(this._$storageToContainer);
-		$containerColumn.append($("<div>").append($("<h2>").append("Changes")).append(this._changeLogContainer));
+		$containerColumn.append($("<div>", { class : "col-md-12" }).append($("<legend>").append("Changes")).append(this._changeLogContainer));
+		$container.css("padding", "0px");
 		$container.append($containerColumn);
 	}
 	
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js
index 942c97719d8..f5a1a228e4c 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js
@@ -150,17 +150,17 @@ function GridView(gridModel) {
 							//Label
 							labels[i].displayName = sample.parents[0].code;
 						}
-							
+						
 						sample = sample.parents[0];
 							
 						var href = Util.getURLFor(null, "showViewSamplePageFromPermId", sample.permId);
-						optSampleTitle = $("<a>", { "href" : href, "class" : "browser-compatible-javascript-link" }).append(labels[i].displayName);
+						optSampleTitle = $("<a>", { "href" : href, "class" : "browser-compatible-javascript-link" }).text(labels[i].displayName);
 						optSampleTitle.click(function() {
 							mainController.changeView("showViewSamplePageFromPermId", sample.permId);
 						});
 					}
 					
-					var labelContainer = $("<div>", { class: "storageBox", id : Util.guid() }).append(labels[i].displayName);
+					var labelContainer = $("<div>", { class: "storageBox", id : Util.guid() }).text(labels[i].displayName);
 					if (sample) {
 						var tooltip = PrintUtil.getTable(sample, false, optSampleTitle, 'inspectorWhiteFont', 'colorEncodedWellAnnotations-holder-' + sample.permId, null, null);
 						labelContainer.tooltipster({
@@ -170,7 +170,7 @@ function GridView(gridModel) {
 						});
 					} else if(labels[i].displayName) {
 						labelContainer.tooltipster({
-							content: $("<span>").html(labels[i].displayName)
+							content: $("<span>").text(labels[i].displayName)
 						});
 					}
 					var dragCopyFunc = function(object, origX, origY) {
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js
index c58d4541f49..13410fa8f69 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js
@@ -38,8 +38,36 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi
 			//
 			
 			//$container.empty(); To allow display into a pop-up
+			
+			//
+			// Merged - Title / Storage / User
+			//
+			var $titleLine = $("<table>", { class : "col-md-12" });
+			var $titleLineTr = $("<tr>");
+			$titleLine.append($titleLineTr);
+			
+			var addToTitleLine = function($component) {
+				$titleLineTr.append($("<td>", { width : "33%", "style" : "text-align: center; padding: 4px;" }).append($component));
+			}
+			
+			//
+			// Merged - Box Name / Box Size
+			//
+			var $boxLine = $("<table>", { class : "col-md-12" });
+			var $boxLineTr = $("<tr>");
+			$boxLine.append($boxLineTr);
+			
+			var addToBoxLine = function($component) {
+				$boxLineTr.append($("<td>", { width : "33%", "style" : "text-align: center; padding: 4px;" }).append($component));
+			}
+			
+			//
+			//
+			//
+			
+			$container.append($titleLine);
 			if( _this._storageModel.config.title) { //It can be null
-				$container.append("<h2>" + _this._storageModel.config.title + "</h2>");
+				addToTitleLine("<legend>" + _this._storageModel.config.title + "</legend>");
 			}
 			
 			if( _this._storageModel.config.storagePropertyGroupSelector === "on") {
@@ -53,7 +81,7 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi
 				}
 				//Paint
 				var $controlGroupStorages = FormUtil.getFieldForComponentWithLabel(_this._defaultStoragesDropDown, "Storage");
-				$container.append($controlGroupStorages);
+				addToTitleLine($controlGroupStorages);
 				//Attach Event
 				_this._defaultStoragesDropDown.change(function(event) {
 					var storageName = $(this).val();
@@ -73,7 +101,7 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi
 			if(_this._storageModel.config.userSelector === "on" && !_this._storageModel.sample) {
 				//Paint
 				var $controlGroupUserId = FormUtil.getFieldForComponentWithLabel(_this._userIdDropdown, "User Id Filter");
-				$container.append($controlGroupUserId);
+				addToTitleLine($controlGroupUserId);
 				_this._userIdDropdown.multiselect();
 				//Attach Event
 				_this._userIdDropdown.change(function() {
@@ -89,11 +117,13 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi
 				_this._storageController.setSelectStorage(_this._storageModel.sample.properties[_this._storageModel.storagePropertyGroup.nameProperty]);
 			}
 			
+			$container.append($boxLine);
+			
 			if(_this._storageModel.config.boxSelector === "on" || _this._storageModel.config.rackSelector === "on") {
 				//Paint
 				_this._boxField.hide();
 				var $controlGroupBox = FormUtil.getFieldForComponentWithLabel(_this._boxField, "Box Name");
-				$container.append($controlGroupBox);
+				addToBoxLine($controlGroupBox);
 				//Attach Event
 				_this._boxField.keyup(function() {
 					if(_this._storageModel.sample) { // Sample to bind
@@ -114,7 +144,7 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi
 				//Paint
 				_this._boxSizeDropDown.hide();
 				var $controlGroupBox = FormUtil.getFieldForComponentWithLabel(_this._boxSizeDropDown, "Box Size");
-				$container.append($controlGroupBox);
+				addToBoxLine($controlGroupBox);
 				//Attach Event
 				_this._boxSizeDropDown.change(function() {
 					if(_this._storageModel.sample) { // Sample to bind
-- 
GitLab