[BUGFIX] Fix wrong JS function name in RTE
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / FolderTree.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea;
3 use TYPO3\CMS\Core\Utility\GeneralUtility;
4
5 /**
6 * Base extension class which generates the folder tree.
7 * Used directly by the RTE.
8 *
9 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
10 */
11 class FolderTree extends \localFolderTree {
12
13 /**
14 * Constructor function of the class
15 */
16 public function __construct() {
17 // The backpath is set here to fix problems with relatives path when used in ajax scope
18 $GLOBALS['BACK_PATH'] = isset($GLOBALS['ajaxID']) ? '../../../' : $GLOBALS['BACK_PATH'];
19 parent::__construct();
20 }
21
22 /**
23 * Wrapping the title in a link, if applicable.
24 *
25 * @param string $title Title, ready for output.
26 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record"
27 * @return string Wrapping title string.
28 * @todo Define visibility
29 */
30 public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
31 if ($this->ext_isLinkable($folderObject)) {
32 $aOnClick = 'return jumpToUrl(\'' . $this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&contentTypo3Charset=' . $GLOBALS['SOBE']->browser->contentTypo3Charset . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
33 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
34 } else {
35 return '<span class="typo3-dimmed">' . $title . '</span>';
36 }
37 }
38
39 /**
40 * Wrap the plus/minus icon in a link
41 *
42 * @param string $icon HTML string to wrap, probably an image tag.
43 * @param string $cmd Command for 'PM' get var
44 * @param boolean $isExpand If expanded
45 * @return string Link-wrapped input string
46 * @access private
47 */
48 public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
49
50 if (empty($this->scope)) {
51 $this->scope = array(
52 'class' => get_class($this),
53 'script' => $this->thisScript,
54 'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs,
55 'browser' => array(
56 'mode' => $GLOBALS['SOBE']->browser->mode,
57 'act' => $GLOBALS['SOBE']->browser->act,
58 'editorNo' => $GLOBALS['SOBE']->browser->editorNo
59 ),
60 );
61 }
62
63 if ($this->thisScript) {
64 // Activates dynamic AJAX based tree
65 $scopeData = serialize($this->scope);
66 $scopeHash = GeneralUtility::hmac($scopeData);
67 $js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int)$isExpand . ', this, ' . GeneralUtility::quoteJSvalue($scopeData) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');');
68 return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
69 } else {
70 return $icon;
71 }
72 }
73
74 }