[BUGFIX] InstallTool: Optimize ALTER TABLE for auto_increment columns
[Packages/TYPO3.CMS.git] / typo3 / move_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 * Move element wizard:
17 * Moving pages or content elements (tt_content) around in the system via a page tree navigation.
18 *
19 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
20 */
21 require __DIR__ . '/init.php';
22
23 /**
24 * Local extension of the page tree class
25 *
26 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
27 */
28 class moveElementLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
29
30 }
31
32 /**
33 * Extension of position map for pages
34 *
35 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
36 */
37 class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
38
39 /**
40 * @todo Define visibility
41 */
42 public $l_insertNewPageHere = 'movePageToHere';
43
44 /**
45 * Page tree implementation class name
46 *
47 * @var string
48 */
49 protected $pageTreeClassName = 'moveElementLocalPageTree';
50
51 /**
52 * Creates the onclick event for the insert-icons.
53 *
54 * @param integer $pid The pid.
55 * @param integer $newPagePID New page id.
56 * @return string Onclick attribute content
57 * @todo Define visibility
58 */
59 public function onClickEvent($pid, $newPagePID) {
60 return 'window.location.href=\'tce_db.php?cmd[pages][' . $GLOBALS['SOBE']->moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&redirect=' . rawurlencode($this->R_URI) . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '\';return false;';
61 }
62
63 /**
64 * Wrapping page title.
65 *
66 * @param string $str Page title.
67 * @param array $rec Page record (?)
68 * @return string Wrapped title.
69 * @todo Define visibility
70 */
71 public function linkPageTitle($str, $rec) {
72 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
73 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
74 }
75
76 /**
77 * Wrap $t_code in bold IF the $dat uid matches $id
78 *
79 * @param string $t_code Title string
80 * @param array $dat Information array with record array inside.
81 * @param integer $id The current id.
82 * @return string The title string.
83 * @todo Define visibility
84 */
85 public function boldTitle($t_code, $dat, $id) {
86 return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
87 }
88
89 }
90
91 /**
92 * Extension of position map for content elements
93 *
94 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
95 */
96 class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
97
98 /**
99 * @todo Define visibility
100 */
101 public $dontPrintPageInsertIcons = 1;
102
103 /**
104 * Page tree implementation class name
105 *
106 * @var string
107 */
108 protected $pageTreeClassName = 'moveElementLocalPageTree';
109
110 /**
111 * Wrapping page title.
112 *
113 * @param string $str Page title.
114 * @param array $rec Page record (?)
115 * @return string Wrapped title.
116 * @todo Define visibility
117 */
118 public function linkPageTitle($str, $rec) {
119 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
120 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
121 }
122
123 /**
124 * Wrapping the title of the record.
125 *
126 * @param string $str The title value.
127 * @param array $row The record row.
128 * @return string Wrapped title string.
129 * @todo Define visibility
130 */
131 public function wrapRecordTitle($str, $row) {
132 if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
133 $str = '<strong>' . $str . '</strong>';
134 }
135 return parent::wrapRecordTitle($str, $row);
136 }
137 }
138
139 $moveElementController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController');
140 $moveElementController->main();
141 $moveElementController->printContent();