[BUGFIX] Field size of t3ver_label too low
[Packages/TYPO3.CMS.git] / typo3 / move_el.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the text file GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * Move element wizard:
30 * Moving pages or content elements (tt_content) around in the system via a page tree navigation.
31 *
32 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
33 */
34 require __DIR__ . '/init.php';
35
36 /**
37 * Local extension of the page tree class
38 *
39 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
40 */
41 class moveElementLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
42
43 /**
44 * Inserting uid-information in title-text for an icon
45 *
46 * @param string $icon Icon image
47 * @param array $row Item row
48 * @return string Wrapping icon image.
49 * @todo Define visibility
50 */
51 public function wrapIcon($icon, $row) {
52 return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
53 }
54
55 }
56
57 /**
58 * Extension of position map for pages
59 *
60 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
61 */
62 class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
63
64 /**
65 * @todo Define visibility
66 */
67 public $l_insertNewPageHere = 'movePageToHere';
68
69 /**
70 * Page tree implementation class name
71 *
72 * @var string
73 */
74 protected $pageTreeClassName = 'moveElementLocalPageTree';
75
76 /**
77 * Creates the onclick event for the insert-icons.
78 *
79 * @param integer $pid The pid.
80 * @param integer $newPagePID New page id.
81 * @return string Onclick attribute content
82 * @todo Define visibility
83 */
84 public function onClickEvent($pid, $newPagePID) {
85 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;';
86 }
87
88 /**
89 * Wrapping page title.
90 *
91 * @param string $str Page title.
92 * @param array $rec Page record (?)
93 * @return string Wrapped title.
94 * @todo Define visibility
95 */
96 public function linkPageTitle($str, $rec) {
97 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
98 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
99 }
100
101 /**
102 * Wrap $t_code in bold IF the $dat uid matches $id
103 *
104 * @param string $t_code Title string
105 * @param array $dat Information array with record array inside.
106 * @param integer $id The current id.
107 * @return string The title string.
108 * @todo Define visibility
109 */
110 public function boldTitle($t_code, $dat, $id) {
111 return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
112 }
113
114 }
115
116 /**
117 * Extension of position map for content elements
118 *
119 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
120 */
121 class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
122
123 /**
124 * @todo Define visibility
125 */
126 public $dontPrintPageInsertIcons = 1;
127
128 /**
129 * Page tree implementation class name
130 *
131 * @var string
132 */
133 protected $pageTreeClassName = 'moveElementLocalPageTree';
134
135 /**
136 * Wrapping page title.
137 *
138 * @param string $str Page title.
139 * @param array $rec Page record (?)
140 * @return string Wrapped title.
141 * @todo Define visibility
142 */
143 public function linkPageTitle($str, $rec) {
144 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
145 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
146 }
147
148 /**
149 * Wrapping the title of the record.
150 *
151 * @param string $str The title value.
152 * @param array $row The record row.
153 * @return string Wrapped title string.
154 * @todo Define visibility
155 */
156 public function wrapRecordTitle($str, $row) {
157 if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
158 $str = '<strong>' . $str . '</strong>';
159 }
160 return parent::wrapRecordTitle($str, $row);
161 }
162 }
163
164 $moveElementController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController');
165 $moveElementController->main();
166 $moveElementController->printContent();