[TASK] Make login_frameset.php dispatched
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / BackendController.php
index f0bfcbf..8dd1a57 100644 (file)
@@ -19,7 +19,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
- * Class for rendering the TYPO3 backend version 4.2+
+ * Class for rendering the TYPO3 backend
  *
  * @author Ingo Renner <ingo@typo3.org>
  */
@@ -28,12 +28,12 @@ class BackendController {
        /**
         * @var string
         */
-       protected $content;
+       protected $content = '';
 
        /**
         * @var string
         */
-       protected $css;
+       protected $css = '';
 
        /**
         * @var array
@@ -43,12 +43,12 @@ class BackendController {
        /**
         * @var string
         */
-       protected $js;
+       protected $js = '';
 
        /**
         * @var array
         */
-       protected $jsFiles;
+       protected $jsFiles = array();
 
        /**
         * @var array
@@ -56,14 +56,9 @@ class BackendController {
        protected $toolbarItems = array();
 
        /**
-        * @var int Intentionally private as nobody should modify defaults
-        */
-       private $menuWidthDefault = 190;
-
-       /**
         * @var int
         */
-       protected $menuWidth;
+       protected $menuWidth = 190;
 
        /**
         * @var bool
@@ -71,6 +66,11 @@ class BackendController {
        protected $debug;
 
        /**
+        * @var string
+        */
+       protected $templatePath = 'EXT:backend/Resources/Private/Templates/';
+
+       /**
         * @var \TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository
         */
        protected $backendModuleRepository;
@@ -111,7 +111,6 @@ class BackendController {
                $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', '//already done', FALSE);
                $this->pageRenderer->addExtDirectCode();
                // Add default BE javascript
-               $this->js = '';
                $this->jsFiles = array(
                        'locallang' => $this->getLocalLangFileName(),
                        'modernizr' => 'contrib/modernizr/modernizr.min.js',
@@ -129,16 +128,30 @@ class BackendController {
                        'util' => 'sysext/backend/Resources/Public/JavaScript/util.js'
                );
                if (!$this->debug) {
-                       $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LoginRefresh');
+                       $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LoginRefresh', 'function(LoginRefresh) {
+                               LoginRefresh.setLoginFramesetUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('login_frameset')) . ');
+                       }');
                }
-               // Add default BE css
-               $this->pageRenderer->addCssLibrary('contrib/normalize/normalize.css', 'stylesheet', 'all', '', TRUE, TRUE);
 
                // load FlashMessages functionality
                $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/FlashMessages');
+
+               // load Modals
+               $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
+
+               // load Legacy CSS Support
+               $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LegacyCssClasses');
+
+               // load the storage API and fill the UC into the PersistentStorage, so no additional AJAX call is needed
+               $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage', 'function(Storage) {
+                       Storage.Persistent.load(' . json_encode($GLOBALS['BE_USER']->uc) . ');
+               }');
                $this->css = '';
+
                $this->initializeToolbarItems();
-               $this->menuWidth = isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) ? (int)$GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] : $this->menuWidthDefault;
+               if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'])) {
+                       $this->menuWidth = (int)$GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
+               }
                $this->executeHook('constructPostProcess');
        }
 
@@ -186,7 +199,7 @@ class BackendController {
                $this->executeHook('renderPreProcess');
 
                // Prepare the scaffolding, at this point extension may still add javascript and css
-               $view = $this->getFluidTemplateObject('EXT:backend/Resources/Private/Templates/Backend/Main.html');
+               $view = $this->getFluidTemplateObject($this->templatePath . 'Backend/Main.html');
                // @todo: kick logo view class and move all logic to Fluid
                $view->assign('logo', GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\LogoView::class)->render());
                $view->assign('moduleMenu', $this->generateModuleMenu());
@@ -468,9 +481,24 @@ class BackendController {
         */
        protected function generateJavascript() {
 
-               // Needed for tceform manipulation (date picker)
+               // Needed for FormEngine manipulation (date picker)
                $dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? array('MM-DD-YYYY', 'HH:mm MM-DD-YYYY') : array('DD-MM-YYYY', 'HH:mm DD-MM-YYYY'));
                $this->pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
+               // define the window size of the element browser etc.
+               $popupWindowSize = trim($GLOBALS['BE_USER']->getTSConfigVal('options.popupWindowSize'));
+               if (!empty($popupWindowSize)) {
+                       list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::trimExplode('x', $popupWindowSize);
+               }
+               $popupWindowWidth  = !empty($popupWindowWidth) ? (int)$popupWindowWidth : 700;
+               $popupWindowHeight = !empty($popupWindowHeight) ? (int)$popupWindowHeight : 750;
+
+               // define the window size of the popups within the RTE
+               $rtePopupWindowSize = trim($GLOBALS['BE_USER']->getTSConfigVal('options.rte.popupWindowSize'));
+               if (!empty($rtePopupWindowSize)) {
+                       list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize);
+               }
+               $rtePopupWindowWidth  = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth-200);
+               $rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight-250);
 
                $pathTYPO3 = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/';
                // If another page module was specified, replace the default Page module with the new one
@@ -507,6 +535,14 @@ class BackendController {
                                'width' => 600,
                                'height' => 400
                        ),
+                       'PopupWindow' => array(
+                               'width' => $popupWindowWidth,
+                               'height' => $popupWindowHeight
+                       ),
+                       'RTEPopupWindow' => array(
+                               'width' => $rtePopupWindowWidth,
+                               'height' => $rtePopupWindowHeight
+                       )
                );
                $this->js .= '
        TYPO3.configuration = ' . json_encode($t3Configuration) . ';
@@ -739,7 +775,7 @@ class BackendController {
                // get all modules except the user modules for the side menu
                $moduleStorage = $this->backendModuleRepository->loadAllowedModules(array('user', 'help'));
 
-               $view = $this->getFluidTemplateObject('EXT:backend/Resources/Private/Templates/ModuleMenu/Main.html');
+               $view = $this->getFluidTemplateObject($this->templatePath . 'ModuleMenu/Main.html');
                $view->assign('modules', $moduleStorage);
                return $view->render();
        }