3f846b222e9eed2fe2668bf0d1d38308b9554585
2 /***************************************************************
5 * (c) 2007-2009 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');
36 require('classes/class.workspaceselector.php');
37 require('classes/class.clearcachemenu.php');
38 require('classes/class.shortcutmenu.php');
39 require('classes/class.backendsearchmenu.php');
41 require_once('class.alt_menu_functions.inc');
42 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
46 * Class for rendering the TYPO3 backend version 4.2+
48 * @author Ingo Renner <ingo@typo3.org>
59 protected $jsFilesAfterInline;
60 protected $toolbarItems;
61 private $menuWidthDefault = 160; // intentionally private as nobody should modify defaults
65 * Object for loading backend modules
67 * @var t3lib_loadModules
69 protected $moduleLoader;
72 * module menu generating object
76 protected $moduleMenu;
83 public function __construct() {
85 // Initializes the backend modules structure for use later.
86 $this->moduleLoader
= t3lib_div
::makeInstance('t3lib_loadModules');
87 $this->moduleLoader
->load($GLOBALS['TBE_MODULES']);
89 $this->moduleMenu
= t3lib_div
::makeInstance('ModuleMenu');
91 // add default BE javascript
93 $this->jsFiles
= array(
94 'contrib/swfupload/swfupload.js',
95 'contrib/swfupload/plugins/swfupload.swfobject.js',
96 'contrib/swfupload/plugins/swfupload.cookies.js',
97 'contrib/swfupload/plugins/swfupload.queue.js',
101 'js/toolbarmanager.js',
103 'js/iecompatibility.js',
105 '../t3lib/jsfunc.evalfield.js'
107 $this->jsFilesAfterInline
= array(
109 'js/loginrefresh.js',
111 // add default BE css
113 $this->cssFiles
= array(
114 'backend-scaffolding' => 'css/backend-scaffolding.css',
115 'backend-style' => 'css/backend-style.css',
116 'modulemenu' => 'css/modulemenu.css',
119 $this->toolbarItems
= array();
120 $this->initializeCoreToolbarItems();
122 $this->menuWidth
= $this->menuWidthDefault
;
123 if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth
) {
124 $this->menuWidth
= (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
129 * initializes the core toolbar items
133 protected function initializeCoreToolbarItems() {
135 $coreToolbarItems = array(
136 'workspaceSelector' => 'WorkspaceSelector',
137 'shortcuts' => 'ShortcutMenu',
138 'clearCacheActions' => 'ClearCacheMenu',
139 'backendSearch' => 'BackendSearchMenu'
142 foreach($coreToolbarItems as $toolbarItemName => $toolbarItemClassName) {
143 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
145 if(!($toolbarItem instanceof backend_toolbarItem
)) {
146 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195126772);
149 if($toolbarItem->checkAccess()) {
150 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
158 * main function generating the BE scaffolding
162 public function render() {
164 // prepare the scaffolding, at this point extension may still add javascript and css
165 $logo = t3lib_div
::makeInstance('TYPO3Logo');
166 $logo->setLogo('gfx/typo3logo_mini.png');
168 $menu = $this->moduleMenu
->render();
170 if ($this->menuWidth
!= $this->menuWidthDefault
) {
174 width: ' . ($this->menuWidth
- 1) . 'px;
179 margin-left: ' . $this->menuWidth
. 'px;
184 // create backend scaffolding
185 $backendScaffolding = '
186 <div id="typo3-backend">
187 <div id="typo3-top-container">
188 <div id="typo3-logo">'.$logo->render().'</div>
189 <div id="typo3-top" class="typo3-top-toolbar">'
190 .$this->renderToolbar()
193 <div id="typo3-main-container">
194 <div id="typo3-side-menu">
197 <div id="typo3-content">
198 <iframe src="alt_intro.php" name="content" id="content" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto"></iframe>
204 /******************************************************
205 * now put the complete backend document together
206 ******************************************************/
208 /** @var $pageRenderer t3lib_PageRenderer */
209 $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
210 $pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
211 $pageRenderer->loadExtJS();
213 // remove duplicate entries
214 $this->jsFiles
= array_unique($this->jsFiles
);
217 foreach($this->jsFiles
as $jsFile) {
218 $GLOBALS['TBE_TEMPLATE']->loadJavascriptLib($jsFile);
220 $GLOBALS['TBE_TEMPLATE']->JScode
.= chr(10);
221 $this->generateJavascript();
222 $GLOBALS['TBE_TEMPLATE']->JScode
.= $GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->js
) . chr(10);
224 foreach($this->jsFilesAfterInline
as $jsFile) {
225 $GLOBALS['TBE_TEMPLATE']->JScode
.= '
226 <script type="text/javascript" src="' . $jsFile . '"></script>';
230 // FIXME abusing the JS container to add CSS, need to fix template.php
231 foreach($this->cssFiles
as $cssFileName => $cssFile) {
232 $GLOBALS['TBE_TEMPLATE']->addStyleSheet($cssFileName, $cssFile);
234 // load addditional css files to overwrite existing core styles
235 if(!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
236 $GLOBALS['TBE_TEMPLATE']->addStyleSheet($cssFileName . 'TBE_STYLES', $GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
240 if(!empty($this->css
)) {
241 $GLOBALS['TBE_TEMPLATE']->inDocStylesArray
['backend.php'] = $this->css
;
244 // set document title:
245 $title = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
246 ?
$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].' [TYPO3 '.TYPO3_version
.']'
247 : 'TYPO3 '.TYPO3_version
250 // start page header:
251 $this->content
.= $GLOBALS['TBE_TEMPLATE']->startPage($title);
252 $this->content
.= $backendScaffolding;
253 $this->content
.= $GLOBALS['TBE_TEMPLATE']->endPage();
259 * renders the items in the top toolbar
261 * @return string top toolbar elements as HTML
263 protected function renderToolbar() {
265 // move search to last position
266 $search = $this->toolbarItems
['backendSearch'];
267 unset($this->toolbarItems
['backendSearch']);
268 $this->toolbarItems
['backendSearch'] = $search;
270 $toolbar = '<ul id="typo3-toolbar">';
271 $toolbar.= '<li>'.$this->getLoggedInUserLabel().'</li>
272 <li><div id="logout-button" class="toolbar-item no-separator">'.$this->moduleMenu
->renderLogoutButton().'</div></li>';
274 foreach($this->toolbarItems
as $toolbarItem) {
275 $menu = $toolbarItem->render();
277 $additionalAttributes = $toolbarItem->getAdditionalAttributes();
278 $toolbar .= '<li' . $additionalAttributes . '>' .$menu. '</li>';
282 return $toolbar.'</ul>';
286 * Gets the label of the BE user currently logged in
288 * @return string html code snippet displaying the currently logged in user
290 protected function getLoggedInUserLabel() {
291 global $BE_USER, $BACK_PATH;
293 $icon = '<img'.t3lib_iconWorks
::skinImg(
295 $BE_USER->isAdmin() ?
296 'gfx/i/be_users_admin.gif' :
297 'gfx/i/be_users.gif',
298 'width="18" height="16"'
300 .' title="" alt="" />';
302 $label = $GLOBALS['BE_USER']->user
['realName'] ?
303 $BE_USER->user
['realName'].' ['.$BE_USER->user
['username'].']' :
304 $BE_USER->user
['username'];
306 // Link to user setup if it's loaded and user has access
308 if (t3lib_extMgm
::isLoaded('setup') && $BE_USER->check('modules','user_setup')) {
309 $link = '<a href="#" onclick="top.goToModule(\'user_setup\');this.blur();return false;">';
312 $username = '">'.$link.$icon.'<span>'.htmlspecialchars($label).'</span>'.($link?
'</a>':'');
315 if($BE_USER->user
['ses_backuserid']) {
316 $username = ' su-user">'.$icon.
317 '<span title="' . $GLOBALS['LANG']->getLL('switchtouser') . '">' .
318 $GLOBALS['LANG']->getLL('switchtousershort') . ' </span>' .
319 '<span>' . htmlspecialchars($label) . '</span>';
322 return '<div id="username" class="toolbar-item no-separator'.$username.'</div>';
326 * Generates the JavaScript code for the backend.
330 protected function generateJavascript() {
332 $pathTYPO3 = t3lib_div
::dirname(t3lib_div
::getIndpEnv('SCRIPT_NAME')).'/';
333 $goToModuleSwitch = $this->moduleMenu
->getGotoModuleJavascript();
334 $moduleFramesHelper = implode(chr(10), $this->moduleMenu
->getFsMod());
336 // If another page module was specified, replace the default Page module with the new one
337 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
338 $pageModule = t3lib_BEfunc
::isModuleSetInTBE_MODULES($newPageModule) ?
$newPageModule : 'web_layout';
340 $menuFrameName = 'menu';
341 if($GLOBALS['BE_USER']->uc
['noMenuMode'] === 'icons') {
342 $menuFrameName = 'topmenuFrame';
345 // determine security level from conf vars and default to super challenged
346 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) {
347 $this->loginSecurityLevel
= $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'];
349 $this->loginSecurityLevel
= 'superchallenged';
352 $t3Configuration = array(
353 'siteUrl' => t3lib_div
::getIndpEnv('TYPO3_SITE_URL'),
354 'PATH_typo3' => $pathTYPO3,
355 'PATH_typo3_enc' => rawurlencode($pathTYPO3),
356 'username' => htmlspecialchars($GLOBALS['BE_USER']->user
['username']),
357 'uniqueID' => t3lib_div
::shortMD5(uniqid('')),
358 'securityLevel' => $this->loginSecurityLevel
,
359 'TYPO3_mainDir' => TYPO3_mainDir
,
360 'pageModule' => $pageModule,
361 'condensedMode' => $GLOBALS['BE_USER']->uc
['condensedMode'] ?
1 : 0 ,
362 'workspaceFrontendPreviewEnabled' => $GLOBALS['BE_USER']->workspace
!= 0 && !$GLOBALS['BE_USER']->user
['workspace_preview'] ?
0 : 1,
363 'veriCode' => $GLOBALS['BE_USER']->veriCode(),
364 'denyFileTypes' => PHP_EXTENSIONS_DEFAULT
,
365 'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ?
intval($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) : FALSE,
368 'waitTitle' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_logging_in') ,
369 'refresh_login_failed' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed'),
370 'refresh_login_failed_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed_message'),
371 'refresh_login_title' => sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_title'), htmlspecialchars($GLOBALS['BE_USER']->user
['username'])),
372 'login_expired' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_expired'),
373 'refresh_login_username' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_username'),
374 'refresh_login_password' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_password'),
375 'refresh_login_emptyPassword' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_emptyPassword'),
376 'refresh_login_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_button'),
377 'refresh_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_logout_button'),
378 'please_wait' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.please_wait'),
379 'be_locked' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.be_locked'),
380 'refresh_login_countdown_singular' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown_singular'),
381 'refresh_login_countdown' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown'),
382 'login_about_to_expire' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire'),
383 'login_about_to_expire_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire_title'),
384 'refresh_login_refresh_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_refresh_button'),
385 'refresh_direct_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_direct_logout_button'),
387 $t3LLLfileUpload = array(
388 'windowTitle' => $GLOBALS['LANG']->getLL('fileUpload_windowTitle'),
389 'buttonSelectFiles' => $GLOBALS['LANG']->getLL('fileUpload_buttonSelectFiles'),
390 'buttonCancelAll' => $GLOBALS['LANG']->getLL('fileUpload_buttonCancelAll'),
391 'infoComponentMaxFileSize' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentMaxFileSize'),
392 'infoComponentFileUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileUploadLimit'),
393 'infoComponentFileTypeLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileTypeLimit'),
394 'infoComponentOverrideFiles' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentOverrideFiles'),
395 'processRunning' => $GLOBALS['LANG']->getLL('fileUpload_processRunning'),
396 'uploadWait' => $GLOBALS['LANG']->getLL('fileUpload_uploadWait'),
397 'uploadStarting' => $GLOBALS['LANG']->getLL('fileUpload_uploadStarting'),
398 'uploadProgress' => $GLOBALS['LANG']->getLL('fileUpload_uploadProgress'),
399 'uploadSuccess' => $GLOBALS['LANG']->getLL('fileUpload_uploadSuccess'),
400 'errorQueueLimitExceeded' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueLimitExceeded'),
401 'errorQueueFileSizeLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueFileSizeLimit'),
402 'errorQueueZeroByteFile' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueZeroByteFile'),
403 'errorQueueInvalidFiletype' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueInvalidFiletype'),
404 'errorUploadHttp' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadHttpError'),
405 'errorUploadMissingUrl' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadMissingUrl'),
406 'errorUploadIO' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadIO'),
407 'errorUploadSecurityError' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadSecurityError'),
408 'errorUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadLimit'),
409 'errorUploadFailed' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFailed'),
410 'errorUploadFileIDNotFound' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileIDNotFound'),
411 'errorUploadFileValidation' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileValidation'),
412 'errorUploadFileCancelled' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileCancelled'),
413 'errorUploadStopped' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadStopped'),
414 'allErrorMessageTitle' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageTitle'),
415 'allErrorMessageText' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageText'),
416 'allError401' => $GLOBALS['LANG']->getLL('fileUpload_allError401'),
417 'allError2038' => $GLOBALS['LANG']->getLL('fileUpload_allError2038'),
420 // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
421 if ($GLOBALS['LANG']->charSet
!== 'utf-8') {
422 $t3Configuration['username'] = $GLOBALS['LANG']->csConvObj
->conv($t3Configuration['username'], $GLOBALS['LANG']->charSet
, 'utf-8');
423 $GLOBALS['LANG']->csConvObj
->convArray($t3LLLcore, $GLOBALS['LANG']->charSet
, 'utf-8');
424 $GLOBALS['LANG']->csConvObj
->convArray($t3LLLfileUpload, $GLOBALS['LANG']->charSet
, 'utf-8');
428 TYPO3.configuration = ' . json_encode($t3Configuration) . ';
430 core : ' . json_encode($t3LLLcore) . ',
431 fileUpload: ' . json_encode($t3LLLfileUpload) . '
437 function typoSetup() { //
438 this.PATH_typo3 = TYPO3.configuration.PATH_typo3;
439 this.PATH_typo3_enc = TYPO3.configuration.PATH_typo3_enc;
440 this.username = TYPO3.configuration.username;
441 this.uniqueID = TYPO3.configuration.uniqueID;
442 this.navFrameWidth = 0;
443 this.securityLevel = TYPO3.configuration.securityLevel;
444 this.veriCode = TYPO3.configuration.veriCode;
445 this.denyFileTypes = TYPO3.configuration.denyFileTypes;
447 var TS = new typoSetup();
449 var currentModuleLoaded = "";
450 var goToModule = ' . $goToModuleSwitch . ';
453 * Frameset Module object
455 * Used in main modules with a frameset for submodules to keep the ID between modules
456 * Typically that is set by something like this in a Web>* sub module:
457 * if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'";
458 * if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
460 function fsModules() { //
461 this.recentIds=new Array(); // used by frameset modules to track the most recent used id for list frame.
462 this.navFrameHighlightedID=new Array(); // used by navigation frames to track which row id was highlighted last time
463 this.currentMainLoaded="";
464 this.currentBank="0";
466 var fsMod = new fsModules();' . $moduleFramesHelper . ';';
470 // Check editing of page:
471 $this->handlePageEditing();
472 $this->setStartupModule();
476 * Checking if the "&edit" variable was sent so we can open it for editing the page.
477 * Code based on code from "alt_shortcut.php"
481 protected function handlePageEditing() {
483 if(!t3lib_extMgm
::isLoaded('cms')) {
488 $editId = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('edit'));
493 // Looking up the page to edit, checking permissions:
494 $where = ' AND ('.$GLOBALS['BE_USER']->getPagePermsClause(2)
495 .' OR '.$GLOBALS['BE_USER']->getPagePermsClause(16).')';
497 if(t3lib_div
::testInt($editId)) {
498 $editRecord = t3lib_BEfunc
::getRecordWSOL('pages', $editId, '*', $where);
500 $records = t3lib_BEfunc
::getRecordsByField('pages', 'alias', $editId, $where);
502 if(is_array($records)) {
504 $editRecord = current($records);
505 t3lib_BEfunc
::workspaceOL('pages', $editRecord);
509 // If the page was accessible, then let the user edit it.
510 if(is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) {
511 // Setting JS code to open editing:
513 // Load page to edit:
514 window.setTimeout("top.loadEditId('.intval($editRecord['uid']).');", 500);
516 // Checking page edit parameter:
517 if(!$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
519 // Expanding page tree:
520 t3lib_BEfunc
::openPageTree(intval($editRecord['pid']), !$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
524 // Warning about page editing:
525 alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)).');
532 * Sets the startup module from either GETvars module and mpdParams or user configuration.
536 protected function setStartupModule() {
537 $startModule = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('module'));
540 if ($GLOBALS['BE_USER']->uc
['startModule']) {
541 $startModule = $GLOBALS['BE_USER']->uc
['startModule'];
542 } else if($GLOBALS['BE_USER']->uc
['startInTaskCenter']) {
543 $startModule = 'user_task';
547 $moduleParameters = t3lib_div
::_GET('modParams');
551 function startInModule(modName, cMR_flag, addGetVars) {
552 Event.observe(document, \'dom:loaded\', function() {
553 top.goToModule(modName, cMR_flag, addGetVars);
557 startInModule(\''.$startModule.'\', false, '.t3lib_div
::quoteJSvalue($moduleParameters).');
563 * generates the code for the TYPO3 logo, either the default TYPO3 logo or a custom one
565 * @return string HTML code snippet to display the TYPO3 logo
567 protected function getLogo() {
568 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
569 '<img'.t3lib_iconWorks
::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
572 // overwrite with custom logo
573 if($GLOBALS['TBE_STYLES']['logo']) {
574 if(substr($GLOBALS['TBE_STYLES']['logo'], 0, 3) == '../') {
575 $imgInfo = @getimagesize
(PATH_site
.substr($GLOBALS['TBE_STYLES']['logo'], 3));
577 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
578 '<img src="'.$GLOBALS['TBE_STYLES']['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
586 * adds a javascript snippet to the backend
588 * @param string javascript snippet
591 public function addJavascript($javascript) {
592 // TODO do we need more checks?
593 if(!is_string($javascript)) {
594 throw new InvalidArgumentException('parameter $javascript must be of type string', 1195129553);
597 $this->js
.= $javascript;
601 * adds a javscript file to the backend after it has been checked that it exists
603 * @param string javascript file reference
604 * @return boolean true if the javascript file was successfully added, false otherwise
606 public function addJavascriptFile($javascriptFile) {
607 $jsFileAdded = false;
609 //TODO add more checks if neccessary
610 if(file_exists(t3lib_div
::resolveBackPath(PATH_typo3
.$javascriptFile))) {
611 $this->jsFiles
[] = $javascriptFile;
619 * adds a css snippet to the backend
621 * @param string css snippet
624 public function addCss($css) {
625 if(!is_string($css)) {
626 throw new InvalidArgumentException('parameter $css must be of type string', 1195129642);
633 * adds a css file to the backend after it has been checked that it exists
635 * @param string the css file's name with out the .css ending
636 * @param string css file reference
637 * @return boolean true if the css file was added, false otherwise
639 public function addCssFile($cssFileName, $cssFile) {
640 $cssFileAdded = false;
642 //TODO add more checks if neccessary
643 if(file_exists(t3lib_div
::resolveBackPath(PATH_typo3
.$cssFile))) {
644 // prevent overwriting existing css files
645 if(empty($this->cssFiles
[$cssFileName])) {
646 $this->cssFiles
[$cssFileName] = $cssFile;
647 $cssFileAdded = true;
651 return $cssFileAdded;
655 * adds an item to the toolbar, the class file for the toolbar item must be loaded at this point
657 * @param string toolbar item name, f.e. tx_toolbarExtension_coolItem
658 * @param string toolbar item class name, f.e. tx_toolbarExtension_coolItem
661 public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
662 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
664 if(!($toolbarItem instanceof backend_toolbarItem
)) {
665 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195125501);
668 if($toolbarItem->checkAccess()) {
669 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
678 if(defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']) {
679 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']);
683 // document generation
684 $TYPO3backend = t3lib_div
::makeInstance('TYPO3backend');
686 // include extensions which may add css, javascript or toolbar items
687 if(is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) {
688 foreach($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) {
689 include_once($additionalBackendItem);
693 $TYPO3backend->render();