/** * Render * * @param string $file */ public function render($file = NULL) { if ($this->isCached()) { $this->pageRenderer->addCssFile($file, $this->arguments['rel'], $this->arguments['media'], $this->arguments['title'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']); } else { $GLOBALS['TSFE']->additionalHeaderData[md5($file)] = '<link rel="' . $this->arguments['rel'] . '" type="text/css" media="' . $this->arguments['media'] . '" href="' . $file . '" />'; } }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; $PATH_TYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/'; if ($BE_USER->user["admin"]) { // Draw the header. $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("template"); $this->doc->backPath = $BACK_PATH; $this->pageRenderer = $this->doc->getPageRenderer(); // Include Ext JS $this->pageRenderer->loadExtJS(true, true); $this->pageRenderer->enableExtJSQuickTips(); $this->pageRenderer->enableExtJsDebug(); $this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.js', 'text/javascript', FALSE, FALSE); $this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeTree.js', 'text/javascript', FALSE, FALSE); //Add caretaker css $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/css/tx.caretaker.nodetree.css', 'stylesheet', 'all', '', FALSE); // storage Pid $confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']); $storagePid = (int) $confArray['storagePid']; $this->pageRenderer->addJsInlineCode('Caretaker_Nodetree', ' Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.ns("tx.caretaker"); Ext.onReady(function() { tx.caretaker.view = new Ext.Viewport({ layout: "fit", items: { id: "cartaker-tree", xtype: "caretaker-nodetree", autoScroll: true, dataUrl: TYPO3.settings.ajaxUrls[\'tx_caretaker::treeloader\'], addUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new", editUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[tx_caretaker_###NODE_TYPE###][###NODE_UID###]=edit", hideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=1", unhideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=0" } }); tx_caretaker_updateTreeById = function( id ){ tx_caretaker_tree = Ext.getCmp("cartaker-tree"); tx_caretaker_tree.reloadTreePartial( id ); } }); '); $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->doc->form = ''; } else { // If no access or if not admin $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->content .= $this->doc->header($LANG->getLL("title")); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { $this->pageRenderer->addInlineLanguageLabelFile('EXT:scheduler_timeline/Resources/Private/Language/locallang.xml'); $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/StyleSheet/timeline.css'); $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/StyleSheet/bars.css'); $this->pageRenderer->addJsLibrary('jquery', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/jquery-1.6.2.min.js'); $this->pageRenderer->addJsLibrary('jquery_tooltip', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/tooltip.js'); $this->pageRenderer->addJsLibrary('jquery_tooltip_dynamic', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/tooltip.dynamic.js'); $this->addJsFileToPageRenderer(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/common.js'); }
/** * Initializes the rendering action. * * Use this method to add all static assets. */ public function initializeAction() { if (!$this->cache->has('brushes')) { return; } $themeCss = $this->resolveFilePathReference(sprintf(self::CSS_PATH . '/shCore%s.css', $this->settings['code_snippet']['theme'])); $this->pageRenderer->addCssFile($themeCss); $coreJs = $this->resolveFilePathReference(self::JS_PATH . '/shCore.min.js'); $this->pageRenderer->addJsFooterLibrary('codesnippet_core', $coreJs); $autoloaderJs = $this->resolveFilePathReference(self::JS_PATH . '/shAutoloader.min.js'); $this->pageRenderer->addJsFooterLibrary('codesnippet_autoloader', $autoloaderJs); }
/** * Load the assets (JavaScript, CSS) for this Vidi module. * * @return void * @api */ public function render() { /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */ $moduleLoader = $this->objectManager->get('Fab\\Vidi\\Module\\ModuleLoader'); foreach ($moduleLoader->getAdditionalStyleSheetFiles() as $addCssFile) { $fileNameAndPath = $this->resolvePath($addCssFile); $this->pageRenderer->addCssFile($fileNameAndPath); } foreach ($moduleLoader->getAdditionalJavaScriptFiles() as $addJsFile) { $fileNameAndPath = $this->resolvePath($addJsFile); $this->pageRenderer->addJsFile($fileNameAndPath); } }
/** * @constuctor * * @param string $absolutename absolutename * @param string $name name * @param array $configuration configuration * @param \Ameos\AmeosForm\Form $form form */ public function __construct($absolutename, $name, $configuration = [], $form) { parent::__construct($absolutename, $name, $configuration, $form); $this->pageRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer'); if (!isset($this->configuration['format'])) { $this->configuration['format'] = 'D MMM YYYY'; } $this->pageRenderer->addCssFile('/typo3conf/ext/ameos_form/Resources/Public/Pikaday/css/pikaday.css'); $this->pageRenderer->addJsFooterFile('/typo3conf/ext/ameos_form/Resources/Public/Momentjs/moment.js'); $this->pageRenderer->addJsFooterFile('/typo3conf/ext/ameos_form/Resources/Public/Pikaday/pikaday.js'); $this->pageRenderer->addJsFooterFile('/typo3conf/ext/ameos_form/Resources/Public/Elements/datepicker.js'); $this->pageRenderer->addJsFooterInlineCode('init-datepicker-' . $name, ' var i18n = { previousMonth: "' . LocalizationUtility::translate('previousMonth', 'AmeosForm') . '", nextMonth: "' . LocalizationUtility::translate('nextMonth', 'AmeosForm') . '", months : { 1: "' . LocalizationUtility::translate('months.1', 'AmeosForm') . '", 2: "' . LocalizationUtility::translate('months.2', 'AmeosForm') . '", 3: "' . LocalizationUtility::translate('months.3', 'AmeosForm') . '", 4: "' . LocalizationUtility::translate('months.4', 'AmeosForm') . '", 5: "' . LocalizationUtility::translate('months.5', 'AmeosForm') . '", 6: "' . LocalizationUtility::translate('months.6', 'AmeosForm') . '", 7: "' . LocalizationUtility::translate('months.7', 'AmeosForm') . '", 8: "' . LocalizationUtility::translate('months.8', 'AmeosForm') . '", 9: "' . LocalizationUtility::translate('months.9', 'AmeosForm') . '", 10: "' . LocalizationUtility::translate('months.10', 'AmeosForm') . '", 11: "' . LocalizationUtility::translate('months.11', 'AmeosForm') . '", 12: "' . LocalizationUtility::translate('months.12', 'AmeosForm') . '" }, weekdays : { 1: "' . LocalizationUtility::translate('weekdays.1', 'AmeosForm') . '", 2: "' . LocalizationUtility::translate('weekdays.2', 'AmeosForm') . '", 3: "' . LocalizationUtility::translate('weekdays.3', 'AmeosForm') . '", 4: "' . LocalizationUtility::translate('weekdays.4', 'AmeosForm') . '", 5: "' . LocalizationUtility::translate('weekdays.5', 'AmeosForm') . '", 6: "' . LocalizationUtility::translate('weekdays.6', 'AmeosForm') . '", 7: "' . LocalizationUtility::translate('weekdays.7', 'AmeosForm') . '" }, weekdaysShort : { 1: "' . LocalizationUtility::translate('weekdaysShort.1', 'AmeosForm') . '", 2: "' . LocalizationUtility::translate('weekdaysShort.2', 'AmeosForm') . '", 3: "' . LocalizationUtility::translate('weekdaysShort.3', 'AmeosForm') . '", 4: "' . LocalizationUtility::translate('weekdaysShort.4', 'AmeosForm') . '", 5: "' . LocalizationUtility::translate('weekdaysShort.5', 'AmeosForm') . '", 6: "' . LocalizationUtility::translate('weekdaysShort.6', 'AmeosForm') . '", 7: "' . LocalizationUtility::translate('weekdaysShort.7', 'AmeosForm') . '" } }; initDatepicker("' . $this->getHtmlId() . '", "' . $this->configuration['format'] . '", i18n); '); }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { // @todo Evaluate how the intval() call can be used with Extbase validators/filters $this->pageId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); $icons = array('language' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('flags-multiple'), 'integrity' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-information'), 'success' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-ok'), 'info' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-information'), 'warning' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-warning'), 'error' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-error')); $this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons); $this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId); $this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1); $this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection()); $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/StyleSheet/module.css'); $this->pageRenderer->addInlineLanguageLabelArray(array('title' => $GLOBALS['LANG']->getLL('title'), 'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path'), 'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.table'), 'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xlf:Depth'), 'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'), 'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'), 'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'), 'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'), 'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'), 'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi'))); $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf'); $this->assignExtensionSettings(); }
/** * Initializes the backend module * * @return void */ public function init() { parent::init(); // Initialize document $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate(ExtensionManagementUtility::extPath('scheduler') . 'mod1/mod_template.html'); $this->pageRenderer = $this->doc->getPageRenderer(); $this->pageRenderer->addCssFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.css'); $this->doc->backPath = $this->backPath; $this->doc->bodyTagId = 'typo3-mod-php'; $this->doc->bodyTagAdditions = 'class="tx_scheduler_mod1"'; // Create scheduler instance $this->scheduler = GeneralUtility::makeInstance('TYPO3\\CMS\\Scheduler\\Scheduler'); }
/** * test add CSS file */ public function testAddCssFile() { $expectedReturnValue = '<link rel="stylesheet" type="text/css" href="fileadmin/test.css" media="all" />'; $this->fixture->addCssFile('fileadmin/test.css'); $out = $this->fixture->render(); $this->assertContains($expectedReturnValue, $out); }
/** * wrapper function called by hook (\TYPO3\CMS\Core\Page\PageRenderer->render-preProcess) * * @param array $parameters : An array of available parameters * @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook * * @return void */ public function addJSCSS($parameters, &$pageRenderer) { // Add javascript $pageRenderer->loadRequireJsModule('TYPO3/CMS/Themes/ThemesBackendTca'); // Add css $filename = $pageRenderer->backPath . ExtensionManagementUtility::extRelPath('themes') . 'Resources/Public/Stylesheet/ThemesBackendTca.css'; $pageRenderer->addCssFile($filename, 'stylesheet', 'screen'); }
/** * Loads all necessary stylesheets * * @return void */ protected function loadStylesheets() { if ($GLOBALS['TBE_STYLES']['stylesheet']) { $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet']); } if ($GLOBALS['TBE_STYLES']['stylesheet2']) { $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet2']); } }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { $this->pageRenderer = $this->getPageRenderer(); // @todo Evaluate how the intval() call can be used with Extbase validators/filters $this->pageId = (int) GeneralUtility::_GP('id'); $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $icons = array('language' => $iconFactory->getIcon('flags-multiple', Icon::SIZE_SMALL)->render(), 'integrity' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(), 'success' => $iconFactory->getIcon('status-dialog-ok', Icon::SIZE_SMALL)->render(), 'info' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(), 'warning' => $iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render(), 'error' => $iconFactory->getIcon('status-dialog-error', Icon::SIZE_SMALL)->render()); $this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons); $this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId); $this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1); $this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection()); $cssFile = 'EXT:workspaces/Resources/Public/Css/module.css'; $cssFile = GeneralUtility::getFileAbsFileName($cssFile); $this->pageRenderer->addCssFile(PathUtility::getAbsoluteWebPath($cssFile)); $this->pageRenderer->addInlineLanguageLabelArray(array('title' => $GLOBALS['LANG']->getLL('title'), 'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path'), 'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.table'), 'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xlf:Depth'), 'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'), 'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'), 'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'), 'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'), 'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'), 'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi'))); $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf'); $this->assignExtensionSettings(); }
/** * @param $path */ protected function includeCssFromPath($path) { $resourcePath = ExtensionManagementUtility::extRelPath('typo3_forum') . $path; $absResourcePath = ExtensionManagementUtility::extPath('typo3_forum') . $path; $cssFiles = glob($absResourcePath . '*.css'); foreach ($cssFiles as $cssFile) { $cssFile = str_replace($absResourcePath, $resourcePath, $cssFile); $this->pageRenderer->addCssFile($cssFile); } }
/** * Load the necessarry css * * This will only be done when the referenced record is available * * @return void */ protected function loadCss() { // TODO Set to TRUE when finished $compress = FALSE; $cssFiles = array('Wizard/Form.css', 'Wizard/Wizard.css'); $baseUrl = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('form') . 'Resources/Public/CSS/'; // Load the wizards css foreach ($cssFiles as $cssFile) { $this->pageRenderer->addCssFile($baseUrl . $cssFile, 'stylesheet', 'all', '', $compress, FALSE); } }
/** * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle * * @param string $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame * @param bool $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE * @param bool $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE * @param bool $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only * @param bool $loadJQuery whether to load jQuery library. Defaults to FALSE * @param array $includeCssFiles List of custom CSS file to be loaded * @param array $includeJsFiles List of custom JavaScript file to be loaded * @param array $addJsInlineLabels Custom labels to add to JavaScript inline labels * @param array $includeRequireJsModules List of RequireJS modules to be loaded * @param string $jQueryNamespace Store the jQuery object in a specific namespace * @return void */ public function render($pageTitle = '', $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null, $jQueryNamespace = null) { if ($pageTitle) { $this->pageRenderer->setTitle($pageTitle); } if ($loadExtJs) { $this->pageRenderer->loadExtJS(true, $loadExtJsTheme); if ($enableExtJsDebug) { $this->pageRenderer->enableExtJsDebug(); } } if ($loadJQuery) { $jQueryNamespace = $jQueryNamespace ?: PageRenderer::JQUERY_NAMESPACE_DEFAULT; $this->pageRenderer->loadJquery(null, null, $jQueryNamespace); } // Include custom CSS and JS files if (is_array($includeCssFiles) && count($includeCssFiles) > 0) { foreach ($includeCssFiles as $addCssFile) { $this->pageRenderer->addCssFile($addCssFile); } } if (is_array($includeJsFiles) && count($includeJsFiles) > 0) { foreach ($includeJsFiles as $addJsFile) { $this->pageRenderer->addJsFile($addJsFile); } } if (is_array($includeRequireJsModules) && count($includeRequireJsModules) > 0) { foreach ($includeRequireJsModules as $addRequireJsFile) { $this->pageRenderer->loadRequireJsModule($addRequireJsFile); } } // Add inline language labels if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) { $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey(); foreach ($addJsInlineLabels as $key) { $label = LocalizationUtility::translate($key, $extensionKey); $this->pageRenderer->addInlineLanguageLabel($key, $label); } } }
/** * Loads the css and javascript files of all registered navigation widgets * * @return void */ protected function loadResourcesForRegisteredNavigationComponents() { if (!is_array($GLOBALS['TBE_MODULES']['_navigationComponents'])) { return; } $loadedComponents = array(); foreach ($GLOBALS['TBE_MODULES']['_navigationComponents'] as $module => $info) { if (in_array($info['componentId'], $loadedComponents)) { continue; } $loadedComponents[] = $info['componentId']; $component = strtolower(substr($info['componentId'], strrpos($info['componentId'], '-') + 1)); $componentDirectory = 'components/' . $component . '/'; if ($info['isCoreComponent']) { $absoluteComponentPath = PATH_site . 'typo3/sysext/backend/Resources/Public/JavaScript/extjs/' . $componentDirectory; $relativeComponentPath = '../' . str_replace(PATH_site, '', $absoluteComponentPath); } else { $absoluteComponentPath = ExtensionManagementUtility::extPath($info['extKey']) . $componentDirectory; $relativeComponentPath = ExtensionManagementUtility::extRelPath($info['extKey']) . $componentDirectory; } $cssFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css'); if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) { // Don't allow inclusion outside directory $loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt')); $cssFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, true); $cssFiles = array_merge($cssFilesOrdered, $cssFiles); } foreach ($cssFiles as $cssFile) { $this->pageRenderer->addCssFile($relativeComponentPath . 'css/' . $cssFile); } $jsFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js'); if (file_exists($absoluteComponentPath . 'javascript/loadorder.txt')) { // Don't allow inclusion outside directory $loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt')); $jsFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, true); $jsFiles = array_merge($jsFilesOrdered, $jsFiles); } foreach ($jsFiles as $jsFile) { $this->pageRenderer->addJsFile($relativeComponentPath . 'javascript/' . $jsFile); } $this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', BackendUtility::getModuleUrl('record_history')); $this->pageRenderer->addInlineSetting('NewRecord', 'moduleUrl', BackendUtility::getModuleUrl('db_new')); $this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit')); } }
/** * Loads data in the HTML head section (e.g. JavaScript or stylesheet information). * * @return void */ protected function loadHeaderData() { // Load CSS Stylesheets: $this->pageRenderer->addCssFile($this->relativePath . 'res/css/customExtJs.css'); // Load Ext JS: $this->pageRenderer->loadExtJS(); $this->pageRenderer->enableExtJSQuickTips(); // Integrate dynamic JavaScript such as configuration or lables: $this->pageRenderer->addInlineSettingArray('Recycler', $this->getJavaScriptConfiguration()); $this->pageRenderer->addInlineLanguageLabelArray($this->getJavaScriptLabels()); // Load Recycler JavaScript: // Load Plugins $uxPath = $this->doc->backpath . 'js/extjs/ux/'; $this->pageRenderer->addJsFile($uxPath . 'Ext.grid.RowExpander.js'); $this->pageRenderer->addJsFile($uxPath . 'Ext.app.SearchField.js'); $this->pageRenderer->addJsFile($uxPath . 'Ext.ux.FitToParent.js'); // Load main script $this->pageRenderer->addJsFile($this->relativePath . 'res/js/t3_recycler.js'); }
/** * Loads the css and javascript files of all registered navigation widgets * * @return void */ protected function loadResourcesForRegisteredNavigationComponents() { if (!is_array($GLOBALS['TBE_MODULES']['_navigationComponents'])) { return; } $loadedComponents = array(); foreach ($GLOBALS['TBE_MODULES']['_navigationComponents'] as $module => $info) { if (in_array($info['componentId'], $loadedComponents)) { continue; } $loadedComponents[] = $info['componentId']; $component = strtolower(substr($info['componentId'], strrpos($info['componentId'], '-') + 1)); $componentDirectory = 'components/' . $component . '/'; if ($info['isCoreComponent']) { $absoluteComponentPath = PATH_t3lib . 'js/extjs/' . $componentDirectory; $relativeComponentPath = '../' . str_replace(PATH_site, '', $absoluteComponentPath); } else { $absoluteComponentPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($info['extKey']) . $componentDirectory; $relativeComponentPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($info['extKey']) . $componentDirectory; } $cssFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css'); if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) { // Don't allow inclusion outside directory $loadOrder = str_replace('../', '', \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt')); $cssFilesOrdered = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $loadOrder, TRUE); $cssFiles = array_merge($cssFilesOrdered, $cssFiles); } foreach ($cssFiles as $cssFile) { $this->pageRenderer->addCssFile($relativeComponentPath . 'css/' . $cssFile); } $jsFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js'); if (file_exists($absoluteComponentPath . 'javascript/loadorder.txt')) { // Don't allow inclusion outside directory $loadOrder = str_replace('../', '', \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt')); $jsFilesOrdered = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $loadOrder, TRUE); $jsFiles = array_merge($jsFilesOrdered, $jsFiles); } foreach ($jsFiles as $jsFile) { $this->pageRenderer->addJsFile($relativeComponentPath . 'javascript/' . $jsFile); } } }
public function render() { $this->pageRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer'); $baseUrl = '../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('extension_builder'); $this->pageRenderer->disableCompressJavascript(); // SECTION: JAVASCRIPT FILES // YUI Basis Files $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/utilities/utilities.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/resize/resize-min.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/layout/layout-min.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/container/container-min.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/json/json-min.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/button/button-min.js'); // YUI-RPC $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui-rpc.js'); // InputEx with wirable options $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/inputex.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/Field.js'); // extended fields for enabling unique ids $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/extended/ListField.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/extended/Group.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/util/inputex/WirableField-beta.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/Visus.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/StringField.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/Textarea.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/SelectField.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/EmailField.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/UrlField.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/CheckBox.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/InPlaceEdit.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/MenuField.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/TypeField.js'); // WireIt $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/excanvas.js', 'text/javascript', TRUE, FALSE, '<!--[if IE]>|<![endif]-->'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/WireIt.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/CanvasElement.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/Wire.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/Terminal.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/util/DD.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/util/DDResize.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/Container.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/ImageContainer.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/Layer.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/util/inputex/FormContainer-beta.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/LayerMap.js'); $this->pageRenderer->addInlineSettingArray('extensionBuilder', array('baseUrl' => $baseUrl)); $this->setLocallangSettings(); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js'); // Extbase Modelling definition $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/extbaseModeling.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/layout.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/extensionProperties.js'); $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/modules/modelObject.js'); // collapsible forms in relations $this->pageRenderer->addJsFile($baseUrl . 'Resources/Public/jsDomainModeling/modules/extendedModelObject.js'); // SECTION: CSS Files // YUI CSS $this->pageRenderer->addCssFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/reset-fonts-grids/reset-fonts-grids.css'); $this->pageRenderer->addCssFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/yui/assets/skins/sam/skin.css'); // InputEx CSS $this->pageRenderer->addCssFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/lib/inputex/css/inputEx.css'); // WireIt CSS $this->pageRenderer->addCssFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/css/WireIt.css'); $this->pageRenderer->addCssFile($baseUrl . 'Resources/Public/jsDomainModeling/wireit/css/WireItEditor.css'); // Custom CSS $this->pageRenderer->addCssFile($baseUrl . 'Resources/Public/jsDomainModeling/extbaseModeling.css'); }
/** * Add style sheet file to document header * * @param string $key: some key identifying the style sheet * @param string $href: uri to the style sheet file * @param string $title: value for the title attribute of the link element * @param string $relation: value for the rel attribute of the link element * @return void */ protected function addStyleSheet($key, $href, $title = '', $relation = 'stylesheet') { $this->pageRenderer->addCssFile($href, $relation, 'screen', $title); }
/** * method that adds CSS files within the page renderer * * @param array $parameters : An array of available parameters while adding CSS to the page renderer * @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook * * @return void */ protected function addCSS($parameters, &$pageRenderer) { if (count($parameters['cssFiles'])) { // get configuration $this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['gridelements']); $filename = $this->confArr['additionalStylesheet']; if ($filename) { // evaluate filename if (substr($filename, 0, 4) === 'EXT:') { // extension list($extKey, $local) = explode('/', substr($filename, 4), 2); $filename = ''; if (strcmp($extKey, '') && ExtensionManagementUtility::isLoaded($extKey) && strcmp($local, '')) { $filename = ExtensionManagementUtility::extRelPath($extKey) . $local; } } $pageRenderer->addCssFile($filename, 'stylesheet', 'screen'); } } }
/** * Add all *.css files of the directory $path to the stylesheets * * @param string $path directory to add * @return void */ public function addStyleSheetDirectory($path) { // Calculation needed, when TYPO3 source is used via a symlink // absolute path to the stylesheets $filePath = dirname(GeneralUtility::getIndpEnv('SCRIPT_FILENAME')) . '/' . $GLOBALS['BACK_PATH'] . $path; // Clean the path $resolvedPath = GeneralUtility::resolveBackPath($filePath); // Read all files in directory and sort them alphabetically $files = GeneralUtility::getFilesInDir($resolvedPath, 'css', false, 1); foreach ($files as $file) { $this->pageRenderer->addCssFile($GLOBALS['BACK_PATH'] . $path . $file, 'stylesheet', 'all'); } }
/** * @param string $file */ public function render($file = NULL) { // TODO: Would be nice if the file could begin with EXT:Sumpsink/ and return a relative path $this->pageRenderer->addCssFile($file, $this->arguments['rel'], $this->arguments['media'], $this->arguments['title'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']); }
/** * Add all *.css files of the directory $path to the stylesheets * * @param string $path directory to add * @return void */ public function addStyleSheetDirectory($path) { // Calculation needed, when TYPO3 source is used via a symlink // absolute path to the stylesheets $filePath = GeneralUtility::getFileAbsFileName($path, false, true); // Clean the path $resolvedPath = GeneralUtility::resolveBackPath($filePath); // Read all files in directory and sort them alphabetically $files = GeneralUtility::getFilesInDir($resolvedPath, 'css', false, 1); foreach ($files as $file) { $this->pageRenderer->addCssFile($path . $file, 'stylesheet', 'all'); } }
/** * Add style sheet file to document header * * @param string $key: some key identifying the style sheet * @param string $href: uri to the style sheet file * @param string $title: value for the title attribute of the link element * @param string $relation: value for the rel attribute of the link element * @param $resultArray array Incoming result array * @return array Modified result array */ protected function addStyleSheet($key, $href, $title = '', $relation = 'stylesheet', array $resultArray) { // If it was not known that an RTE-enabled CE would be created when the page was first created, the css would not be added to head if ($this->globalOptions['isAjaxContext']) { $resultArray['additionalHeadTags'][] = '<link rel="' . $relation . '" type="text/css" href="' . $href . '" title="' . $title . '" />'; } else { $this->pageRenderer->addCssFile($href, $relation, 'screen', $title); } return $resultArray; }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; $PATH_TYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/'; if ($BE_USER->user["admin"]) { // find node $node_repository = tx_caretaker_NodeRepository::getInstance(); $node = $node_repository->id2node($this->node_id, true); if (!$node) { $node = $node_repository->getRootNode(); } // Draw the header. $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $BACK_PATH; $this->pageRenderer = $this->doc->getPageRenderer(); // Include Ext JS $this->pageRenderer->loadExtJS(); $this->pageRenderer->addJsFile($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.js'); $panels = array(); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['caretaker']['extJsBackendPanels'] as $extJsBackendPanel) { // register JS foreach ($extJsBackendPanel['jsIncludes'] as $jsInclude) { $filename = $BACK_PATH . '../' . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($jsInclude)); $this->pageRenderer->addJsFile($filename); } // register CSS foreach ($extJsBackendPanel['cssIncludes'] as $cssInclude) { $filename = $BACK_PATH . '../' . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($cssInclude)); $this->pageRenderer->addCssFile($filename); } // add ExtJs Panel $panels[$extJsBackendPanel['id']] = $extJsBackendPanel['xtype']; } $this->pageRenderer->addJsFile($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeToolbar.js'); // Enable debug mode for Ext JS $this->pageRenderer->enableExtJsDebug(); // storage Pid $confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']); $storagePid = (int) $confArray['storagePid']; //Add caretaker css $this->pageRenderer->addCssFile($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/css/tx.caretaker.overview.css'); $pluginItems = array(); foreach ($panels as $id => $xtype) { $pluginItems[] = '{ id: "' . $id . '", xtype: "' . $xtype . '" , back_path: back_path , node_id: node_id }'; } $this->pageRenderer->addJsInlineCode('Caretaker_Overview', ' Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.namespace("tx","tx.caretaker"); Ext.onReady( function() { var back_path = "' . $this->doc->backPath . '"; var back_url = "' . urlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) . '"; var path_typo3 = "' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/"; var add_url = "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new"; var node_id = "' . $node->getCaretakerNodeId() . '"; var node_type = "' . strtolower($node->getType()) . '"; var node_hidden = "' . $node->getHidden() . '"; var node_uid = "' . $node->getUid() . '"; var node_title = "' . htmlspecialchars($node->getTitle() ? $node->getTitle() : '[no title]') . '( ' . ($node->getTypeDescription() ? htmlspecialchars($node->getTypeDescription()) : $node->getType()) . ' )" ; var node_state = "' . $node->getTestResult()->getState() . '" ; var node_state_info = "' . $node->getTestResult()->getStateInfo() . '" ; tx.caretaker.view = new Ext.Viewport({ layout: "fit", items: { xtype : "panel", id : "node", autoScroll: true, title : node_title, iconCls : "icon-caretaker-type-" + node_type, tbar : { xtype: "caretaker-nodetoolbar", back_path: back_path, path_typo3: path_typo3, back_url: back_url, add_url :add_url, node_id: node_id, node_type: node_type, node_uid: node_uid, node_hidden: node_hidden, node_state: node_state, node_state_info: node_state_info }, items : [ { xtype : "panel", padding : "10", layout : "fit", id : "caretaker-panels", items : [ ' . implode(chr(10) . ',', $pluginItems) . chr(10) . ' ] } ], } }); }); '); $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->doc->form = ''; } else { // If no access or if not admin $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL("title")); $this->content .= $this->doc->header($LANG->getLL("title")); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Add all *.css files of the directory $path to the stylesheets * * @param string $path directory to add * @return void */ public function addStyleSheetDirectory($path) { $path = GeneralUtility::getFileAbsFileName($path); // Read all files in directory and sort them alphabetically $cssFiles = GeneralUtility::getFilesInDir($path, 'css'); foreach ($cssFiles as $cssFile) { $this->pageRenderer->addCssFile(PathUtility::getRelativePathTo($path) . $cssFile); } }