62568175cc1777d840412b718ac699132963971b
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 // create challenge for the (re)login form and save it in the session.
346 $challenge = md5(uniqid('').getmypid());
348 $_SESSION['login_challenge'] = $challenge;
350 // determine security level from conf vars and default to super challenged
351 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) {
352 $this->loginSecurityLevel
= $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'];
354 $this->loginSecurityLevel
= 'superchallenged';
358 Ext.BLANK_IMAGE_URL = "' .
359 // t3lib_div::locationHeaderUrl() will include '/typo3/' in the URL
360 htmlspecialchars(t3lib_div
::locationHeaderUrl('gfx/clear.gif')) .
364 TYPO3.configuration = ' . json_encode(array(
365 'siteUrl' => t3lib_div
::getIndpEnv('TYPO3_SITE_URL'),
366 'PATH_typo3' => $pathTYPO3,
367 'PATH_typo3_enc' => rawurlencode($pathTYPO3),
368 'username' => htmlspecialchars($GLOBALS['BE_USER']->user
['username']),
369 'uniqueID' => t3lib_div
::shortMD5(uniqid('')),
370 'securityLevel' => $this->loginSecurityLevel
,
371 'challenge' => $challenge,
372 'TYPO3_mainDir' => TYPO3_mainDir
,
373 'pageModule' => $pageModule,
374 'condensedMode' => $GLOBALS['BE_USER']->uc
['condensedMode'] ?
1 : 0 ,
375 'workspaceFrontendPreviewEnabled' => (($GLOBALS['BE_USER']->workspace
!= 0 && !$GLOBALS['BE_USER']->user
['workspace_preview']) ?
'false' : 'true'),
376 'veriCode' => $GLOBALS['BE_USER']->veriCode(),
377 'denyFileTypes' => PHP_EXTENSIONS_DEFAULT
,
380 core : ' . json_encode(array(
381 'waitTitle' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_logging_in') ,
382 'refresh_login_failed' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed'),
383 'refresh_login_failed_message' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_failed_message'),
384 'refresh_login_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_title'),
385 'login_expired' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_expired'),
386 'refresh_login_username' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_username'),
387 'refresh_login_password' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_password'),
388 'refresh_login_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_button'),
389 'refresh_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_logout_button'),
390 'please_wait' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.please_wait'),
391 'be_locked' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.be_locked'),
392 'refresh_login_countdown_singular' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown_singular'),
393 'refresh_login_countdown' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_countdown'),
394 'login_about_to_expire' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire'),
395 'login_about_to_expire_title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.login_about_to_expire_title'),
396 'refresh_login_refresh_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_login_refresh_button'),
397 'refresh_direct_logout_button' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:mess.refresh_direct_logout_button'),
399 fileUpload: ' . json_encode(array(
400 'windowTitle' => $GLOBALS['LANG']->getLL('fileUpload_windowTitle'),
401 'buttonSelectFiles' => $GLOBALS['LANG']->getLL('fileUpload_buttonSelectFiles'),
402 'buttonCancelAll' => $GLOBALS['LANG']->getLL('fileUpload_buttonCancelAll'),
403 'infoComponentMaxFileSize' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentMaxFileSize'),
404 'infoComponentFileUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileUploadLimit'),
405 'infoComponentFileTypeLimit' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentFileTypeLimit'),
406 'infoComponentOverrideFiles' => $GLOBALS['LANG']->getLL('fileUpload_infoComponentOverrideFiles'),
407 'processRunning' => $GLOBALS['LANG']->getLL('fileUpload_processRunning'),
408 'uploadWait' => $GLOBALS['LANG']->getLL('fileUpload_uploadWait'),
409 'uploadStarting' => $GLOBALS['LANG']->getLL('fileUpload_uploadStarting'),
410 'uploadProgress' => $GLOBALS['LANG']->getLL('fileUpload_uploadProgress'),
411 'uploadSuccess' => $GLOBALS['LANG']->getLL('fileUpload_uploadSuccess'),
412 'errorQueueLimitExceeded' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueLimitExceeded'),
413 'errorQueueFileSizeLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueFileSizeLimit'),
414 'errorQueueZeroByteFile' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueZeroByteFile'),
415 'errorQueueInvalidFiletype' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueInvalidFiletype'),
416 'errorUploadHttp' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadHttp'),
417 'errorUploadMissingUrl' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadMissingUrl'),
418 'errorUploadIO' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadIO'),
419 'errorUploadSecurityError' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadSecurityError'),
420 'errorUploadLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadLimit'),
421 'errorUploadFailed' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFailed'),
422 'errorUploadFileIDNotFound' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileIDNotFound'),
423 'errorUploadFileValidation' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileValidation'),
424 'errorUploadFileCancelled' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileCancelled'),
425 'errorUploadStopped' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadStopped'),
431 function typoSetup() { //
432 this.PATH_typo3 = TYPO3.configuration.PATH_typo3;
433 this.PATH_typo3_enc = TYPO3.configuration.PATH_typo3_enc;
434 this.username = TYPO3.configuration.username;
435 this.uniqueID = TYPO3.configuration.uniqueID;
436 this.navFrameWidth = 0;
437 this.securityLevel = TYPO3.configuration.securityLevel;
438 this.veriCode = TYPO3.configuration.veriCode;
439 this.denyFileTypes = TYPO3.configuration.denyFileTypes;
441 var TS = new typoSetup();
443 var currentModuleLoaded = "";
444 var goToModule = ' . $goToModuleSwitch . ';
447 * Frameset Module object
449 * Used in main modules with a frameset for submodules to keep the ID between modules
450 * Typically that is set by something like this in a Web>* sub module:
451 * if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'";
452 * if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
454 function fsModules() { //
455 this.recentIds=new Array(); // used by frameset modules to track the most recent used id for list frame.
456 this.navFrameHighlightedID=new Array(); // used by navigation frames to track which row id was highlighted last time
457 this.currentMainLoaded="";
458 this.currentBank="0";
460 var fsMod = new fsModules();' . $moduleFramesHelper . ';';
464 // Check editing of page:
465 $this->handlePageEditing();
466 $this->setStartupModule();
470 * Checking if the "&edit" variable was sent so we can open it for editing the page.
471 * Code based on code from "alt_shortcut.php"
475 protected function handlePageEditing() {
477 if(!t3lib_extMgm
::isLoaded('cms')) {
482 $editId = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('edit'));
487 // Looking up the page to edit, checking permissions:
488 $where = ' AND ('.$GLOBALS['BE_USER']->getPagePermsClause(2)
489 .' OR '.$GLOBALS['BE_USER']->getPagePermsClause(16).')';
491 if(t3lib_div
::testInt($editId)) {
492 $editRecord = t3lib_BEfunc
::getRecordWSOL('pages', $editId, '*', $where);
494 $records = t3lib_BEfunc
::getRecordsByField('pages', 'alias', $editId, $where);
496 if(is_array($records)) {
498 $editRecord = current($records);
499 t3lib_BEfunc
::workspaceOL('pages', $editRecord);
503 // If the page was accessible, then let the user edit it.
504 if(is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) {
505 // Setting JS code to open editing:
507 // Load page to edit:
508 window.setTimeout("top.loadEditId('.intval($editRecord['uid']).');", 500);
510 // Checking page edit parameter:
511 if(!$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
513 // Expanding page tree:
514 t3lib_BEfunc
::openPageTree(intval($editRecord['pid']), !$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
518 // Warning about page editing:
519 alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)).');
526 * Sets the startup module from either GETvars module and mpdParams or user configuration.
530 protected function setStartupModule() {
531 $startModule = preg_replace('/[^[:alnum:]_]/', '', t3lib_div
::_GET('module'));
534 if ($GLOBALS['BE_USER']->uc
['startModule']) {
535 $startModule = $GLOBALS['BE_USER']->uc
['startModule'];
536 } else if($GLOBALS['BE_USER']->uc
['startInTaskCenter']) {
537 $startModule = 'user_task';
541 $moduleParameters = t3lib_div
::_GET('modParams');
545 function startInModule(modName, cMR_flag, addGetVars) {
546 Event.observe(document, \'dom:loaded\', function() {
547 top.goToModule(modName, cMR_flag, addGetVars);
551 startInModule(\''.$startModule.'\', false, \''.$moduleParameters.'\');
557 * generates the code for the TYPO3 logo, either the default TYPO3 logo or a custom one
559 * @return string HTML code snippet to display the TYPO3 logo
561 protected function getLogo() {
562 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
563 '<img'.t3lib_iconWorks
::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
566 // overwrite with custom logo
567 if($GLOBALS['TBE_STYLES']['logo']) {
568 if(substr($GLOBALS['TBE_STYLES']['logo'], 0, 3) == '../') {
569 $imgInfo = @getimagesize
(PATH_site
.substr($GLOBALS['TBE_STYLES']['logo'], 3));
571 $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
572 '<img src="'.$GLOBALS['TBE_STYLES']['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
580 * adds a javascript snippet to the backend
582 * @param string javascript snippet
585 public function addJavascript($javascript) {
586 // TODO do we need more checks?
587 if(!is_string($javascript)) {
588 throw new InvalidArgumentException('parameter $javascript must be of type string', 1195129553);
591 $this->js
.= $javascript;
595 * adds a javscript file to the backend after it has been checked that it exists
597 * @param string javascript file reference
598 * @return boolean true if the javascript file was successfully added, false otherwise
600 public function addJavascriptFile($javascriptFile) {
601 $jsFileAdded = false;
603 //TODO add more checks if neccessary
604 if(file_exists(t3lib_div
::resolveBackPath(PATH_typo3
.$javascriptFile))) {
605 $this->jsFiles
[] = $javascriptFile;
613 * adds a css snippet to the backend
615 * @param string css snippet
618 public function addCss($css) {
619 if(!is_string($css)) {
620 throw new InvalidArgumentException('parameter $css must be of type string', 1195129642);
627 * adds a css file to the backend after it has been checked that it exists
629 * @param string the css file's name with out the .css ending
630 * @param string css file reference
631 * @return boolean true if the css file was added, false otherwise
633 public function addCssFile($cssFileName, $cssFile) {
634 $cssFileAdded = false;
636 //TODO add more checks if neccessary
637 if(file_exists(t3lib_div
::resolveBackPath(PATH_typo3
.$cssFile))) {
638 // prevent overwriting existing css files
639 if(empty($this->cssFiles
[$cssFileName])) {
640 $this->cssFiles
[$cssFileName] = $cssFile;
641 $cssFileAdded = true;
645 return $cssFileAdded;
649 * adds an item to the toolbar, the class file for the toolbar item must be loaded at this point
651 * @param string toolbar item name, f.e. tx_toolbarExtension_coolItem
652 * @param string toolbar item class name, f.e. tx_toolbarExtension_coolItem
655 public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
656 $toolbarItem = t3lib_div
::makeInstance($toolbarItemClassName, $this);
658 if(!($toolbarItem instanceof backend_toolbarItem
)) {
659 throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195125501);
662 if($toolbarItem->checkAccess()) {
663 $this->toolbarItems
[$toolbarItemName] = $toolbarItem;
672 if(defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']) {
673 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/backend.php']);
677 // document generation
678 $TYPO3backend = t3lib_div
::makeInstance('TYPO3backend');
680 // include extensions which may add css, javascript or toolbar items
681 if(is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) {
682 foreach($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) {
683 include_once($additionalBackendItem);
687 $TYPO3backend->render();