[TASK] Set a flash msg if no subpages available
[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-2011 Kasper Skårhøj (kasper@typo3.com)
8 * (c) 2004-2012 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 textfile 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 * @package TYPO3
41 * @subpackage tx_rte
42 */
43 class ImageFolderTree extends TBE_FolderTree {
44
45 /**
46 * @todo Define visibility
47 */
48 public $ext_IconMode = 1;
49
50 /**
51 * Wrapping the title in a link, if applicable.
52 *
53 * @param string Title, ready for output.
54 * @param \TYPO3\CMS\Core\Resource\Folder The "record
55 * @return string Wrapping title string.
56 * @todo Define visibility
57 */
58 public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
59 if ($this->ext_isLinkable($folderObject)) {
60 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
61 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
62 } else {
63 return '<span class="typo3-dimmed">' . $title . '</span>';
64 }
65 }
66
67 /**
68 * Returns TRUE if the input "record" contains a folder which can be linked.
69 *
70 * @param \TYPO3\CMS\Core\Resource\Folder Object with information about the folder element. Contains keys like title, uid, path, _title
71 * @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
72 * @todo Define visibility
73 */
74 public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
75 // $folderObject->getStorage()->isPublic() does not matter if the mode is 'magic'
76 return $GLOBALS['SOBE']->browser->act === 'magic' || parent::ext_isLinkable($folderObject);
77 }
78
79 /**
80 * Wrap the plus/minus icon in a link
81 *
82 * @param string HTML string to wrap, probably an image tag.
83 * @param string Command for 'PM' get var
84 * @return string Link-wrapped input string
85 * @access private
86 */
87 public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
88 if ($this->thisScript) {
89 $js = htmlspecialchars('Tree.thisScript=\'' . $GLOBALS['BACK_PATH'] . 'ajax.php\';Tree.load(\'' . $cmd . '\', ' . intval($isExpand) . ', this);');
90 return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
91 } else {
92 return $icon;
93 }
94 }
95
96 }
97
98
99 ?>