[BUG] RTE: Default skin is broken
[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 * Inserting uid-information in title-text for an icon
32 *
33 * @param string $icon Icon image
34 * @param array $row Item row
35 * @return string Wrapping icon image.
36 */
37 public function wrapIcon($icon, $row) {
38 return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
39 }
40
41 }
42
43 /**
44 * Extension of position map for pages
45 *
46 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
47 */
48 class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
49
50 /**
51 * @var string
52 */
53 public $l_insertNewPageHere = 'movePageToHere';
54
55 /**
56 * Page tree implementation class name
57 *
58 * @var string
59 */
60 protected $pageTreeClassName = 'moveElementLocalPageTree';
61
62 /**
63 * Creates the onclick event for the insert-icons.
64 *
65 * @param int $pid The pid.
66 * @param int $newPagePID New page id.
67 * @return string Onclick attribute content
68 */
69 public function onClickEvent($pid, $newPagePID) {
70 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;';
71 }
72
73 /**
74 * Wrapping page title.
75 *
76 * @param string $str Page title.
77 * @param array $rec Page record (?)
78 * @return string Wrapped title.
79 */
80 public function linkPageTitle($str, $rec) {
81 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
82 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
83 }
84
85 /**
86 * Wrap $t_code in bold IF the $dat uid matches $id
87 *
88 * @param string $t_code Title string
89 * @param array $dat Information array with record array inside.
90 * @param int $id The current id.
91 * @return string The title string.
92 */
93 public function boldTitle($t_code, $dat, $id) {
94 return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
95 }
96
97 }
98
99 /**
100 * Extension of position map for content elements
101 *
102 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
103 */
104 class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
105
106 /**
107 * @var int
108 */
109 public $dontPrintPageInsertIcons = 1;
110
111 /**
112 * Page tree implementation class name
113 *
114 * @var string
115 */
116 protected $pageTreeClassName = 'moveElementLocalPageTree';
117
118 /**
119 * Wrapping page title.
120 *
121 * @param string $str Page title.
122 * @param array $rec Page record (?)
123 * @return string Wrapped title.
124 */
125 public function linkPageTitle($str, $rec) {
126 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
127 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
128 }
129
130 /**
131 * Wrapping the title of the record.
132 *
133 * @param string $str The title value.
134 * @param array $row The record row.
135 * @return string Wrapped title string.
136 */
137 public function wrapRecordTitle($str, $row) {
138 if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
139 $str = '<strong>' . $str . '</strong>';
140 }
141 return parent::wrapRecordTitle($str, $row);
142 }
143 }
144
145 $moveElementController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController');
146 $moveElementController->main();
147 $moveElementController->printContent();