From bf774b63300070ea0f68d9e4a18e170545ce8d2c Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Wed, 24 Feb 2016 19:12:57 +0100
Subject: [PATCH] [BUGFIX] Convert colPos in backend layout wizard to number

The method `setColumn` in the backend layout wizard sanitizes the
value by wrapping it into a <p> tag and fetching its text which strips
off any HTML. This returns a string.

However, the code later checks after performing a save action whether
the value is a number. The value gets converted to a number in
`setColumn` to recover the functionality.

Change-Id: I686657e170668adf71f278fa537aa5510e3e2241
Resolves: #73656
Releases: master
Reviewed-on: https://review.typo3.org/46880
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
---
 .../backend/Resources/Public/JavaScript/GridEditor.js       | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js b/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js
index 69ce3a4a1f1d..8c942376167a 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js
@@ -326,7 +326,9 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity', 'boot
 	 */
 	GridEditor.setName = function(newName, col, row) {
 		var cell = GridEditor.getCell(col, row);
-		if (!cell) return false;
+		if (!cell) {
+			return false;
+		}
 		cell.name = GridEditor.stripMarkup(newName);
 		return true;
 	};
@@ -346,7 +348,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity', 'boot
 		if (!cell) {
 			return false;
 		}
-		cell.column = GridEditor.stripMarkup(newColumn);
+		cell.column = parseInt(GridEditor.stripMarkup(newColumn), 10);
 		return true;
 	};
 
-- 
GitLab