/** * Main * * @return void */ public function main() { // Template markers $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => ''); // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $this->access = is_array($this->pageinfo); $lang = $this->getLanguageService(); if ($this->id && $this->access) { $urlParameters = array('id' => $this->id, 'template' => 'all'); $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); // JavaScript $this->moduleTemplate->addJavaScriptCode('TSTemplateInlineJS', ' function uFormUrl(aname) { document.forms[0].action = ' . GeneralUtility::quoteJSvalue($aHref . '#') . '+aname; } function brPoint(lnumber,t) { window.location.href = ' . GeneralUtility::quoteJSvalue($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=') . '+(t?"setup":"const")+"&breakPointLN="+lnumber; return false; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . '; '); $this->moduleTemplate->getPageRenderer()->addCssInlineBlock('TSTemplateInlineStyle', ' TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; } TABLE#typo3-objectBrowser A { text-decoration: none; } TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; } .ts-typoscript { width: 100%; } .tsob-search-submit {margin-left: 3px; margin-right: 3px;} .tst-analyzer-options { margin:5px 0; } '); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); // Build the module content $this->content = '<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="multipart/form-data" id="TypoScriptTemplateModuleController" name="editForm" class="form">'; $this->content .= $this->moduleTemplate->header($lang->getLL('moduleTitle')); $this->extObjContent(); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); $this->content .= '</form>'; } else { // Template pages: $records = $this->getDatabaseConnection()->exec_SELECTgetRows('pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val', 'pages,sys_template', 'pages.uid=sys_template.pid' . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages') . BackendUtility::deleteClause('sys_template') . BackendUtility::versioningPlaceholderClause('sys_template'), 'pages.uid', 'pages.pid, pages.sorting'); $pArray = array(); foreach ($records as $record) { $this->setInPageArray($pArray, BackendUtility::BEgetRootLine($record['uid'], 'AND 1=1'), $record); } $table = '<div class="table-fit"><table class="table table-striped table-hover" id="ts-overview">' . '<thead>' . '<tr>' . '<th>' . $lang->getLL('pageName') . '</th>' . '<th>' . $lang->getLL('templates') . '</th>' . '<th>' . $lang->getLL('isRoot') . '</th>' . '<th>' . $lang->getLL('isExt') . '</th>' . '</tr>' . '</thead>' . '<tbody>' . implode('', $this->renderList($pArray)) . '</tbody>' . '</table></div>'; $this->content = $this->moduleTemplate->header($lang->getLL('moduleTitle')); $this->content .= '<p class="lead">' . $lang->getLL('overview') . '</p>' . $table; // RENDER LIST of pages with templates, END // Setting up the buttons and markers for docheader $this->getButtons(); } }
/** * Initialization * * @return void */ public function init() { $this->MCONF['name'] = $this->moduleName; $this->menuConfig(); $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); $this->moduleTemplate->addJavaScriptCode('jumpToUrl', ' function jumpToUrl(URL) { window.location.href = URL; return false; } '); }
/** * Initialization * * @return void */ public function init() { $this->MCONF['name'] = $this->moduleName; $this->menuConfig(); $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); $this->moduleTemplate->setForm('<form action="" method="post" name="' . $this->formName . '">'); $this->moduleTemplate->addJavaScriptCode('jumpToUrl', ' function jumpToUrl(URL) { window.location.href = URL; return false; } '); }
/** * Creates the module's content. In this case it rather acts as a kind of # * dispatcher redirecting requests to specific tasks. * * @return void */ public function main() { $this->getButtons(); $this->generateMenu(); $this->moduleTemplate->addJavaScriptCode('TaskCenterInlineJavascript', 'if (top.fsMod) { top.fsMod.recentIds["web"] = 0; }'); // Render content depending on the mode $mode = (string) $this->MOD_SETTINGS['mode']; if ($mode === 'information') { $this->renderInformationContent(); } else { $this->renderModuleContent(); } // Renders the module page $this->moduleTemplate->setTitle($this->getLanguageService()->getLL('title')); }
/** * Initialize module header etc and call extObjContent function * * @return void */ public function main() { // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); if ($this->pageinfo) { $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); } $access = is_array($this->pageinfo); // We keep this here, in case somebody relies on the old doc being here $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); // Main if ($this->id && $access) { // JavaScript $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" id="PageFunctionsController" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />'; $vContent = $this->moduleTemplate->getVersionSelector($this->id, true); if ($vContent) { $this->content .= '<div>' . $vContent . '</div>'; } $this->extObjContent(); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); $this->content .= '</form>'; } else { // If no access or if ID == zero $title = $this->getLanguageService()->getLL('title'); $message = $this->getLanguageService()->getLL('clickAPage_content'); $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html')); $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO)); $this->content = $view->render(); // Setting up the buttons and markers for docheader $this->getButtons(); } }
/** * Initialize module header etc and call extObjContent function * * @return void */ public function main() { // We leave this here because of dependencies to submodules $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); // The page will show only if there is a valid page and if this page // may be viewed by the user $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); if ($this->pageinfo) { $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); } $access = is_array($this->pageinfo); if ($this->id && $access || $this->backendUser->user['admin'] && !$this->id) { if ($this->backendUser->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } // JavaScript $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; function jumpToUrl(URL) { window.location.href = URL; return false; } '); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) . '" method="post" id="InfoModuleController" name="webinfoForm" class="form-inline form-inline-spaced">'; $vContent = $this->moduleTemplate->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->moduleTemplate->section('', $vContent); } $this->extObjContent(); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); $this->content .= '</form>'; } else { // If no access or if ID == zero $this->content = $this->doc->header($this->languageService->getLL('title')); } }
/** * Initialize module header etc and call extObjContent function * * @return void */ public function main() { // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); if ($this->pageinfo) { $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); } $access = is_array($this->pageinfo); // We keep this here, in case somebody relies on the old doc being here $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); // Main if ($this->id && $access) { // JavaScript $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->view = $this->getFluidTemplateObject('func', 'func'); $this->view->assign('moduleName', BackendUtility::getModuleUrl('web_func')); $this->view->assign('id', $this->id); $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, true)); $this->view->assign('functionMenuModuleContent', $this->getExtObjContent()); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); $this->content .= $this->view->render(); } else { // If no access or if ID == zero $title = $this->getLanguageService()->getLL('title'); $message = $this->getLanguageService()->getLL('clickAPage_content'); $this->view = $this->getFluidTemplateObject('func', 'func', 'InfoBox'); $this->view->assignMultiple(['title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO]); $this->content = $this->view->render(); // Setting up the buttons and markers for docheader $this->getButtons(); } }
/** * Main * * @return void */ public function main() { // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $this->access = is_array($this->pageinfo); $view = $this->getFluidTemplateObject('tstemplate'); if ($this->id && $this->access) { $urlParameters = ['id' => $this->id, 'template' => 'all']; $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); // JavaScript $this->moduleTemplate->addJavaScriptCode('TSTemplateInlineJS', 'function uFormUrl(aname) { document.forms[0].action = ' . GeneralUtility::quoteJSvalue($aHref . '#') . '+aname; } function brPoint(lnumber,t) { window.location.href = ' . GeneralUtility::quoteJSvalue($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\' . 'TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=') . '+(t?"setup":"const")+"&breakPointLN="+lnumber; return false; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';'); $this->moduleTemplate->getPageRenderer()->addCssInlineBlock('TSTemplateInlineStyle', 'TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; } TABLE#typo3-objectBrowser A { text-decoration: none; } TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; } .ts-typoscript { width: 100%; } .tsob-search-submit {margin-left: 3px; margin-right: 3px;} .tst-analyzer-options { margin:5px 0; }'); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); // Build the module content $view->assign('actionName', $aHref); $view->assign('typoscriptTemplateModuleContent', $this->getExtObjContent()); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); } else { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class))->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); $result = $queryBuilder->select('pages.uid')->addSelectLiteral($queryBuilder->expr()->count('*', 'count'), $queryBuilder->expr()->max('sys_template.root', 'root_max_val'), $queryBuilder->expr()->min('sys_template.root', 'root_min_val'))->from('pages')->from('sys_template')->where($queryBuilder->expr()->eq('pages.uid', $queryBuilder->quoteIdentifier('sys_template.pid')))->groupBy('pages.uid')->orderBy('pages.pid')->addOrderBy('pages.sorting')->execute(); $pArray = []; while ($record = $result->fetch()) { $this->setInPageArray($pArray, BackendUtility::BEgetRootLine($record['uid'], 'AND 1=1'), $record); } $view->getRenderingContext()->setControllerAction('PageZero'); $view->assign('templateList', $this->renderList($pArray)); // RENDER LIST of pages with templates, END // Setting up the buttons and markers for docheader $this->getButtons(); } $this->content = $view->render(); }
/** * Main function. * Creates some general objects and calls other functions for the main rendering of module content. * * @return void */ public function main() { $lang = $this->getLanguageService(); // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $access = is_array($this->pageinfo) ? 1 : 0; // Content $content = ''; if ($this->id && $access) { // Initialize permission settings: $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo); $this->EDIT_CONTENT = $this->pageIsNotLockedForEditors(); $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); // override the default jumpToUrl $this->moduleTemplate->addJavaScriptCode('jumpToUrl', ' function jumpToUrl(URL,formEl) { if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?) if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else { window.location.href = URL; } } '); $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', ' if (top.fsMod) { top.fsMod.recentIds["web"] = ' . (int) $this->id . '; top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . '; } ' . ($this->popView ? BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id)) : '') . ' function deleteRecord(table,id,url) { // if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) { window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . '&prErr=1&uPT=1"; } return false; } '); // Find backend layout / columns $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this); if (!empty($backendLayout['__colPosList'])) { $this->colPosList = implode(',', $backendLayout['__colPosList']); } // Removing duplicates, if any $this->colPosList = array_unique(GeneralUtility::intExplode(',', $this->colPosList)); // Accessible columns if (isset($this->modSharedTSconfig['properties']['colPos_list']) && trim($this->modSharedTSconfig['properties']['colPos_list']) !== '') { $this->activeColPosList = array_unique(GeneralUtility::intExplode(',', trim($this->modSharedTSconfig['properties']['colPos_list']))); // Match with the list which is present in the colPosList for the current page if (!empty($this->colPosList) && !empty($this->activeColPosList)) { $this->activeColPosList = array_unique(array_intersect($this->activeColPosList, $this->colPosList)); } } else { $this->activeColPosList = $this->colPosList; } $this->activeColPosList = implode(',', $this->activeColPosList); $this->colPosList = implode(',', $this->colPosList); $content .= $this->getHeaderFlashMessagesForCurrentPid(); // Render the primary module content: if ($this->MOD_SETTINGS['function'] == 0) { // QuickEdit $content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db', ['prErr' => 1, 'uPT' => 1])) . '" method="post" enctype="multipart/form-data" name="editform" id="PageLayoutController" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; $content .= $this->renderQuickEdit(); } else { $content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName, array('id' => $this->id, 'imagemode' => $this->imagemode))) . '" id="PageLayoutController" method="post">'; // Page title $content .= '<h1 class="t3js-title-inlineedit">' . htmlspecialchars($this->getLocalizedPageTitle()) . '</h1>'; // All other listings $content .= $this->renderListContent(); } $content .= '</form>'; $content .= $this->searchContent; // Setting up the buttons for the docheader $this->makeButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : ''); // Create LanguageMenu $this->makeLanguageMenu(); } else { $this->moduleTemplate->addJavaScriptCode('mainJsFunctions', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); $content .= '<h1>' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '</h1>'; $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html')); $view->assignMultiple(array('title' => $lang->getLL('clickAPage_header'), 'message' => $lang->getLL('clickAPage_content'), 'state' => InfoboxViewHelper::STATE_INFO)); $content .= $view->render(); } // Set content $this->moduleTemplate->setContent($content); }
/** * Main module function * * @throws \BadFunctionCallException * @throws \InvalidArgumentException * @return void */ public function main() { $this->lang->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf'); // Start document template object: // We keep this here, in case somebody relies on the old doc being here $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->bodyTagId = 'imp-exp-mod'; $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Impexp/ImportExport'); $this->moduleTemplate->addJavaScriptCode('ImpexpInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); $this->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('xMOD_tximpexp')) . '" method="post" enctype="multipart/form-data">' . '<input type="hidden" name="id" value="' . $this->id . '" />'); // Input data grabbed: $inData = GeneralUtility::_GP('tx_impexp'); $this->content .= $this->moduleTemplate->sectionHeader($this->lang->getLL('title_' . (string) $inData['action'])); $this->content .= '<div style="padding-top: 5px;"></div>'; $this->checkUpload(); switch ((string) $inData['action']) { case 'export': $this->shortcutName = $this->lang->getLL('title_export'); // Finally: If upload went well, set the new file as the thumbnail in the $inData array: if (!empty($this->uploadedFiles[0])) { $inData['meta']['thumbnail'] = $this->uploadedFiles[0]->getCombinedIdentifier(); } // Call export interface $this->exportData($inData); break; case 'import': $this->shortcutName = $this->lang->getLL('title_import'); // Finally: If upload went well, set the new file as the import file: if (!empty($this->uploadedFiles[0])) { // Only allowed extensions.... if (GeneralUtility::inList('t3d,xml', $this->uploadedFiles[0]->getExtension())) { $inData['file'] = $this->uploadedFiles[0]->getCombinedIdentifier(); } } // Call import interface: $this->importData($inData); break; } // Setting up the buttons and markers for docheader $this->getButtons(); }
/** * Main module function * * @throws \BadFunctionCallException * @throws \InvalidArgumentException * @return void */ public function main() { $this->lang->includeLLFile('EXT:impexp/Resources/Private/Language/locallang.xlf'); // Start document template object: // We keep this here, in case somebody relies on the old doc being here $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->bodyTagId = 'imp-exp-mod'; $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); if (is_array($this->pageinfo)) { $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); } // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Impexp/ImportExport'); $this->moduleTemplate->addJavaScriptCode('ImpexpInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); // Input data grabbed: $inData = GeneralUtility::_GP('tx_impexp'); $this->standaloneView->assign('moduleUrl', BackendUtility::getModuleUrl('xMOD_tximpexp')); $this->standaloneView->assign('id', $this->id); $this->standaloneView->assign('inData', $inData); switch ((string) $inData['action']) { case 'export': $this->shortcutName = $this->lang->getLL('title_export'); // Call export interface $this->exportData($inData); $this->standaloneView->setTemplate('Export.html'); break; case 'import': $this->shortcutName = $this->lang->getLL('title_import'); if (GeneralUtility::_POST('_upload')) { $this->checkUpload(); } // Finally: If upload went well, set the new file as the import file: if (!empty($this->uploadedFiles[0])) { // Only allowed extensions.... $extension = $this->uploadedFiles[0]->getExtension(); if ($extension === 't3d' || $extension === 'xml') { $inData['file'] = $this->uploadedFiles[0]->getCombinedIdentifier(); } } // Call import interface: $this->importData($inData); $this->standaloneView->setTemplate('Import.html'); break; } // Setting up the buttons and markers for docheader $this->getButtons(); }