Esempio n. 1
0
 /**
  * Assigns additional Workspace settings to TYPO3.settings.Workspaces.extension
  *
  * @return void
  */
 protected function assignExtensionSettings()
 {
     $extension = ['AdditionalColumn' => ['Definition' => [], 'Handler' => []]];
     $extension['AdditionalColumn']['Definition'] = $this->getAdditionalColumnService()->getDefinition();
     $extension['AdditionalColumn']['Handler'] = $this->getAdditionalColumnService()->getHandler();
     $this->pageRenderer->addInlineSetting('Workspaces', 'extension', $extension);
 }
Esempio n. 2
0
 /**
  * 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 . '" />';
     }
 }
Esempio n. 3
0
 /**
  * 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');
 }
Esempio n. 4
0
 /**
  * Load RequireJS code.
  *
  * @return void
  * @api
  */
 public function render()
 {
     $content = $this->renderChildren();
     $this->pageRenderer->addJsInlineCode('vidi-inline', $content);
     $configuration['paths']['Fab/Vidi'] = '../typo3conf/ext/vidi/Resources/Public/JavaScript';
     $this->pageRenderer->addRequireJsConfiguration($configuration);
     $this->pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main');
 }
 /**
  * Construct
  */
 public function __construct()
 {
     $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
     $this->pageRenderer->loadJquery();
     $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Recordlist/ElementBrowser');
     $this->initialize();
 }
 /**
  * @param StandaloneView $view
  * @param PageRenderer $pageRenderer
  * @param LoginController $loginController
  * @throws \UnexpectedValueException
  */
 public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
 {
     GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class)->dispatch(__CLASS__, self::SIGNAL_getPageRenderer, array($pageRenderer));
     $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin');
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/UserPassLoginForm.html'));
     if (GeneralUtility::getIndpEnv('TYPO3_SSL')) {
         $view->assign('presetUsername', GeneralUtility::_GP('u'));
         $view->assign('presetPassword', GeneralUtility::_GP('p'));
     }
 }
Esempio n. 7
0
 /**
  * Initialize every action.
  */
 public function initializeAction()
 {
     $this->pageRenderer->addInlineLanguageLabelFile('EXT:vidi/Resources/Private/Language/locallang.xlf');
     // Configure property mapping to retrieve the file object.
     if ($this->arguments->hasArgument('columns')) {
         /** @var \Fab\Vidi\TypeConverter\CsvToArrayConverter $typeConverter */
         $typeConverter = $this->objectManager->get('Fab\\Vidi\\TypeConverter\\CsvToArrayConverter');
         $propertyMappingConfiguration = $this->arguments->getArgument('columns')->getPropertyMappingConfiguration();
         $propertyMappingConfiguration->setTypeConverter($typeConverter);
     }
 }
 /**
  * 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);
 }
 /**
  * @param PageRenderer $pageRenderer
  */
 public function getPageRenderer(PageRenderer $pageRenderer)
 {
     $loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) ?: 'normal';
     if ($loginSecurityLevel === 'rsa') {
         $javascriptPath = '../' . ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/';
         $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js');
         foreach ($files as $file) {
             $pageRenderer->addJsFile($javascriptPath . $file);
         }
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/BackendLoginFormRsaEncryption');
     }
 }
 /**
  * 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);
     }
 }
Esempio n. 11
0
 /**
  * Reads locallang file into array (for possible include in header)
  *
  * @return void
  */
 protected function loadLocalization()
 {
     $wizardLabels = $GLOBALS['LANG']->includeLLFile('EXT:form/Resources/Private/Language/locallang_wizard.xlf', FALSE, TRUE);
     $controllerLabels = $GLOBALS['LANG']->includeLLFile('EXT:form/Resources/Private/Language/locallang_controller.xlf', FALSE, TRUE);
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($controllerLabels, $wizardLabels);
     $this->pageRenderer->addInlineLanguageLabelArray($controllerLabels['default']);
 }
