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;
81 * @var $pageRenderer t3lib_PageRenderer
83 protected $pageRenderer;
90 public function __construct() {
92 // Initializes the backend modules structure for use later.
93 $this->moduleLoader
= t3lib_div
::makeInstance('t3lib_loadModules');
94 $this->moduleLoader
->load($GLOBALS['TBE_MODULES']);
96 $this->moduleMenu
= t3lib_div
::makeInstance('ModuleMenu');
98 $this->pageRenderer
= $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
99 $this->pageRenderer
->loadScriptaculous('builder,effects,controls,dragdrop');
100 $this->pageRenderer
->loadExtJS();
102 // register the extDirect API providers
103 // Note: we need to iterate thru the object, because the addProvider method
104 // does this only with multiple arguments
105 $this->pageRenderer
->addExtOnReadyCode(
106 'for (var api in Ext.app.ExtDirectAPI) {
107 Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);
109 TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
115 // add default BE javascript
117 $this->jsFiles
= array(
118 'contrib/swfupload/swfupload.js',
119 'contrib/swfupload/plugins/swfupload.swfobject.js',
120 'contrib/swfupload/plugins/swfupload.cookies.js',
121 'contrib/swfupload/plugins/swfupload.queue.js',
124 'js/extjs/backendsizemanager.js',
125 'js/toolbarmanager.js',
127 'js/iecompatibility.js',
129 '../t3lib/jsfunc.evalfield.js',
130 '../t3lib/js/extjs/ux/flashmessages.js',
132 'js/loginrefresh.js',
133 'js/extjs/viewport.js',
134 'js/extjs/viewportConfiguration.js',
137 // add default BE css
139 $this->cssFiles
= array();
141 $this->toolbarItems
= array();
142 $this->initializeCoreToolbarItems();
144 $this->menuWidth
= $this->menuWidthDefault
;
145 if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth
) {
146 $this->menuWidth
= (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
151 * initializes the core toolbar items
155 protected function initializeCoreToolbarItems() {
157 $coreToolbarItems = array(
158 'workspaceSelector' => 'WorkspaceSelector',
159 'shortcuts' => 'ShortcutMenu',
160 'clearCacheActions' => 'ClearCacheMenu',
161 'backendSearch' => 'BackendSearchMenu'
164 foreach($coreToolbarItems as $toolbarItemName => $toolbarItemClassName) {
165 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
167 if(!($toolbarItem instanceof backend_toolbarItem
)) {
168 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195126772);
171 if($toolbarItem->checkAccess()) {
172 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
180 * main function generating the BE scaffolding
184 public function render() {
186 // prepare the scaffolding, at this point extension may still add javascript and css
187 $logo = t3lib_div
::makeInstance('TYPO3Logo');
188 $logo->setLogo('gfx/typo3logo_mini.png');
190 $menu = $this->moduleMenu
->render();
192 if ($this->menuWidth
!= $this->menuWidthDefault
) {
195 margin-left: ' . $this->menuWidth
. 'px;
200 // create backend scaffolding
201 $backendScaffolding = '
202 <div id="typo3-backend">
203 <div id="typo3-top-container" class="x-hide-display">
204 <div id="typo3-logo">'.$logo->render().'</div>
205 <div id="typo3-top" class="typo3-top-toolbar">' .
206 $this->renderToolbar() .
209 <div id="typo3-main-container">
210 <div id="typo3-side-menu" class="x-hide-display">' .
213 <div id="typo3-content" class="x-hide-display">
214 <iframe src="alt_intro.php" name="content" id="content" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto"></iframe>
220 /******************************************************
221 * now put the complete backend document together
222 ******************************************************/
224 foreach($this->cssFiles
as $cssFileName => $cssFile) {
225 $this->pageRenderer
->addCssFile($cssFile);
227 // load addditional css files to overwrite existing core styles
228 if(!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
229 $this->pageRenderer
->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
233 if(!empty($this->css
)) {
234 $this->pageRenderer
->addCssInlineBlock('BackendInlineCSS', $this->css
);
237 foreach ($this->jsFiles
as $jsFile) {
238 $this->pageRenderer
->addJsFile($jsFile);
240 // we mustn't compress this file
241 $this->pageRenderer
->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Backend', NULL
, FALSE
);
243 $this->generateJavascript();
244 $this->pageRenderer
->addJsInlineCode('BackendInlineJavascript', $this->js
);
247 // set document title:
248 $title = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
249 ?
$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].' [TYPO3 '.TYPO3_version
.']'
250 : 'TYPO3 '.TYPO3_version
253 // start page header:
254 $this->content
.= $GLOBALS['TBE_TEMPLATE']->startPage($title);
255 $this->content
.= $backendScaffolding;
256 $this->content
.= $GLOBALS['TBE_TEMPLATE']->endPage();
262 * renders the items in the top toolbar
264 * @return string top toolbar elements as HTML
266 protected function renderToolbar() {
268 // move search to last position
269 $search = $this->toolbarItems
['backendSearch'];
270 unset($this->toolbarItems
['backendSearch']);
271 $this->toolbarItems
['backendSearch'] = $search;
273 $toolbar = '<ul id="typo3-toolbar">';
274 $toolbar.= '<li>'.$this->getLoggedInUserLabel().'</li>
275 <li><div id="logout-button" class="toolbar-item no-separator">'.$this->moduleMenu
->renderLogoutButton().'</div></li>';
277 foreach($this->toolbarItems
as $toolbarItem) {
278 $menu = $toolbarItem->render();
280 $additionalAttributes = $toolbarItem->getAdditionalAttributes();
281 $toolbar .= '<li' . $additionalAttributes . '>' .$menu. '</li>';
285 return $toolbar.'</ul>';
289 * Gets the label of the BE user currently logged in
291 * @return string html code snippet displaying the currently logged in user
293 protected function getLoggedInUserLabel() {
294 global $BE_USER, $BACK_PATH;
296 $icon = '<img'.t3lib_iconWorks
::skinImg(
298 $BE_USER->isAdmin() ?
299 'gfx/i/be_users_admin.gif' :
300 'gfx/i/be_users.gif',
301 'width="18" height="16"'
303 .' title="" alt="" />';
305 $label = $GLOBALS['BE_USER']->user
['realName'] ?
306 $BE_USER->user
['realName'].' ['.$BE_USER->user
['username'].']' :
307 $BE_USER->user
['username'];
309 // Link to user setup if it's loaded and user has access
311 if (t3lib_extMgm
::isLoaded('setup') && $BE_USER->check('modules','user_setup')) {
312 $link = '<a href="#" onclick="top.goToModule(\'user_setup\');this.blur();return false;">';
315 $username = '">'.$link.$icon.'<span>'.htmlspecialchars($label).'</span>'.($link?
'</a>':'');
318 if($BE_USER->user
['ses_backuserid']) {
319 $username = ' su-user">'.$icon.
320 '<span title="' . $GLOBALS['LANG']->getLL('switchtouser') . '">' .
321 $GLOBALS['LANG']->getLL('switchtousershort') . ' </span>' .
322 '<span>' . htmlspecialchars($label) . '</span>';
325 return '<div id="username" class="toolbar-item no-separator'.$username.'</div>';
329 * Generates the JavaScript code for the backend.
333 protected function generateJavascript() {
335 $pathTYPO3 = t3lib_div
::dirname(t3lib_div
::getIndpEnv('SCRIPT_NAME')).'/';
336 $goToModuleSwitch = $this->moduleMenu
->getGotoModuleJavascript();
337 $moduleFramesHelper = implode(LF
, $this->moduleMenu
->getFsMod());
339 // If another page module was specified, replace the default Page module with the new one
340 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
341 $pageModule = t3lib_BEfunc
::isModuleSetInTBE_MODULES($newPageModule) ?
$newPageModule : 'web_layout';
343 $menuFrameName = 'menu';
344 if($GLOBALS['BE_USER']->uc
['noMenuMode'] === 'icons') {
345 $menuFrameName = 'topmenuFrame';
348 // determine security level from conf vars and default to super challenged
349 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) {
350 $this->loginSecurityLevel
= $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'];
352 $this->loginSecurityLevel
= 'superchallenged';
355 $t3Configuration = array(
356 'siteUrl' => t3lib_div
::getIndpEnv('TYPO3_SITE_URL'),
357 'PATH_typo3' => $pathTYPO3,
358 'PATH_typo3_enc' => rawurlencode($pathTYPO3),
359 'username' => htmlspecialchars($GLOBALS['BE_USER']->user
['username']),
360 'uniqueID' => t3lib_div
::shortMD5(uniqid('')),
361 'securityLevel' => $this->loginSecurityLevel
,
362 'TYPO3_mainDir' => TYPO3_mainDir
,
363 'pageModule' => $pageModule,
364 'condensedMode' => $GLOBALS['BE_USER']->uc
['condensedMode'] ?
1 : 0 ,
365 'inWorkspace' => $GLOBALS['BE_USER']->workspace
!== 0 ?
1 : 0,
366 'workspaceFrontendPreviewEnabled' => $GLOBALS['BE_USER']->user
['workspace_preview'] ?
1 : 0,
367 'veriCode' => $GLOBALS['BE_USER']->veriCode(),
368 'denyFileTypes' => PHP_EXTENSIONS_DEFAULT
,
369 'moduleMenuWidth' => $this->menuWidth
- 1,
370 'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ?
intval($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) : FALSE
,
373 'waitTitle' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_logging_in') ,
374 'refresh_login_failed' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed'),
375 'refresh_login_failed_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed_message'),
376 'refresh_login_title' => sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_title'), htmlspecialchars($GLOBALS['BE_USER']->user
['username'])),
377 'login_expired' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_expired'),
378 'refresh_login_username' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_username'),
379 'refresh_login_password' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_password'),
380 'refresh_login_emptyPassword' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_emptyPassword'),
381 'refresh_login_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_button'),
382 'refresh_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_logout_button'),
383 'please_wait' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.please_wait'),
384 'be_locked' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.be_locked'),
385 'refresh_login_countdown_singular' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown_singular'),
386 'refresh_login_countdown' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown'),
387 'login_about_to_expire' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire'),
388 'login_about_to_expire_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire_title'),
389 'refresh_login_refresh_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_refresh_button'),
390 'refresh_direct_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_direct_logout_button'),
391 'tabs_closeAll' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.closeAll'),
393 $t3LLLfileUpload = array(
394 'windowTitle' => $GLOBALS['LANG']->getLL('fileUpload_windowTitle'),
395 'buttonSelectFiles' => $GLOBALS['LANG']->getLL('fileUpload_buttonSelectFiles'),
396 'buttonCancelAll' => $GLOBALS['LANG']->getLL('fileUpload_buttonCancelAll'),
397 'infoComponentMaxFileSize' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentMaxFileSize'),
398 'infoComponentFileUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileUploadLimit'),
399 'infoComponentFileTypeLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileTypeLimit'),
400 'infoComponentOverrideFiles' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentOverrideFiles'),
401 'processRunning' => $GLOBALS['LANG']->getLL('fileUpload_processRunning'),
402 'uploadWait' => $GLOBALS['LANG']->getLL('fileUpload_uploadWait'),
403 'uploadStarting' => $GLOBALS['LANG']->getLL('fileUpload_uploadStarting'),
404 'uploadProgress' => $GLOBALS['LANG']->getLL('fileUpload_uploadProgress'),
405 'uploadSuccess' => $GLOBALS['LANG']->getLL('fileUpload_uploadSuccess'),
406 'errorQueueLimitExceeded' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueLimitExceeded'),
407 'errorQueueFileSizeLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueFileSizeLimit'),
408 'errorQueueZeroByteFile' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueZeroByteFile'),
409 'errorQueueInvalidFiletype' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueInvalidFiletype'),
410 'errorUploadHttp' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadHttpError'),
411 'errorUploadMissingUrl' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadMissingUrl'),
412 'errorUploadIO' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadIO'),
413 'errorUploadSecurityError' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadSecurityError'),
414 'errorUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadLimit'),
415 'errorUploadFailed' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFailed'),
416 'errorUploadFileIDNotFound' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileIDNotFound'),
417 'errorUploadFileValidation' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileValidation'),
418 'errorUploadFileCancelled' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileCancelled'),
419 'errorUploadStopped' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadStopped'),
420 'allErrorMessageTitle' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageTitle'),
421 'allErrorMessageText' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageText'),
422 'allError401' => $GLOBALS['LANG']->getLL('fileUpload_allError401'),
423 'allError2038' => $GLOBALS['LANG']->getLL('fileUpload_allError2038'),
426 // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
427 if ($GLOBALS['LANG']->charSet
!== 'utf-8') {
428 $t3Configuration['username'] = $GLOBALS['LANG']->csConvObj
->conv($t3Configuration['username'], $GLOBALS['LANG']->charSet
, 'utf-8');
429 $GLOBALS['LANG']->csConvObj
->convArray($t3LLLcore, $GLOBALS['LANG']->charSet
, 'utf-8');
430 $GLOBALS['LANG']->csConvObj
->convArray($t3LLLfileUpload, $GLOBALS['LANG']->charSet
, 'utf-8');
434 TYPO3.configuration = ' . json_encode($t3Configuration) . ';
436 core : ' . json_encode($t3LLLcore) . ',
437 fileUpload: ' . json_encode($t3LLLfileUpload) . '
443 function typoSetup() { //
444 this.PATH_typo3 = TYPO3.configuration.PATH_typo3;
445 this.PATH_typo3_enc = TYPO3.configuration.PATH_typo3_enc;
446 this.username = TYPO3.configuration.username;
447 this.uniqueID = TYPO3.configuration.uniqueID;
448 this.navFrameWidth = 0;
449 this.securityLevel = TYPO3.configuration.securityLevel;
450 this.veriCode = TYPO3.configuration.veriCode;
451 this.denyFileTypes = TYPO3.configuration.denyFileTypes;
453 var TS = new typoSetup();
455 var currentModuleLoaded = "";
458 * Frameset Module object
460 * Used in main modules with a frameset for submodules to keep the ID between modules
461 * Typically that is set by something like this in a Web>* sub module:
462 * if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'";
463 * if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
465 function fsModules() { //
466 this.recentIds=new Array(); // used by frameset modules to track the most recent used id for list frame.
467 this.navFrameHighlightedID=new Array(); // used by navigation frames to track which row id was highlighted last time
468 this.currentMainLoaded="";
469 this.currentBank="0";
471 var fsMod = new fsModules();' . $moduleFramesHelper . ';';
473 // add goToModule code
474 $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
475 $pageRenderer->addExtOnReadyCode('
476 top.goToModule = ' . $goToModuleSwitch . ';
479 // Check editing of page:
480 $this->handlePageEditing();
481 $this->setStartupModule();
485 * Checking if the "&edit" variable was sent so we can open it for editing the page.
486 * Code based on code from "alt_shortcut.php"
490 protected function handlePageEditing() {
492 if(!t3lib_extMgm
::isLoaded('cms')) {
497 $editId = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('edit'));
502 // Looking up the page to edit, checking permissions:
503 $where = ' AND ('.$GLOBALS['BE_USER']->getPagePermsClause(2)
504 .' OR '.$GLOBALS['BE_USER']->getPagePermsClause(16).')';
506 if(t3lib_div
::testInt($editId)) {
507 $editRecord = t3lib_BEfunc
::getRecordWSOL('pages', $editId, '*', $where);
509 $records = t3lib_BEfunc
::getRecordsByField('pages', 'alias', $editId, $where);
511 if(is_array($records)) {
513 $editRecord = current($records);
514 t3lib_BEfunc
::workspaceOL('pages', $editRecord);
518 // If the page was accessible, then let the user edit it.
519 if(is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) {
520 // Setting JS code to open editing:
522 // Load page to edit:
523 window.setTimeout("top.loadEditId('.intval($editRecord['uid']).');", 500);
525 // Checking page edit parameter:
526 if(!$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
528 // Expanding page tree:
529 t3lib_BEfunc
::openPageTree(intval($editRecord['pid']), !$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
533 // Warning about page editing:
534 alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)).');
541 * Sets the startup module from either GETvars module and mpdParams or user configuration.
545 protected function setStartupModule() {
546 $startModule = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('module'));
549 if ($GLOBALS['BE_USER']->uc
['startModule']) {
550 $startModule = $GLOBALS['BE_USER']->uc
['startModule'];
551 } else if($GLOBALS['BE_USER']->uc
['startInTaskCenter']) {
552 $startModule = 'user_task';
556 $moduleParameters = t3lib_div
::_GET('modParams');
558 $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
559 $pageRenderer->addExtOnReadyCode('
561 function startInModule(modName, cMR_flag, addGetVars) {
562 Ext.onReady(function() {
563 top.goToModule(modName, cMR_flag, addGetVars);
567 startInModule(\''.$startModule.'\', false, '.t3lib_div
::quoteJSvalue($moduleParameters).');
573 * generates the code for the TYPO3 logo, either the default TYPO3 logo or a custom one
575 * @return string HTML code snippet to display the TYPO3 logo
577 protected function getLogo() {
578 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
579 '<img'.t3lib_iconWorks
::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
582 // overwrite with custom logo
583 if($GLOBALS['TBE_STYLES']['logo']) {
584 if(substr($GLOBALS['TBE_STYLES']['logo'], 0, 3) == '../') {
585 $imgInfo = @getimagesize
(PATH_site
.substr($GLOBALS['TBE_STYLES']['logo'], 3));
587 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
588 '<img src="'.$GLOBALS['TBE_STYLES']['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
596 * adds a javascript snippet to the backend
598 * @param string javascript snippet
601 public function addJavascript($javascript) {
602 // TODO do we need more checks?
603 if(!is_string($javascript)) {
604 throw new InvalidArgumentException('parameter $javascript must be of type string', 1195129553);
607 $this->js
.= $javascript;
611 * adds a javscript file to the backend after it has been checked that it exists
613 * @param string javascript file reference
614 * @return boolean true if the javascript file was successfully added, false otherwise
616 public function addJavascriptFile($javascriptFile) {
617 $jsFileAdded = false
;
619 //TODO add more checks if neccessary
620 if(file_exists(t3lib_div
::resolveBackPath(PATH_typo3
.$javascriptFile))) {
621 $this->jsFiles
[] = $javascriptFile;
629 * adds a css snippet to the backend
631 * @param string css snippet
634 public function addCss($css) {
635 if(!is_string($css)) {
636 throw new InvalidArgumentException('parameter $css must be of type string', 1195129642);
643 * adds a css file to the backend after it has been checked that it exists
645 * @param string the css file's name with out the .css ending
646 * @param string css file reference
647 * @return boolean true if the css file was added, false otherwise
649 public function addCssFile($cssFileName, $cssFile) {
650 $cssFileAdded = false
;
652 if(empty($this->cssFiles
[$cssFileName])) {
653 $this->cssFiles
[$cssFileName] = $cssFile;
654 $cssFileAdded = true
;
657 return $cssFileAdded;
661 * adds an item to the toolbar, the class file for the toolbar item must be loaded at this point
663 * @param string toolbar item name, f.e. tx_toolbarExtension_coolItem
664 * @param string toolbar item class name, f.e. tx_toolbarExtension_coolItem
667 public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
668 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
670 if(!($toolbarItem instanceof backend_toolbarItem
)) {
671 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195125501);
674 if($toolbarItem->checkAccess()) {
675 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
684 if(defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']) {
685 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']);
689 // document generation
690 $TYPO3backend = t3lib_div
::makeInstance('TYPO3backend');
692 // include extensions which may add css, javascript or toolbar items
693 if(is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) {
694 foreach($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) {
695 include_once($additionalBackendItem);
699 $TYPO3backend->render();