[API][CONF][!!!] Make the name of cookies configurable
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_adminpanel.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2008-2011 Jeff Segars <jeff@webempoweredchurch.org>
6 * (c) 2008-2011 David Slayback <dave@webempoweredchurch.org>
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
19 *
20 *
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * This copyright notice MUST APPEAR in all copies of the scri.pt!
27 ***************************************************************/
28 /**
29 * View class for the admin panel in frontend editing.
30 *
31 * @author Jeff Segars <jeff@webempoweredchurch.org>
32 * @author David Slayback <dave@webempoweredchurch.org>
33 * @author Dmitry Dulepov <dmitry@typo3.org>
34 * @package TYPO3
35 * @subpackage tslib
36 */
37 class tslib_AdminPanel {
38
39 /**
40 * Determines whether the update button should be shown.
41 *
42 * @var boolean
43 */
44 protected $extNeedUpdate = FALSE;
45
46 /**
47 * Force preview?
48 *
49 * @var boolean
50 */
51 protected $ext_forcePreview = FALSE;
52
53 /**
54 * Comma separated list of page UIDs to be published.
55 *
56 * @var string
57 */
58 protected $extPublishList = '';
59
60 public function __construct() {
61 $this->initialize();
62 }
63
64 /*****************************************************
65 *
66 * Admin Panel Configuration/Initialization
67 *
68 ****************************************************/
69
70 /**
71 * Initializes settings for the admin panel.
72 *
73 * @return void
74 */
75 public function initialize() {
76 $this->saveConfigOptions();
77
78 // Setting some values based on the admin panel
79 $GLOBALS['TSFE']->forceTemplateParsing = $this->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
80 $GLOBALS['TSFE']->displayEditIcons = $this->extGetFeAdminValue('edit', 'displayIcons');
81 $GLOBALS['TSFE']->displayFieldEditIcons = $this->extGetFeAdminValue('edit', 'displayFieldIcons');
82
83 if ($this->extGetFeAdminValue('tsdebug', 'displayQueries')) {
84 if ($GLOBALS['TYPO3_DB']->explainOutput == 0) { // do not override if the value is already set in t3lib_db
85 // Enable execution of EXPLAIN SELECT queries
86 $GLOBALS['TYPO3_DB']->explainOutput = 3;
87 }
88 }
89
90 if (t3lib_div::_GP('ADMCMD_editIcons')) {
91 $GLOBALS['TSFE']->displayFieldEditIcons=1;
92 $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] = 1;
93 }
94
95 if (t3lib_div::_GP('ADMCMD_simUser')) {
96 $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateUserGroup']=intval(t3lib_div::_GP('ADMCMD_simUser'));
97 $this->ext_forcePreview = TRUE;
98 }
99
100 if (t3lib_div::_GP('ADMCMD_simTime')) {
101 $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateDate']=intval(t3lib_div::_GP('ADMCMD_simTime'));
102 $this->ext_forcePreview = TRUE;
103 }
104
105 if ($GLOBALS['TSFE']->forceTemplateParsing || $GLOBALS['TSFE']->displayEditIcons || $GLOBALS['TSFE']->displayFieldEditIcons) {
106 $GLOBALS['TSFE']->set_no_cache();
107 }
108 }
109
110 /**
111 * Obtains header data for the admin panel.
112 *
113 * @return string
114 */
115 public function getAdminPanelHeaderData() {
116 $result = '';
117
118 // Include BE styles
119 $GLOBALS['TSFE']->includeTCA();
120
121 if(!empty($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) {
122 $result = '<link rel="stylesheet" type="text/css" href="' .
123 htmlspecialchars(t3lib_div::locationHeaderUrl($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) .
124 '" />';
125 }
126 return $result;
127 }
128
129 /**
130 * Checks if a Admin Panel section ("module") is available for the user. If so, TRUE is returned.
131 *
132 * @param string The module key, eg. "edit", "preview", "info" etc.
133 * @return boolean
134 */
135 public function isAdminModuleEnabled($key) {
136 $result = FALSE;
137
138 // Returns TRUE if the module checked is "preview" and the forcePreview flag is set.
139 if ($key == 'preview' && $this->ext_forcePreview) {
140 $result = TRUE;
141 }
142
143 // If key is not set, only "all" is checked
144 if ($GLOBALS['BE_USER']->extAdminConfig['enable.']['all']) {
145 $result = TRUE;
146 }
147
148 if ($GLOBALS['BE_USER']->extAdminConfig['enable.'][$key]) {
149 $result = TRUE;
150 }
151
152 return $result;
153 }
154
155 /**
156 * Saves any change in settings made in the Admin Panel.
157 * Called from index_ts.php right after access check for the Admin Panel
158 *
159 * @return void
160 */
161 public function saveConfigOptions() {
162 $input = t3lib_div::_GP('TSFE_ADMIN_PANEL');
163 if (is_array($input)) {
164 // Setting
165 $GLOBALS['BE_USER']->uc['TSFE_adminConfig'] = array_merge(!is_array($GLOBALS['BE_USER']->uc['TSFE_adminConfig']) ? array() : $GLOBALS['BE_USER']->uc['TSFE_adminConfig'], $input); // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...
166 unset($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['action']);
167
168 // Actions:
169 if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache')) {
170 $GLOBALS['BE_USER']->extPageInTreeInfo=array();
171 $theStartId = intval($input['cache_clearCacheId']);
172 $GLOBALS['TSFE']->clearPageCacheContent_pidList($GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache', 'clearCacheLevels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId);
173 }
174 if ($input['action']['publish'] && $this->isAdminModuleEnabled('publish')) {
175 $theStartId = intval($input['publish_id']);
176 $this->extPublishList = $GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish', 'levels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId;
177 }
178
179 // Saving
180 $GLOBALS['BE_USER']->writeUC();
181 }
182 $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug', 'LR');
183
184 if ($this->extGetFeAdminValue('cache', 'noCache')) {
185 $GLOBALS['TSFE']->set_no_cache();
186 }
187
188 // Hook for post processing the frontend admin configuration. Added with TYPO3 4.2, so naming is now incorrect but preserves compatibility.
189 // @deprecated since TYPO3 4.3
190 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'])) {
191 t3lib_div::deprecationLog('Frontend admin post processing hook extSaveFeAdminConfig-postProc is deprecated since TYPO3 4.3.');
192 $_params = array('input' => &$input, 'pObj' => &$this);
193 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'] as $_funcRef) {
194 t3lib_div::callUserFunction($_funcRef, $_params, $this);
195 }
196 }
197 }
198
199 /**
200 * Returns the value for a Admin Panel setting. You must specify both the module-key and the internal setting key.
201 *
202 * @param string Module key
203 * @param string Setting key
204 * @return string The setting value
205 */
206 public function extGetFeAdminValue($sectionName, $val = '') {
207 // Check if module is enabled.
208 if ($this->isAdminModuleEnabled($sectionName)) {
209 // Exceptions where the values can be overridden from backend:
210 // deprecated
211 if ($sectionName . '_' . $val == 'edit_displayIcons' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceDisplayIcons']) {
212 return TRUE;
213 }
214 if ($sectionName . '_' . $val == 'edit_displayFieldIcons' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons']) {
215 return TRUE;
216 }
217
218 // override all settings with user TSconfig
219 if ($val && $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName . '.'][$val]) {
220 return $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName . '.'][$val];
221 }
222 if ($GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName]) {
223 return $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName];
224 }
225
226 $retVal = $val ? $GLOBALS['BE_USER']->uc['TSFE_adminConfig'][$sectionName . '_' . $val] : 1;
227
228 if ($sectionName == 'preview' && $this->ext_forcePreview) {
229 return (!$val ? TRUE : $retVal);
230 }
231 // regular check:
232 if ($this->isAdminModuleOpen($sectionName)) { // See if the menu is expanded!
233 return $retVal;
234 }
235
236 // Hook for post processing the frontend admin configuration. Added with TYPO3 4.2, so naming is now incorrect but preserves compatibility.
237 // @deprecated since TYPO3 4.3
238 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'])) {
239 t3lib_div::deprecationLog('Frontend admin post processing hook extEditAction-postProc is deprecated since TYPO3 4.3.');
240 $params = array('cmd' => &$cmd, 'tce' => &$this->tce, 'pObj' => &$this);
241 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'] as $funcRef) {
242 t3lib_div::callUserFunction($funcRef, $params, $this);
243 }
244 }
245 }
246 }
247
248 /**
249 * Enables the force preview option.
250 *
251 * @return void
252 */
253 public function forcePreview() {
254 $this->ext_forcePreview = TRUE;
255 }
256
257 /**
258 * Returns the comma-separated list of page UIDs to be published.
259 *
260 * @return string
261 */
262 public function getExtPublishList() {
263 return $this->extPublishList;
264 }
265
266 /**
267 * Returns TRUE if admin panel module is open
268 *
269 * @param string Module key
270 * @return boolean TRUE, if the admin panel is open for the specified admin panel module key.
271 */
272 public function isAdminModuleOpen($pre) {
273 return $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'] && $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_' . $pre];
274 }
275
276 /*****************************************************
277 *
278 * Admin Panel Rendering
279 *
280 ****************************************************/
281
282 /**
283 * Creates and returns the HTML code for the Admin Panel in the TSFE frontend.
284 *
285 * @return string HTML for the Admin Panel
286 */
287 public function display() {
288 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
289
290 $moduleContent = '';
291
292 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
293 if ($this->isAdminModuleEnabled('preview')) {
294 $moduleContent .= $this->getPreviewModule();
295 }
296 if ($this->isAdminModuleEnabled('cache')) {
297 $moduleContent .= $this->getCacheModule();
298 }
299 if ($this->isAdminModuleEnabled('publish')) {
300 $moduleContent .= $this->getPublishModule();
301 }
302 if ($this->isAdminModuleEnabled('edit')) {
303 $moduleContent .= $this->getEditModule();
304 }
305 if ($this->isAdminModuleEnabled('tsdebug')) {
306 $moduleContent .= $this->getTSDebugModule();
307 }
308 if ($this->isAdminModuleEnabled('info')) {
309 $moduleContent .= $this->getInfoModule();
310 }
311 }
312
313 $row = $this->extGetLL('adminPanelTitle') . ': <span class="typo3-adminPanel-beuser">' .
314 htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</span>';
315
316 $isVisible = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'];
317 $cssClassName = 'typo3-adminPanel-panel-' . ($isVisible ? 'open' : 'closed');
318 $header = '<tr class="typo3-adminPanel-hRow">' .
319 '<td colspan="2" id="typo3-adminPanel-header" class="' . $cssClassName . '">' .
320 '<span class="typo3-adminPanel-header-title">' . $row . '</span>' .
321 $this->linkSectionHeader('top', '<span class="typo3-adminPanel-header-button"></span>', 'typo3-adminPanel-header-buttonWrapper') .
322 '<input type="hidden" name="TSFE_ADMIN_PANEL[display_top]" value="' . $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'] . '" /></td>' .
323 '</tr>';
324
325 if ($moduleContent) {
326 $footer = '<tr class="typo3-adminPanel-fRow">' .
327 '<td colspan="2" id="typo3-adminPanel-footer">' .
328 ($this->extNeedUpdate ? ' <input class="typo3-adminPanel-update" type="submit" value="' . $this->extGetLL('update') . '" />' : '') . '</td>' .
329 '</tr>';
330 } else {
331 $footer = '';
332 }
333
334 $query = !t3lib_div::_GET('id') ? ('<input type="hidden" name="id" value="' . $GLOBALS['TSFE']->id . '" />') : '';
335 // the dummy field is needed for Firefox: to force a page reload on submit with must change the form value with JavaScript (see "onsubmit" attribute of the "form" element")
336 $query .= '<input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="" />';
337 foreach (t3lib_div::_GET() as $key => $value) {
338 if ($key != 'TSFE_ADMIN_PANEL') {
339 if (is_array($value)) {
340 $query .= $this->getHiddenFields($key, $value);
341 } else {
342 $query .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />';
343 }
344 }
345 }
346
347 $out = '
348 <!--
349 TYPO3 admin panel start
350 -->
351 <a id="TSFE_ADMIN"></a>
352 <form id="TSFE_ADMIN_PANEL_FORM" name="TSFE_ADMIN_PANEL_FORM" action="' . htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '#TSFE_ADMIN" method="get" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">' .
353 $query . '<table class="typo3-adminPanel">' .
354 $header . $moduleContent . $footer . '</table></form>';
355
356 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
357 $out .= '<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
358 $out .= '<script type="text/javascript">/*<![CDATA[*/' . t3lib_div::minifyJavaScript('
359 var evalFunc = new evalFunc();
360 // TSFEtypo3FormFieldSet()
361 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) { //
362 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
363 var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
364 if (checkbox && theValue==checkboxValue) {
365 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
366 alert(theField);
367 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
368 } else {
369 document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
370 if (document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"]) {
371 document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
372 }
373 }
374 }
375 // TSFEtypo3FormFieldGet()
376 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) { //
377 var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
378 if (checkbox_off) {
379 document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
380 }else{
381 document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
382 }
383 TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
384 }') . '/*]]>*/</script><script language="javascript" type="text/javascript">' .
385 $this->extJSCODE . '</script>';
386 }
387
388 $out .= '<script src="' . t3lib_div::locationHeaderUrl('t3lib/js/adminpanel.js') . '" type="text/javascript"></script><script type="text/javascript">/*<![CDATA[*/' .
389 'typo3AdminPanel = new TYPO3AdminPanel();typo3AdminPanel.init("typo3-adminPanel-header", "TSFE_ADMIN_PANEL_FORM");' .
390 '/*]]>*/</script>
391 <!--
392 TYPO3 admin panel end
393 -->
394 ';
395
396 return $out;
397 }
398
399 /**
400 * Fetches recursively all GET parameters as hidden fields.
401 * Called from display()
402 *
403 * @param string current key
404 * @param mixed current value
405 * @return string hidden fields
406 * @see display()
407 */
408 protected function getHiddenFields($key, array $val) {
409 $out = '';
410 foreach ($val as $k => $v) {
411 if (is_array($v)) {
412 $out .= $this->getHiddenFields($key . '[' . $k . ']', $v);
413 } else {
414 $out .= '<input type="hidden" name="' . htmlspecialchars($key) . '[' . htmlspecialchars($k) . ']" value="' . htmlspecialchars($v) . '">' . LF;
415 }
416 }
417 return $out;
418 }
419
420 /*****************************************************
421 *
422 * Creating sections of the Admin Panel
423 *
424 ****************************************************/
425
426 /**
427 * Creates the content for the "preview" section ("module") of the Admin Panel
428 *
429 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
430 * @see display()
431 */
432 protected function getPreviewModule() {
433 $out = $this->extGetHead('preview');
434 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_preview']) {
435 $this->extNeedUpdate = TRUE;
436 $out .= $this->extGetItem('preview_showHiddenPages', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_showHiddenPages'] ? ' checked="checked"' : '') . ' />');
437 $out .= $this->extGetItem('preview_showHiddenRecords', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_showHiddenRecords'] ? ' checked="checked"' : '') . ' />');
438
439 // Simulate date
440 $out .= $this->extGetItem('preview_simulateDate', '<input type="text" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr" onchange="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\', 1,0);" /><input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="' . $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateDate'] . '" />');
441 $this->extJSCODE .= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 0, 0);';
442
443 // Simulate fe_user:
444 $options = '<option value="0">&nbsp;</option>';
445 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
446 'fe_groups.uid, fe_groups.title',
447 'fe_groups,pages',
448 'pages.uid=fe_groups.pid AND pages.deleted=0 ' . t3lib_BEfunc::deleteClause('fe_groups') . ' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)
449 );
450 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
451 $options .= '<option value="' . $row['uid'] . '"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateUserGroup'] == $row['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars('[' . $row['uid'] . '] ' . $row['title']) . '</option>';
452 }
453 $out .= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">' . $options . '</select>');
454 }
455
456 return $out;
457 }
458
459 /**
460 * Creates the content for the "cache" section ("module") of the Admin Panel
461 *
462 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
463 * @see display()
464 */
465 protected function getCacheModule() {
466 $out = $this->extGetHead('cache');
467 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_cache']) {
468 $this->extNeedUpdate = TRUE;
469 $out .= $this->extGetItem('cache_noCache', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_noCache]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[cache_noCache]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['cache_noCache'] ? ' checked="checked"' : '') . ' />');
470 $levels = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['cache_clearCacheLevels'];
471 $options = '';
472 $options .= '<option value="0"' . ($levels == 0 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_0') . '</option>';
473 $options .= '<option value="1"' . ($levels == 1 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_1') . '</option>';
474 $options .= '<option value="2"' . ($levels == 2 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_2') . '</option>';
475 $out .= $this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">' . $options . '</select>' .
476 '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="' . $GLOBALS['TSFE']->id . '" /> <input type="submit" value="' . $this->extGetLL('update') . '" />');
477
478 // Generating tree:
479 $depth = $this->extGetFeAdminValue('cache', 'clearCacheLevels');
480 $outTable = '';
481 $GLOBALS['BE_USER']->extPageInTreeInfo = array();
482 $GLOBALS['BE_USER']->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'], htmlspecialchars($GLOBALS['TSFE']->page['title']), $depth+1);
483 $GLOBALS['BE_USER']->extGetTreeList($GLOBALS['TSFE']->id, $depth, 0, $GLOBALS['BE_USER']->getPagePermsClause(1));
484 foreach ($GLOBALS['BE_USER']->extPageInTreeInfo as $row) {
485 $outTable .= '<tr>' .
486 '<td><img src="typo3/gfx/clear.gif" width="' . (($depth+1-$row[2])*18) . '" height="1" alt="" /><img ' .
487 t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/i/pages.gif', 'width="18" height="16"') . ' align="top" alt="" /> ' . htmlspecialchars($row[1]) .
488 '</td><td>' . $GLOBALS['BE_USER']->extGetNumberOfCachedPages($row[0]) . '</td></tr>';
489 }
490
491 $outTable = '<br /><table>' . $outTable . '</table>';
492 $outTable .= '<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="' . $this->extGetLL('cache_doit') . '" />';
493
494 $out .= $this->extGetItem('cache_cacheEntries', $outTable);
495 }
496
497 return $out;
498 }
499
500 /**
501 * Creates the content for the "publish" section ("module") of the Admin Panel
502 *
503 * @param string Optional start-value; The generated content is added to this variable.
504 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
505 * @see display()
506 */
507 protected function getPublishModule() {
508 $out = $this->extGetHead('publish');
509 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_publish']) {
510 $this->extNeedUpdate = TRUE;
511 $levels = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['publish_levels'];
512 $options = '';
513 $options .= '<option value="0"' . ($levels == 0 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_0') . '</option>';
514 $options .= '<option value="1"' . ($levels ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_1') . '</option>';
515 $options .= '<option value="2"' . ($levels == 2 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_2') . '</option>';
516 $out .= $this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">' . $options . '</select>' .
517 '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="' . $GLOBALS['TSFE']->id . '" />&nbsp;<input type="submit" value="' . $this->extGetLL('update') . '" />');
518
519 // Generating tree:
520 $depth = $this->extGetFeAdminValue('publish', 'levels');
521 $outTable = '';
522 $GLOBALS['BE_USER']->extPageInTreeInfo = array();
523 $GLOBALS['BE_USER']->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'], htmlspecialchars($GLOBALS['TSFE']->page['title']), $depth+1);
524 $GLOBALS['BE_USER']->extGetTreeList($GLOBALS['TSFE']->id, $depth, 0, $GLOBALS['BE_USER']->getPagePermsClause(1));
525 foreach ($GLOBALS['BE_USER']->extPageInTreeInfo as $row) {
526 $outTable.= '<tr>' .
527 '<td style="white-space:nowrap;"><img src="typo3/gfx/clear.gif" width="' . (($depth + 1 - $row[2]) * 18) . '" height="1" alt="" /><img ' .
528 t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/i/pages.gif', 'width="18" height="16"') . ' align="top" border="0" alt="" />' . $row[1] .
529 '</td><td><img src="typo3/gfx/clear.gif" width="10" height="1" alt="" /></td><td>...</td></tr>';
530 }
531 $outTable = '<br /><table>' . $outTable . '</table>';
532 $outTable .= '<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="' . $this->extGetLL('publish_doit') . '" />';
533
534 $out .= $this->extGetItem('publish_tree', $outTable);
535 }
536
537 return $out;
538 }
539
540 /**
541 * Creates the content for the "edit" section ("module") of the Admin Panel
542 *
543 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
544 * @see display()
545 */
546 protected function getEditModule() {
547 $out = $this->extGetHead('edit');
548 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_edit']) {
549
550 // If another page module was specified, replace the default Page module with the new one
551 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
552 $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
553
554 $this->extNeedUpdate = TRUE;
555 $out .= $this->extGetItem('edit_displayFieldIcons', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_displayFieldIcons'] ? ' checked="checked"' : '') . ' />');
556 $out .= $this->extGetItem('edit_displayIcons', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_displayIcons'] ? ' checked="checked"' : '') . ' />');
557 $out .= $this->extGetItem('edit_editFormsOnPage', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_editFormsOnPage]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_editFormsOnPage]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] ? ' checked="checked"':'') . ' />');
558 $out .= $this->extGetItem('edit_editNoPopup', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_editNoPopup]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_editNoPopup]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] ? ' checked="checked"' : '') . ' />');
559 $out .= $this->extGetItem('', $this->ext_makeToolBar());
560
561 if (!t3lib_div::_GP('ADMCMD_view')) {
562 $out .= $this->extGetItem('', '<a href="#" onclick="' .
563 htmlspecialchars('
564 if (parent.opener && parent.opener.top && parent.opener.top.TS) {
565 parent.opener.top.fsMod.recentIds["web"]=' . intval($GLOBALS['TSFE']->page['uid']) . ';
566 if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav) {
567 parent.opener.top.content.nav_frame.refresh_nav();
568 }
569 parent.opener.top.goToModule("' . $pageModule . '");
570 parent.opener.top.focus();
571 } else {
572 vHWin=window.open(\'' . TYPO3_mainDir.t3lib_BEfunc::getBackendScript() . '\',\'' . md5('Typo3Backend-' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
573 vHWin.focus();
574 }
575 return false;
576 ').
577 '">' . $this->extGetLL('edit_openAB') . '</a>');
578 }
579 }
580
581 return $out;
582 }
583
584 /**
585 * Creates the content for the "tsdebug" section ("module") of the Admin Panel
586 *
587 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
588 * @see display()
589 */
590 protected function getTSDebugModule() {
591 $out = $this->extGetHead('tsdebug');
592 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_tsdebug']) {
593 $this->extNeedUpdate = TRUE;
594
595 $out .= $this->extGetItem('tsdebug_tree', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_tree'] ? ' checked="checked"' : '') . ' />');
596 $out .= $this->extGetItem('tsdebug_displayTimes', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayTimes'] ? ' checked="checked"' : '') . ' />');
597 $out .= $this->extGetItem('tsdebug_displayMessages', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayMessages'] ? ' checked="checked"':'') . ' />');
598 $out .= $this->extGetItem('tsdebug_LR', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_LR'] ? ' checked="checked"' : '') . ' />');
599 $out .= $this->extGetItem('tsdebug_displayContent', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayContent'] ? ' checked="checked"' : '') . ' />');
600 $out .= $this->extGetItem('tsdebug_displayQueries', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayQueries'] ? ' checked="checked"' : '') . ' />');
601 $out .= $this->extGetItem('tsdebug_forceTemplateParsing', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_forceTemplateParsing'] ? ' checked="checked"' : '') . ' />');
602
603 $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug', 'tree');
604 $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug', 'displayTimes');
605 $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug', 'displayMessages');
606 $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug', 'displayContent');
607 $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug', 'displayQueries');
608
609 $out.= '<tr><td colspan="2">' . $GLOBALS['TT']->printTSlog() . '</td></tr>';
610 }
611
612 return $out;
613 }
614
615 /**
616 * Creates the content for the "info" section ("module") of the Admin Panel
617 *
618 * @return string HTML content for the section. Consists of a string with table-rows with four columns.
619 * @see display()
620 */
621 protected function getInfoModule() {
622 $out = $this->extGetHead('info');
623 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_info']) {
624 $tableArr = array();
625
626 if ($this->extGetFeAdminValue('cache', 'noCache')) {
627 $theBytes = 0;
628 $count = 0;
629
630 if (count($GLOBALS['TSFE']->imagesOnPage)) {
631 $tableArr[] = array('*Images on this page:*', '');
632 foreach ($GLOBALS['TSFE']->imagesOnPage as $file) {
633 $fs = @filesize($file);
634 $tableArr[] = array('&ndash; ' . $file, t3lib_div::formatSize($fs));
635 $theBytes+= $fs;
636 $count++;
637 }
638 }
639 $tableArr[] = array('', ''); // Add an empty line
640
641 $tableArr[] = array('*Total number of images:*', $count);
642 $tableArr[] = array('*Total image file sizes:*', t3lib_div::formatSize($theBytes));
643 $tableArr[] = array('*Document size:*', t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)));
644 $tableArr[] = array('*Total page load:*', t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)+$theBytes));
645 $tableArr[] = array('', '');
646 }
647
648 $tableArr[] = array('id:', $GLOBALS['TSFE']->id);
649 $tableArr[] = array('type:', $GLOBALS['TSFE']->type);
650 $tableArr[] = array('gr_list:', $GLOBALS['TSFE']->gr_list);
651 $tableArr[] = array('no_cache:', $GLOBALS['TSFE']->no_cache ? 1 : 0);
652 $tableArr[] = array('USER_INT objects:', count($GLOBALS['TSFE']->config['INTincScript']));
653 $tableArr[] = array('fe_user, name:', $GLOBALS['TSFE']->fe_user->user['username']);
654 $tableArr[] = array('fe_user, uid:', $GLOBALS['TSFE']->fe_user->user['uid']);
655 $tableArr[] = array('', ''); // Add an empty line
656
657 // parsetime:
658 $tableArr[] = array('*Total parsetime:*', $GLOBALS['TSFE']->scriptParseTime . ' ms');
659
660 $table = '';
661 foreach ($tableArr as $arr) {
662 if (strlen($arr[0])) { // Put text wrapped by "*" between <strong> tags
663 $value1 = preg_replace('/^\*(.*)\*$/', '$1', $arr[0], -1, $count);
664 $value1 = ($count?'<strong>':'') . $value1 . ($count?'</strong>':'');
665 } else {
666 $value1 = '&nbsp;';
667 }
668
669 $value2 = strlen($arr[1]) ? $arr[1] : '&nbsp;';
670 $value2 = $value2;
671
672 $table .= '<tr class="typo3-adminPanel-itemRow">' .
673 '<td class="typo3-adminPanel-section-content-title">' . $value1 . '</td>' .
674 '<td class="typo3-adminPanel-section-content">' . $value2 . '</td>' .
675 '</tr>';
676 }
677
678 $out .= $table;
679 }
680
681 return $out;
682 }
683
684 /*****************************************************
685 *
686 * Admin Panel Layout Helper functions
687 *
688 ****************************************************/
689
690 /**
691 * Returns a row (with colspan=4) which is a header for a section in the Admin Panel.
692 * It will have a plus/minus icon and a label which is linked so that it submits the form which surrounds the whole Admin Panel when clicked, alterting the TSFE_ADMIN_PANEL[display_' . $pre . '] value
693 * See the functions get*Module
694 *
695 * @param string The suffix to the display_ label. Also selects the label from the LOCAL_LANG array.
696 * @return string HTML table row.
697 * @access private
698 * @see extGetItem()
699 */
700 protected function extGetHead($sectionSuffix) {
701 $settingName = 'display_' . $sectionSuffix;
702 $isVisible = $GLOBALS['BE_USER']->uc['TSFE_adminConfig'][$settingName];
703 $cssClassName = 'typo3-adminPanel-section-' . ($isVisible ? 'open' : 'closed');
704
705 return '<tr class="typo3-adminPanel-section-title"><td colspan="2">' .
706 $this->linkSectionHeader($sectionSuffix, $this->extGetLL($sectionSuffix), $cssClassName) .
707 '<input type="hidden" name="TSFE_ADMIN_PANEL[' . $settingName .
708 ']" value="' . $isVisible . '" /></td></tr>';
709 }
710
711 /**
712 * Wraps a string in a link which will open/close a certain part of the Admin Panel
713 *
714 * @param string The code for the display_ label/key
715 * @param string Input string
716 * @return string Linked input string
717 * @access private
718 * @see extGetHead()
719 */
720 protected function linkSectionHeader($sectionSuffix, $sectionTitle, $className = '') {
721 return '<div class="typo3-adminPanel-label"><a href="javascript:void(0)" onclick="' .
722 htmlspecialchars('document.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[display_' . $sectionSuffix . ']\'].value=' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_' . $sectionSuffix] ? '0' : '1') . ';document.TSFE_ADMIN_PANEL_FORM.submit();return false;') .
723 '"' . ($className ? ' class="' . $className . '"' : '') . '>' . $sectionTitle . '</a></div>';
724 }
725
726 /**
727 * Returns a row (with 4 columns) for content in a section of the Admin Panel.
728 * It will take $pre as a key to a label to display and $element as the content to put into the forth cell.
729 *
730 * @param string Key to label
731 * @param string The HTML content for the forth table cell.
732 * @return string HTML table row.
733 * @access private
734 * @see extGetHead()
735 */
736 protected function extGetItem($title, $content = '', $checkboxContent = '') {
737 $out = '<tr class="typo3-adminPanel-itemRow">' .
738 '<td class="typo3-adminPanel-section-content">' . $checkboxContent . ($title ? $this->extGetLL($title) : '&nbsp;') . $content . '</td></tr>';
739
740 return $out;
741 }
742
743 /**
744 * Creates the tool bar links for the "edit" section of the Admin Panel.
745 *
746 * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
747 */
748 public function ext_makeToolBar() {
749 // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
750 $tsConfig = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
751 $tsConfig = $tsConfig['properties']['newContentWiz.']['overrideWithExtension'];
752 $newContentWizScriptPath = t3lib_extMgm::isLoaded($tsConfig) ? (t3lib_extMgm::extRelPath($tsConfig) . 'mod1/db_new_content_el.php') : (TYPO3_mainDir . 'sysext/cms/layout/db_new_content_el.php');
753
754 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
755 $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid);
756
757 $id = $GLOBALS['TSFE']->id;
758 $toolBar = '<a href="' . htmlspecialchars(TYPO3_mainDir . 'show_rechis.php?element=' . rawurlencode('pages:' . $id) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '#latest">' .
759 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/history2.gif', 'width="13" height="12"') .
760 ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_recordHistory') . '" alt="" /></a>';
761
762 if (($perms & 16) && $langAllowed) {
763 $params = '';
764 if ($GLOBALS['TSFE']->sys_language_uid) {
765 $params = '&sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid;
766 }
767 $toolBar .= '<a href="' . htmlspecialchars($newContentWizScriptPath . '?id=' . $id . $params . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
768 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/new_record.gif', 'width="16" height="12"') . ' hspace="1" border="0" align="top" title="' . $this->extGetLL('edit_newContentElement') . '" alt="" /></a>';
769 }
770 if (($perms & 2)) {
771 $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'move_el.php?table=pages&uid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
772 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/move_page.gif', 'width="11" height="12') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_move_page') . '" alt="" /></a>';
773 }
774 if (($perms & 8)) {
775 $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'db_new.php?id=' . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
776 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/new_page.gif', 'width="13" height="12"') . ' hspace="0" border="0" align="top" title="' . $this->extGetLL('edit_newPage') . '" alt="" /></a>';
777 }
778 if (($perms & 2)) {
779 $params = '&edit[pages][' . $id . ']=edit';
780 $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
781 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/edit2.gif', 'width="11" height="12"') . 'hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_editPageProperties') . '" alt="" /></a>';
782
783 if ($GLOBALS['TSFE']->sys_language_uid && $langAllowed) {
784 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
785 'uid,pid,t3ver_state', 'pages_language_overlay',
786 'pid=' . intval($id) . ' AND sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid . $GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'),
787 '', '', '1');
788 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
789 $GLOBALS['TSFE']->sys_page->versionOL('pages_language_overlay',$row);
790 if (is_array($row)) {
791 $params = '&edit[pages_language_overlay][' . $row['uid'] . ']=edit';
792 $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
793 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/edit3.gif', 'width="11" height="12"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_editPageOverlay') . '" alt="" /></a>';
794 }
795 }
796 }
797 if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
798 $urlParams = array();
799 $urlParams['id'] = $id;
800 $urlParams['returnUrl'] = t3lib_div::getIndpEnv('REQUEST_URI');
801 $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . t3lib_BEfunc::getModuleUrl('web_list', $urlParams)) . '">' .
802 '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/list.gif', 'width="11" height="11"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_db_list') . '" alt="" /></a>';
803 }
804
805 return $toolBar;
806 }
807
808 /**
809 * Returns the label for key, $key. If a translation for the language set in $GLOBALS['BE_USER']->uc['lang'] is found that is returned, otherwise the default value.
810 * IF the global variable $LOCAL_LANG is NOT an array (yet) then this function loads the global $LOCAL_LANG array with the content of "sysext/lang/locallang_tsfe.php" so that the values therein can be used for labels in the Admin Panel
811 *
812 * FIXME The function should onvert to $TSFE->renderCharset, not to UTF8!
813 *
814 * @param string Key for a label in the $LOCAL_LANG array of "sysext/lang/locallang_tsfe.php"
815 * @return string The value for the $key
816 */
817 protected function extGetLL($key) {
818 $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key)); // Label string in the default backend output charset.
819
820 // Convert to utf-8, then to entities:
821 if ($GLOBALS['LANG']->charSet != 'utf-8') {
822 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
823 }
824 $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
825
826 // Return the result:
827 return $labelStr;
828 }
829 }
830
831 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/cms/tslib/class.tslib_adminpanel.php'])) {
832 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/cms/tslib/class.tslib_adminpanel.php']);
833 }
834
835 ?>