2 /***************************************************************
5 * (c) 2007-2010 Ingo Renner <ingo@typo3.org>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 require_once('init.php');
29 require_once('template.php');
30 require_once('interfaces/interface.backend_toolbaritem.php');
32 require('classes/class.typo3logo.php');
33 require('classes/class.modulemenu.php');
34 require_once('classes/class.donatewindow.php');
37 require('classes/class.workspaceselector.php');
38 require('classes/class.clearcachemenu.php');
39 require('classes/class.shortcutmenu.php');
40 require('classes/class.backendsearchmenu.php');
42 require_once('class.alt_menu_functions.inc');
43 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
47 * Class for rendering the TYPO3 backend version 4.2+
49 * @author Ingo Renner <ingo@typo3.org>
60 protected $jsFilesAfterInline;
61 protected $toolbarItems;
62 private $menuWidthDefault = 190; // intentionally private as nobody should modify defaults
66 * Object for loading backend modules
68 * @var t3lib_loadModules
70 protected $moduleLoader;
73 * module menu generating object
77 protected $moduleMenu;
82 * @var t3lib_PageRenderer
84 protected $pageRenderer;
91 public function __construct() {
93 // Initializes the backend modules structure for use later.
94 $this->moduleLoader
= t3lib_div
::makeInstance('t3lib_loadModules');
95 $this->moduleLoader
->load($GLOBALS['TBE_MODULES']);
97 $this->moduleMenu
= t3lib_div
::makeInstance('ModuleMenu');
99 $this->pageRenderer
= $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
100 $this->pageRenderer
->loadScriptaculous('builder,effects,controls,dragdrop');
101 $this->pageRenderer
->loadExtJS();
103 // register the extDirect API providers
104 // Note: we need to iterate thru the object, because the addProvider method
105 // does this only with multiple arguments
106 $this->pageRenderer
->addExtOnReadyCode(
107 'for (var api in Ext.app.ExtDirectAPI) {
108 Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);
110 TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
116 // add default BE javascript
118 $this->jsFiles
= array(
119 'contrib/swfupload/swfupload.js',
120 'contrib/swfupload/plugins/swfupload.swfobject.js',
121 'contrib/swfupload/plugins/swfupload.cookies.js',
122 'contrib/swfupload/plugins/swfupload.queue.js',
125 'js/extjs/backendsizemanager.js',
126 'js/toolbarmanager.js',
128 'js/iecompatibility.js',
130 '../t3lib/jsfunc.evalfield.js',
131 '../t3lib/js/extjs/ux/flashmessages.js',
132 '../t3lib/js/extjs/ux/ext.ux.tabclosemenu.js',
134 'js/loginrefresh.js',
135 'js/extjs/debugPanel.js',
136 'js/extjs/viewport.js',
137 'js/extjs/viewportConfiguration.js',
140 // add default BE css
142 $this->cssFiles
= array();
144 $this->toolbarItems
= array();
145 $this->initializeCoreToolbarItems();
147 $this->menuWidth
= $this->menuWidthDefault
;
148 if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth
) {
149 $this->menuWidth
= (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
152 $this->executeHook('constructPostProcess');
156 * initializes the core toolbar items
160 protected function initializeCoreToolbarItems() {
162 $coreToolbarItems = array(
163 'workspaceSelector' => 'WorkspaceSelector',
164 'shortcuts' => 'ShortcutMenu',
165 'clearCacheActions' => 'ClearCacheMenu',
166 'backendSearch' => 'BackendSearchMenu'
169 foreach($coreToolbarItems as $toolbarItemName => $toolbarItemClassName) {
170 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
172 if(!($toolbarItem instanceof backend_toolbarItem
)) {
173 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195126772);
176 if($toolbarItem->checkAccess()) {
177 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
185 * main function generating the BE scaffolding
189 public function render() {
190 $this->executeHook('renderPreProcess');
192 if (t3lib_div
::makeInstance('DonateWindow')->isDonateWindowAllowed()) {
193 $this->pageRenderer
->addJsFile('js/donate.js');
196 // prepare the scaffolding, at this point extension may still add javascript and css
197 $logo = t3lib_div
::makeInstance('TYPO3Logo');
198 $logo->setLogo('gfx/typo3logo_mini.png');
200 $menu = $this->moduleMenu
->render();
202 if ($this->menuWidth
!= $this->menuWidthDefault
) {
205 margin-left: ' . $this->menuWidth
. 'px;
210 // create backend scaffolding
211 $backendScaffolding = '
212 <div id="typo3-backend">
213 <div id="typo3-top-container" class="x-hide-display">
214 <div id="typo3-logo">'.$logo->render().'</div>
215 <div id="typo3-top" class="typo3-top-toolbar">' .
216 $this->renderToolbar() .
219 <div id="typo3-main-container">
220 <div id="typo3-side-menu" class="x-hide-display">' .
223 <div id="typo3-content" class="x-hide-display">
224 <iframe src="alt_intro.php" name="content" id="content" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto"></iframe>
230 /******************************************************
231 * now put the complete backend document together
232 ******************************************************/
234 foreach($this->cssFiles
as $cssFileName => $cssFile) {
235 $this->pageRenderer
->addCssFile($cssFile);
237 // load addditional css files to overwrite existing core styles
238 if(!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
239 $this->pageRenderer
->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
243 if(!empty($this->css
)) {
244 $this->pageRenderer
->addCssInlineBlock('BackendInlineCSS', $this->css
);
247 foreach ($this->jsFiles
as $jsFile) {
248 $this->pageRenderer
->addJsFile($jsFile);
251 // Those lines can be removed once we have at least one official ExtDirect router within the backend.
252 $hasExtDirectRouter = FALSE
;
253 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'])) {
254 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'] as $key => $value) {
255 if (strpos($key, 'TYPO3.Backend') !== FALSE
) {
256 $hasExtDirectRouter = TRUE
;
261 if ($hasExtDirectRouter) {
262 $this->pageRenderer
->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Backend', NULL
, FALSE
);
265 $this->generateJavascript();
266 $this->pageRenderer
->addJsInlineCode('BackendInlineJavascript', $this->js
);
269 // set document title:
270 $title = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
271 ?
$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].' [TYPO3 '.TYPO3_version
.']'
272 : 'TYPO3 '.TYPO3_version
275 // start page header:
276 $this->content
.= $GLOBALS['TBE_TEMPLATE']->startPage($title);
277 $this->content
.= $backendScaffolding;
278 $this->content
.= $GLOBALS['TBE_TEMPLATE']->endPage();
280 $hookConfiguration = array('content' => &$this->content
);
281 $this->executeHook('renderPostProcess', $hookConfiguration);
287 * renders the items in the top toolbar
289 * @return string top toolbar elements as HTML
291 protected function renderToolbar() {
293 // move search to last position
294 $search = $this->toolbarItems
['backendSearch'];
295 unset($this->toolbarItems
['backendSearch']);
296 $this->toolbarItems
['backendSearch'] = $search;
298 $toolbar = '<ul id="typo3-toolbar">';
299 $toolbar.= '<li>'.$this->getLoggedInUserLabel().'</li>
300 <li><div id="logout-button" class="toolbar-item no-separator">'.$this->moduleMenu
->renderLogoutButton().'</div></li>';
302 foreach($this->toolbarItems
as $toolbarItem) {
303 $menu = $toolbarItem->render();
305 $additionalAttributes = $toolbarItem->getAdditionalAttributes();
306 $toolbar .= '<li' . $additionalAttributes . '>' .$menu. '</li>';
310 return $toolbar.'</ul>';
314 * Gets the label of the BE user currently logged in
316 * @return string html code snippet displaying the currently logged in user
318 protected function getLoggedInUserLabel() {
319 global $BE_USER, $BACK_PATH;
321 $icon = t3lib_iconWorks
::getSpriteIcon('status-user-'. ($BE_USER->isAdmin() ?
'admin' : 'backend'));
323 $label = $GLOBALS['BE_USER']->user
['realName'] ?
324 $BE_USER->user
['realName'] . ' (' . $BE_USER->user
['username'] . ')' :
325 $BE_USER->user
['username'];
327 // Link to user setup if it's loaded and user has access
329 if (t3lib_extMgm
::isLoaded('setup') && $BE_USER->check('modules','user_setup')) {
330 $link = '<a href="#" onclick="top.goToModule(\'user_setup\');this.blur();return false;">';
333 $username = '">'.$link.$icon.'<span>'.htmlspecialchars($label).'</span>'.($link?
'</a>':'');
336 if($BE_USER->user
['ses_backuserid']) {
337 $username = ' su-user">'.$icon.
338 '<span title="' . $GLOBALS['LANG']->getLL('switchtouser') . '">' .
339 $GLOBALS['LANG']->getLL('switchtousershort') . ' </span>' .
340 '<span>' . htmlspecialchars($label) . '</span>';
343 return '<div id="username" class="toolbar-item no-separator'.$username.'</div>';
347 * Generates the JavaScript code for the backend.
351 protected function generateJavascript() {
353 $pathTYPO3 = t3lib_div
::dirname(t3lib_div
::getIndpEnv('SCRIPT_NAME')).'/';
354 $goToModuleSwitch = $this->moduleMenu
->getGotoModuleJavascript();
355 $moduleFramesHelper = implode(LF
, $this->moduleMenu
->getFsMod());
357 // If another page module was specified, replace the default Page module with the new one
358 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
359 $pageModule = t3lib_BEfunc
::isModuleSetInTBE_MODULES($newPageModule) ?
$newPageModule : 'web_layout';
361 $menuFrameName = 'menu';
362 if($GLOBALS['BE_USER']->uc
['noMenuMode'] === 'icons') {
363 $menuFrameName = 'topmenuFrame';
366 // determine security level from conf vars and default to super challenged
367 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) {
368 $this->loginSecurityLevel
= $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'];
370 $this->loginSecurityLevel
= 'superchallenged';
373 $t3Configuration = array(
374 'siteUrl' => t3lib_div
::getIndpEnv('TYPO3_SITE_URL'),
375 'PATH_typo3' => $pathTYPO3,
376 'PATH_typo3_enc' => rawurlencode($pathTYPO3),
377 'username' => htmlspecialchars($GLOBALS['BE_USER']->user
['username']),
378 'uniqueID' => t3lib_div
::shortMD5(uniqid('')),
379 'securityLevel' => $this->loginSecurityLevel
,
380 'TYPO3_mainDir' => TYPO3_mainDir
,
381 'pageModule' => $pageModule,
382 'condensedMode' => $GLOBALS['BE_USER']->uc
['condensedMode'] ?
1 : 0 ,
383 'inWorkspace' => $GLOBALS['BE_USER']->workspace
!== 0 ?
1 : 0,
384 'workspaceFrontendPreviewEnabled' => $GLOBALS['BE_USER']->user
['workspace_preview'] ?
1 : 0,
385 'veriCode' => $GLOBALS['BE_USER']->veriCode(),
386 'denyFileTypes' => PHP_EXTENSIONS_DEFAULT
,
387 'moduleMenuWidth' => $this->menuWidth
- 1,
388 'topBarHeight' => (int) $GLOBALS['TBE_STYLES']['dims']['topFrameH'],
389 'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ?
intval($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) : FALSE
,
392 'waitTitle' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_logging_in') ,
393 'refresh_login_failed' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed'),
394 'refresh_login_failed_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed_message'),
395 'refresh_login_title' => sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_title'), htmlspecialchars($GLOBALS['BE_USER']->user
['username'])),
396 'login_expired' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_expired'),
397 'refresh_login_username' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_username'),
398 'refresh_login_password' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_password'),
399 'refresh_login_emptyPassword' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_emptyPassword'),
400 'refresh_login_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_button'),
401 'refresh_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_logout_button'),
402 'please_wait' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.please_wait'),
403 'be_locked' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.be_locked'),
404 'refresh_login_countdown_singular' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown_singular'),
405 'refresh_login_countdown' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown'),
406 'login_about_to_expire' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire'),
407 'login_about_to_expire_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire_title'),
408 'refresh_login_refresh_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_refresh_button'),
409 'refresh_direct_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_direct_logout_button'),
410 'tabs_closeAll' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.closeAll'),
411 'tabs_closeOther' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.closeOther'),
412 'tabs_close' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.close'),
413 'donateWindow_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.title'),
414 'donateWindow_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.message'),
415 'donateWindow_button_donate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.button_donate'),
416 'donateWindow_button_disable' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.button_disable'),
417 'donateWindow_button_postpone' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:donateWindow.button_postpone'),
419 $t3LLLfileUpload = array(
420 'windowTitle' => $GLOBALS['LANG']->getLL('fileUpload_windowTitle'),
421 'buttonSelectFiles' => $GLOBALS['LANG']->getLL('fileUpload_buttonSelectFiles'),
422 'buttonCancelAll' => $GLOBALS['LANG']->getLL('fileUpload_buttonCancelAll'),
423 'infoComponentMaxFileSize' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentMaxFileSize'),
424 'infoComponentFileUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileUploadLimit'),
425 'infoComponentFileTypeLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileTypeLimit'),
426 'infoComponentOverrideFiles' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentOverrideFiles'),
427 'processRunning' => $GLOBALS['LANG']->getLL('fileUpload_processRunning'),
428 'uploadWait' => $GLOBALS['LANG']->getLL('fileUpload_uploadWait'),
429 'uploadStarting' => $GLOBALS['LANG']->getLL('fileUpload_uploadStarting'),
430 'uploadProgress' => $GLOBALS['LANG']->getLL('fileUpload_uploadProgress'),
431 'uploadSuccess' => $GLOBALS['LANG']->getLL('fileUpload_uploadSuccess'),
432 'errorQueueLimitExceeded' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueLimitExceeded'),
433 'errorQueueFileSizeLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueFileSizeLimit'),
434 'errorQueueZeroByteFile' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueZeroByteFile'),
435 'errorQueueInvalidFiletype' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueInvalidFiletype'),
436 'errorUploadHttp' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadHttpError'),
437 'errorUploadMissingUrl' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadMissingUrl'),
438 'errorUploadIO' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadIO'),
439 'errorUploadSecurityError' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadSecurityError'),
440 'errorUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadLimit'),
441 'errorUploadFailed' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFailed'),
442 'errorUploadFileIDNotFound' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileIDNotFound'),
443 'errorUploadFileValidation' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileValidation'),
444 'errorUploadFileCancelled' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileCancelled'),
445 'errorUploadStopped' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadStopped'),
446 'allErrorMessageTitle' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageTitle'),
447 'allErrorMessageText' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageText'),
448 'allError401' => $GLOBALS['LANG']->getLL('fileUpload_allError401'),
449 'allError2038' => $GLOBALS['LANG']->getLL('fileUpload_allError2038'),
452 // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
453 if ($GLOBALS['LANG']->charSet
!== 'utf-8') {
454 $t3Configuration['username'] = $GLOBALS['LANG']->csConvObj
->conv($t3Configuration['username'], $GLOBALS['LANG']->charSet
, 'utf-8');
455 $GLOBALS['LANG']->csConvObj
->convArray($t3LLLcore, $GLOBALS['LANG']->charSet
, 'utf-8');
456 $GLOBALS['LANG']->csConvObj
->convArray($t3LLLfileUpload, $GLOBALS['LANG']->charSet
, 'utf-8');
460 TYPO3.configuration = ' . json_encode($t3Configuration) . ';
462 core : ' . json_encode($t3LLLcore) . ',
463 fileUpload: ' . json_encode($t3LLLfileUpload) . '
469 function typoSetup() { //
470 this.PATH_typo3 = TYPO3.configuration.PATH_typo3;
471 this.PATH_typo3_enc = TYPO3.configuration.PATH_typo3_enc;
472 this.username = TYPO3.configuration.username;
473 this.uniqueID = TYPO3.configuration.uniqueID;
474 this.navFrameWidth = 0;
475 this.securityLevel = TYPO3.configuration.securityLevel;
476 this.veriCode = TYPO3.configuration.veriCode;
477 this.denyFileTypes = TYPO3.configuration.denyFileTypes;
479 var TS = new typoSetup();
481 var currentModuleLoaded = "";
484 * Frameset Module object
486 * Used in main modules with a frameset for submodules to keep the ID between modules
487 * Typically that is set by something like this in a Web>* sub module:
488 * if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'";
489 * if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
491 function fsModules() { //
492 this.recentIds=new Array(); // used by frameset modules to track the most recent used id for list frame.
493 this.navFrameHighlightedID=new Array(); // used by navigation frames to track which row id was highlighted last time
494 this.currentMainLoaded="";
495 this.currentBank="0";
497 var fsMod = new fsModules();' . $moduleFramesHelper . ';';
499 // add goToModule code
500 $this->pageRenderer
->addExtOnReadyCode('
501 top.goToModule = ' . $goToModuleSwitch . ';
504 // Check editing of page:
505 $this->handlePageEditing();
506 $this->setStartupModule();
510 * Checking if the "&edit" variable was sent so we can open it for editing the page.
511 * Code based on code from "alt_shortcut.php"
515 protected function handlePageEditing() {
517 if(!t3lib_extMgm
::isLoaded('cms')) {
522 $editId = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('edit'));
527 // Looking up the page to edit, checking permissions:
528 $where = ' AND ('.$GLOBALS['BE_USER']->getPagePermsClause(2)
529 .' OR '.$GLOBALS['BE_USER']->getPagePermsClause(16).')';
531 if(t3lib_div
::testInt($editId)) {
532 $editRecord = t3lib_BEfunc
::getRecordWSOL('pages', $editId, '*', $where);
534 $records = t3lib_BEfunc
::getRecordsByField('pages', 'alias', $editId, $where);
536 if(is_array($records)) {
538 $editRecord = current($records);
539 t3lib_BEfunc
::workspaceOL('pages', $editRecord);
543 // If the page was accessible, then let the user edit it.
544 if(is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) {
545 // Setting JS code to open editing:
547 // Load page to edit:
548 window.setTimeout("top.loadEditId('.intval($editRecord['uid']).');", 500);
550 // Checking page edit parameter:
551 if(!$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
553 // Expanding page tree:
554 t3lib_BEfunc
::openPageTree(intval($editRecord['pid']), !$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
558 // Warning about page editing:
559 alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)).');
566 * Sets the startup module from either GETvars module and mpdParams or user configuration.
570 protected function setStartupModule() {
571 $startModule = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('module'));
574 if ($GLOBALS['BE_USER']->uc
['startModule']) {
575 $startModule = $GLOBALS['BE_USER']->uc
['startModule'];
576 } else if($GLOBALS['BE_USER']->uc
['startInTaskCenter']) {
577 $startModule = 'user_task';
581 $moduleParameters = t3lib_div
::_GET('modParams');
583 $this->pageRenderer
->addExtOnReadyCode('
585 function startInModule(modName, cMR_flag, addGetVars) {
586 Ext.onReady(function() {
587 top.goToModule(modName, cMR_flag, addGetVars);
591 startInModule(\''.$startModule.'\', false, '.t3lib_div
::quoteJSvalue($moduleParameters).');
597 * generates the code for the TYPO3 logo, either the default TYPO3 logo or a custom one
599 * @return string HTML code snippet to display the TYPO3 logo
601 protected function getLogo() {
602 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
603 '<img'.t3lib_iconWorks
::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
606 // overwrite with custom logo
607 if($GLOBALS['TBE_STYLES']['logo']) {
608 if(substr($GLOBALS['TBE_STYLES']['logo'], 0, 3) == '../') {
609 $imgInfo = @getimagesize
(PATH_site
.substr($GLOBALS['TBE_STYLES']['logo'], 3));
611 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
612 '<img src="'.$GLOBALS['TBE_STYLES']['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
620 * adds a javascript snippet to the backend
622 * @param string javascript snippet
625 public function addJavascript($javascript) {
626 // TODO do we need more checks?
627 if(!is_string($javascript)) {
628 throw new InvalidArgumentException('parameter $javascript must be of type string', 1195129553);
631 $this->js
.= $javascript;
635 * adds a javscript file to the backend after it has been checked that it exists
637 * @param string javascript file reference
638 * @return boolean true if the javascript file was successfully added, false otherwise
640 public function addJavascriptFile($javascriptFile) {
641 $jsFileAdded = false
;
643 //TODO add more checks if neccessary
644 if(file_exists(t3lib_div
::resolveBackPath(PATH_typo3
.$javascriptFile))) {
645 $this->jsFiles
[] = $javascriptFile;
653 * adds a css snippet to the backend
655 * @param string css snippet
658 public function addCss($css) {
659 if(!is_string($css)) {
660 throw new InvalidArgumentException('parameter $css must be of type string', 1195129642);
667 * adds a css file to the backend after it has been checked that it exists
669 * @param string the css file's name with out the .css ending
670 * @param string css file reference
671 * @return boolean true if the css file was added, false otherwise
673 public function addCssFile($cssFileName, $cssFile) {
674 $cssFileAdded = false
;
676 if(empty($this->cssFiles
[$cssFileName])) {
677 $this->cssFiles
[$cssFileName] = $cssFile;
678 $cssFileAdded = true
;
681 return $cssFileAdded;
685 * adds an item to the toolbar, the class file for the toolbar item must be loaded at this point
687 * @param string toolbar item name, f.e. tx_toolbarExtension_coolItem
688 * @param string toolbar item class name, f.e. tx_toolbarExtension_coolItem
691 public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
692 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
694 if(!($toolbarItem instanceof backend_toolbarItem
)) {
695 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195125501);
698 if($toolbarItem->checkAccess()) {
699 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
706 * Executes defined hooks functions for the given identifier.
708 * These hook identifiers are valid:
709 * + constructPostProcess
711 * + renderPostProcess
713 * @param string $identifier Specific hook identifier
714 * @param array $hookConfiguration Additional configuration passed to hook functions
717 protected function executeHook($identifier, array $hookConfiguration = array()) {
718 $options =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php'];
720 if(isset($options[$identifier]) && is_array($options[$identifier])) {
721 foreach($options[$identifier] as $hookFunction) {
722 t3lib_div
::callUserFunction($hookFunction, $hookConfiguration, $this);
730 if(defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']) {
731 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']);
735 // document generation
736 $TYPO3backend = t3lib_div
::makeInstance('TYPO3backend');
738 // include extensions which may add css, javascript or toolbar items
739 if(is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) {
740 foreach($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) {
741 include_once($additionalBackendItem);
745 $TYPO3backend->render();