/**
     * Constructor, initialize.
     *
     * @return void
     * @todo Define visibility
     */
    public function init()
    {
        // Start the template object:
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate');
        $this->doc->bodyTagMargins['x'] = 5;
        $this->doc->bodyTagMargins['y'] = 5;
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        // Add JS
        $this->doc->JScode = $this->doc->wrapScriptTags('
		function jump(url, modName, mainModName) {
				// clear information about which entry in nav. tree that might have been highlighted.
			top.fsMod.navFrameHighlightedID = [];

			if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
				top.content.nav_frame.refresh_nav();
			}

			top.nextLoadModuleUrl = url;
			top.goToModule(modName);
		}
		');
        // Start the page:
        $this->content = '';
        $this->content .= $this->doc->startPage('TYPO3 Edit Document');
        // Loads the backend modules available for the logged in user.
        $this->loadModules = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
        $this->loadModules->load($GLOBALS['TBE_MODULES']);
    }
 /**
  * Constructor
  */
 public function __construct()
 {
     // Set debug flag for BE development only
     $this->debug = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) === 1;
     // Initializes the backend modules structure for use later.
     $this->moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
     $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
     $this->moduleMenu = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\ModuleMenuView');
     $this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
     $this->pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
     $this->pageRenderer->loadExtJS();
     $this->pageRenderer->enableExtJSQuickTips();
     $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', '//already done', FALSE);
     $this->pageRenderer->addExtDirectCode();
     // Add default BE javascript
     $this->js = '';
     $this->jsFiles = array('common' => 'js/common.js', 'locallang' => $this->getLocalLangFileName(), 'modernizr' => 'contrib/modernizr/modernizr.min.js', 'swfupload' => 'contrib/swfupload/swfupload.js', 'swfupload.swfobject' => 'contrib/swfupload/plugins/swfupload.swfobject.js', 'swfupload.cookies' => 'contrib/swfupload/plugins/swfupload.cookies.js', 'swfupload.queue' => 'contrib/swfupload/plugins/swfupload.queue.js', 'md5' => 'md5.js', 'toolbarmanager' => 'js/toolbarmanager.js', 'modulemenu' => 'js/modulemenu.js', 'iecompatibility' => 'js/iecompatibility.js', 'flashupload' => 'js/flashupload.js', 'evalfield' => '../t3lib/jsfunc.evalfield.js', 'flashmessages' => '../t3lib/js/extjs/ux/flashmessages.js', 'tabclosemenu' => '../t3lib/js/extjs/ux/ext.ux.tabclosemenu.js', 'notifications' => '../t3lib/js/extjs/notifications.js', 'backend' => 'js/backend.js', 'loginrefresh' => 'js/loginrefresh.js', 'debugPanel' => 'js/extjs/debugPanel.js', 'viewport' => 'js/extjs/viewport.js', 'iframepanel' => 'js/extjs/iframepanel.js', 'backendcontentiframe' => 'js/extjs/backendcontentiframe.js', 'modulepanel' => 'js/extjs/modulepanel.js', 'viewportConfiguration' => 'js/extjs/viewportConfiguration.js', 'util' => '../t3lib/js/extjs/util.js');
     if ($this->debug) {
         unset($this->jsFiles['loginrefresh']);
     }
     // Add default BE css
     $this->css = '';
     $this->cssFiles = array();
     $this->toolbarItems = array();
     $this->initializeCoreToolbarItems();
     $this->menuWidth = $this->menuWidthDefault;
     if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth) {
         $this->menuWidth = (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
     }
     $this->executeHook('constructPostProcess');
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     // Set debug flag for BE development only
     $this->debug = (int) $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1;
     // Initializes the backend modules structure for use later.
     $this->moduleLoader = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
     $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
     $this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
     $this->pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
     $this->pageRenderer->loadExtJS();
     $this->pageRenderer->loadJquery(NULL, NULL, \TYPO3\CMS\Core\Page\PageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT);
     $this->pageRenderer->enableExtJSQuickTips();
     $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', '//already done', FALSE);
     $this->pageRenderer->addExtDirectCode();
     // Add default BE javascript
     $this->js = '';
     $this->jsFiles = array('common' => 'sysext/backend/Resources/Public/JavaScript/common.js', 'locallang' => $this->getLocalLangFileName(), 'modernizr' => 'contrib/modernizr/modernizr.min.js', 'md5' => 'sysext/backend/Resources/Public/JavaScript/md5.js', 'toolbarmanager' => 'sysext/backend/Resources/Public/JavaScript/toolbarmanager.js', 'modulemenu' => 'sysext/backend/Resources/Public/JavaScript/modulemenu.js', 'evalfield' => 'sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js', 'flashmessages' => 'sysext/backend/Resources/Public/JavaScript/flashmessages.js', 'tabclosemenu' => 'js/extjs/ux/ext.ux.tabclosemenu.js', 'notifications' => 'sysext/backend/Resources/Public/JavaScript/notifications.js', 'backend' => 'sysext/backend/Resources/Public/JavaScript/backend.js', 'loginrefresh' => 'sysext/backend/Resources/Public/JavaScript/loginrefresh.js', 'debugPanel' => 'js/extjs/debugPanel.js', 'viewport' => 'js/extjs/viewport.js', 'iframepanel' => 'sysext/backend/Resources/Public/JavaScript/iframepanel.js', 'backendcontentiframe' => 'js/extjs/backendcontentiframe.js', 'modulepanel' => 'js/extjs/modulepanel.js', 'viewportConfiguration' => 'js/extjs/viewportConfiguration.js', 'util' => 'sysext/backend/Resources/Public/JavaScript/util.js');
     if ($this->debug) {
         unset($this->jsFiles['loginrefresh']);
     }
     // Add default BE css
     $this->pageRenderer->addCssLibrary('contrib/normalize/normalize.css', 'stylesheet', 'all', '', TRUE, TRUE);
     $this->css = '';
     $this->cssFiles = array();
     $this->toolbarItems = array();
     $this->initializeCoreToolbarItems();
     $this->menuWidth = $this->menuWidthDefault;
     if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth) {
         $this->menuWidth = (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
     }
     $this->executeHook('constructPostProcess');
 }
 /**
  * Constructor, initializes several variables
  */
 public function __construct()
 {
     $this->backPath = '';
     $this->linkModules = TRUE;
     // Loads the backend modules available for the logged in user.
     $this->moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
     $this->moduleLoader->observeWorkspaces = TRUE;
     $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
     $this->loadedModules = $this->moduleLoader->modules;
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->getLanguageService()->includeLLFile('EXT:lang/locallang_misc.xlf');
     // Needed to get the correct icons when reloading the menu after saving it
     $this->moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class);
     $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
     // By default, 5 groups are set
     $this->shortcutGroups = array(1 => '1', 2 => '1', 3 => '1', 4 => '1', 5 => '1');
     $this->shortcutGroups = $this->initShortcutGroups();
     $this->shortcuts = $this->initShortcuts();
     $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ShortcutMenu');
 }
