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