[BUGFIX] Hide the field "Selected Pages" for menu type "Sitemap"
[Packages/TYPO3.CMS.git] / typo3 / alt_menu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 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 textfile 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 * Displays the vertical menu in the left most frame of TYPO3s backend
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
32 * XHTML-trans compliant
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
36 */
37 /**
38 * [CLASS/FUNCTION INDEX of SCRIPT]
39 *
40 *
41 *
42 * 80: class SC_alt_menu
43 * 91: function init()
44 * 108: function main()
45 * 190: function printContent()
46 *
47 * TOTAL FUNCTIONS: 3
48 * (This index is automatically created/updated by the extension "extdeveval")
49 *
50 * @deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7. The TYPO3 backend is using typo3/backend.php with less frames, which makes this file obsolete.
51 */
52
53
54 require ('init.php');
55 require ('template.php');
56 require_once ('class.alt_menu_functions.inc');
57
58
59 t3lib_div::deprecationLog('alt_palette.php is deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7. The TYPO3 backend is using typo3/backend.php with less frames, which makes this file obsolete.');
60
61
62
63
64
65
66
67
68
69
70
71
72 /**
73 * Script Class for rendering the vertical menu in the left side of the backend frameset
74 *
75 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
76 * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
77 * @package TYPO3
78 * @subpackage core
79 */
80 class SC_alt_menu {
81
82 // Internal, Static: GPvar
83 var $_clearCacheFiles;
84
85 /**
86 * Menu functions object
87 *
88 * @var alt_menu_functions
89 */
90 var $alt_menuObj;
91
92 /**
93 * Initialize
94 * Loads the backend modules available for the logged in user.
95 *
96 * @return void
97 */
98 function init() {
99 global $TBE_MODULES, $TBE_TEMPLATE;
100
101 // Setting GPvars:
102 $this->_clearCacheFiles = t3lib_div::_GP('_clearCacheFiles');
103
104 // Loads the backend modules available for the logged in user.
105 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
106 $this->loadModules->observeWorkspaces = TRUE;
107 $this->loadModules->load($TBE_MODULES);
108
109 // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frame.
110 $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
111
112 $TBE_TEMPLATE->JScodeArray[] = $this->alt_menuObj->generateMenuJScode($this->loadModules->modules);
113 }
114
115 /**
116 * Main content generated
117 *
118 * @return void
119 */
120 function main() {
121 global $BE_USER,$TYPO3_CONF_VARS,$TBE_TEMPLATE;
122
123 $TBE_TEMPLATE->divClass='vertical-menu';
124 $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
125
126 $this->content.=$TBE_TEMPLATE->startPage('Vertical Backend Menu');
127 $backPath = $GLOBALS['BACK_PATH'];
128
129 // Printing the menu
130 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
131 $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
132
133 // clear cache commands for Admins and allowed users
134 if($GLOBALS['BE_USER']->isAdmin()
135 || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')
136 || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) { // && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
137 $functionsArray = $alt_menuObj->adminFunctions($backPath);
138
139 $this->content.='
140
141 <!--
142 Menu with admin functions: Clearing cache:
143 -->
144 <div id="typo3-alt-menu-php-adminFunc">';
145
146
147 // Table with those admin functions
148 $this->content.='
149 <table border="0" cellpadding="0" cellspacing="1" width="100%" id="typo3-adminmenu">';
150
151 // Header: Admin functions
152 $this->content.='
153 <tr class="c-mainitem">
154 <td colspan="2"><span class="c-label"><strong>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions',1).'</strong>&nbsp;</span><span class="c-iconCollapse"></span></td>
155 </tr>';
156
157 $rows=array();
158 foreach($functionsArray as $functionsArraySetup) {
159 if(($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')))
160 || ($functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin())) {
161 $rows[]='
162 <tr class="c-subitem">
163 <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
164 <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
165 </tr>';
166 }
167 }
168
169 // Imploding around the divider table row:
170 $this->content.=implode('
171 <tr>
172 <td colspan="2"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
173 </tr>',$rows);
174
175 $this->content.='
176 </table>';
177 $this->content.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_adminFunction', $GLOBALS['BACK_PATH']);
178 $this->content.='
179 </div>
180 ';
181 }
182
183 // superuser mode
184 if($BE_USER->user['ses_backuserid']) {
185 $username = '<p id="username" class="typo3-red-background">[' .
186 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:switchtousershort') . ' ' .
187 htmlspecialchars($BE_USER->user['username']) . ']</p>';
188 } else {
189 $username = '<p id="username">[' . htmlspecialchars($BE_USER->user['username']) . ']</p>';
190 }
191 // Printing buttons (logout button)
192 $this->content.='
193
194
195 <!--
196 Logout button / username
197 -->
198 <div id="typo3-alt-menu-php-logininfo">'.$alt_menuObj->topButtons().$username.'
199 </div>';
200
201 // End page:
202 $this->content.=$TBE_TEMPLATE->endPage();
203 }
204
205 /**
206 * Outputting the accumulated content to screen
207 *
208 * @return void
209 */
210 function printContent() {
211 echo $this->content;
212 }
213 }
214
215
216 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php'])) {
217 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php']);
218 }
219
220
221
222 // Make instance:
223 $SOBE = t3lib_div::makeInstance('SC_alt_menu');
224 $SOBE->init();
225 $SOBE->main();
226 $SOBE->printContent();
227
228 ?>