From 7c26376f295584e04e99a3e1b0c6bba72d2d47bd Mon Sep 17 00:00:00 2001
From: Kay Strobach <typo3@kay-strobach.de>
Date: Tue, 11 Oct 2011 08:38:27 +0200
Subject: [PATCH] [BUGFIX] EM: Fix button "close window" after fulfilling
 dependencies

This fix opens the window in a sized window and changes the logic to
determine the correct function for closing the window.

Change-Id: Ie16d67284240a833e5bfae67d8b78eab808f9a79
Releases: 4.6
Resolves: #29788
Reviewed-on: http://review.typo3.org/5706
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
---
 typo3/sysext/em/classes/index.php                |  2 +-
 .../em/classes/install/class.tx_em_install.php   | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/typo3/sysext/em/classes/index.php b/typo3/sysext/em/classes/index.php
index eedea4895773..2439855debcd 100644
--- a/typo3/sysext/em/classes/index.php
+++ b/typo3/sysext/em/classes/index.php
@@ -2571,7 +2571,7 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
 				$GLOBALS['LANG']->getLL('ext_import_close_check') . '</a>';
 			return $link;
 		} else {
-			return '<a id="closewindow" href="javascript:if (parent.TYPO3.EM) {parent.TYPO3.EM.Tools.closeImportWindow();} else {window.close();}">' . $GLOBALS['LANG']->getLL('ext_import_close') . '</a>';
+			return '<a id="closewindow" href="javascript:if (parent.TYPO3.EM && top.frames.length) {parent.TYPO3.EM.Tools.closeImportWindow();} else {window.close();}">' . $GLOBALS['LANG']->getLL('ext_import_close') . '</a>';
 		}
 	}
 
diff --git a/typo3/sysext/em/classes/install/class.tx_em_install.php b/typo3/sysext/em/classes/install/class.tx_em_install.php
index d2a50ba970e4..f3dc9639f86a 100644
--- a/typo3/sysext/em/classes/install/class.tx_em_install.php
+++ b/typo3/sysext/em/classes/install/class.tx_em_install.php
@@ -493,25 +493,25 @@ class tx_em_Install {
 						$msg[] = '<br />' . sprintf($GLOBALS['LANG']->getLL('checkDependencies_ext_not_available'),
 							$depK);
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-import', array('title' => $GLOBALS['LANG']->getLL('checkDependencies_import_ext'))) . '&nbsp;
-							<a href="' . t3lib_div::linkThisUrl($this->parentObject->script, array(
+							<a href="#" onclick="window.open(\'' . t3lib_div::linkThisUrl($this->parentObject->script, array(
 							'CMD[importExt]' => $depK,
 							'CMD[loc]' => 'L',
 							'CMD[standAlone]' => 1
-						)) . '" target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_import_now') . '</a>';
+						)) . '\', \'' . md5($instExtInfo[$depK]['EM_CONF']['title']) . '\', \'width=650, height=500\'); return false;" target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_import_now') . '</a>';
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" value="1" name="depsolver[ignore][' . $depK . ']" id="checkIgnore_' . $depK . '" />
 							<label for="checkIgnore_' . $depK . '">' . $GLOBALS['LANG']->getLL('checkDependencies_ignore_ext_requirement') . '</label>';
 					} else {
 						$msg[] = '<br />' . sprintf($GLOBALS['LANG']->getLL('checkDependencies_ext_not_installed'),
 							$depK, $instExtInfo[$depK]['EM_CONF']['title']);
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;' . tx_em_Tools::installButton() . '&nbsp;
-							<a href="' . t3lib_div::linkThisUrl($this->parentObject->script, array(
+							<a href="#" onclick="window.open(\'' . t3lib_div::linkThisUrl($this->parentObject->script, array(
 							'CMD[showExt]' => $depK,
 							'CMD[load]' => 1,
 							'CMD[clrCmd]' => 1,
 							'CMD[standAlone]' => 1,
 							'SET[singleDetails]' => 'info'
 						)) .
-								'" target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_install_now') . '</a>';
+								'\', \'' . md5($instExtInfo[$depK]['EM_CONF']['title']) . '\', \'width=650, height=500\'); return false; " target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_install_now') . '</a>';
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" value="1" name="depsolver[ignore][' . $depK . ']" id="checkIgnore_' . $depK . '" />
 							<label for="checkIgnore_' . $depK . '">' . $GLOBALS['LANG']->getLL('checkDependencies_ignore_ext_requirement') . '</label>';
 					}
@@ -607,25 +607,25 @@ class tx_em_Install {
 						$msg[] = sprintf($GLOBALS['LANG']->getLL('checkDependencies_suggest_import'),
 							$suggestK);
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-import', array('title' => $GLOBALS['LANG']->getLL('checkDependencies_import_ext'))) . '&nbsp;
-							<a href="' . t3lib_div::linkThisScript(array(
+							<a href="#" onclick="window.open(\'' . t3lib_div::linkThisScript(array(
 							'CMD[importExt]' => $suggestK,
 							'CMD[loc]' => 'L',
 							'CMD[standAlone]' => 1
-						)) . '" target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_import_now') . '</a>';
+						)) . '\', \'' . md5($suggestK) . '\', \'width=650, height=500\'); return false; " target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_import_now') . '</a>';
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" value="1" name="depsolver[ignore][' . $suggestK . ']" id="checkIgnore_' . $suggestK . '" />
 							<label for="checkIgnore_' . $suggestK . '">' . $GLOBALS['LANG']->getLL('checkDependencies_ignore_suggestion') . '</label>';
 					} else {
 						$msg[] = sprintf($GLOBALS['LANG']->getLL('checkDependencies_suggest_installation'),
 							$suggestK, $instExtInfo[$suggestK]['EM_CONF']['title']);
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;' . tx_em_Tools::installButton() . '&nbsp;
-							<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
+							<a href="#" onclick="window.open(\''  . htmlspecialchars(t3lib_div::linkThisScript(array(
 							'CMD[showExt]' => $suggestK,
 							'CMD[load]' => 1,
 							'CMD[clrCmd]' => 1,
 							'CMD[standAlone]' => 1,
 							'SET[singleDetails]' => 'info'
 						))) .
-								'" target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_install_now') . '</a>';
+								'\', \'' . md5($suggestK) . '\', \'width=650, height=500\'); return false; " target="_blank">' . $GLOBALS['LANG']->getLL('checkDependencies_install_now') . '</a>';
 						$msg[] = '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" value="1" name="depsolver[ignore][' . $suggestK . ']" id="checkIgnore_' . $suggestK . '" />
 							<label for="checkIgnore_' . $suggestK . '">' . $GLOBALS['LANG']->getLL('checkDependencies_ignore_suggestion') . '</label>';
 					}
-- 
GitLab