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