From b4954ef2b1aac8361b0e5e5b398398f003a481ea Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Tue, 23 Jun 2015 12:07:55 +0000
Subject: [PATCH] SSDM-1959 : Show gene name instead of gene number in ELN
 plate hierarchy view

SVN: 34248
---
 .../1/as/webapps/eln-lims/html/css/style.css  | 52 +---------------
 .../eln-lims/html/js/util/PrintUtil.js        | 61 ++++---------------
 .../js/views/SampleForm/widgets/PlateView.js  |  2 +-
 .../html/js/views/legacy/SampleHierarchy.js   |  2 +-
 4 files changed, 17 insertions(+), 100 deletions(-)

diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css
index fede4b1fbc3..f190282d3d5 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css
@@ -289,10 +289,6 @@ h1, h2, legend {
 	float:left;
 }
 
-.inspector {
-	margin: 10px 10px 10px 10px;	
-}
-
 .inspectorLineBreak {
 	word-wrap: break-word;
 	width:300px;
@@ -302,7 +298,7 @@ div.inspectorWhiteFont {
 	color: white !important;	
 }
 
-div.inspectorCondensed {
+div.inspector {
 	text-decoration: none;
 	color: #000;
 	display: block;
@@ -311,54 +307,12 @@ div.inspectorCondensed {
 	border-radius: 10px;
 }
 
-div.inspectorCondensed > .table th,
-div.inspectorCondensed > .table td {
+div.inspector > .table th,
+div.inspector > .table td {
 	border-top: none;
 	line-height: 12px;
 }
 
-div.inspector > table {
-	width: 400px;
-}
-
-div.inspector {
-	text-decoration: none;
-	color: #000;
-	display: block;
-	width: 400px;
-	overflow: hidden;
-	padding: 0.5em;
-	-moz-box-shadow: 5px 5px 7px rgba(33,33,33,1);
-	-webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);
-	box-shadow: 5px 5px 7px rgba(33,33,33,.7);
-	/*
-	-o-transform: rotate(1deg);
-	-webkit-transform: rotate(1deg);
-	-moz-transform: rotate(1deg);
-	*/
-	position: relative;
-	/*
-	-moz-transition:-moz-transform .15s linear;
-	-o-transition:-o-transform .15s linear;
-	-webkit-transition:-webkit-transform .15s linear;
-	*/
-	
-}
-
-div.inspector:hover,div.inspector:focus{
-	/*
-  box-shadow:10px 10px 7px rgba(0,0,0,.7);
-  -moz-box-shadow:10px 10px 7px rgba(0,0,0,.7);
-  -webkit-box-shadow: 10px 10px 7px rgba(0,0,0,.7);
-  
-  -webkit-transform: scale(1.25);
-  -moz-transform: scale(1.25);
-  -o-transform: scale(1.25);
-  */
-  position:relative;
-  z-index:5;
-}
-
 .inspectorExtra {
 	margin-left: 0px !important;
 }
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
index c4b658f2473..2c2fc5f23e3 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js
@@ -19,20 +19,13 @@ var PrintUtil = new function() {
 
 	this.printSample = function(sample) {
 		var newWindow = window.open(undefined,"print " + sample.permId);
-		
-		var pageToPrint = "";
-			pageToPrint += "<html>";
-			pageToPrint += "<head>";
-			pageToPrint += "</head>";
-			pageToPrint += "<body stlye='font-family: '\"'Helvetica Neue\",Helvetica,Arial,sans-serif;'>";
-			pageToPrint += this.getTable(sample, false, false, false);
-			pageToPrint += "</body>";
-			pageToPrint += "</html>";
-		
+		var pageToPrint = $("<html>")
+							.append($("<head>"))
+							.append($("<body>").append(this.getTable(sample)));
 		$(newWindow.document.body).html(pageToPrint);
 	}
 	
-	this.getParentsChildrenText = function(parentsChildrenList, withLinks) {
+	this.getParentsChildrenText = function(parentsChildrenList) {
 		var allParentCodesByType = {};
 		
 		if(parentsChildrenList) {
@@ -59,11 +52,7 @@ var PrintUtil = new function() {
 			var parents = allParentCodesByType[sampleType];
 			for(var i = 0; i < parents.length; i++) {
 				var parent = parents[i];
-				if(withLinks) {
-					allParentCodesAsText += "<a href=\"javascript:mainController.inspector.showSampleOnInspector('" + parent.permId + "');\">" + parent.code + "</a> ";
-				} else {
-					allParentCodesAsText += parent.code + " ";
-				}
+				allParentCodesAsText += parent.code + " ";
 			}
 			allParentCodesAsText += "</br>";
 		}
@@ -71,56 +60,30 @@ var PrintUtil = new function() {
 		return allParentCodesAsText;
 	}
 	
-	this.getTable = function(entity, showClose, withColors, withLinks, optionalTitle, isCondensed, customClass, extraCustomId, extraContent) {
+	this.getTable = function(entity, isNotTransparent, optionalTitle, customClass, extraCustomId, extraContent) {
 		var defaultColor = null;
 		
-		if(!withColors) {
-			defaultColor = "transparent"
-		} else {
+		if(isNotTransparent) {
 			defaultColor = "#FBFBFB";
+		} else {
+			defaultColor = "transparent"
 		} 
 
 		var inspector = "";
 			var divID = entity.sampleTypeCode + "_" + entity.code + "_INSPECTOR";
 			
-			var inspectorClass = null;
-			if(isCondensed) {
-				inspectorClass = 'inspectorCondensed';
-			} else {
-				inspectorClass = 'inspector';
-			}
-			
+			var inspectorClass = 'inspector';
 			if(customClass) {
 				inspectorClass += ' ' + customClass;
 			}
 			inspector += "<div id='"+divID+"' class='" + inspectorClass + "' style='background-color:" + defaultColor + ";' >";
 			
-			if(showClose) {
-				var removeButton = "<span class='btn inspectorToolbar btn-default' style='float:left; margin: 2px' onclick='mainController.inspector.closeNewInspector(\""+entity.id+"\")'><i class='glyphicon glyphicon-remove'></i></span>";
-				inspector += removeButton;
-			}
-			
-			if(withLinks) {
-				var toogleButton = "<span class='btn inspectorToolbar btn-default' style='float:left; margin: 2px' onclick='mainController.inspector.toogleInspector(\""+entity.permId+"_TOOGLE\")'><i id='"+entity.permId+"_TOOGLE_ICON' class='glyphicon glyphicon-chevron-up'></i></span>";
-				inspector += toogleButton;
-			}
-			
 			if(optionalTitle) {
 				inspector += optionalTitle;
 			} else {
 				inspector += "<strong>" + entity.code + "</strong>";
 			}
 			
-			
-			if(withLinks) {
-				var printButton = "<span class='btn btn-default inspectorToolbar' style='float:right; margin: 2px;' onclick='javascript:mainController.inspector.printInspector(\""+entity.permId+"\")'><i class='glyphicon glyphicon-print'></i></span>";
-				inspector += printButton;
-				var viewButton = "<span class='btn btn-default inspectorToolbar' style='float:right; margin: 2px' onclick='javascript:mainController.changeView(\"showViewSamplePageFromPermId\",\""+entity.permId+"\")'><i class='glyphicon glyphicon-edit'></i></span>";
-				inspector += viewButton;
-				var hierarchyButton = "<span class='btn btn-default inspectorToolbar' style='float:right; margin: 2px' onclick=\"javascript:mainController.changeView('showSampleHierarchyPage','"+entity.permId+"');\"><img src='./img/hierarchy-icon.png' style='width:16px; height:17px;' /></span>";
-				inspector += hierarchyButton;
-			}
-			
 			inspector += "<table id='" + entity.permId +"_TOOGLE' class='properties table table-condensed'>"
 			
 			//Show Properties following the order given on openBIS
@@ -207,7 +170,7 @@ var PrintUtil = new function() {
 			}
 			
 			//Show Parent Codes
-			var allParentCodesAsText = this.getParentsChildrenText(entity.parents, withLinks);
+			var allParentCodesAsText = this.getParentsChildrenText(entity.parents);
 			if(allParentCodesAsText.length > 0) {
 				inspector += "<tr>";
 				inspector += "<td class='property'>Parents</td>";
@@ -216,7 +179,7 @@ var PrintUtil = new function() {
 			}
 			
 			//Show Children Codes
-			var allChildrenCodesAsText = this.getParentsChildrenText(entity.children, withLinks);
+			var allChildrenCodesAsText = this.getParentsChildrenText(entity.children);
 			if(allChildrenCodesAsText.length > 0) {
 				inspector += "<tr>";
 				inspector += "<td class='property'>Children</td>";
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js
index 391fd794fff..831cc8e1f8d 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js
@@ -63,7 +63,7 @@ function PlateView(plateController, plateModel) {
 					$cell = $("<td>").append("&nbsp;");
 					if(well) {
 						$cell.addClass('well');
-						var tooltip = PrintUtil.getTable(well, false, false, false, well.code, true, 'inspectorWhiteFont');
+						var tooltip = PrintUtil.getTable(well, false, well.code, 'inspectorWhiteFont');
 						$cell.tooltipster({
 			                content: $(tooltip),
 			                interactive: true
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js
index bc6b8310186..830de82814e 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js
@@ -338,7 +338,7 @@ function SampleHierarchy(serverFacade, containerId, profile, sample) {
 						extraCustomId = plateController.getPlaceHolderId();
 						plateController.initWithPlaceHolder();
 					}
-					var $graphTable = PrintUtil.getTable(sample, false, true, false, title, true, null, extraCustomId, extraContent);
+					var $graphTable = PrintUtil.getTable(sample, true, title, null, extraCustomId, extraContent);
 					
 					$nodeContent.empty();
 					$nodeContent.css({
-- 
GitLab