[TASK] Rebuild extension translation list in lang module
[Packages/TYPO3.CMS.git] / typo3 / class.browse_links.php
1 <?php
2 /*
3 * @deprecated since 6.0, the classname TBE_browser_recordList and this file is obsolete
4 * and will be removed by 7.0. The class was renamed and is now located at:
5 * typo3/sysext/backend/Classes/RecordList/ElementBrowserRecordList.php
6 */
7 require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('backend') . 'Classes/RecordList/ElementBrowserRecordList.php';
8 /**
9 * Class which generates the page tree
10 *
11 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
12 * @package TYPO3
13 * @subpackage core
14 */
15 class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
16
17 /**
18 * whether the page ID should be shown next to the title, activate through
19 * userTSconfig (options.pageTree.showPageIdWithTitle)
20 *
21 * @boolean
22 */
23 public $ext_showPageId = FALSE;
24
25 /**
26 * Constructor. Just calling init()
27 *
28 * @todo Define visibility
29 */
30 public function __construct() {
31 $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
32 $this->init();
33 $this->clause = ' AND doktype!=' . \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER . $this->clause;
34 }
35
36 /**
37 * Wrapping the title in a link, if applicable.
38 *
39 * @param string $title Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
40 * @param array $v The record
41 * @param boolean $ext_pArrPages (Ignore)
42 * @return string Wrapping title string.
43 * @todo Define visibility
44 */
45 public function wrapTitle($title, $v, $ext_pArrPages = '') {
46 if ($this->ext_isLinkable($v['doktype'], $v['uid'])) {
47 $aOnClick = 'return link_typo3Page(\'' . $v['uid'] . '\');';
48 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
49 } else {
50 return '<span style="color: #666666;">' . $title . '</span>';
51 }
52 }
53
54 /**
55 * Create the page navigation tree in HTML
56 *
57 * @param array $treeArr Tree array
58 * @return string HTML output.
59 * @todo Define visibility
60 */
61 public function printTree($treeArr = '') {
62 $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
63 if (!is_array($treeArr)) {
64 $treeArr = $this->tree;
65 }
66 $out = '';
67 $c = 0;
68 foreach ($treeArr as $k => $v) {
69 $c++;
70 $bgColorClass = ($c + 1) % 2 ? 'bgColor' : 'bgColor-10';
71 if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
72 $arrCol = '<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowR" alt="" /></td>';
73 $bgColorClass = 'bgColor4';
74 } else {
75 $arrCol = '<td></td>';
76 }
77 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid'] . '\');';
78 $cEbullet = $this->ext_isLinkable($v['row']['doktype'], $v['row']['uid']) ? '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"') . ' alt="" /></a>' : '';
79 $out .= '
80 <tr class="' . $bgColorClass . '">
81 <td nowrap="nowrap"' . ($v['row']['_CSSCLASS'] ? ' class="' . $v['row']['_CSSCLASS'] . '"' : '') . '>' . $v['HTML'] . $this->wrapTitle($this->getTitleStr($v['row'], $titleLen), $v['row'], $this->ext_pArrPages) . '</td>' . $arrCol . '<td>' . $cEbullet . '</td>
82 </tr>';
83 }
84 $out = '
85
86
87 <!--
88 Navigation Page Tree:
89 -->
90 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
91 ' . $out . '
92 </table>';
93 return $out;
94 }
95
96 /**
97 * Returns TRUE if a doktype can be linked.
98 *
99 * @param integer $doktype Doktype value to test
100 * @param integer $uid uid to test.
101 * @return boolean
102 * @todo Define visibility
103 */
104 public function ext_isLinkable($doktype, $uid) {
105 if ($uid && $doktype < 199) {
106 return TRUE;
107 }
108 }
109
110 /**
111 * Wrap the plus/minus icon in a link
112 *
113 * @param string $icon HTML string to wrap, probably an image tag.
114 * @param string $cmd Command for 'PM' get var
115 * @param boolean $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
116 * @return string Link-wrapped input string
117 * @todo Define visibility
118 */
119 public function PM_ATagWrap($icon, $cmd, $bMark = '') {
120 if ($bMark) {
121 $anchor = '#' . $bMark;
122 $name = ' name="' . $bMark . '"';
123 }
124 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?PM=' . $cmd . '\',\'' . $anchor . '\');';
125 return '<a href="#"' . $name . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
126 }
127
128 /**
129 * Wrapping the image tag, $icon, for the row, $row
130 *
131 * @param string $icon The image tag for the icon
132 * @param array $row The row for the current element
133 * @return string The processed icon input value.
134 * @todo Define visibility
135 */
136 public function wrapIcon($icon, $row) {
137 $content = $this->addTagAttributes($icon, ' title="id=' . $row['uid'] . '"');
138 if ($this->ext_showPageId) {
139 $content .= '[' . $row['uid'] . ']&nbsp;';
140 }
141 return $content;
142 }
143
144 }
145
146 /**
147 * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
148 *
149 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
150 * @package TYPO3
151 * @subpackage core
152 */
153 class rtePageTree extends localPageTree {
154
155
156 }
157
158 /**
159 * For TBE record browser
160 *
161 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
162 * @package TYPO3
163 * @subpackage core
164 */
165 class TBE_PageTree extends localPageTree {
166
167 /**
168 * Returns TRUE if a doktype can be linked (which is always the case here).
169 *
170 * @param integer $doktype Doktype value to test
171 * @param integer $uid uid to test.
172 * @return boolean
173 * @todo Define visibility
174 */
175 public function ext_isLinkable($doktype, $uid) {
176 return TRUE;
177 }
178
179 /**
180 * Wrapping the title in a link, if applicable.
181 *
182 * @param string $title Title, ready for output.
183 * @param array $v The record
184 * @param boolean $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page.
185 * @return string Wrapping title string.
186 * @todo Define visibility
187 */
188 public function wrapTitle($title, $v, $ext_pArrPages) {
189 if ($ext_pArrPages) {
190 $ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $v);
191 $onClick = 'return insertElement(\'pages\', \'' . $v['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($v['title']) . ', \'\', \'\', \'' . $ficon . '\',\'\',1);';
192 } else {
193 $onClick = htmlspecialchars('return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid'] . '\');');
194 }
195 return '<a href="#" onclick="' . $onClick . '">' . $title . '</a>';
196 }
197
198 }
199
200 /**
201 * Base extension class which generates the folder tree.
202 * Used directly by the RTE.
203 * also used for the linkpicker on files
204 *
205 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
206 * @package TYPO3
207 * @subpackage core
208 */
209 class localFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
210
211 /**
212 * @todo Define visibility
213 */
214 public $ext_IconMode = 1;
215
216 /**
217 * Initializes the script path
218 *
219 * @todo Define visibility
220 */
221 public function __construct() {
222 $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
223 parent::__construct();
224 }
225
226 /**
227 * Wrapping the title in a link, if applicable.
228 *
229 * @param string $title Title, ready for output.
230 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record
231 * @return string Wrapping title string.
232 * @todo Define visibility
233 */
234 public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
235 if ($this->ext_isLinkable($folderObject)) {
236 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
237 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
238 } else {
239 return '<span class="typo3-dimmed">' . $title . '</span>';
240 }
241 }
242
243 /**
244 * Returns TRUE if the input "record" contains a folder which can be linked.
245 *
246 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
247 * @return boolean TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
248 * @todo Define visibility
249 */
250 public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
251 if (!$folderObject->getStorage()->isPublic() || strstr($folderObject->getIdentifier(), '_recycler_') || strstr($folderObject->getIdentifier(), '_temp_')) {
252 return FALSE;
253 } else {
254 return TRUE;
255 }
256 }
257
258 /**
259 * Wrap the plus/minus icon in a link
260 *
261 * @param string $icon HTML string to wrap, probably an image tag.
262 * @param string $cmd Command for 'PM' get var
263 * @param boolean $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
264 * @return string Link-wrapped input string
265 * @access private
266 * @todo Define visibility
267 */
268 public function PM_ATagWrap($icon, $cmd, $bMark = '') {
269 if ($bMark) {
270 $anchor = '#' . $bMark;
271 $name = ' name="' . $bMark . '"';
272 }
273 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?PM=' . $cmd . '\',\'' . $anchor . '\');';
274 return '<a href="#"' . $name . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
275 }
276
277 }
278
279 /**
280 * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
281 *
282 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
283 * @package TYPO3
284 * @subpackage core
285 */
286 class rteFolderTree extends localFolderTree {
287
288
289 }
290
291 /**
292 * For TBE File Browser
293 *
294 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
295 * @package TYPO3
296 * @subpackage core
297 */
298 class TBE_FolderTree extends localFolderTree {
299
300 // If file-drag mode is set, temp and recycler folders are filtered out.
301 /**
302 * @todo Define visibility
303 */
304 public $ext_noTempRecyclerDirs = 0;
305
306 /**
307 * Returns TRUE if the input "record" contains a folder which can be linked.
308 *
309 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject object with information about the folder element. Contains keys like title, uid, path, _title
310 * @return boolean TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
311 * @todo Define visibility
312 */
313 public function ext_isLinkable($folderObject) {
314 if ($this->ext_noTempRecyclerDirs && (substr($folderObject->getIdentifier(), -7) == '_temp_/' || substr($folderObject->getIdentifier(), -11) == '_recycler_/')) {
315 return FALSE;
316 } else {
317 return TRUE;
318 }
319 }
320
321 /**
322 * Wrapping the title in a link, if applicable.
323 *
324 * @param string $title Title, ready for output.
325 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folderObject 'record'
326 * @return string Wrapping title string.
327 * @todo Define visibility
328 */
329 public function wrapTitle($title, $folderObject) {
330 if ($this->ext_isLinkable($folderObject)) {
331 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
332 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
333 } else {
334 return '<span class="typo3-dimmed">' . $title . '</span>';
335 }
336 }
337
338 }
339
340 /*
341 * @deprecated since 6.0, the classname browse_links and this file is obsolete
342 * and will be removed by 7.0. The class was renamed and is now located at:
343 * typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
344 */
345 require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recordlist') . 'Classes/Browser/ElementBrowser.php';
346 ?>