Commit 40a79c0a authored by Alexander Stehlik's avatar Alexander Stehlik Committed by Anja Leichsenring
Browse files

[TASK] Respect alternative web mounts in suggest wizard

The suggest wizard now respects temporary page tree mount
points and altElementBrowserMountPoints from the TSconfig.

The detection and adjustment of element browser mountpoints
is centralized in the backend user.

Resolves: #64215
Releases: master
Change-Id: Ic8eaf0cd2155051db0f3bed0678087ec72b9fadb
Reviewed-on: https://review.typo3.org/57193


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 1a66bc91
......@@ -120,6 +120,7 @@ class SuggestWizardDefaultReceiver
if (isset($config['maxItemsInResultList'])) {
$this->maxItems = $config['maxItemsInResultList'];
}
$GLOBALS['BE_USER']->initializeWebmountsForElementBrowser();
if ($this->table === 'pages') {
$this->queryBuilder->andWhere(
QueryHelper::stripLogicalOperatorPrefix($GLOBALS['BE_USER']->getPagePermsClause(Permission::PAGE_SHOW)),
......
......@@ -1322,6 +1322,34 @@ class BackendUserAuthentication extends AbstractUserAuthentication
$this->groupData['webmounts'] = implode(',', array_unique($mountPointUids));
}
/**
* Checks for alternative web mount points for the element browser.
*
* If there is a temporary mount point active in the page tree it will be used.
*
* If the User TSconfig options.pageTree.altElementBrowserMountPoints is not empty the pages configured
* there are used as web mounts If options.pageTree.altElementBrowserMountPoints.append is enabled,
* they are appended to the existing webmounts.
*
* @internal - do not use in your own extension
*/
public function initializeWebmountsForElementBrowser()
{
$alternativeWebmountPoint = (int)$this->getSessionData('pageTree_temporaryMountPoint');
if ($alternativeWebmountPoint) {
$alternativeWebmountPoint = GeneralUtility::intExplode(',', $alternativeWebmountPoint);
$this->setWebmounts($alternativeWebmountPoint);
return;
}
$alternativeWebmountPoints = trim($this->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints'] ?? '');
$appendAlternativeWebmountPoints = $this->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints.']['append'] ?? '';
if ($alternativeWebmountPoints) {
$alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
$this->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
}
}
/**
* Returns TRUE or FALSE, depending if an alert popup (a javascript confirmation) should be shown
* call like $GLOBALS['BE_USER']->jsConfirmation($BITMASK).
......
......@@ -172,20 +172,8 @@ class DatabaseBrowser extends AbstractElementBrowser implements ElementBrowserIn
if (isset($tmpMount)) {
$backendUser->setAndSaveSessionData('pageTree_temporaryMountPoint', (int)$tmpMount);
}
// Set temporary DB mounts
$alternativeWebmountPoint = (int)$backendUser->getSessionData('pageTree_temporaryMountPoint');
if ($alternativeWebmountPoint) {
$alternativeWebmountPoint = GeneralUtility::intExplode(',', $alternativeWebmountPoint);
$backendUser->setWebmounts($alternativeWebmountPoint);
} else {
// Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
$alternativeWebmountPoints = \trim($backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints'] ?? '');
$appendAlternativeWebmountPoints = $backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints.']['append'] ?? '';
if ($alternativeWebmountPoints) {
$alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
$this->getBackendUser()->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
}
}
$backendUser->initializeWebmountsForElementBrowser();
}
/**
......
......@@ -122,20 +122,8 @@ abstract class AbstractLinkHandler
if (isset($tmpMount)) {
$backendUser->setAndSaveSessionData('pageTree_temporaryMountPoint', (int)$tmpMount);
}
// Set temporary DB mounts
$alternativeWebmountPoint = (int)$backendUser->getSessionData('pageTree_temporaryMountPoint');
if ($alternativeWebmountPoint) {
$alternativeWebmountPoint = GeneralUtility::intExplode(',', $alternativeWebmountPoint);
$backendUser->setWebmounts($alternativeWebmountPoint);
} else {
// Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
$alternativeWebmountPoints = \trim($backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints'] ?? '');
$appendAlternativeWebmountPoints = $backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints.']['append'] ?? '';
if ($alternativeWebmountPoints) {
$alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
$this->getBackendUser()->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
}
}
$backendUser->initializeWebmountsForElementBrowser();
}
/**
......
Supports Markdown
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