Example #6
0
 /**
  * Constructor, initializes several variables
  */
 public function __construct()
 {
     if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
         $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
     }
     $this->backPath = '';
     $this->linkModules = TRUE;
     // Loads the backend modules available for the logged in user.
     $this->moduleLoader = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
     $this->moduleLoader->observeWorkspaces = TRUE;
     $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
     $this->loadedModules = $this->moduleLoader->modules;
 }
 /**
  * Pre-initialization - setting input variables for storing shortcuts etc.
  *
  * @return void
  * @todo Define visibility
  */
 public function preinit()
 {
     // Setting GPvars:
     $this->isAjaxCall = (bool) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('ajax');
     $this->modName = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('modName');
     $this->M_modName = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('motherModName');
     $this->URL = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('URL');
     $this->editSC = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('editShortcut');
     $this->deleteCategory = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('deleteCategory');
     $this->editPage = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('editPage');
     $this->changeWorkspace = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('changeWorkspace');
     $this->changeWorkspacePreview = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('changeWorkspacePreview');
     $this->editName = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('editName');
     $this->editGroup = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('editGroup');
     $this->whichItem = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('whichItem');
     // Creating modules object
     $this->loadModules = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
     $this->loadModules->load($GLOBALS['TBE_MODULES']);
 }
Example #8
0
 /**
  * Returns title for the shortcut icon
  *
  * @param string $shortcutLabel Shortcut label
  * @param string $moduleName Backend module name (key)
  * @param string $parentModuleName Parent module label
  * @return string Title for the shortcut icon
  */
 protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '')
 {
     $languageService = $this->getLanguageService();
     if (substr($moduleName, 0, 5) == 'xMOD_') {
         $title = substr($moduleName, 5);
     } else {
         list($mainModule, $subModule) = explode('_', $moduleName);
         $mainModuleLabels = $this->moduleLoader->getLabelsForModule($mainModule);
         $title = $languageService->sL($mainModuleLabels['title']);
         if (!empty($subModule)) {
             $subModuleLabels = $this->moduleLoader->getLabelsForModule($moduleName);
             $title .= '>' . $languageService->sL($subModuleLabels['title']);
         }
     }
     if ($parentModuleName) {
         $title .= ' (' . $parentModuleName . ')';
     }
     $title .= ': ' . $shortcutLabel;
     return $title;
 }