Esempio n. 12
0
 /**
  * Add the needed JavaScript files for all actions
  */
 public function initializeAction()
 {
     $this->pageRenderer->addInlineLanguageLabelFile('EXT:extensionmanager/Resources/Private/Language/locallang.xlf');
     if ($this->configurationUtility->getCurrentConfiguration('extensionmanager')['offlineMode']['value']) {
         $this->settings['offlineMode'] = true;
     }
 }
Esempio n. 13
0
 /**
  * action show
  *
  * @param \Subugoe\Substaff\Domain\Model\Group $group
  */
 public function showAction(\Subugoe\Substaff\Domain\Model\Group $group)
 {
     $this->pageRenderer->setTitle($group->getTitle());
     // group's name should be shown as title
     $GLOBALS['TSFE']->page['title'] = $group->getTitle();
     $people = $this->personRepository->findGroupMembers($group);
     $projects = $this->projectRepository->findProjectsByGroups($group->getUid());
     if ($group->getParentGroup() === null) {
         $subGroups = $this->groupRepository->findByParentGroup($group->getUid());
         $this->view->assign('subGroups', $subGroups);
     }
     if ($this->settings['groupDetailTeaser']) {
         $this->view->assign('showTeaser', $this->settings['groupDetailTeaser'])->assign('teaserLength', $this->settings['groupDetailTeaserLength']);
     }
     $this->view->assign('group', $group)->assign('people', $people)->assign('projects', $projects);
 }
 /**
  * Gets instance of PageRenderer
  *
  * @return 	PageRenderer
  */
 public function getPageRenderer()
 {
     if (!isset($this->pageRenderer)) {
         $this->pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
         $this->pageRenderer->setBackPath(TYPO3_mainDir);
     }
     return $this->pageRenderer;
 }
 /**
  * Wrapper for t3lib_PageRenderer->addJsFile. Excludes $jsFile from concatenation on TYPO3 4.6+.
  *
  * @param string $jsFile
  * @return void
  */
 protected function addJsFileToPageRenderer($jsFile)
 {
     if (version_compare(TYPO3_version, '4.6', '>=')) {
         $this->pageRenderer->addJsFile($jsFile, 'text/javascript', true, false, '', true);
     } else {
         $this->pageRenderer->addJsFile($jsFile);
     }
 }
Esempio n. 16
0
 /**
  * Add JS inline code
  *
  * @param string $name
  * @param string $block
  * @param boolean $compress
  * @param boolean $forceOnTop
  * @param string $position
  */
 public function addJSInlineCode($name, $block, $compress = true, $forceOnTop = false, $position = 'footer')
 {
     if ($position === 'header') {
         $this->pageRenderer->addJsInlineCode($name, $block, $compress, $forceOnTop);
     } else {
         $this->pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop);
     }
 }
 /**
  * @test
  */
 public function absoluteUrlCanBeForced()
 {
     $mockTagBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('dummy'));
     $this->viewHelper->_set('arguments', array('property' => 'title'));
     $this->viewHelper->_set('tag', $mockTagBuilder);
     $this->viewHelper->initialize();
     $this->viewHelper->render(TRUE, TRUE);
     $this->assertEquals($this->pageRenderer->_get('metaTags'), array('<meta property="title" content="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . '" />'));
 }
 /**
  * This method loads the locallang.xml file (default language), and
  * adds all keys found in it to the TYPO3.settings.extension_builder._LOCAL_LANG object
  * translated into the current language
  *
  * Dots in a key are replaced by a _
  *
  * Example:
  *		error.name becomes TYPO3.settings.extension_builder._LOCAL_LANG.error_name
  *
  * @return void
  */
 private function setLocallangSettings()
 {
     $LL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:extension_builder/Resources/Private/Language/locallang.xml', 'default');
     if (!empty($LL['default']) && is_array($LL['default'])) {
         foreach ($LL['default'] as $key => $value) {
             $this->pageRenderer->addInlineSetting('extensionBuilder._LOCAL_LANG', str_replace('.', '_', $key), \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, 'extension_builder'));
         }
     }
 }
