/**
  * Generates the action menu
  *
  * @return void
  */
 protected function generateMenu()
 {
     $menuItems = ['installedExtensions' => ['controller' => 'List', 'action' => 'index', 'label' => $this->translate('installedExtensions')]];
     if (!$this->settings['offlineMode'] && !Bootstrap::usesComposerClassLoading()) {
         $menuItems['getExtensions'] = ['controller' => 'List', 'action' => 'ter', 'label' => $this->translate('getExtensions')];
         $menuItems['distributions'] = ['controller' => 'List', 'action' => 'distributions', 'label' => $this->translate('distributions')];
         if ($this->actionMethodName === 'showAllVersionsAction') {
             $menuItems['showAllVersions'] = ['controller' => 'List', 'action' => 'showAllVersions', 'label' => $this->translate('showAllVersions') . ' ' . $this->request->getArgument('extensionKey')];
         }
     }
     $uriBuilder = $this->objectManager->get(UriBuilder::class);
     $uriBuilder->setRequest($this->request);
     $menu = $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
     $menu->setIdentifier('ExtensionManagerModuleMenu');
     foreach ($menuItems as $menuItemConfig) {
         if ($this->request->getControllerName() === $menuItemConfig['controller']) {
             $isActive = $this->request->getControllerActionName() === $menuItemConfig['action'] ? true : false;
         } else {
             $isActive = false;
         }
         $menuItem = $menu->makeMenuItem()->setTitle($menuItemConfig['label'])->setHref($this->getHref($menuItemConfig['controller'], $menuItemConfig['action']))->setActive($isActive);
         $menu->addMenuItem($menuItem);
     }
     $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
     $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
 }
 /**
  * Registers the Icons into the docheader
  *
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function registerDocHeaderButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $currentRequest = $this->request;
     $moduleName = $currentRequest->getPluginName();
     $getVars = $this->request->getArguments();
     $lang = $this->getLanguageService();
     $extensionName = $currentRequest->getControllerExtensionName();
     if (empty($getVars)) {
         $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
         $getVars = array('id', 'M', $modulePrefix);
     }
     if ($currentRequest->getControllerActionName() === 'edit') {
         // CLOSE button:
         $closeUrl = $this->uriBuilder->reset()->setArguments(array('action' => 'index', 'id' => $this->id))->buildBackendUri();
         $closeButton = $buttonBar->makeLinkButton()->setHref($closeUrl)->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc'))->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL));
         $buttonBar->addButton($closeButton);
         // SAVE button:
         $saveButton = $buttonBar->makeInputButton()->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc'))->setName('tx_beuser_system_beusertxpermission[submit]')->setValue('Save')->setForm('PermissionControllerEdit')->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))->setShowLabelText(true);
         $buttonBar->addButton($saveButton);
     }
     // SHORTCUT botton:
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setGetVariables($getVars);
     $buttonBar->addButton($shortcutButton);
 }
Example #3
0
 /**
  * DocHeaderButtons
  */
 protected function prepareDocHeaderButtons()
 {
     // @todo: the html structure needed to operate the buttons correctly is broken now.
     // @todo: LanguageModule.js and backend.css -> div.typo3-module-lang div.menuItems
     $downloadAllButton = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->makeLinkButton()->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-system-extension-download', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang.xlf:button.downloadAll'))->setClasses('menuItem updateItem t3js-button-update')->setDataAttributes(['action' => 'updateActiveLanguages'])->setHref('#');
     $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->addButton($downloadAllButton, ButtonBar::BUTTON_POSITION_LEFT);
     $cancelButton = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->makeLinkButton()->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang.xlf:button.cancel'))->setClasses('menuItem cancelItem disabled t3js-button-cancel')->setDataAttributes(['action' => 'cancelLanguageUpdate'])->setHref('#');
     $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->addButton($cancelButton, ButtonBar::BUTTON_POSITION_LEFT);
 }