Example #9
0
 /**
  * @codeCoverageIgnore
  * @param array $modules
  * @param mixed $user
  */
 protected function performModuleLoading(array $modules, $user)
 {
     parent::load($modules, NULL === $BE_USER ? $GLOBALS['BE_USER'] : $BE_USER);
 }
 /**
  * Generate the main settings form:
  *
  * @return void
  */
 public function main()
 {
     $this->content .= '<form action="' . BackendUtility::getModuleUrl('user_setup') . '" method="post" id="SetupModuleController" name="usersetup" enctype="multipart/form-data">';
     if ($this->languageUpdate) {
         $this->moduleTemplate->addJavaScriptCode('languageUpdate', '
             if (top && top.TYPO3.ModuleMenu.App) {
                 top.TYPO3.ModuleMenu.App.refreshMenu();
             }
         ');
     }
     if ($this->pagetreeNeedsRefresh) {
         BackendUtility::setUpdateSignal('updatePageTree');
     }
     // Start page:
     $this->moduleTemplate->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
     // Use a wrapper div
     $this->content .= '<div id="user-setup-wrapper">';
     // Load available backend modules
     $this->loadModules = GeneralUtility::makeInstance(ModuleLoader::class);
     $this->loadModules->observeWorkspaces = true;
     $this->loadModules->load($GLOBALS['TBE_MODULES']);
     $this->content .= $this->doc->header($this->getLanguageService()->getLL('UserSettings'));
     // Show if setup was saved
     if ($this->setupIsUpdated && !$this->settingsAreResetToDefault) {
         $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('setupWasUpdated'), $this->getLanguageService()->getLL('UserSettings'));
         $this->content .= $flashMessage->render();
     }
     // Show if temporary data was cleared
     if ($this->settingsAreResetToDefault) {
         $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('settingsAreReset'), $this->getLanguageService()->getLL('resetConfiguration'));
         $this->content .= $flashMessage->render();
     }
     // Notice
     if ($this->setupIsUpdated || $this->settingsAreResetToDefault) {
         $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('activateChanges'), '', FlashMessage::INFO);
         $this->content .= $flashMessage->render();
     }
     // If password is updated, output whether it failed or was OK.
     if ($this->passwordIsSubmitted) {
         $flashMessage = null;
         switch ($this->passwordIsUpdated) {
             case self::PASSWORD_OLD_WRONG:
                 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('oldPassword_failed'), $this->getLanguageService()->getLL('newPassword'), FlashMessage::ERROR);
                 break;
             case self::PASSWORD_NOT_THE_SAME:
                 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('newPassword_failed'), $this->getLanguageService()->getLL('newPassword'), FlashMessage::ERROR);
                 break;
             case self::PASSWORD_UPDATED:
                 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('newPassword_ok'), $this->getLanguageService()->getLL('newPassword'));
                 break;
         }
         if ($flashMessage) {
             $this->content .= $flashMessage->render();
         }
     }
     // Render user switch
     $this->content .= $this->renderSimulateUserSelectAndLabel();
     // Render the menu items
     $menuItems = $this->renderUserSetup();
     $this->content .= $this->moduleTemplate->getDynamicTabMenu($menuItems, 'user-setup', 1, false, false);
     $formToken = $this->formProtection->generateToken('BE user setup', 'edit');
     $this->content .= '<div>';
     $this->content .= '<input type="hidden" name="simUser" value="' . $this->simUser . '" />
         <input type="hidden" name="formToken" value="' . $formToken . '" />
         <input type="hidden" value="1" name="data[save]" />
         <input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" />';
     $this->content .= '</div>';
     // End of wrapper div
     $this->content .= '</div>';
     // Setting up the buttons and markers for docheader
     $this->getButtons();
     // Build the <body> for the module
     // Renders the module page
     $this->moduleTemplate->setContent($this->content);
     $this->content .= '</form>';
 }
 /**
  * @test
  * @dataProvider addModuleLabelsDataProvider
  *
  * @param string $moduleName
  * @param string|array $labels
  * @param array $expectedResult
  */
 public function validateLabelsString($moduleName, $labels, array $expectedResult)
 {
     $moduleLoader = new ModuleLoader();
     $moduleLoader->addLabelsForModule($moduleName, $labels);
     $this->assertEquals($expectedResult, $moduleLoader->getLabelsForModule($moduleName));
 }
