From ec8d5172a26cedd86666917e09e74ae96585dd8a Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Thu, 30 Jun 2016 13:27:11 +0000
Subject: [PATCH] SSDM-3817 : Checkbox to not show warning anymore on Plain
 text imports

SVN: 36771
---
 .../js/views/DataGrid/DataGridController.js   | 28 ++++++-------------
 .../webapps/eln-lims/html/lib/grid/js/Grid.js | 13 +++++++--
 2 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js
index 1b8cfc13b10..dbecaeda7d9 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js
@@ -26,30 +26,18 @@ function DataGridController(title, columns, data, rowClickEventHandler, showAllC
 	
 	this.init = function($container, extraOptions) {
 		var webAppId = "ELN-LIMS";
-		mainController.serverFacade.openbisServer.getWebAppSettings(webAppId, function(response) {
-			var settings = response.result.settings;
+		mainController.serverFacade.getSetting(configKey, function(tableConfig) {
 			var onColumnsChange = function(tableState) {
-				if(!settings) {
-					settings = {};
-				}
-				settings[configKey] = JSON.stringify(tableState);
-				
-				var webAppSettings = {
-						"@type" : "WebAppSettings",
-						"webAppId" : webAppId,
-						"settings" : settings
-				}
-				
-				mainController.serverFacade.openbisServer.setWebAppSettings(webAppSettings, function(result) {});
+				mainController.serverFacade.setSetting(configKey, JSON.stringify(tableState));
 			}
-			var tableSettings = null;
-			if(configKey && settings[configKey]) {
-				tableSettings = JSON.parse(settings[configKey]);
-				if(Object.keys(tableSettings).length > 3) { //Clean old settings
-					tableSettings = null;
+			
+			if(tableConfig) {
+				tableConfig = JSON.parse(tableConfig);
+				if(!tableConfig.pageSize) { //Clean old settings
+					tableConfig = null;
 				}
 			}
-			_this._grid = new Grid(columns, data, showAllColumns, tableSettings, onColumnsChange, isMultiselectable);
+			_this._grid = new Grid(columns, data, showAllColumns, tableConfig, onColumnsChange, isMultiselectable);
 			if(rowClickEventHandler) {
 				_this._grid.addRowClickListener(rowClickEventHandler);
 			}
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js
index 13f118cf9b3..9ff4aa5ede6 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js
@@ -311,9 +311,18 @@ $.extend(Grid.prototype, {
 	
 	exportTSV : function(isAllRowsOrVisible, isAllColumnsOrVisible, plainText) {
 		var _this = this;
-		if(plainText) {
-			Util.showWarning("<b>DO NOT USE THIS FILE FOR BATCH UPDATE!</b><br>This file does not contain rich text format. If used for Batch Update, all rich text format in the updated entries will be lost!", function() {
+		var disablePlanTextExportWarning = this.tableSettings.disablePlanTextExportWarning;
+		if(plainText  && !disablePlanTextExportWarning) {
+			var dontShowAnymore = "<input type='checkbox' id='disablePlanTextExportWarning'> Don't show this warning again.";
+			
+			Util.showWarning("<b>DO NOT USE THIS FILE FOR BATCH UPDATE!</b><br>This file does not contain rich text format. If used for Batch Update, all rich text format in the updated entries will be lost!<br><br>" + dontShowAnymore, function() {
 				_this.exportTSVB(isAllRowsOrVisible, isAllColumnsOrVisible, plainText);
+				
+				var isSelected = $("#disablePlanTextExportWarning").val() === "on";
+				if(_this.onChangeState) {
+					_this.tableSettings.disablePlanTextExportWarning = isSelected;
+					_this.onChangeState(_this.tableSettings);
+				}
 			});
 		} else {
 			_this.exportTSVB(isAllRowsOrVisible, isAllColumnsOrVisible, plainText);
-- 
GitLab