2 declare(strict_types = 1);
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
47 'sys_language' =>
'Using $sys_language of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
48 'page_id' =>
'Using $page_id of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
49 'table' =>
'Using $table of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
50 'R_URI' =>
'Using $R_URI of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
51 'input_moveUid' =>
'Using $input_moveUid of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
52 'moveUid' =>
'Using $moveUid of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
53 'makeCopy' =>
'Using $makeCopy of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
54 'perms_clause' =>
'Using $perms_clause of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
55 'content' =>
'Using $content of MoveElementController from the outside is discouraged, as this variable is used for internal storage.',
119 $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
125 $this->
init($request);
135 public function mainAction(ServerRequestInterface $request): ResponseInterface
147 public function init(ServerRequestInterface $request =
null)
149 if ($request ===
null) {
151 trigger_error(
'MoveElementController->init() will be set to protected in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
155 $parsedBody = $request->getParsedBody();
156 $queryParams = $request->getQueryParams();
159 $this->sys_language = (int)($parsedBody[
'sys_language'] ?? $queryParams[
'sys_language'] ?? 0);
160 $this->page_id = (int)($parsedBody[
'uid'] ?? $queryParams[
'uid'] ?? 0);
161 $this->table = $parsedBody[
'table'] ?? $queryParams[
'table'] ??
null;
162 $this->R_URI = GeneralUtility::sanitizeLocalUrl($parsedBody[
'returnUrl'] ?? $queryParams[
'returnUrl'] ??
'');
163 $this->input_moveUid = $parsedBody[
'moveUid'] ?? $queryParams[
'moveUid'] ??
null;
164 $this->moveUid = $this->input_moveUid ? $this->input_moveUid :
$this->page_id;
165 $this->makeCopy = $parsedBody[
'makeCopy'] ?? $queryParams[
'makeCopy'] ?? 0;
177 if ($this->page_id) {
180 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/Tooltip');
185 $assigns[
'elRow'] = $elRow;
189 $onClick =
'window.location.href=' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript([
'makeCopy' => !$this->makeCopy])) .
';';
190 $assigns[
'makeCopyChecked'] = $this->makeCopy ?
' checked="checked"' :
'';
191 $assigns[
'makeCopyOnClick'] = $onClick;
193 if ((
string)$this->table ===
'pages') {
196 if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo[
'pid'], $this->perms_clause)) {
198 $posMap = GeneralUtility::makeInstance(PageMovingPagePositionMap::class);
199 $posMap->moveOrCopy = $this->makeCopy ?
'copy' :
'move';
202 if ($pageInfo[
'pid']) {
204 if (is_array($pidPageInfo)) {
205 if ($backendUser->isInWebMount($pidPageInfo[
'pid'], $this->perms_clause)) {
206 $assigns[
'pages'][
'goUpUrl'] = GeneralUtility::linkThisScript([
207 'uid' => (
int)$pageInfo[
'pid'],
208 'moveUid' => $this->moveUid
211 $assigns[
'pages'][
'pidPageInfo'] = $pidPageInfo;
217 $assigns[
'pages'][
'positionTree'] = $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI);
221 if ((
string)$this->table ===
'tt_content') {
225 if (!$this->input_moveUid) {
226 $this->page_id = $tt_content_rec[
'pid'];
230 if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo[
'pid'], $this->perms_clause)) {
232 $posMap = GeneralUtility::makeInstance(ContentMovingPagePositionMap::class);
233 $posMap->moveOrCopy = $this->makeCopy ?
'copy' :
'move';
237 $assigns[
'ttContent'][
'pageInfo'] = $pageInfo;
240 $colPosArray = GeneralUtility::callUserFunction(\
TYPO3\CMS\Backend\View\BackendLayoutView::class .
'->getColPosListItemsParsed', $this->page_id, $this);
242 foreach ($colPosArray as $colPos) {
243 $colPosIds[] = $colPos[1];
246 $colPosList = implode(
',', array_unique($colPosIds));
248 $assigns[
'ttContent'][
'contentElementColumns'] = $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI);
250 if ($pageInfo[
'pid']) {
252 if (is_array($pidPageInfo)) {
253 if ($backendUser->isInWebMount($pidPageInfo[
'pid'], $this->perms_clause)) {
254 $assigns[
'ttContent'][
'goUpUrl'] = GeneralUtility::linkThisScript([
255 'uid' => (
int)$pageInfo[
'pid'],
256 'moveUid' => $this->moveUid
259 $assigns[
'ttContent'][
'pidPageInfo'] = $pidPageInfo;
265 $assigns[
'ttContent'][
'positionTree'] = $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI);
269 $view = GeneralUtility::makeInstance(StandaloneView::class);
270 $view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName(
'EXT:backend/Resources/Private/Templates')]);
271 $view->setPartialRootPaths([GeneralUtility::getFileAbsFileName(
'EXT:backend/Resources/Private/Partials')]);
272 $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
273 'EXT:backend/Resources/Private/Templates/ContentElement/MoveElement.html'
275 $view->assignMultiple($assigns);
276 $this->content .= $view->render();
282 $this->moduleTemplate->setTitle($lang->getLL(
'movingElement'));
283 $this->moduleTemplate->setContent($this->content);
285 $this->content = $this->moduleTemplate->renderContent();
293 public function main()
295 trigger_error(
'MoveElementController->main() will be replaced by protected method renderContent() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
304 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
305 if ($this->page_id) {
306 if ((
string)$this->table ===
'pages') {
307 $cshButton = $buttonBar->makeHelpButton()
308 ->setModuleName(
'xMOD_csh_corebe')
309 ->setFieldName(
'move_el_pages');
310 $buttonBar->addButton($cshButton);
311 } elseif ((
string)$this->table ===
'tt_content') {
312 $cshButton = $buttonBar->makeHelpButton()
313 ->setModuleName(
'xMOD_csh_corebe')
314 ->setFieldName(
'move_el_cs');
315 $buttonBar->addButton($cshButton);
319 $backButton = $buttonBar->makeLinkButton()
320 ->setHref($this->R_URI)
322 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
323 'actions-view-go-back',
326 $buttonBar->addButton($backButton);