Example #4
0
 /**
  * Statistics for a given page hash
  *
  * @param int $pageHash
  * @return void
  */
 public function statisticDetailsAction($pageHash = 0)
 {
     $pageHash = (int) $pageHash;
     // Set back button
     $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL);
     $backButton = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xml:administration.back'))->setIcon($icon)->setHref($this->getHref('Administration', 'statistic'));
     $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->addButton($backButton);
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_phash');
     $pageHashRow = $queryBuilder->select('*')->from('index_phash')->where($queryBuilder->expr()->eq('phash', $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)))->execute()->fetch();
     if (!is_array($pageHashRow)) {
         $this->redirect('statistic');
     }
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_debug');
     $debugRow = $queryBuilder->select('*')->from('index_debug')->where($queryBuilder->expr()->eq('phash', $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)))->execute()->fetchAll();
     $debugInfo = [];
     $lexer = '';
     if (is_array($debugRow)) {
         $debugInfo = unserialize($debugRow[0]['debuginfo']);
         $lexer = $debugInfo['lexer'];
         unset($debugInfo['lexer']);
     }
     $pageRecord = BackendUtility::getRecord('pages', $pageHashRow['data_page_id']);
     $keywords = is_array($pageRecord) ? array_flip(GeneralUtility::trimExplode(',', $pageRecord['keywords'], true)) : [];
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_words');
     $wordRecords = $queryBuilder->select('index_words.*', 'index_rel.*')->from('index_words')->from('index_rel')->where($queryBuilder->expr()->eq('index_rel.phash', $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('index_words.wid', $queryBuilder->quoteIdentifier('index_rel.wid')))->orderBy('index_words.baseword')->execute()->fetchAll();
     foreach ($wordRecords as $id => $row) {
         if (isset($keywords[$row['baseword']])) {
             $wordRecords[$id]['is_keyword'] = true;
         }
     }
     $metaphoneRows = $metaphone = [];
     if ($this->enableMetaphoneSearch && is_array($wordRecords)) {
         // Group metaphone hash
         foreach ($wordRecords as $row) {
             $metaphoneRows[$row['metaphone']][] = $row['baseword'];
         }
         foreach ($metaphoneRows as $hash => $words) {
             if (count($words) > 1) {
                 $metaphone[] = ['metaphone' => $this->indexer->metaphone($words[0], 1), $hash, 'words' => $words, 'hash' => $hash];
             }
         }
     }
     // sections
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_section');
     $sections = $queryBuilder->select('*')->from('index_section')->where($queryBuilder->expr()->eq('phash', $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)))->execute()->fetchAll();
     // top words
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_words');
     $topCountWords = $queryBuilder->select('index_words.baseword', 'index_words.metaphone', 'index_rel.*')->from('index_words')->from('index_rel')->setMaxResults(20)->where($queryBuilder->expr()->eq('index_rel.phash', $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('index_words.is_stopword', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('index_words.wid', $queryBuilder->quoteIdentifier('index_rel.wid')))->orderBy('index_rel.count', 'DESC')->execute()->fetchAll();
     // top frequency
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_words');
     $topFrequency = $queryBuilder->select('index_words.baseword', 'index_words.metaphone', 'index_rel.*')->from('index_words')->from('index_rel')->setMaxResults(20)->where($queryBuilder->expr()->eq('index_rel.phash', $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('index_words.is_stopword', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('index_words.wid', $queryBuilder->quoteIdentifier('index_rel.wid')))->orderBy('index_rel.freq', 'DESC')->execute()->fetchAll();
     $this->view->assignMultiple(['phash' => (int) $pageHash, 'phashRow' => $pageHashRow, 'words' => $wordRecords, 'sections' => $sections, 'topCount' => $topCountWords, 'topFrequency' => $topFrequency, 'debug' => $debugInfo, 'lexer' => $lexer, 'metaphone' => $metaphone, 'page' => $pageRecord, 'keywords' => $keywords]);
 }
 /**
  * Gets all buttons for the docheader
  */
 protected function generateButtons()
 {
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $moduleName = $this->request->getPluginName();
     $getVars = $this->request->hasArgument('getVars') ? $this->request->getArgument('getVars') : [];
     $setVars = $this->request->hasArgument('setVars') ? $this->request->getArgument('setVars') : [];
     if (count($getVars) === 0) {
         $modulePrefix = strtolower('tx_' . $this->request->getControllerExtensionName() . '_' . $moduleName);
         $getVars = array('id', 'M', $modulePrefix);
     }
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setGetVariables($getVars)->setDisplayName($this->shortcutName)->setSetVariables($setVars);
     $buttonBar->addButton($shortcutButton);
 }
 /**
  * Create the panel of buttons
  *
  * @return void
  */
 protected function createButtons()
 {
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $uriBuilder = $this->objectManager->get(UriBuilder::class);
     $uriBuilder->setRequest($this->request);
     $buttons = [['table' => 'tx_news_domain_model_news', 'label' => 'module.createNewNewsRecord', 'action' => 'newNews'], ['table' => 'tx_news_domain_model_tag', 'label' => 'module.createNewTag', 'action' => 'newTag'], ['table' => 'sys_category', 'label' => 'module.createNewCategory', 'action' => 'newCategory']];
     foreach ($buttons as $key => $tableConfiguration) {
         if ($this->getBackendUser()->isAdmin() || GeneralUtility::inList($this->getBackendUser()->groupData['tables_modify'], $tableConfiguration['table'])) {
             $viewButton = $buttonBar->makeLinkButton()->setHref($uriBuilder->reset()->setRequest($this->request)->uriFor($tableConfiguration['action'], array(), 'Administration'))->setTitle($this->getLanguageService()->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:' . $tableConfiguration['label'], true))->setIcon($this->iconFactory->getIconForRecord($tableConfiguration['table'], [], Icon::SIZE_SMALL));
             $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, $key);
         }
     }
 }
Example #7
0
 /**
  * Gets all buttons for the docheader
  */
 protected function generateButtons()
 {
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $moduleName = $this->request->getPluginName();
     $getVars = $this->request->hasArgument('getVars') ? $this->request->getArgument('getVars') : [];
     $setVars = $this->request->hasArgument('setVars') ? $this->request->getArgument('setVars') : [];
     if ($this->getBackendUser()->mayMakeShortcut()) {
         if (count($getVars) === 0) {
             $modulePrefix = strtolower('tx_' . $this->request->getControllerExtensionName() . '_' . $moduleName);
             $getVars = array('id', 'M', $modulePrefix);
         }
         $shortcutButton = $buttonBar->makeFullyRenderedButton()->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon(implode(',', $getVars), implode(',', $setVars), $moduleName));
         $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT, 99);
     }
 }
 /**
  * Registers the Icons into the docheader
  *
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function registerDocheaderButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $currentRequest = $this->request;
     $moduleName = $currentRequest->getPluginName();
     $getVars = $this->request->getArguments();
     $extensionName = $currentRequest->getControllerExtensionName();
     if (count($getVars) === 0) {
         $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
         $getVars = array('id', 'M', $modulePrefix);
     }
     $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xml:backendUsers');
     if ($this->request->getControllerName() === 'BackendUser') {
         if ($this->request->getControllerActionName() === 'index') {
             $returnUrl = rawurlencode(BackendUtility::getModuleUrl('system_BeuserTxBeuser'));
             $parameters = GeneralUtility::explodeUrl2Array('edit[be_users][0]=new&returnUrl=' . $returnUrl);
             $addUserLink = BackendUtility::getModuleUrl('record_edit', $parameters);
             $title = $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral', true);
             $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL);
             $addUserButton = $buttonBar->makeLinkButton()->setHref($addUserLink)->setTitle($title)->setIcon($icon);
             $buttonBar->addButton($addUserButton, ButtonBar::BUTTON_POSITION_LEFT);
         }
         if ($this->request->getControllerActionName() === 'compare') {
             $addUserLink = BackendUtility::getModuleUrl('system_BeuserTxBeuser');
             $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true);
             $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL);
             $addUserButton = $buttonBar->makeLinkButton()->setHref($addUserLink)->setTitle($title)->setIcon($icon);
             $buttonBar->addButton($addUserButton, ButtonBar::BUTTON_POSITION_LEFT);
         }
         if ($this->request->getControllerActionName() === 'online') {
             $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xml:onlineUsers');
         }
     }
     if ($this->request->getControllerName() === 'BackendUserGroup') {
         $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xml:backendUserGroupsMenu');
         $returnUrl = rawurlencode(BackendUtility::getModuleUrl('system_BeuserTxBeuser', array('tx_beuser_system_beusertxbeuser' => array('action' => 'index', 'controller' => 'BackendUserGroup'))));
         $parameters = GeneralUtility::explodeUrl2Array('edit[be_groups][0]=new&returnUrl=' . $returnUrl);
         $addUserLink = BackendUtility::getModuleUrl('record_edit', $parameters);
         $title = $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral', true);
         $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL);
         $addUserGroupButton = $buttonBar->makeLinkButton()->setHref($addUserLink)->setTitle($title)->setIcon($icon);
         $buttonBar->addButton($addUserGroupButton, ButtonBar::BUTTON_POSITION_LEFT);
     }
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setDisplayName($shortcutName)->setGetVariables($getVars);
     $buttonBar->addButton($shortcutButton);
 }
Example #9
0
 /**
  * Registers the Icons into the docheader
  *
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function registerDocheaderButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $currentRequest = $this->request;
     $moduleName = $currentRequest->getPluginName();
     $getVars = $this->request->getArguments();
     $extensionName = $currentRequest->getControllerExtensionName();
     if (count($getVars) === 0) {
         $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
         $getVars = ['id', 'M', $modulePrefix];
     }
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setGetVariables($getVars);
     $buttonBar->addButton($shortcutButton);
     $reloadButton = $buttonBar->makeLinkButton()->setHref('#')->setDataAttributes(['action' => 'reload'])->setTitle($this->getLanguageService()->sL('LLL:EXT:recycler/Resources/Private/Language/locallang.xlf:button.reload'))->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-refresh', Icon::SIZE_SMALL));
     $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT);
 }
 /**
  * Lists the available documents.
  *
  * @return void
  */
 public function listAction()
 {
     $this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]);
     $documents = $this->getDocuments();
     // Filter documents to be shown for current user
     $hideDocuments = $this->getBackendUser()->getTSConfigVal('mod.help_DocumentationDocumentation.documents.hide');
     $hideDocuments = GeneralUtility::trimExplode(',', $hideDocuments, true);
     if (!empty($hideDocuments)) {
         $documents = array_diff_key($documents, array_flip($hideDocuments));
     }
     $showDocuments = $this->getBackendUser()->getTSConfigVal('mod.help_DocumentationDocumentation.documents.show');
     $showDocuments = GeneralUtility::trimExplode(',', $showDocuments, true);
     if (!empty($showDocuments)) {
         $documents = array_intersect_key($documents, array_flip($showDocuments));
     }
     $this->view->assign('documents', $documents);
 }
    /**
     * Statistics for a given page hash
     *
     * @param int $pageHash
     * @return void
     */
    public function statisticDetailsAction($pageHash = 0)
    {
        // Set back button
        $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL);
        $backButton = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:indexed_search/Resources/Private/Language/locallang.xml:administration.back'))->setIcon($icon)->setHref($this->getHref('Administration', 'statistic'));
        $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar()->addButton($backButton);
        $pageHash = (int) $pageHash;
        $db = $this->getDatabaseConnection();
        $pageHashRow = $db->exec_SELECTgetSingleRow('*', 'index_phash', 'phash = ' . (int) $pageHash);
        if (!is_array($pageHashRow)) {
            $this->redirect('statistic');
        }
        $debugRow = $db->exec_SELECTgetRows('*', 'index_debug', 'phash = ' . (int) $pageHash);
        $debugInfo = array();
        $lexer = '';
        if (is_array($debugRow)) {
            $debugInfo = unserialize($debugRow[0]['debuginfo']);
            $lexer = $debugInfo['lexer'];
            unset($debugInfo['lexer']);
        }
        $pageRecord = BackendUtility::getRecord('pages', $pageHashRow['data_page_id']);
        $keywords = is_array($pageRecord) ? array_flip(GeneralUtility::trimExplode(',', $pageRecord['keywords'], true)) : array();
        $wordRecords = $db->exec_SELECTgetRows('index_words.*, index_rel.*', 'index_rel, index_words', 'index_rel.phash = ' . (int) $pageHash . ' AND index_words.wid = index_rel.wid', '', 'index_words.baseword');
        foreach ($wordRecords as $id => $row) {
            if (isset($keywords[$row['baseword']])) {
                $wordRecords[$id]['is_keyword'] = true;
            }
        }
        $metaphoneRows = $metaphone = array();
        if ($this->enableMetaphoneSearch && is_array($wordRecords)) {
            // Group metaphone hash
            foreach ($wordRecords as $row) {
                $metaphoneRows[$row['metaphone']][] = $row['baseword'];
            }
            foreach ($metaphoneRows as $hash => $words) {
                if (count($words) > 1) {
                    $metaphone[] = array('metaphone' => $this->indexer->metaphone($words[0], 1), $hash, 'words' => $words, 'hash' => $hash);
                }
            }
        }
        $this->view->assignMultiple(array('phash' => $pageHash, 'phashRow' => $pageHashRow, 'words' => $wordRecords, 'sections' => $db->exec_SELECTgetRows('*', 'index_section', 'index_section.phash = ' . (int) $pageHash), 'topCount' => $db->exec_SELECTgetRows('index_words.baseword, index_words.metaphone, index_rel.*', 'index_rel, index_words', 'index_rel.phash = ' . (int) $pageHash . ' AND index_words.wid = index_rel.wid
					 AND index_words.is_stopword=0', '', 'index_rel.count DESC', '20'), 'topFrequency' => $db->exec_SELECTgetRows('index_words.baseword, index_words.metaphone, index_rel.*', 'index_rel, index_words', 'index_rel.phash = ' . (int) $pageHash . ' AND index_words.wid = index_rel.wid
					 AND index_words.is_stopword=0', '', 'index_rel.freq DESC', '20'), 'debug' => $debugInfo, 'lexer' => $lexer, 'metaphone' => $metaphone, 'page' => $pageRecord, 'keywords' => $keywords));
    }
Example #12
0
 /**
  * Determine the url to view
  *
  * @return string
  */
 protected function getTargetUrl()
 {
     $pageIdToShow = (int) GeneralUtility::_GP('id');
     $permissionClause = $this->getBackendUser()->getPagePermsClause(1);
     $pageRecord = BackendUtility::readPageAccess($pageIdToShow, $permissionClause);
     if ($pageRecord) {
         $this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
         $adminCommand = $this->getAdminCommand($pageIdToShow);
         $domainName = $this->getDomainName($pageIdToShow);
         $languageParameter = $this->getLanguageParameter();
         // Mount point overlay: Set new target page id and mp parameter
         /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPage */
         $sysPage = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
         $sysPage->init(false);
         $mountPointMpParameter = '';
         $finalPageIdToShow = $pageIdToShow;
         $mountPointInformation = $sysPage->getMountPointInfo($pageIdToShow);
         if ($mountPointInformation && $mountPointInformation['overlay']) {
             // New page id
             $finalPageIdToShow = $mountPointInformation['mount_pid'];
             $mountPointMpParameter = '&MP=' . $mountPointInformation['MPvar'];
         }
         // Modify relative path to protocol with host if domain record is given
         $protocolAndHost = '..';
         if ($domainName) {
             // TCEMAIN.previewDomain can contain the protocol, check prevents double protocol URLs
             if (strpos($domainName, '://') !== false) {
                 $protocolAndHost = $domainName;
             } else {
                 $protocol = 'http';
                 $page = (array) $sysPage->getPage($finalPageIdToShow);
                 if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && GeneralUtility::getIndpEnv('TYPO3_SSL')) {
                     $protocol = 'https';
                 }
                 $protocolAndHost = $protocol . '://' . $domainName;
             }
         }
         return $protocolAndHost . '/index.php?id=' . $finalPageIdToShow . $this->getTypeParameterIfSet($finalPageIdToShow) . $mountPointMpParameter . $adminCommand . $languageParameter;
     } else {
         return '#';
     }
 }
Example #13
0
 /**
  * Registers the Icons into the docheader
  *
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function registerDocHeaderButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $currentRequest = $this->request;
     $moduleName = $currentRequest->getPluginName();
     $getVars = $this->request->getArguments();
     $extensionName = $currentRequest->getControllerExtensionName();
     if (empty($getVars)) {
         $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
         $getVars = array('id', 'M', $modulePrefix);
     }
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setGetVariables($getVars);
     $buttonBar->addButton($shortcutButton);
     if ($this->id > 0) {
         $iconFactory = $this->view->getModuleTemplate()->getIconFactory();
         $viewButton = $buttonBar->makeLinkButton()->setOnClick(htmlspecialchars(BackendUtility::viewOnClick($this->pageInfo['uid'], '', BackendUtility::BEgetRootLine($this->pageInfo['uid']))))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#');
         $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
     }
 }
Example #14
0
 /**
  * Create the panel of buttons
  *
  * @return void
  */
 protected function createButtons()
 {
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $uriBuilder = $this->objectManager->get(UriBuilder::class);
     $uriBuilder->setRequest($this->request);
     $buttons = [['table' => 'tx_news_domain_model_news', 'label' => 'module.createNewNewsRecord', 'action' => 'newNews'], ['table' => 'tx_news_domain_model_tag', 'label' => 'module.createNewTag', 'action' => 'newTag'], ['table' => 'sys_category', 'label' => 'module.createNewCategory', 'action' => 'newCategory']];
     foreach ($buttons as $key => $tableConfiguration) {
         if ($this->getBackendUser()->isAdmin() || GeneralUtility::inList($this->getBackendUser()->groupData['tables_modify'], $tableConfiguration['table'])) {
             $viewButton = $buttonBar->makeLinkButton()->setHref($uriBuilder->reset()->setRequest($this->request)->uriFor($tableConfiguration['action'], [], 'Administration'))->setTitle($this->getLanguageService()->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:' . $tableConfiguration['label']))->setIcon($this->iconFactory->getIconForRecord($tableConfiguration['table'], [], Icon::SIZE_SMALL));
             $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, $key);
         }
     }
     /** @var Clipboard clipObj */
     $clipBoard = GeneralUtility::makeInstance(Clipboard::class);
     $clipBoard->initializeClipboard();
     $elFromTable = $clipBoard->elFromTable('tx_news_domain_model_news');
     if (!empty($elFromTable)) {
         $viewButton = $buttonBar->makeLinkButton()->setHref($clipBoard->pasteUrl('', $this->pageUid))->setOnClick('return ' . $clipBoard->confirmMsg('pages', BackendUtilityCore::getRecord('pages', $this->pageUid), 'into', $elFromTable))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:clip_pasteInto'))->setIcon($this->iconFactory->getIcon('actions-document-paste-into', ICON::SIZE_SMALL));
         $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
     }
 }
Example #15
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return array All available buttons as an assoc. array
  */
 protected function registerButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     /** @var IconFactory $iconFactory */
     $iconFactory = $this->view->getModuleTemplate()->getIconFactory();
     /** @var $resourceFactory ResourceFactory */
     $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
     $lang = $this->getLanguageService();
     // Refresh page
     $refreshLink = GeneralUtility::linkThisScript(['target' => rawurlencode($this->folderObject->getCombinedIdentifier()), 'imagemode' => $this->filelist->thumbs]);
     $refreshButton = $buttonBar->makeLinkButton()->setHref($refreshLink)->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.reload'))->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL));
     $buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT);
     // Level up
     try {
         $currentStorage = $this->folderObject->getStorage();
         $parentFolder = $this->folderObject->getParentFolder();
         if ($parentFolder->getIdentifier() !== $this->folderObject->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
             $levelUpClick = 'top.document.getElementsByName("navigation")[0].contentWindow.Tree.highlightActiveItem("file","folder' . GeneralUtility::md5int($parentFolder->getCombinedIdentifier()) . '_"+top.fsMod.currentBank)';
             $levelUpButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('file_FilelistList', ['id' => $parentFolder->getCombinedIdentifier()]))->setOnClick($levelUpClick)->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.upOneLevel'))->setIcon($iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL));
             $buttonBar->addButton($levelUpButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
         }
     } catch (\Exception $e) {
     }
     // Shortcut
     if ($this->getBackendUser()->mayMakeShortcut()) {
         $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName('file_FilelistList');
         $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
     }
     // Upload button (only if upload to this directory is allowed)
     if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) {
         $uploadButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('file_upload', ['target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()]))->setClasses('t3js-drag-uploader-trigger')->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.upload'))->setIcon($iconFactory->getIcon('actions-edit-upload', Icon::SIZE_SMALL));
         $buttonBar->addButton($uploadButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
     }
     // New folder button
     if ($this->folderObject && $this->folderObject->checkActionPermission('write') && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))) {
         $newButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('file_newfolder', ['target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()]))->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.new'))->setIcon($iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL));
         $buttonBar->addButton($newButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
     }
     // Add paste button if clipboard is initialized
     if ($this->filelist->clipObj instanceof Clipboard && $this->folderObject->checkActionPermission('write')) {
         $elFromTable = $this->filelist->clipObj->elFromTable('_FILE');
         if (!empty($elFromTable)) {
             $addPasteButton = true;
             $elToConfirm = [];
             foreach ($elFromTable as $key => $element) {
                 $clipBoardElement = $resourceFactory->retrieveFileOrFolderObject($element);
                 if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $this->folderObject)) {
                     $addPasteButton = false;
                 }
                 $elToConfirm[$key] = $clipBoardElement->getName();
             }
             if ($addPasteButton) {
                 $confirmText = $this->filelist->clipObj->confirmMsgText('_FILE', $this->folderObject->getReadablePath(), 'into', $elToConfirm);
                 $pasteButton = $buttonBar->makeLinkButton()->setHref($this->filelist->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier()))->setClasses('t3js-modal-trigger')->setDataAttributes(['severity' => 'warning', 'content' => $confirmText, 'title' => $lang->getLL('clip_paste')])->setTitle($lang->getLL('clip_paste'))->setIcon($iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL));
                 $buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
             }
         }
     }
 }