/** * Main function for Extension Manager module. * * @return void */ function main() { $menu = ''; if (empty($this->MOD_SETTINGS['mirrorListURL'])) { $this->MOD_SETTINGS['mirrorListURL'] = $GLOBALS['TYPO3_CONF_VARS']['EXT']['em_mirrorListURL']; } // Starting page: $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('header')); // Command given which is executed regardless of main menu setting: if ($this->CMD['showExt']) { // Show details for a single extension $this->showExtDetails($this->CMD['showExt']); } elseif ($this->CMD['requestInstallExtensions']) { // Show details for a single extension $this->requestInstallExtensions($this->CMD['requestInstallExtensions']); } elseif ($this->CMD['importExt'] || $this->CMD['uploadExt']) { // Imports an extension from online rep. $err = $this->importExtFromRep($this->CMD['importExt'], $this->CMD['extVersion'], $this->CMD['loc'], $this->CMD['uploadExt']); if ($err) { $this->content .= $this->doc->section('', tx_em_Tools::rfw($err)); } if (!$err && $this->CMD['importExt']) { $this->translations->installTranslationsForExtension($this->CMD['importExt'], $this->getMirrorURL()); } } elseif ($this->CMD['importExtInfo']) { // Gets detailed information of an extension from online rep. $this->importExtInfo($this->CMD['importExtInfo'], $this->CMD['extVersion']); } elseif ($this->CMD['downloadExtFile']) { tx_em_Tools::sendFile($this->CMD['downloadExtFile']); } else { // No command - we show what the menu setting tells us: if (t3lib_div::inList('loaded_list,installed_list,import', $this->MOD_SETTINGS['function'])) { $menu .= ' ' . $GLOBALS['LANG']->getLL('group_by') . ' ' . t3lib_BEfunc::getFuncMenu(0, 'SET[listOrder]', $this->MOD_SETTINGS['listOrder'], $this->MOD_MENU['listOrder']) . ' ' . $GLOBALS['LANG']->getLL('show') . ' ' . t3lib_BEfunc::getFuncMenu(0, 'SET[display_details]', $this->MOD_SETTINGS['display_details'], $this->MOD_MENU['display_details']) . '<br />'; } if (t3lib_div::inList('loaded_list,installed_list,updates', $this->MOD_SETTINGS['function'])) { $menu .= '<label for="checkDisplayShy">' . $GLOBALS['LANG']->getLL('display_shy') . '</label> ' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_shy]', $this->MOD_SETTINGS['display_shy'], '', '', 'id="checkDisplayShy"'); } if (t3lib_div::inList('import', $this->MOD_SETTINGS['function']) && strlen($this->fe_user['username'])) { $menu .= '<label for="checkDisplayOwn">' . $GLOBALS['LANG']->getLL('only_my_ext') . '</label> ' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_own]', $this->MOD_SETTINGS['display_own'], '', '', 'id="checkDisplayOwn"'); } if (t3lib_div::inList('loaded_list,installed_list,import', $this->MOD_SETTINGS['function'])) { $menu .= ' <label for="checkDisplayObsolete">' . $GLOBALS['LANG']->getLL('show_obsolete') . '</label> ' . t3lib_BEfunc::getFuncCheck(0, 'SET[display_obsolete]', $this->MOD_SETTINGS['display_obsolete'], '', '', 'id="checkDisplayObsolete"'); } $this->content .= $menu ? $this->doc->section('', '<form action="' . $this->script . '" method="post" name="pageform"><span class="nobr">' . $menu . '</span></form>') : ''; $view = $this->MOD_SETTINGS['function']; if (t3lib_div::_GP('view')) { // temporary overwrite the view with GP var. Used from ExtJS without changing the submodule $view = t3lib_div::_GP('view'); } switch ($view) { case 'loaded_list': // Lists loaded (installed) extensions $headline = $GLOBALS['LANG']->getLL('loaded_exts'); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'loaded', $headline); $content = $this->extensionList->extensionList_loaded(); $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE); break; case 'installed_list': // Lists the installed (available) extensions $headline = sprintf($GLOBALS['LANG']->getLL('available_extensions'), $this->MOD_MENU['listOrder'][$this->MOD_SETTINGS['listOrder']]); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'avail', $headline); $content = $this->extensionList->extensionList_installed(); $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE); break; case 'import': // Lists the extensions available from online rep. $this->extensionList_import(); break; case 'settings': // Shows the settings screen $headline = $GLOBALS['LANG']->getLL('repository_settings'); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'settings', $headline); $content = $this->alterSettings(); $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE); break; case 'translations': // Allows to set the translation preferences and check the status $this->translations->translationHandling(); break; case 'updates': // Shows a list of extensions with updates in TER $this->checkForUpdates(); break; case 'extensionmanager': $this->content .= $this->extensionmanager->render(); break; default: $this->extObjContent(); break; } } // closing any form? $formTags = substr_count($this->content, '<form') + substr_count($this->content, '</form'); if ($formTags % 2 > 0) { $this->content .= '</form>'; } if (!$this->noDocHeader) { // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->content); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } // Renders the module page $this->content = $this->doc->render('Extension Manager', $this->content); }