Esempio n. 19
0
 /**
  * Tests the addInlineLanguageLabelFile() method.
  *
  * @test
  */
 public function areInlineLanguageLabelsSelectedAndStripped()
 {
     $this->fixture->setLanguage($GLOBALS['LANG']->lang);
     $this->fixture->addInlineLanguageLabelFile('EXT:lang/locallang_core.xml', 'labels.', 'lock');
     $out = $this->fixture->render();
     $this->assertContains('edRecord', $out);
     $this->assertContains('edRecord_content', $out);
     $this->assertContains('edRecordUser', $out);
 }
 /**
  * @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);
     }
 }
 /**
  * @param string $table
  * @param array|string $data
  * @return string
  */
 public function render($table = NULL, $data = NULL)
 {
     if (!$data) {
         $data = array();
     }
     if ($table) {
         if (!$data['uid']) {
             $data['uid'] = "none";
         }
         if (!$data['pid']) {
             $data['pid'] = "0";
         }
         $this->pageRenderer->loadPrototype();
         $this->pageRenderer->loadExtJS();
         $this->tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
         $this->tceforms->initDefaultBEMode();
         // EXTBASE FORMS
         $this->tceforms->prependFormFieldNames = $this->getFieldNamePrefix();
         $this->tceforms->formName = $table;
         $this->tceforms->totalWrap = '<div class="typo3-TCEforms"> |  </div>';
         $this->tceforms->doSaveFieldName = 'doSave';
         $this->tceforms->localizationMode = GeneralUtility::inList('text,media', $this->localizationMode) ? $this->localizationMode : '';
         $this->tceforms->returnUrl = $this->R_URI;
         $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
         $this->tceforms->disableRTE = !$GLOBALS['BE_USER']->isRTE();
         $this->tceforms->enableClickMenu = TRUE;
         $this->tceforms->enableTabMenu = TRUE;
         $panel = $this->tceforms->getMainFields($table, $data);
         $body = $this->tceforms->printNeededJSFunctions_top();
         $body .= $this->tceforms->wrapTotal($panel, $data, $table);
         $body .= $this->tceforms->printNeededJSFunctions();
         if (count($this->tceforms->commentMessages)) {
             $body .= '
                 <!-- TCEFORM messages
                 ' . htmlspecialchars(implode(LF, $this->tceforms->commentMessages)) . '
                 -->
             ';
         }
     } else {
         return "Tabelle wurde nicht angegeben.";
     }
     return $body;
 }
 /**
  * Render
  *
  * @param string $block
  */
 public function render()
 {
     $block = $this->renderChildren();
     if ($this->isCached()) {
         $this->pageRenderer->addJsFooterInlineCode($this->arguments['name'], $block, $this->arguments['compress'], $this->arguments['forceOnTop']);
     } else {
         // additionalFooterData not possible in USER_INT
         $GLOBALS['TSFE']->additionalFooterData[md5($this->arguments['name'])] = GeneralUtility::wrapJS($block);
     }
 }
 /**
  * Render the URI to the resource. The filename is used from child content.
  *
  * @param string $file The relative path of the resource (relative to Public resource directory of the extension).
  */
 public function render($file = NULL)
 {
     if (!$this->arguments['extensionName']) {
         $this->arguments['extensionName'] = $this->controllerContext->getRequest()->getControllerExtensionName();
     }
     $uri = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored($this->arguments['extensionName']) . $this->getResourcesPathAndFilename($file);
     $uri = GeneralUtility::getFileAbsFileName($uri);
     $uri = substr($uri, strlen(PATH_site));
     switch ($this->arguments['where']) {
         case 'footer':
             $this->pageRenderer->addJsFooterFile($uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
             break;
         case 'footerLibs':
             $this->pageRenderer->addJsFooterLibrary($this->arguments['key'], $uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
             break;
         default:
             $this->pageRenderer->addJsFile($uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
             break;
     }
 }
Esempio n. 24
0
    /**
     * 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);
        }
    }
Esempio n. 25
0
 /**
  * Shows all versions of a specific extension
  *
  * @return void
  */
 public function showAllVersionsAction()
 {
     $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/notifications.js');
     $extensions = array();
     $extensionKey = '';
     if ($this->request->hasArgument('allVersions') && $this->request->getArgument('allVersions') == 1 && $this->request->hasArgument('extensionKey') && is_string($this->request->getArgument('extensionKey'))) {
         $extensionKey = $this->request->getArgument('extensionKey');
         $extensions = $this->extensionRepository->findByExtensionKeyOrderedByVersion($extensionKey);
     } else {
         $this->redirect('ter');
     }
     $this->view->assign('extensions', $extensions)->assign('extensionKey', $extensionKey);
 }
Esempio n. 26
0
    /**
     * Generates the JavaScript code for the backend.
     *
     * @return void
     */
    protected function generateJavascript()
    {
        $beUser = $this->getBackendUser();
        // Needed for FormEngine manipulation (date picker)
        $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? ['MM-DD-YYYY', 'HH:mm MM-DD-YYYY'] : ['DD-MM-YYYY', 'HH:mm DD-MM-YYYY'];
        $this->pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
        // If another page module was specified, replace the default Page module with the new one
        $newPageModule = trim($beUser->getTSConfigVal('options.overridePageModule'));
        $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
        if (!$beUser->check('modules', $pageModule)) {
            $pageModule = '';
        }
        $t3Configuration = ['siteUrl' => GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), 'username' => htmlspecialchars($beUser->user['username']), 'uniqueID' => GeneralUtility::shortMD5(uniqid('', true)), 'pageModule' => $pageModule, 'inWorkspace' => $beUser->workspace !== 0, 'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ? (int) $GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup'] : false, 'ContextHelpWindows' => ['width' => 600, 'height' => 400]];
        $this->js .= '
	TYPO3.configuration = ' . json_encode($t3Configuration) . ';

	/**
	 * TypoSetup object.
	 */
	function typoSetup() {	//
		this.username = TYPO3.configuration.username;
		this.uniqueID = TYPO3.configuration.uniqueID;
	}
	var TS = new typoSetup();
		//backwards compatibility
	/**
	 * Frameset Module object
	 *
	 * Used in main modules with a frameset for submodules to keep the ID between modules
	 * Typically that is set by something like this in a Web>* sub module:
	 *		if (top.fsMod) top.fsMod.recentIds["web"] = "\'.(int)$this->id.\'";
	 * 		if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
	 */
	function fsModules() {	//
		this.recentIds=new Array();					// used by frameset modules to track the most recent used id for list frame.
		this.navFrameHighlightedID=new Array();		// used by navigation frames to track which row id was highlighted last time
		this.currentBank="0";
	}
	var fsMod = new fsModules();

	top.goToModule = function(modName, cMR_flag, addGetVars) {
		TYPO3.ModuleMenu.App.showModule(modName, addGetVars);
	}
	' . $this->setStartupModule();
        // Check editing of page:
        $this->handlePageEditing();
    }
Esempio n. 27
0
 /**
  * Insert javascript-tags for jQuery
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Page\PageRenderer $pObj
  * @return void
  */
 public function renderPreProcess($params, $pObj)
 {
     // Get plugin-configuration
     $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_libjquery.']['settings.'];
     // Generate script-tag for jquery if CDN is set
     if (!empty($conf['cdn']) && array_key_exists($conf['cdn'], $this->jQueryCdnUrls)) {
         // Set version-number for CDN
         if (!(int) $conf['version'] || $conf['version'] === 'latest') {
             $versionCdn = end($this->availableLocalJqueryVersions);
         } else {
             $versionCdn = VersionNumberUtility::convertVersionNumberToInteger($conf['version']);
         }
         // Set correct version-number for local version
         if (!in_array($versionCdn, $this->availableLocalJqueryVersions)) {
             $versionLocal = $this->getNearestVersion($versionCdn);
         } else {
             $versionLocal = $versionCdn;
         }
         $fallbackTag = '';
         // Choose minified version if debug is disabled
         $minPart = (int) $conf['debug'] ? '' : '.min';
         // Deliver gzipped-version if compression is activated and client supports gzip (compression done with "gzip --best -k -S .gzip")
         $gzipPart = (int) $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['compressionLevel'] ? '.gzip' : '';
         // Set path and placeholders for local file
         $this->jQueryCdnUrls['local'] = $conf['localPath'] . 'jquery-%1$s%2$s.js';
         // Generate tags for local or CDN (and fallback)
         if ($conf['cdn'] === 'local') {
             // Get local version and replace placeholders
             $file = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
             $file = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($file));
         } else {
             // Get CDN and replace placeholders
             $file = sprintf($this->jQueryCdnUrls[$conf['cdn']], VersionNumberUtility::convertIntegerToVersionNumber($versionCdn), $minPart);
             // Generate fallback if required
             if ((int) $conf['localFallback']) {
                 // Get local fallback version and replace placeholders
                 $fileFallback = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
                 // Get absolute path to the fallback-file
                 $fileFallback = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($fileFallback));
                 // Wrap it in some javascript code which will enable the fallback
                 $fallbackTag = '<script>window.jQuery || document.write(\'<script src="' . htmlspecialchars($fileFallback) . '" type="text/javascript"><\\/script>\')</script>' . LF;
             }
         }
         $pObj->addJsLibrary('lib_jquery', $file, 'text/javascript', FALSE, TRUE, '|' . LF . $fallbackTag . '', TRUE);
     }
 }
