From 6413329e68f486fd9d91cbcd352909b47e167a06 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Tue, 5 Apr 2016 09:18:34 +0000
Subject: [PATCH] SSDM-3449 : Direct link to host

SVN: 36077
---
 .../as/webapps/eln-lims/html/js/util/Util.js  | 21 +++++++++++++++++++
 .../DataSetForm/widgets/DatasetViewerModel.js | 12 ++++-------
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js
index 5f167619bb8..642ef3beeb3 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/Util.js
@@ -226,6 +226,27 @@ var Util = new function() {
 		});
 	}
 
+	this.showDirectLink = function(directLink) {
+		var css = {
+				'text-align' : 'left',
+				'top' : '15%',
+				'width' : '80%',
+				'left' : '10%',
+				'right' : '10%',
+				'overflow' : 'hidden'
+		};
+		
+		var $window = $("<div>").append($("<h1>").append("Direct Link"))
+											.append("Please use this link to access the folder though the network: ")
+											.append($("<br>"))
+											.append("Directly clicking on it will open the default application.")
+											.append($("<br>"))
+											.append($("<a>", { "href" : directLink, "target" : "_blank"}).append(directLink));
+		$window.css("margin", "10px");
+		
+		Util.blockUI($window, css);
+	}
+	
 	//HACK: This method is intended to be used by naughty SVG images that don't provide a correct with/height and don't resize correctly
 	this.loadSVGImage = function(imageURL, containerWidth, containerHeight, callback, isSEQSVG) {
 		d3.xml(imageURL, "image/svg+xml", 
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js
index 98fa358961f..8555455163c 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js
@@ -68,9 +68,10 @@ function DataSetViewerModel(containerId, profile, sample, serverFacade, datastor
 	}
 	
 	this.getDirectDirectoryLink = function(datasetCode, datasetFile) {
-		var directLinkURL = profile.directLinkURL + this.sample.experimentIdentifierOrNull.substring(1) + "/" + datasetCode + "/" + datasetFile.pathInDataSet + "/";
-		var directLink = "<span onclick=\"" + "window.open('" + directLinkURL + "')" + "\" class='glyphicon glyphicon-hdd'></span>";
-		return directLink;
+		var directLink = profile.directLinkURL + this.sample.experimentIdentifierOrNull.substring(1) + "/" + datasetCode + "/" + datasetFile.pathInDataSet + "/";
+		var directLinkComponent = "<span onclick=\"" + "Util.showDirectLink('" + directLink + "')" + "\" class='glyphicon glyphicon-hdd'></span>";
+//		var directLink = "<span onclick=\"" + "window.open('" + directLinkURL + "')" + "\" class='glyphicon glyphicon-hdd'></span>";
+		return directLinkComponent;
 	}
 	
 	this.getPreviewLink = function(datasetCode, datasetFile) {
@@ -79,11 +80,6 @@ function DataSetViewerModel(containerId, profile, sample, serverFacade, datastor
 			var imageURLAsString = profile.getDefaultDataStoreURL() + "/" + datasetCode + "/" + datasetFile.pathInDataSet + "?sessionID=" + mainController.serverFacade.getSession();
 			var onclick = "Util.showImage(\"" + imageURLAsString + "\");"
 			previewLink = "<span onclick='" + onclick + "' class='glyphicon glyphicon-search'></span>";
-//			previewLink = FormUtil.getButtonWithIcon("glyphicon-search", function() {
-//				var imageURL = profile.getDefaultDataStoreURL() + '/' + datasetCode + "/" + datasetFile.pathInDataSet + "?sessionID=" + mainController.serverFacade.getSession();
-//				Util.showImage(imageURL);
-//				event.stopPropagation();
-//			});
 		}
 		return previewLink;
 	}
-- 
GitLab