Example #12
0
 /**
  * Create array with data of all subModules of a specific main module
  *
  * @param ModuleLoader $loadedModules the module loader instance
  * @param string $moduleName Name of the main module
  * @return array
  */
 protected function getSubModuleData(ModuleLoader $loadedModules, $moduleName)
 {
     $subModulesData = [];
     foreach ($loadedModules->modules[$moduleName]['sub'] as $subModuleName => $subModuleInfo) {
         $moduleLabels = $loadedModules->getLabelsForModule($moduleName . '_' . $subModuleName);
         $subModuleData = [];
         $subModuleData['name'] = $subModuleName;
         $subModuleData['icon'] = $subModuleInfo['icon'];
         $subModuleData['iconIdentifier'] = $subModuleInfo['iconIdentifier'];
         $subModuleData['label'] = $moduleLabels['title'];
         $subModuleData['shortDescription'] = $moduleLabels['shortdescription'];
         $subModuleData['longDescription'] = $moduleLabels['description'];
         $subModulesData[] = $subModuleData;
     }
     return $subModulesData;
 }
Example #13
0
 /**
  * Returns a select with all modules for startup
  *
  * @param array $params
  * @param SetupModuleController $pObj
  *
  * @return string Complete select as HTML string
  */
 public function renderStartModuleSelect($params, $pObj)
 {
     // Load available backend modules
     $this->loadModules = GeneralUtility::makeInstance(ModuleLoader::class);
     $this->loadModules->observeWorkspaces = true;
     $this->loadModules->load($GLOBALS['TBE_MODULES']);
     $startModuleSelect = '<option value="">' . htmlspecialchars($this->getLanguageService()->getLL('startModule.firstInMenu')) . '</option>';
     foreach ($pObj->loadModules->modules as $mainMod => $modData) {
         if (!empty($modData['sub']) && is_array($modData['sub'])) {
             $modules = '';
             foreach ($modData['sub'] as $subData) {
                 $modName = $subData['name'];
                 $modules .= '<option value="' . htmlspecialchars($modName) . '"';
                 $modules .= $this->getBackendUser()->uc['startModule'] === $modName ? ' selected="selected"' : '';
                 $modules .= '>' . htmlspecialchars($this->getLanguageService()->sL($this->loadModules->getLabelsForModule($modName)['title'])) . '</option>';
             }
             $groupLabel = htmlspecialchars($this->getLanguageService()->sL($this->loadModules->getLabelsForModule($mainMod)['title']));
             $startModuleSelect .= '<optgroup label="' . htmlspecialchars($groupLabel) . '">' . $modules . '</optgroup>';
         }
     }
     return '<select id="field_startModule" name="data[startModule]" class="form-control">' . $startModuleSelect . '</select>';
 }