Esempio n. 28
0
 /**
  * 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/js/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'));
     }
 }
 /**
  * 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');
 }
Esempio n. 30
0
 /**
  * Returns JS callback for the given action
  *
  * @param null $action
  * @param array $arguments
  * @param null $controller
  * @param null $extensionName
  * @param null $pluginName
  * @param string $format
  * @param string $section
  * @return string
  */
 public function getAjaxFunction($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $format = '', $section = 'footer')
 {
     // current element needs to have additional logic...
     $this->hijaxEventDispatcher->setIsHijaxElement(true);
     $request = $this->mvcDispatcher->getCurrentRequest();
     if ($request) {
         if ($action === NULL) {
             $action = $request->getControllerActionName();
         }
         if ($controller === NULL) {
             $controller = $request->getControllerName();
         }
         if ($extensionName === NULL) {
             $extensionName = $request->getControllerExtensionName();
         }
         if ($pluginName === NULL && TYPO3_MODE === 'FE') {
             $pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controller, $action);
         }
         if ($pluginName === NULL) {
             $pluginName = $request->getPluginName();
         }
     }
     $settings = array('extension' => $extensionName, 'plugin' => $pluginName, 'controller' => $controller, 'format' => $format ? $format : 'html', 'action' => $action, 'arguments' => $arguments, 'settingsHash' => $this->mvcDispatcher->getCurrentListener() ? $this->mvcDispatcher->getCurrentListener()->getId() : '', 'namespace' => $extensionName && $pluginName ? $this->extensionService->getPluginNamespace($extensionName, $pluginName) : '');
     $functionName = 'extbaseHijax_' . md5(serialize($settings));
     $content = "; {$functionName}=function(settings, pendingElement, loaders) {";
     foreach ($settings as $k => $v) {
         $content .= "if (typeof settings.{$k} == 'undefined') settings.{$k}=" . json_encode($v) . ";";
     }
     $content .= "return jQuery.hijax(settings, pendingElement, loaders);};";
     if ($this->isCached()) {
         if ($section == 'footer') {
             $this->pageRenderer->addJsFooterInlineCode(md5($content), $content, FALSE, TRUE);
         } else {
             $this->pageRenderer->addJsInlineCode(md5($content), $content, FALSE, TRUE);
         }
     } else {
         // additionalFooterData not possible in USER_INT
         $GLOBALS['TSFE']->additionalHeaderData[md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
     }
     return $functionName;
 }