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