d2527f883ae523410619bb9d23ac301796d14e56
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / ImageFolderTree.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasper@typo3.com)
8 * (c) 2004-2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 * A copy is found in the text file GPL.txt and important notices to the license
20 * from the author is found in LICENSE.txt distributed with these scripts.
21 *
22 *
23 * This script is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
30 /**
31 * Displays image selector for the RTE
32 *
33 * @author Kasper Skårhøj <kasper@typo3.com>
34 * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
35 */
36 /**
37 * Local Folder Tree
38 *
39 * @author Kasper Skårhøj <kasper@typo3.com>
40 */
41 class ImageFolderTree extends \TBE_FolderTree {
42
43 /**
44 * @todo Define visibility
45 */
46 public $ext_IconMode = 1;
47
48 /**
49 * Wrapping the title in a link, if applicable.
50 *
51 * @param string Title, ready for output.
52 * @param \TYPO3\CMS\Core\Resource\Folder The "record
53 * @return string Wrapping title string.
54 * @todo Define visibility
55 */
56 public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
57 if ($this->ext_isLinkable($folderObject)) {
58 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
59 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
60 } else {
61 return '<span class="typo3-dimmed">' . $title . '</span>';
62 }
63 }
64
65 /**
66 * Returns TRUE if the input "record" contains a folder which can be linked.
67 *
68 * @param \TYPO3\CMS\Core\Resource\Folder Object with information about the folder element. Contains keys like title, uid, path, _title
69 * @return boolean TRUE is returned if the path is found in the web-part of the the server and is NOT a recycler or temp folder
70 * @todo Define visibility
71 */
72 public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
73 // $folderObject->getStorage()->isPublic() does not matter if the mode is 'magic'
74 return $GLOBALS['SOBE']->browser->act === 'magic' || parent::ext_isLinkable($folderObject);
75 }
76
77 /**
78 * Wrap the plus/minus icon in a link
79 *
80 * @param string $icon HTML string to wrap, probably an image tag.
81 * @param string $cmd Command for 'PM' get var
82 * @param boolean $isExpand If expanded
83 * @return string Link-wrapped input string
84 * @access private
85 */
86 public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
87 if ($this->thisScript) {
88 $js = htmlspecialchars('Tree.thisScript=\'' . $GLOBALS['BACK_PATH'] . 'ajax.php\';Tree.load(\'' . $cmd . '\', ' . (int)$isExpand . ', this);');
89 return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
90 } else {
91 return $icon;
92 }
93 }
94
95 }