/** * Injects $code in header data * * @param string $code A rendered tag suitable for <head> * @param string $type Optional, if left out we assume the code is already wrapped * @param string $key Optional key for referencing later through $GLOBALS['TSFE']->additionalHeaderData, defaults to md5 cheksum of tag * @param int $index Position to take in additionalHeaderData; pushes current resident DOWN * @param array $attributes Attributes of tag * @deprecated */ public function includeHeader($code, $type = NULL, $key = NULL, $index = -1, $attributes = NULL) { if ($key === NULL) { $key = md5($code); } if ($type == 'js') { if ($this->isCached()) { $this->pageRenderer->addJsInlineCode($key, $code, FALSE, $index == 0); } else { $GLOBALS['TSFE']->additionalHeaderData[md5($key)] = t3lib_div::wrapJS($code); } } elseif ($type == 'css') { if ($this->isCached()) { $this->pageRenderer->addCssInlineBlock($key, $code, FALSE, $index == 0); } else { $GLOBALS['TSFE']->additionalHeaderData[md5($key)] = '<style type="text/css">' . $code . '</style>'; } } }
/** * Outputting document style * * @return string HTML style section/link tags */ function docStyle() { // Request background image: if ($this->backGroundImage) { $this->inDocStylesArray[] = ' BODY { background-image: url(' . $this->backPath . $this->backGroundImage . '); }'; } // Add inDoc styles variables as well: $this->inDocStylesArray[] = $this->inDocStyles; $this->inDocStylesArray[] = $this->inDocStyles_TBEstyle; // Implode it all: $inDocStyles = implode(LF, $this->inDocStylesArray); if ($this->styleSheetFile) { $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile); } if ($this->styleSheetFile2) { $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile2); } $this->pageRenderer->addCssInlineBlock('inDocStyles', $inDocStyles . LF . '/*###POSTCSSMARKER###*/'); if ($this->styleSheetFile_post) { $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile_post); } }
/** * Render module content * * @return string $content */ public function render() { /* Add CSS */ $this->pageRenderer->addCssFile($this->resPath . 'js/ux/css/GridFilters.css'); $this->pageRenderer->addCssFile($this->resPath . 'js/ux/css/RangeMenu.css'); $this->pageRenderer->addCssFile($this->resPath . 'css/t3_em.css'); $iconsGfxPath = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['relDir'] . 'gfx/'; $this->pageRenderer->addCssInlineBlock('em-t3skin-icons', ' .x-tree-node-leaf img.tree-edit { background-image:url(' . $iconsGfxPath . 'edit_file.gif);} .x-btn-edit { background-image:url(' . $iconsGfxPath . 'edit2.gif) !important;} .x-btn-new { background-image:url(' . $iconsGfxPath . 'new_el.gif) !important;} .x-btn-delete { background-image:url(' . $iconsGfxPath . 'garbage.gif) !important;} .x-tree-node-leaf img.tree-unknown { background-image:url(' . $iconsGfxPath . 'default.gif); } .x-btn-save { background-image:url(' . $iconsGfxPath . 'savedok.gif) !important;} .x-btn-upload { background-image:url(' . $iconsGfxPath . 'upload.gif) !important;} .x-btn-download { background-image:url(' . $iconsGfxPath . 'down.gif) !important;} .x-btn-undo { background-image:url(' . $this->resPath . 'icons/arrow_undo.png) !important;} .x-btn-redo { background-image:url(' . $this->resPath . 'icons/arrow_redo.png) !important;} .x-btn-jslint { background-image:url(' . $this->resPath . 'icons/jslint.gif) !important;} .x-btn-indent { background-image:url(' . $this->resPath . 'icons/text_indent.png) !important;} '); /* load ExtJS */ $this->pageRenderer->loadExtJS(); $this->pageRenderer->enableExtJSQuickTips(); // Load JavaScript: $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . 'ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.EM', NULL, FALSE); $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . 'ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.EMSOAP', NULL, FALSE); $this->pageRenderer->addExtDirectCode(); // Localization $labels = array(); $this->pageRenderer->addInlineLanguageLabelFile(t3lib_extMgm::extPath('em', 'language/locallang.xml')); $labels['yes'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); $labels['no'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no'); $this->pageRenderer->addInlineLanguageLabelArray($labels); $globalSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['em']); if (!is_array($globalSettings)) { $globalSettings = array('displayMyExtensions' => 0, 'selectedLanguages' => array(), 'inlineToWindow' => 1); } $settings = $this->parentObject->MOD_SETTINGS; $mirrors = unserialize($settings['extMirrors']); $settings['extMirrors'] = array(array('Random (recommended)', '', '', '', '', '', '')); if (is_array($mirrors)) { foreach ($mirrors as $mirror) { $settings['extMirrors'][] = array($mirror['title'], $mirror['country'], $mirror['host'], $mirror['path'], $mirror['sponsor']['name'], $mirror['sponsor']['link'], $mirror['sponsor']['logo']); } } $allowRepositoryUpdate = !intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.hideRepositoryUpdate')); /* file operations */ $fileAllowMove = intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.fileAllowMove')); $fileAllowDelete = intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.fileAllowDelete')); $fileAllowRename = intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.fileAllowRename')); $fileAllowUpload = intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.fileAllowUpload')); $fileAllowCreate = intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.fileAllowCreate')); $fileAllowDownload = intval($GLOBALS['BE_USER']->getTSConfigVal('mod.tools_em.fileAllowDownload')); // add the settings $additionalSettings = array('siteUrl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL'), 'backPath' => $this->parentObject->doc->backPath, 'hasCredentials' => isset($settings['fe_u']) && isset($settings['fe_p']) && $settings['fe_u'] !== '' && $settings['fe_p'] !== '', 'scriptLink' => $this->parentObject->script, 'editorCss' => $this->resPath . 'css/editor.css', 'codemirrorCssPath' => $this->parentObject->doc->backPath . 'contrib/codemirror/css/', 'codemirrorJsPath' => $this->parentObject->doc->backPath . 'contrib/codemirror/js/', 'codemirrorContribPath' => $this->parentObject->doc->backPath . 'contrib/codemirror/contrib/', 'selectedLanguages' => t3lib_div::trimExplode(',', $globalSettings['selectedLanguages'], TRUE), 'state' => $GLOBALS['BE_USER']->uc['moduleData']['tools_em']['States'], 'inlineToWindow' => $globalSettings['inlineToWindow'], 'allowRepositoryUpdate' => $allowRepositoryUpdate, 'displayMyExtensions' => $globalSettings['displayMyExtensions'], 'debug' => $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] > 0, 'fileAllowSave' => $GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit'] == 0, 'fileAllowMove' => 0, 'fileAllowDelete' => 0, 'fileAllowRename' => 0, 'fileAllowUpload' => 0, 'fileAllowCreate' => 0, 'fileAllowDownload' => $fileAllowDownload); $settings = array_merge($settings, $additionalSettings); // Add JS $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . '../t3lib/js/extjs/ux/flashmessages.js'); $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . 'js/extjs/iframepanel.js'); $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . 'contrib/codemirror/js/codemirror.js'); //Plugins $this->pageRenderer->addJsFile($this->resPath . 'js/overrides/ext_overrides.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/custom_plugins.js'); $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js'); $this->pageRenderer->addJsFile($this->parentObject->doc->backPath . '../t3lib/js/extjs/notifications.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/TreeState.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/RowPanelExpander.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/searchfield.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/fileuploadfield.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/menu/RangeMenu.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/menu/ListMenu.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/GridFilters.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/filter/Filter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/filter/BooleanFilter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/filter/DateFilter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/filter/ListFilter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/filter/NumericFilter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/filter/StringFilter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/ux/jslint.js'); //Scripts $this->pageRenderer->addJsFile($this->resPath . 'js/em_layouts.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_components.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_files.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_ter.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_tools.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_locallist.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_repositorylist.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_usertools.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_languages.js'); $this->pageRenderer->addJsFile($this->resPath . 'js/em_settings.js'); //Application $this->pageRenderer->addJsFile($this->resPath . 'js/em_app.js'); // clear flashmessages from php t3lib_FlashMessageQueue::getAllMessagesAndFlush(); $content = ' <div id="em-message-area"></div><div id="em-app"></div> <!-- dummy form to make configuration js happy --> <form name="tsStyleConfigForm" action="" method="post"></form> '; //hook for the extension manager gui if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['em/classes/class.tx_em_extensionamager.php']['renderHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['em/classes/class.tx_em_extensionamager.php']['renderHook'] as $classRef) { $hookObject = t3lib_div::getUserObj($classRef); if (!$hookObject instanceof tx_em_renderHook) { throw new UnexpectedValueException('$hookObject must implement interface tx_em_renderHook', 1298121373); } $hookObject->render($this->pageRenderer, $settings, $content); } } // render settings and labels $this->pageRenderer->addInlineSettingArray('EM', $settings); $this->pageRenderer->addInlineLanguageLabelArray($labels); return $content; }
/** * main function generating the BE scaffolding * * @return void */ public function render() { $this->executeHook('renderPreProcess'); // prepare the scaffolding, at this point extension may still add javascript and css $logo = t3lib_div::makeInstance('TYPO3Logo'); $logo->setLogo('gfx/typo3logo_mini.png'); // create backend scaffolding $backendScaffolding = ' <div id="typo3-top-container" class="x-hide-display"> <div id="typo3-logo">' . $logo->render() . '</div> <div id="typo3-top" class="typo3-top-toolbar">' . $this->renderToolbar() . '</div> </div> '; /****************************************************** * now put the complete backend document together ******************************************************/ foreach ($this->cssFiles as $cssFileName => $cssFile) { $this->pageRenderer->addCssFile($cssFile); // load addditional css files to overwrite existing core styles if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) { $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]); } } if (!empty($this->css)) { $this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css); } foreach ($this->jsFiles as $jsFile) { $this->pageRenderer->addJsFile($jsFile); } $this->generateJavascript(); $this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js); $this->loadResourcesForRegisteredNavigationComponents(); // add state provider $GLOBALS['TBE_TEMPLATE']->setExtDirectStateProvider(); $states = $GLOBALS['BE_USER']->uc['BackendComponents']['States']; //save states in BE_USER->uc $extOnReadyCode = ' Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({ key: "BackendComponents.States", autoRead: false })); '; if ($states) { $extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');'; } $extOnReadyCode .= ' TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration); if (typeof console === "undefined") { console = TYPO3.Backend.DebugConsole; } TYPO3.ContextHelpWindow.init();'; $this->pageRenderer->addExtOnReadyCode($extOnReadyCode); // set document title: $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 ' . TYPO3_version . ']' : 'TYPO3 ' . TYPO3_version; $this->content = $backendScaffolding; // Renders the module page $this->content = $GLOBALS['TBE_TEMPLATE']->render($title, $this->content); $hookConfiguration = array('content' => &$this->content); $this->executeHook('renderPostProcess', $hookConfiguration); echo $this->content; }
/** * main function generating the BE scaffolding * * @return void */ public function render() { $this->executeHook('renderPreProcess'); if (t3lib_div::makeInstance('DonateWindow')->isDonateWindowAllowed()) { $this->pageRenderer->addJsFile('js/donate.js'); } // prepare the scaffolding, at this point extension may still add javascript and css $logo = t3lib_div::makeInstance('TYPO3Logo'); $logo->setLogo('gfx/typo3logo_mini.png'); $menu = $this->moduleMenu->render(); if ($this->menuWidth != $this->menuWidthDefault) { $this->css .= ' #typo3-top { margin-left: ' . $this->menuWidth . 'px; } '; } // create backend scaffolding $backendScaffolding = ' <div id="typo3-backend"> <div id="typo3-top-container" class="x-hide-display"> <div id="typo3-logo">' . $logo->render() . '</div> <div id="typo3-top" class="typo3-top-toolbar">' . $this->renderToolbar() . '</div> </div> <div id="typo3-main-container"> <div id="typo3-side-menu" class="x-hide-display">' . $menu . '</div> <div id="typo3-content" class="x-hide-display"> <iframe src="alt_intro.php" name="content" id="content" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto"></iframe> </div> </div> </div> '; /****************************************************** * now put the complete backend document together ******************************************************/ foreach ($this->cssFiles as $cssFileName => $cssFile) { $this->pageRenderer->addCssFile($cssFile); // load addditional css files to overwrite existing core styles if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) { $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]); } } if (!empty($this->css)) { $this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css); } foreach ($this->jsFiles as $jsFile) { $this->pageRenderer->addJsFile($jsFile); } // Those lines can be removed once we have at least one official ExtDirect router within the backend. $hasExtDirectRouter = FALSE; if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'] as $key => $value) { if (strpos($key, 'TYPO3.Ajax.ExtDirect') !== FALSE) { $hasExtDirectRouter = TRUE; break; } } } if ($hasExtDirectRouter) { $this->pageRenderer->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Ajax.ExtDirect', NULL, FALSE); } $this->generateJavascript(); $this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js); // set document title: $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 ' . TYPO3_version . ']' : 'TYPO3 ' . TYPO3_version; // start page header: $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($title); $this->content .= $backendScaffolding; $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage(); $hookConfiguration = array('content' => &$this->content); $this->executeHook('renderPostProcess', $hookConfiguration); echo $this->content; }