Commit e44f009a authored by Benjamin Kott's avatar Benjamin Kott Committed by Andreas Fernandez
Browse files

[TASK] Move info popups to modal windows

Resolves: #83844
Releases: master
Change-Id: I5fef80a48d52da9800a7a9a2a23445d60168e8b5
Reviewed-on: https://review.typo3.org/55659

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Tested-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 1ea84aa1
......@@ -6,6 +6,7 @@
*/
declare namespace TYPO3 {
export let DebugConsole: any;
export let InfoWindow: any;
export let Popover: any;
export let ShortcutMenu: any;
export let Storage: any;
......
......@@ -405,7 +405,7 @@ class Clipboard
$this->getBackendUser()->uc['titleLen']
)), $fileObject->getName()),
'thumb' => $thumb,
'infoLink' => htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($v) . '); return false;'),
'infoLink' => htmlspecialchars('top.TYPO3.InfoWindow.showItem(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($v) . '); return false;'),
'removeLink' => $this->removeUrl('_FILE', GeneralUtility::shortMD5($v))
];
} else {
......@@ -427,7 +427,7 @@ class Clipboard
$table,
$rec
), $this->getBackendUser()->uc['titleLen'])), $rec, $table),
'infoLink' => htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', \'' . (int)$uid . '\'); return false;'),
'infoLink' => htmlspecialchars('top.TYPO3.InfoWindow.showItem(' . GeneralUtility::quoteJSvalue($table) . ', \'' . (int)$uid . '\'); return false;'),
'removeLink' => $this->removeUrl($table, $uid)
];
......
......@@ -151,6 +151,9 @@ class BackendController
// load Modals
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
// load InfoWindow
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/InfoWindow');
// load ContextMenu
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextMenu');
......
......@@ -732,6 +732,7 @@ class EditDocumentController
// Info view:
function launchView(table,uid) {
console.warn(\'Calling launchView() has been deprecated in v9 and will be removed in v10.0\');
var thePreviewWindow = window.open(
' . GeneralUtility::quoteJSvalue((string)$uriBuilder->buildUriFromRoute('show_item') . '&table=') . ' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
"ShowItem" + Math.random().toString(16).slice(2),
......
......@@ -444,7 +444,7 @@ class InlineRecordContainer extends AbstractContainer
$cells['info'] = '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
} else {
$cells['info'] = '
<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:showInfo')) . '">
<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.TYPO3.InfoWindow.showItem(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . htmlspecialchars($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:showInfo')) . '">
' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '
</a>';
}
......
......@@ -517,7 +517,7 @@ abstract class AbstractRecordList
* sys_refindex records you hand over
*
* @param int $references number of records from sys_refindex table
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.launchView
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.TYPO3.InfoWindow.showItem
* @return string
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10
*/
......@@ -528,7 +528,7 @@ abstract class AbstractRecordList
} else {
$htmlCode = '<a href="#"';
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(('top.launchView(' . $launchViewParameter . '); return false;')) . '"';
$htmlCode .= ' onclick="' . htmlspecialchars(('top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;')) . '"';
}
$htmlCode .= ' title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang.xlf:show_references') . ' (' . $references . ')') . '">';
$htmlCode .= $references;
......
......@@ -1346,7 +1346,7 @@ class BackendUtility
. '</span>';
}
if ($linkInfoPopup) {
$onClick = 'top.launchView(\'_FILE\',\'' . (int)$fileObject->getUid() . '\'); return false;';
$onClick = 'top.TYPO3.InfoWindow.showItem(\'_FILE\',\'' . (int)$fileObject->getUid() . '\'); return false;';
$thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $imgTag . '</a> ';
} else {
$thumbData .= $imgTag;
......@@ -1400,7 +1400,7 @@ class BackendUtility
$image = '<img src="' . htmlspecialchars($imageUrl) . '" hspace="2" border="0" title="' . htmlspecialchars($fileObject->getName()) . '"' . $tparams . ' alt="" />';
if ($linkInfoPopup) {
$onClick = 'top.launchView(\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileName) . ',\'\');return false;';
$onClick = 'top.TYPO3.InfoWindow.showItem(\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileName) . ',\'\');return false;';
$thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $image . '</a> ';
} else {
$thumbData .= $image;
......@@ -1411,7 +1411,7 @@ class BackendUtility
. $iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render()
. '</span>';
if ($linkInfoPopup) {
$onClick = 'top.launchView(\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileName) . ',\'\'); return false;';
$onClick = 'top.TYPO3.InfoWindow.showItem(\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileName) . ',\'\'); return false;';
$thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $fileIcon . '</a> ';
} else {
$thumbData .= $fileIcon;
......
......@@ -3750,7 +3750,7 @@ class PageLayoutView implements LoggerAwareInterface
case 'info':
// "Info": (All records)
$code = '<a href="#" onclick="' . htmlspecialchars(
('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')
('top.TYPO3.InfoWindow.showItem(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')
) . '" title="' . htmlspecialchars($lang->getLL('showInfo')) . '">' . $code . '</a>';
break;
default:
......@@ -4440,7 +4440,7 @@ class PageLayoutView implements LoggerAwareInterface
* sys_refindex records you hand over
*
* @param int $references number of records from sys_refindex table
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.launchView
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.TYPO3.InfoWindow.showItem
* @return string
*/
protected function generateReferenceToolTip($references, $launchViewParameter = '')
......@@ -4451,7 +4451,7 @@ class PageLayoutView implements LoggerAwareInterface
$htmlCode = '<a href="#"';
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(
('top.launchView(' . $launchViewParameter . '); return false;')
('top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;')
) . '"';
}
$htmlCode .= ' title="' . htmlspecialchars(
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import Modal = require('TYPO3/CMS/Backend/Modal');
import Severity = require('TYPO3/CMS/Backend/Severity');
/**
* Module: TYPO3/CMS/Backend/InfoWindow
* @exports TYPO3/CMS/Backend/InfoWindow
*/
class InfoWindow {
/**
* Shows the info modal
*
* @param {string} table
* @param {string | number} uid
*/
public static showItem(table: string, uid: string|number): void {
Modal.advanced({
type: Modal.types.iframe,
size: Modal.sizes.large,
content: TYPO3.settings.ShowItem.moduleUrl
+ '&table=' + encodeURIComponent(table)
+ '&uid=' + (typeof uid === 'number' ? uid : encodeURIComponent(uid)),
severity: Severity.notice
});
}
}
// expose as global object
TYPO3.InfoWindow = InfoWindow;
export = InfoWindow;
......@@ -41,7 +41,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
};
ContextMenuActions.openInfoPopUp = function(table, uid) {
top.launchView(table, uid);
top.TYPO3.InfoWindow.showItem(table, uid);
};
ContextMenuActions.mountAsTreeRoot = function(table, uid) {
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Severity"],function(a,b,c,d){"use strict";var e=function(){function a(){}return a.showItem=function(a,b){console.log(TYPO3.settings),c.advanced({type:c.types.iframe,size:c.sizes.large,content:TYPO3.settings.ShowItem.moduleUrl+"&table="+encodeURIComponent(a)+"&uid="+("number"==typeof b?b:encodeURIComponent(b)),severity:d.notice})},a}();return TYPO3.InfoWindow=e,e});
\ No newline at end of file
......@@ -71,6 +71,7 @@ function str_replace(match, replace, string) { //
* Launcing information window for records/files (fileref as "table" argument)
*/
function launchView(table, uid) {
console.warn('Calling launchView() has been deprecated in v9 and will be removed in v10.0');
var thePreviewWindow = window.open(TYPO3.settings.ShowItem.moduleUrl + '&table=' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
"ShowItem" + Math.random().toString(16).slice(2),
"width=650,height=600,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
......
......@@ -48,7 +48,7 @@
<bu:removeUser backendUser="{backendUser}" />
</div>
<div class="btn-group" role="group">
<a class="btn btn-default" href="#" onclick="top.launchView('be_users', '{backendUser.uid}'); return false;"><core:icon identifier="actions-document-info" /></a>
<a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_users', '{backendUser.uid}'); return false;"><core:icon identifier="actions-document-info" /></a>
</div>
<div class="btn-group" role="group">
<f:if condition="{compareUserUidList.{backendUser.uid}}">
......
......@@ -40,7 +40,7 @@
</f:link.action>
</f:else>
</f:if>
<a class="btn btn-default" href="#" onclick="top.launchView('be_users', '{onlineUser.backendUser.uid}',''); return false;">
<a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_users', '{onlineUser.backendUser.uid}'); return false;">
<core:icon identifier="actions-document-info" />
</a>
</div>
......
......@@ -33,7 +33,7 @@
</f:if>
</div>
<div class="btn-group" role="group">
<a class="btn btn-default" href="#" onclick="top.launchView('be_groups', '{backendUserGroup.uid}'); return false;"><core:icon identifier="actions-document-info" /></a
<a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_groups', '{backendUserGroup.uid}'); return false;"><core:icon identifier="actions-document-info" /></a
</div>
</td>
</tr>
......@@ -718,7 +718,7 @@ class QueryView
$out .= '<a class="btn btn-default" href="' . htmlspecialchars($url) . '">'
. $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>';
$out .= '</div><div class="btn-group" role="group">';
$out .= '<a class="btn btn-default" href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid']
$out .= '<a class="btn btn-default" href="#" onClick="top.TYPO3.InfoWindow.showItem(\'' . $table . '\',' . $row['uid']
. ');return false;">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render()
. '</a>';
$out .= '</div>';
......
.. include:: ../../Includes.txt
========================================================
Deprecation: #83844 - Deprecated usage of top.launchView
========================================================
See :issue:`83844`
Description
===========
The usage of :js:`top.launchView()`, that opens certain information in a popup window, has been deprecated.
Impact
======
Calling :js:`top.launchView()` will trigger a deprecation log entry in the browser's console.
Affected Installations
======================
Every 3rd party extension that uses :js:`top.launchView` is affected.
Migration
=========
Either use :js:`top.TYPO3.InfoWindow.showItem()` directly or import the RequireJS module `TYPO3/CMS/Backend/InfoWindow`
and call :js:`showItem()`.
.. index:: Backend, JavaScript, NotScanned
......@@ -517,7 +517,11 @@ class FileListController extends ActionController
}
}
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
$pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('show_item'));
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileList');
$thumbnailConfiguration = GeneralUtility::makeInstance(ThumbnailConfiguration::class);
......@@ -528,8 +532,6 @@ class FileListController extends ActionController
$this->view->assign('searchWord', $searchWord);
$this->view->assign('files', $fileFacades);
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$this->view->assign('deleteUrl', (string)$uriBuilder->buildUriFromRoute('tce_file'));
$this->view->assign('settings', [
'jsConfirmationDelete' => $this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)
......
......@@ -1381,9 +1381,9 @@ class FileList
if ($fileOrFolderObject->checkActionPermission('read')) {
$infoOnClick = '';
if ($fileOrFolderObject instanceof Folder) {
$infoOnClick = 'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
$infoOnClick = 'top.TYPO3.InfoWindow.showItem(\'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
} elseif ($fileOrFolderObject instanceof File) {
$infoOnClick = 'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
$infoOnClick = 'top.TYPO3.InfoWindow.showItem(\'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
}
$cells['info'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.info') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>';
} else {
......@@ -1535,7 +1535,7 @@ class FileList
* sys_refindex records you hand over
*
* @param int $references number of records from sys_refindex table
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.launchView
* @param string $launchViewParameter JavaScript String, which will be passed as parameters to top.TYPO3.InfoWindow.showItem
* @return string
*/
protected function generateReferenceToolTip($references, $launchViewParameter = '')
......@@ -1546,7 +1546,7 @@ class FileList
$htmlCode = '<a href="#"';
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(
('top.launchView(' . $launchViewParameter . '); return false;')
('top.TYPO3.InfoWindow.showItem(' . $launchViewParameter . '); return false;')
) . '"';
}
$htmlCode .= ' title="' . htmlspecialchars(
......
......@@ -48,10 +48,10 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], func
ContextMenuActions.openInfoPopUp = function(table, uid) {
if (table === 'sys_file_storage') {
top.launchView(table, uid);
top.TYPO3.InfoWindow.showItem(table, uid);
} else {
//files and folders
top.launchView('_FILE', uid);
top.TYPO3.InfoWindow.showItem('_FILE', uid);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment