[TASK] Refactor module dispatcher to RequestHandler
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / layout / db_new_content_el.php
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 /**
16 * New content elements wizard
17 * (Part of the 'cms' extension)
18 *
19 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
20 */
21 unset($MCONF);
22 require __DIR__ . '/conf.php';
23 require $BACK_PATH . 'init.php';
24 // Unset MCONF/MLANG since all we wanted was back path etc. for this particular script.
25 unset($MCONF);
26 unset($MLANG);
27 // Merging locallang files/arrays:
28 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
29 $LOCAL_LANG_orig = $LOCAL_LANG;
30 $LANG->includeLLFile('EXT:cms/layout/locallang_db_new_content_el.xlf');
31 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($LOCAL_LANG_orig, $LOCAL_LANG);
32 $LOCAL_LANG = $LOCAL_LANG_orig;
33 /**
34 * Local position map class
35 *
36 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
37 */
38 class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
39
40 /**
41 * @var bool
42 */
43 public $dontPrintPageInsertIcons = 1;
44
45 /**
46 * Wrapping the title of the record - here we just return it.
47 *
48 * @param string $str The title value.
49 * @param array $row The record row.
50 * @return string Wrapped title string.
51 */
52 public function wrapRecordTitle($str, $row) {
53 return $str;
54 }
55
56 /**
57 * Create on-click event value.
58 *
59 * @param array $row The record.
60 * @param string $vv Column position value.
61 * @param int $moveUid Move uid
62 * @param int $pid PID value.
63 * @param int $sys_lang System language
64 * @return string
65 */
66 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) {
67 $table = 'tt_content';
68 $location = $this->backPath . 'alt_doc.php?edit[tt_content][' . (is_array($row) ? -$row['uid'] : $pid) . ']=new&defVals[tt_content][colPos]=' . $vv . '&defVals[tt_content][sys_language_uid]=' . $sys_lang . '&returnUrl=' . rawurlencode($GLOBALS['SOBE']->R_URI);
69 return 'window.location.href=\'' . $location . '\'+document.editForm.defValues.value; return false;';
70 }
71
72 }
73
74 \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
75 'The new element class is moved to an own module. Please use BackendUtility::getModuleUrl(\'new_content_element\') to link to db_new_content_el.php. This script will be removed with version 8.'
76 );
77
78 $GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController::class);
79 $GLOBALS['SOBE']->init();
80 $GLOBALS['SOBE']->main();
81 $GLOBALS['SOBE']->printContent();