/** * Initialize the module output * * @return void */ protected function init() { // Create internal template object $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/show_rechis.html'); // Start the page header $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); }
/** * Renders the content of the module. * * @return void */ public function render() { $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= '<p class="lead">' . $GLOBALS['LANG']->getLL('description') . '</p>'; if ($this->isAccessibleForCurrentUser) { $this->loadHeaderData(); // div container for renderTo $this->content .= '<div id="recyclerContent"></div>'; } else { // If no access or if ID == zero $this->content .= $this->doc->spacer(10); } }
/** * Main function to generate the content * * @return void * @todo Define visibility */ public function main() { $this->content = $this->doc->header('Indexing Engine Statistics'); $this->content .= $this->doc->spacer(5); switch ($this->MOD_SETTINGS['function']) { case 'stat': $this->content .= $this->doc->section('Records', $this->doc->table($this->getRecordsNumbers()), 0, 1); $this->content .= $this->doc->spacer(15); $this->content .= $this->doc->section('index_phash TYPES', $this->doc->table($this->getPhashTypes()), 1); $this->content .= $this->doc->spacer(15); break; case 'externalDocs': $this->content .= $this->doc->section('External documents', $this->doc->table($this->getPhashExternalDocs()), 0, 1); $this->content .= $this->doc->spacer(15); break; case 'typo3pages': $this->content .= $this->doc->section('TYPO3 Pages', $this->doc->table($this->getPhashT3pages()), 0, 1); $this->content .= $this->doc->spacer(15); break; } $docHeaderButtons = $this->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content); $this->content = $this->doc->startPage('Indexing Engine Statistics'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function of the module. Write the content to $this->content. * * @return void */ public function main() { $backendUser = $this->getBackendUser(); $language = $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 $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); // Checking access: if ($this->id && $access || $backendUser->isAdmin()) { // Render content: $this->moduleContent(); } else { // If no access or if ID == zero $this->content .= $this->doc->header($language->getLL('statistic')); } $docHeaderButtons = $this->getHeaderButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content); $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])); // put it all together $this->content = $this->doc->startPage($language->getLL('statistic')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * 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); $access = is_array($this->pageinfo); if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html'); $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), 'defRow' => array('0' => array('<td valign="top">', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>'))); // JavaScript $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">'; $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } $this->extObjContent(); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } else { // If no access or if ID == zero $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); }
/** * Main function, creating the content for the access editing forms/listings * * @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 = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); // Checking access: if ($this->id && $access || $GLOBALS['BE_USER']->isAdmin() && !$this->id) { if ($GLOBALS['BE_USER']->isAdmin() && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } // This decides if the editform can and will be drawn: $this->editingAllowed = $this->pageinfo['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin(); $this->edit = $this->edit && $this->editingAllowed; // If $this->edit then these functions are called in the end of the page... if ($this->edit) { $this->doc->postCode .= $this->doc->wrapScriptTags(' setCheck("check[perms_user]", "data[pages][' . $this->id . '][perms_user]"); setCheck("check[perms_group]", "data[pages][' . $this->id . '][perms_group]"); setCheck("check[perms_everybody]", "data[pages][' . $this->id . '][perms_everybody]"); '); } // Draw the HTML page header. $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('permissions') . ($this->edit ? ': ' . $GLOBALS['LANG']->getLL('Edit') : '')); $this->content .= $this->doc->spacer(5); $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } // Main function, branching out: if (!$this->edit) { $this->notEdit(); } else { $this->doEdit(); } $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $this->docHeaderButtons['csh']; $markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } else { // If no access or if ID == zero $this->content = $this->doc->header($GLOBALS['LANG']->getLL('permissions')); } // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('permissions'), $this->content); }
/** * Main function, rendering the upload file form fields * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')); $form = $this->renderUploadForm(); $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')) . $this->doc->section('', $form); // Header Buttons $docHeaderButtons = array('csh' => BackendUtility::cshItem('xMOD_csh_corebe', 'file_upload', $GLOBALS['BACK_PATH']), 'back' => ''); $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function, rendering the upload file form fields * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')); $form = $this->renderUploadForm(); $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')) . $this->doc->section('', $form); // Header Buttons $docHeaderButtons = array('csh' => BackendUtility::cshItem('xMOD_csh_corebe', 'file_upload'), 'back' => ''); $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL)->render() . '</a>'; } $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function, rendering the content of the rename form * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent .= $this->doc->spacer(5); $pageContent .= $this->doc->divider(5); if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $fileIdentifier = $this->fileOrFolderObject->getCombinedIdentifier(); } else { $fileIdentifier = $this->fileOrFolderObject->getUid(); } $code = '<form action="tce_file.php" method="post" name="editform">'; // Making the formfields for renaming: $code .= ' <div id="c-rename"> <input type="text" name="file[rename][0][target]" value="' . htmlspecialchars($this->fileOrFolderObject->getName()) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' /> <input type="hidden" name="file[rename][0][data]" value="' . htmlspecialchars($fileIdentifier) . '" /> </div> '; // Making submit button: $code .= ' <div id="c-submit"> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.submit', TRUE) . '" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; $code .= '</form>'; // Add the HTML as a section: $pageContent .= $code; $docHeaderButtons = array('back' => ''); $docHeaderButtons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function of the module. Write the content to $this->content * * @return void */ public function main() { // Access check! // The page will show only if user has admin rights if ($GLOBALS['BE_USER']->user['admin']) { // Set the form //$this->doc->form = '<form name="tx_kickstarter_form" id="tx_kickstarter_form" method="post" action="">'; // Prepare main content $this->content = $this->doc->header($GLOBALS['LANG']->getLL('function.' . $this->MOD_SETTINGS['function'])); $this->content .= $this->getModuleContent(); } else { // If no access, only display the module's title $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->spacer(5); } // Place content inside template $content = $this->doc->moduleBody(array(), $this->getDocHeaderButtons(), $this->getTemplateMarkers()); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $content); }
/** * Show list references * * @return void * @todo Define visibility */ public function func_relations() { global $LANG, $BACK_PATH; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('relations')); $admin = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck'); $admin->genTree_makeHTML = 0; $admin->backPath = $BACK_PATH; $fkey_arrays = $admin->getGroupFields(''); $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays); $fileTest = $admin->testFileRefs(); $code = ''; if (is_array($fileTest['noReferences'])) { foreach ($fileTest['noReferences'] as $val) { $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong></nobr><br>'; } } else { $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>'; } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_ref'), $code, TRUE, TRUE); $code = ''; if (is_array($fileTest['moreReferences'])) { foreach ($fileTest['moreReferences'] as $val) { $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong>: ' . $val[2] . ' ' . $GLOBALS['LANG']->getLL('references') . '</nobr><br>' . $val[3] . '<br><br>'; } } else { $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>'; } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_many_ref'), $code, TRUE, TRUE); $code = ''; if (is_array($fileTest['noFile'])) { ksort($fileTest['noFile']); foreach ($fileTest['noFile'] as $val) { $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong> ' . $GLOBALS['LANG']->getLL('isMissing') . ' </nobr><br>' . $GLOBALS['LANG']->getLL('referencedFrom') . $val[2] . '<br><br>'; } } else { $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>'; } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_file'), $code, TRUE, TRUE); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('select_db'), $admin->testDBRefs($admin->checkSelectDBRefs), TRUE, TRUE); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('group_db'), $admin->testDBRefs($admin->checkGroupDBRefs), TRUE, TRUE); }
/** * Main function, rendering the content of the rename form * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $fileIdentifier = $this->fileOrFolderObject->getCombinedIdentifier(); } else { $fileIdentifier = $this->fileOrFolderObject->getUid(); } $pageContent .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform" role="form">'; // Making the formfields for renaming: $pageContent .= ' <div class="form-group"> <input class="form-control" type="text" name="file[rename][0][target]" value="' . htmlspecialchars($this->fileOrFolderObject->getName()) . '" ' . $this->getDocumentTemplate()->formWidth(40) . ' /> <input type="hidden" name="file[rename][0][data]" value="' . htmlspecialchars($fileIdentifier) . '" /> </div> '; // Making submit button: $pageContent .= ' <div class="form-group"> <input class="btn btn-primary" type="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.submit', TRUE) . '" /> <input class="btn btn-danger" type="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; $pageContent .= '</form>'; $docHeaderButtons = array('back' => ''); $docHeaderButtons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_rename'); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Constructor, initializing internal variables. * * @return void */ public function init() { // Setting internal vars: $this->sys_language = (int) GeneralUtility::_GP('sys_language'); $this->page_id = (int) GeneralUtility::_GP('uid'); $this->table = GeneralUtility::_GP('table'); $this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); $this->input_moveUid = GeneralUtility::_GP('moveUid'); $this->moveUid = $this->input_moveUid ? $this->input_moveUid : $this->page_id; $this->makeCopy = GeneralUtility::_GP('makeCopy'); // Select-pages where clause for read-access: $this->perms_clause = $this->getBackendUser()->getPagePermsClause(1); // Starting the document template object: $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/move_el.html'); $this->doc->JScode = ''; // Starting document content (header): $this->content = ''; $this->content .= $this->doc->header($this->getLanguageService()->getLL('movingElement')); }
/** * 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')); } }
/** * 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>'; }
/** * Constructor function for the class * * @return void */ public function init() { $backendUser = $this->getBackendUser(); $language = $this->getLanguageService(); // page-selection permission clause (reading) $this->permsClause = $backendUser->getPagePermsClause(1); // Setting GPvars: // The page id to operate from $this->id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id') ? (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id') : Tx_Commerce_Utility_BackendUtility::getProductFolderUid(); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'); // this to be accomplished from the caller: &edit['.$table.'][-'.$uid.']=new& $this->param = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('edit'); $this->defVals = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('defVals'); // Create instance of template class for output $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->docType = 'xhtml_trans'; $this->doc->JScode = ''; $this->head = $language->getLL('newRecordGeneral', 1); // Creating content $this->content = ''; $this->content .= $this->doc->startPage($this->head); $this->content .= $this->doc->header($this->head); // Id a positive id is supplied, ask for the page record // with permission information contained: if ($this->id > 0) { $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->permsClause); } // If a page-record was returned, the user had read-access to the page. if ($this->pageinfo['uid']) { // Get record of parent page $this->pidInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $this->pageinfo['pid']); // Checking the permissions for the user with regard to the // parent page: Can he create new pages, new content record, new page after? if ($backendUser->doesUserHaveAccess($this->pageinfo, 16)) { $this->newContentInto = 1; } } elseif ($backendUser->isAdmin()) { // Admins can do it all $this->newContentInto = 1; } else { // People with no permission can do nothing $this->newContentInto = 0; } }
/** * Generate the main settings formular: * * @return void * @todo Define visibility */ public function main() { global $LANG; if ($this->languageUpdate) { $this->doc->JScodeArray['languageUpdate'] .= ' if (top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '; } if ($this->pagetreeNeedsRefresh) { BackendUtility::setUpdateSignal('updatePageTree'); } // Start page: $this->doc->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('TYPO3\\CMS\\Backend\\Module\\ModuleLoader'); $this->loadModules->observeWorkspaces = TRUE; $this->loadModules->load($GLOBALS['TBE_MODULES']); $this->content .= $this->doc->header($LANG->getLL('UserSettings')); // Show if setup was saved if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('setupWasUpdated'), $LANG->getLL('UserSettings')); $this->content .= $flashMessage->render(); } // Show if temporary data was cleared if ($this->tempDataIsCleared) { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('tempDataClearedFlashMessage'), $LANG->getLL('tempDataCleared')); $this->content .= $flashMessage->render(); } // Show if temporary data was cleared if ($this->settingsAreResetToDefault) { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('settingsAreReset'), $LANG->getLL('resetConfiguration')); $this->content .= $flashMessage->render(); } // Notice if ($this->setupIsUpdated || $this->settingsAreResetToDefault) { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('activateChanges'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $this->content .= $flashMessage->render(); } // If password is updated, output whether it failed or was OK. if ($this->passwordIsSubmitted) { if ($this->passwordIsUpdated) { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('newPassword_ok'), $LANG->getLL('newPassword')); } else { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('newPassword_failed'), $LANG->getLL('newPassword'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); } $this->content .= $flashMessage->render(); } // Render the menu items $menuItems = $this->renderUserSetup(); $this->content .= $this->doc->getDynTabMenu($menuItems, 'user-setup', FALSE, FALSE, 1, FALSE, 1, $this->dividers2tabs); $formToken = $this->formProtection->generateToken('BE user setup', 'edit'); $this->content .= $this->doc->section('', '<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" /> <input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />'); // End of wrapper div $this->content .= '</div>'; // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['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($LANG->getLL('UserSettings'), $this->content); }
/** * 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; if ($this->id && $access) { // Initialize permission settings: $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo); $this->EDIT_CONTENT = $this->CALC_PERMS & Permission::CONTENT_EDIT ? 1 : 0; // Start document template object: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html'); // override the default jumpToUrl $this->doc->JScodeArray['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->doc->JScode .= $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . '; ' . ($this->popView ? BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], 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() . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1"; } return false; } '); $this->doc->JScode .= $this->doc->wrapScriptTags(' var DTM_array = new Array(); var DTM_origClass = new String(); // if tabs are used in a popup window the array might not exists if(!top.DTM_currentTabs) { top.DTM_currentTabs = new Array(); } function DTM_activate(idBase,index,doToogle) { // // Hiding all: if (DTM_array[idBase]) { for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { if (DTM_array[idBase][cnt] != idBase+"-"+index) { document.getElementById(DTM_array[idBase][cnt]+"-DIV").className = "tab-pane"; document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").value = "tab"; } } } // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").className === "tab-pane active") { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase] = -1; } else { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active"; } else { DTM_origClass = "active"; } top.DTM_currentTabs[idBase] = index; } } } function DTM_toggle(idBase,index,isInit) { // // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase+"-"+index] = 0; } else { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active"; } else { DTM_origClass = "active"; } top.DTM_currentTabs[idBase+"-"+index] = 1; } } } '); // Setting doc-header $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_layout', array('id' => $this->id, 'imagemode' => $this->imagemode))) . '" method="post">'; // Creating the top function menu: $this->topFuncMenu = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], '', ''); $languageMenu = count($this->MOD_MENU['language']) > 1 ? $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], '', '') : ''; // Find backend layout / coumns $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); $body = ''; $body .= $this->getHeaderFlashMessagesForCurrentPid(); // Render the primary module content: if ($this->MOD_SETTINGS['function'] == 0) { // QuickEdit $body .= $this->renderQuickEdit(); } else { // Page title $body .= $this->doc->header($this->getLocalizedPageTitle()); // All other listings $body .= $this->renderListContent(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : ''); $this->markers['CSH'] = $docHeaderButtons['csh']; $this->markers['TOP_FUNCTION_MENU'] = $this->topFuncMenu . $this->editSelect; $this->markers['LANGSELECTOR'] = $languageMenu; $this->markers['CONTENT'] = $body; // Build the <body> for the module $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $this->markers); // Renders the module page $this->content = $this->doc->render($lang->getLL('title'), $this->content); } else { // If no access or id value, create empty document: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; '); $body = $this->doc->header($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']); $title = $lang->getLL('clickAPage_header'); $message = $lang->getLL('clickAPage_content'); $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html')); $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO)); $body .= $view->render(); // Setting up the buttons and markers for docheader $docHeaderButtons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => '', 'edit_language' => ''); $this->markers['CSH'] = ''; $this->markers['TOP_FUNCTION_MENU'] = ''; $this->markers['LANGSELECTOR'] = ''; $this->markers['CONTENT'] = $body; $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $this->markers); // Renders the module page $this->content = $this->doc->render($lang->getLL('title'), $this->content); } }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * @return [type] ... */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // 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 = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { $full_script_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/'; $this->relative_site_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // first get the http-path to typo3: $this->httpTypo3Path = substr(substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'))), 0, -1); if (strlen($this->httpTypo3Path) == 1) { $this->httpTypo3Path = '/'; } else { $this->httpTypo3Path .= '/'; } // Get the vhost full path (example: /var/www/html/domain.com/public_html/my_cms/) $this->DOCUMENT_ROOT = PATH_site; // Get the vhost full path to multishop (example: /var/www/html/domain.com/public_html/my_cms/typo3conf/ext/multishop/) $this->DOCUMENT_ROOT_MS = PATH_site . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // Get the site full URL (example: http://domain.com/my_cms/) $this->FULL_HTTP_URL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); // Get the multishop full URL (example: http://domain.com/my_cms/typo3/ext/multishop or http://domain.com/my_cms/typo3conf/ext/multishop) $this->FULL_HTTP_URL_MS = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // Get the host URL (example: http://domain.com) // dont use hostURL cause its not supporting subdirectory hosting $this->hostURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); // Draw the header. $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); //$this->doc->setModuleTemplate(ExtensionManagementUtility::extPath($this->extKey) . 'mod1/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; //$this->doc= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('bigDoc'); //$this->doc->backPath=$BACK_PATH; // JavaScript $this->doc->JScode = ' <style type="text/css"> /*<![CDATA[*/ <!-- /*inDocStyles*/ /*###POSTCSSMARKER###*/ --> /*]]>*/ .shadow_bottom { overflow:hidden; width:100%; background:url(' . $this->FULL_HTTP_URL_MS . 'mod1/images/shadow_bottom.png) left bottom no-repeat; padding:0 0 35px; } fieldset { display:block; border:1px solid #999; background:#fff; margin:10px 0 0; padding:10px 10px 10px; } fieldset legend { background:#585858; color:#fff; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; padding:2px 4px; } fieldset legend a { color:#fff; } fieldset legend a:hover { color:#fff; text-decoration:underline; } ul { list-style:none; margin:0; padding:0; } a.buttons, a.buttons_db { -moz-border-radius:1px 1px 1px 1px; BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button.png); background-color:#F6F6F6; background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #D5D5D5 90%); background-position:center bottom; background-repeat:repeat-x; border:1px solid #7C7C7C; color:#434343; display:block; padding:2px 4px; text-align:center; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; line-height:16px; } a.buttons:hover, a.buttons_db:hover { BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button-hover.png); background-color:#C8C8C8; background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #BDBCBC 90%); background-position:center bottom; background-repeat:repeat-x; border:1px solid #737F91; color:#1E1E1E; } a.buttons { width:142px; } a.buttons_db { width:126px; } fieldset.mod1MultishopFieldset ul { overflow:hidden; width:100%; } fieldset.mod1MultishopFieldset ul li { float:left; margin:0 10px 0 0; } </style> <!--[if IE]> <style> fieldset { position: relative; padding-top:15px; margin:20px 0 0; } legend { position: absolute; top: -10px; left: 10px; } </style> <![endif]--> <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } function CONFIRM(label) { if (confirm(label)) { return true; } else { return false; } } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50); $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); $this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } $this->content .= $this->doc->spacer(10); } else { // If no access or if ID == zero $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Main function. * Creates some general objects and calls other functions for the main rendering of module content. * * @return void * @todo Define visibility */ 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 $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access) { // Initialize permission settings: $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); $this->EDIT_CONTENT = $this->CALC_PERMS & 16 ? 1 : 0; // Start document template object: $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html'); // JavaScript: $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . GeneralUtility::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . 'js/jsfunc.updateform.js') . '">' . '</script>'; // override the default jumpToUrl $this->doc->JScodeArray['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->doc->JScode .= $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . '; ' . ($this->popView ? BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->id)) : '') . ' function deleteRecord(table,id,url) { // if (confirm(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->getLL('deleteWarning')) . ')) { window.location.href = "' . $GLOBALS['BACK_PATH'] . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1"; } return false; } '); $this->doc->JScode .= $this->doc->wrapScriptTags(' var DTM_array = new Array(); var DTM_origClass = new String(); // if tabs are used in a popup window the array might not exists if(!top.DTM_currentTabs) { top.DTM_currentTabs = new Array(); } function DTM_activate(idBase,index,doToogle) { // // Hiding all: if (DTM_array[idBase]) { for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { if (DTM_array[idBase][cnt] != idBase+"-"+index) { document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none"; document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } } } // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase] = -1; } else { document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; } else { DTM_origClass = "tabact"; } top.DTM_currentTabs[idBase] = index; } } } function DTM_toggle(idBase,index,isInit) { // // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase+"-"+index] = 0; } else { document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; } else { DTM_origClass = "tabact"; } top.DTM_currentTabs[idBase+"-"+index] = 1; } } } function DTM_mouseOver(obj) { // DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue; obj.attributes.getNamedItem(\'class\').nodeValue += "_over"; } function DTM_mouseOut(obj) { // obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass; DTM_origClass = ""; } '); // Setting doc-header $this->doc->form = '<form action="' . htmlspecialchars('db_layout.php?id=' . $this->id . '&imagemode=' . $this->imagemode) . '" method="post">'; // Creating the top function menu: $this->topFuncMenu = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], 'db_layout.php', ''); $this->languageMenu = count($this->MOD_MENU['language']) > 1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], 'db_layout.php', '') : ''; // Find backend layout / coumns $backendLayout = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', $this->id, $this); if (count($backendLayout['__colPosList'])) { $this->colPosList = implode(',', $backendLayout['__colPosList']); } // Removing duplicates, if any $this->colPosList = implode(',', array_unique(GeneralUtility::intExplode(',', $this->colPosList))); // Page title $body = $this->doc->header($this->getLocalizedPageTitle()); $body .= $this->getHeaderFlashMessagesForCurrentPid(); // Render the primary module content: if ($this->MOD_SETTINGS['function'] == 0) { // QuickEdit $body .= $this->renderQuickEdit(); } else { // All other listings $body .= $this->renderListContent(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : ''); $markers = array('CSH' => $docHeaderButtons['csh'], 'TOP_FUNCTION_MENU' => $this->topFuncMenu . $this->editSelect, 'LANGSELECTOR' => $this->languageMenu, 'CONTENT' => $body); // Build the <body> for the module $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); } else { // If no access or id value, create empty document: $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; '); $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('clickAPage_content'), $GLOBALS['LANG']->getLL('clickAPage_header'), FlashMessage::INFO); $body = $flashMessage->render(); // Setting up the buttons and markers for docheader $docHeaderButtons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => '', 'edit_language' => ''); $markers = array('CSH' => BackendUtility::cshItem($this->descrTable, '', $GLOBALS['BACK_PATH'], '', TRUE), 'TOP_FUNCTION_MENU' => '', 'LANGSELECTOR' => '', 'CONTENT' => $body); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); } }
/** * Constructor function for the class * * @return void */ protected function init() { // Page-selection permission clause (reading) $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); // This will hide records from display - it has nothing to do with user rights!! if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) { if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) { $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')'; } } // Setting GPvars: // The page id to operate from $this->id = (int) GeneralUtility::_GP('id'); $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); $this->pagesOnly = GeneralUtility::_GP('pagesOnly'); // Create instance of template class for output $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_new.html'); $this->doc->JScode = ''; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Creating content $this->content = ''; $this->content .= $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle')); // Id a positive id is supplied, ask for the page record with permission information contained: if ($this->id > 0) { $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); } // If a page-record was returned, the user had read-access to the page. if ($this->pageinfo['uid']) { // Get record of parent page $this->pidInfo = BackendUtility::getRecord('pages', $this->pageinfo['pid']); // Checking the permissions for the user with regard to the parent page: Can he create new pages, new content record, new page after? if ($GLOBALS['BE_USER']->doesUserHaveAccess($this->pageinfo, 8)) { $this->newPagesInto = 1; } if ($GLOBALS['BE_USER']->doesUserHaveAccess($this->pageinfo, 16)) { $this->newContentInto = 1; } if (($GLOBALS['BE_USER']->isAdmin() || is_array($this->pidInfo)) && $GLOBALS['BE_USER']->doesUserHaveAccess($this->pidInfo, 8)) { $this->newPagesAfter = 1; } } elseif ($GLOBALS['BE_USER']->isAdmin()) { // Admins can do it all $this->newPagesInto = 1; $this->newContentInto = 1; $this->newPagesAfter = 0; } else { // People with no permission can do nothing $this->newPagesInto = 0; $this->newContentInto = 0; $this->newPagesAfter = 0; } }
/** * Main function, redering the actual content of the editing page * * @return void */ public function main() { $docHeaderButtons = $this->getButtons(); $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle')); // Hook before compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) { $preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook']; if (is_array($preOutputProcessingHook)) { $hookParameters = array('content' => &$this->content, 'target' => &$this->target); foreach ($preOutputProcessingHook as $hookFunction) { GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName())); $pageContent .= $this->doc->spacer(2); $code = ''; $extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext']; try { if (!$extList || !GeneralUtility::inList($extList, $this->fileObject->getExtension())) { throw new \Exception('Files with that extension are not editable.'); } // Read file content to edit: $fileContent = $this->fileObject->getContents(); // Making the formfields $hValue = BackendUtility::getModuleUrl('file_edit', array('target' => $this->origTarget, 'returnUrl' => $this->returnUrl)); // Edit textarea: $code .= ' <div id="c-edit"> <textarea rows="30" name="file[editfile][0][data]" wrap="off" ' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="text-monospace t3js-enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea> <input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> <br />'; // Make shortcut: if ($this->getBackendUser()->mayMakeShortcut()) { $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', 'file_edit', 1); } else { $docHeaderButtons['shortcut'] = ''; } } catch (\Exception $e) { $code .= sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'), $extList); } // Ending of section and outputting editing form: $pageContent .= $this->doc->sectionEnd(); $pageContent .= $code; // Hook after compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) { $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook']; if (is_array($postOutputProcessingHook)) { $hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target); foreach ($postOutputProcessingHook as $hookFunction) { GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Shows the copy wizard. * * @param int $uidClip Uid of the clipped item * @param int $uidTarget Uid of target * @param string $command Command */ protected function showCopyWizard($uidClip, $uidTarget, $command) { $language = $this->getLanguageService(); $str = ''; $this->pageinfo = BackendUtility::readCategoryAccess($uidTarget, BackendUtility::getCategoryPermsClause(1)); $str .= $this->doc->header($language->getLL('Copy')); $str .= $this->doc->spacer(5); // flag if neither sorting nor localizations // are existing and we can immediately copy $noActionReq = false; // First prepare user defined hooks $hooks = \CommerceTeam\Commerce\Factory\HookFactory::getHooks('Utility/DataHandlerUtility', 'showCopyWizard'); switch ($command) { case 'overwrite': // pass through // pass through case 'pasteProduct': // chose local to copy from product /** * Product. * * @var \CommerceTeam\Commerce\Domain\Model\Product $product */ $product = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Product', $uidClip); $product->loadData(); $prods = $product->getL18nProducts(); if (!empty($prods)) { $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1> <h2>' . $language->getLL('copy.product') . ': ' . $product->getTitle() . '</h2> <ul>'; // walk the l18n and get the selector box $l = count($prods); for ($i = 0; $i < $l; ++$i) { $tmpProd = $prods[$i]; $flag = $tmpProd['flag'] != '' ? '<img src="' . $this->getBackPath() . 'gfx/flags/' . $tmpProd['flag'] . '" alt="Flag" />' : ''; $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpProd['uid'] . '" value="' . $tmpProd['sys_language'] . '" /><label for="loc_' . $tmpProd['uid'] . '">' . $flag . $tmpProd['title'] . '</label></li>'; } $str .= '</ul>'; } $records = array(); // chose sorting position if ($command != 'overwrite') { // Initialize tree object: /** * Product data. * * @var \CommerceTeam\Commerce\Tree\Leaf\ProductData $productData */ $productData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ProductData'); $productData->init(); $records = $productData->getRecordsDbList($uidTarget); } $l = count($records['pid'][$uidTarget]); // Hook: beforeFormClose $userIgnoreClose = false; foreach ($hooks as $hookObj) { if (method_exists($hookObj, 'beforeFormClose')) { // set $user_ignoreClose to true if you want to // force the script to print out the execute button $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose); } } if (0 >= $l && (!empty($prods) || $userIgnoreClose)) { // no child object - sorting position is irrelevant - just print a submit button // and notify users that there are not products in the category yet $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />'; } elseif (0 < $l) { // at least 1 item - offer choice $icon = '<img' . IconUtility::skinImg($this->getBackPath(), 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />'; $prodIcon = '<img' . IconUtility::skinImg($this->getBackPath(), IconUtility::getIcon('tx_commerce_products', array('uid' => $uidTarget)), 'width="18" height="16"') . 'align="top" class="c-recIcon"/>'; $str .= '<h1>' . $language->getLL('copy.position') . '</h1>'; $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; for ($i = 0; $i < $l; ++$i) { $record = $records['pid'][$uidTarget][$i]; $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"'; $str .= '<span class="nobr">' . $prodIcon . $record['title'] . '</span><br />'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; } } else { $noActionReq = true; } break; case 'pasteCategory': // chose locale to copy from category /** * Category. * * @var \CommerceTeam\Commerce\Domain\Model\Category $category */ $category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $uidClip); $category->loadData(); $cats = $category->getL18nCategories(); if (!empty($cats)) { $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1> <h2>' . $language->getLL('copy.category') . ': ' . $category->getTitle() . '</h2> <ul>'; // walk the l18n and get the selector box $l = count($cats); for ($i = 0; $i < $l; ++$i) { $tmpCat = $cats[$i]; $flag = $tmpCat['flag'] != '' ? '<img src="' . $this->getBackPath() . 'gfx/flags/' . $tmpCat['flag'] . '" alt="Flag" />' : ''; $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpCat['uid'] . '" value="' . $tmpCat['sys_language'] . '" /><label for="loc_' . $tmpCat['uid'] . '">' . $flag . $tmpCat['title'] . '</label></li>'; } $str .= '</ul>'; } // chose sorting position // Initialize tree object: /** * Category data. * * @var \CommerceTeam\Commerce\Tree\Leaf\CategoryData $categoryData */ $categoryData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryData'); $categoryData->init(); $records = $categoryData->getRecordsDbList($uidTarget); $l = count($records['pid'][$uidTarget]); // Hook: beforeFormClose $userIgnoreClose = false; foreach ($hooks as $hookObj) { if (method_exists($hookObj, 'beforeFormClose')) { $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose); } } if ($l == 0 && (!empty($cats) || $userIgnoreClose)) { // no child object - sorting position is irrelevant - just print a submit button $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />'; } elseif (0 < $l) { // at least 1 item - offer choice $icon = '<img' . IconUtility::skinImg($this->getBackPath(), 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />'; $catIcon = '<img' . IconUtility::skinImg($this->getBackPath(), IconUtility::getIcon('tx_commerce_categories', array('uid' => $uidTarget)), 'width="18" height="16"') . 'align="top" class="c-recIcon"/>'; $str .= '<h1>' . $language->getLL('copy.position') . '</h1>'; $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; for ($i = 0; $i < $l; ++$i) { $record = $records['pid'][$uidTarget][$i]; $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"'; $str .= '<span class="nobr">' . $catIcon . $record['title'] . '</span><br /> <span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; } } else { $noActionReq = true; } break; default: die('unknown command'); } // skip transforming and execute the command // if there are no locales and no positions if ($noActionReq) { $this->commitCommand($uidClip, $uidTarget, $command); return; } // Hook: beforeTransform foreach ($hooks as $hookObj) { if (method_exists($hookObj, 'beforeTransform')) { $str .= $hookObj->beforeTransform($uidClip, $uidTarget, $command); } } $this->content .= $str; $markers = array('CSH' => '', 'CONTENT' => $this->content, 'CATINFO' => '', 'CATPATH' => ''); $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode'])); $this->content = $this->doc->startPage($language->getLL('Copy')); $this->content .= $this->doc->moduleBody($this->pageinfo, array(), $markers); $this->content .= $this->doc->endPage(); }
/** * Main function, redering the actual content of the editing page * * @return void * @todo Define visibility */ public function main() { //TODO: change locallang*.php to locallang*.xml $docHeaderButtons = $this->getButtons(); $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle')); // Hook before compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) { $preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook']; if (is_array($preOutputProcessingHook)) { $hookParameters = array('content' => &$this->content, 'target' => &$this->target); foreach ($preOutputProcessingHook as $hookFunction) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName())); $pageContent .= $this->doc->spacer(2); $code = ''; $extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext']; if ($extList && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($extList, $this->fileObject->getExtension())) { // Read file content to edit: $fileContent = $this->fileObject->getContents(); // Making the formfields $hValue = 'file_edit.php?target=' . rawurlencode($this->origTarget) . '&returnUrl=' . rawurlencode($this->returnUrl); // Edit textarea: $code .= ' <div id="c-edit"> <textarea rows="30" name="file[editfile][0][data]" wrap="off"' . $this->doc->formWidthText(48, 'width:98%;height:80%', 'off') . ' class="fixed-font enable-tab">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($fileContent) . '</textarea> <input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" /> </div> <br />'; // Make shortcut: if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $this->MCONF['name'] = 'xMOD_file_edit.php'; $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', $this->MCONF['name'], 1); } else { $docHeaderButtons['shortcut'] = ''; } } else { $code .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.coundNot'), $extList); } // Ending of section and outputting editing form: $pageContent .= $this->doc->sectionEnd(); $pageContent .= $code; // Hook after compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) { $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook']; if (is_array($postOutputProcessingHook)) { $hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target); foreach ($postOutputProcessingHook as $hookFunction) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function, starting the rendering of the list. * * @return void * @todo Define visibility */ public function main() { // Start document template object: $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:recordlist/Resources/Private/Templates/db_list.html'); // Loading current page record and checking access: $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Apply predefined values for hidden checkboxes // Set predefined value for DisplayBigControlPanel: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') { $this->MOD_SETTINGS['bigControlPanel'] = TRUE; } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') { $this->MOD_SETTINGS['bigControlPanel'] = FALSE; } // Set predefined value for Clipboard: if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') { $this->MOD_SETTINGS['clipBoard'] = TRUE; } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') { $this->MOD_SETTINGS['clipBoard'] = FALSE; } // Set predefined value for LocalizationView: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') { $this->MOD_SETTINGS['localization'] = TRUE; } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') { $this->MOD_SETTINGS['localization'] = FALSE; } // Initialize the dblist object: /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */ $dblist = GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\RecordList\\DatabaseRecordList'); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->script = BackendUtility::getModuleUrl('web_list', array(), ''); $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); $dblist->thumbs = $GLOBALS['BE_USER']->uc['thumbnailsByDefault']; $dblist->returnUrl = $this->returnUrl; $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0; $dblist->localizationView = $this->MOD_SETTINGS['localization']; $dblist->showClipboard = 1; $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView']; $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView']; $dblist->hideTables = $this->modTSconfig['properties']['hideTables']; $dblist->hideTranslations = $this->modTSconfig['properties']['hideTranslations']; $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.']; $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0; $dblist->allowedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], TRUE); $dblist->deniedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], TRUE); $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0; $dblist->pageRow = $this->pageinfo; $dblist->counter++; $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => ''); $dblist->modTSconfig = $this->modTSconfig; $clickTitleMode = trim($this->modTSconfig['properties']['clickTitleMode']); $dblist->clickTitleMode = $clickTitleMode === '' ? 'edit' : $clickTitleMode; // Clipboard is initialized: // Start clipboard $dblist->clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard'); // Initialize - reads the clipboard content from the user session $dblist->clipObj->initializeClipboard(); // Clipboard actions are handled: // CB is the clipboard command array $CB = GeneralUtility::_GET('CB'); if ($this->cmd == 'setCB') { // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. // By merging we get a full array of checked/unchecked elements // This is set to the 'el' array of the CB after being parsed so only the table in question is registered. $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), $this->cmd_table); } if (!$this->MOD_SETTINGS['clipBoard']) { // If the clipboard is NOT shown, set the pad to 'normal'. $CB['setP'] = 'normal'; } // Execute commands. $dblist->clipObj->setCmd($CB); // Clean up pad $dblist->clipObj->cleanCurrent(); // Save the clipboard content $dblist->clipObj->endClipboard(); // This flag will prevent the clipboard panel in being shown. // It is set, if the clickmenu-layer is active AND the extended view is not enabled. $dblist->dontShowClipControlPanels = !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers']; // If there is access to the page or root page is used for searching, then render the list contents and set up the document template object: if ($access || $this->id === 0 && $this->search_levels > 0 && strlen($this->search_field) > 0) { // Deleting records...: // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table. if ($this->cmd == 'delete') { $items = $dblist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), $this->cmd_table, 1); if (count($items)) { $cmd = array(); foreach ($items as $iK => $value) { $iKParts = explode('|', $iK); $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1; } $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); if (isset($cmd['pages'])) { BackendUtility::setUpdateSignal('updatePageTree'); } $tce->printLogErrorMessages(GeneralUtility::getIndpEnv('REQUEST_URI')); } } // Initialize the listing object, dblist, for rendering the list: $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000); $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit); $dblist->setDispFields(); // Render versioning selector: if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) { $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id); } // Render the list of tables: $dblist->generateList(); $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH'])); // Add JavaScript functions to the page: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpExt(URL,anchor) { // var anc = anchor?anchor:""; window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc; return false; } function jumpSelf(URL) { // window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); return false; } function setHighlight(id) { // top.fsMod.recentIds["web"]=id; top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } } ' . $this->doc->redirectUrls($listUrl) . ' ' . $dblist->CBfunctions() . ' function editRecords(table,idList,addParams,CBflag) { // window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams; } function editList(table,idList) { // var list=""; // Checking how many is checked, how many is not var pointer=0; var pos = idList.indexOf(","); while (pos!=-1) { if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) { list+=idList.substr(pointer,pos-pointer)+","; } pointer=pos+1; pos = idList.indexOf(",",pointer); } if (cbValue(table+"|"+idList.substr(pointer))) { list+=idList.substr(pointer)+","; } return list ? list : idList; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); } // access // Begin to compile the whole page, starting out with page header: $this->body = $this->doc->header($this->pageinfo['title']); $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">'; $this->body .= $dblist->HTMLcode; $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>'; // If a listing was produced, create the page footer with search form etc: if ($dblist->HTMLcode) { // Making field select box (when extended view for a single table is enabled): if ($dblist->table) { $this->body .= $dblist->fieldSelectBox($dblist->table); } // Adding checkbox options for extended listing and clipboard display: $this->body .= ' <!-- Listing options for extended view, clipboard and localization view --> <div id="typo3-listOptions"> <form action="" method="post">'; // Add "display bigControlPanel" checkbox: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') { $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"'); $this->body .= '<label for="checkLargeControl">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />'; } // Add "clipboard" checkbox: if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') { if ($dblist->showClipboard) { $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"'); $this->body .= '<label for="checkShowClipBoard">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />'; } } // Add "localization view" checkbox: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') { $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"'); $this->body .= '<label for="checkLocalization">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />'; } $this->body .= ' </form> </div>'; } // Printing clipboard if enabled if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) { $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>'; } // Search box: if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dblist->HTMLcode || $dblist->searchString !== '')) { $sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE)); $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>'; } // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $this->body .= GeneralUtility::callUserFunction($hook, $params, $this); } } // Setting up the buttons and markers for docheader $docHeaderButtons = $dblist->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body, 'EXTRACONTAINERCLASS' => $this->table ? 'singletable' : ''); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render('DB list', $this->content); }
/** * Main function, rendering the main module content * * @return void */ public function main() { $lang = $this->getLanguageService(); // Start content compilation $this->content .= $this->doc->startPage($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle')); // Make page header: $pageContent = $this->doc->header($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle')); if ($this->folderObject->checkActionPermission('add')) { $code = '<form role="form" action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">'; // Making the selector box for the number of concurrent folder-creations $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10); $code .= ' <div class="form-group"> <div class="form-section"> <div class="form-group"> <label for="number-of-new-folders">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . '</label> <div class="form-control-wrap"> <div class="input-group"> <select class="form-control form-control-adapt" name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">'; for ($a = 1; $a <= $this->folderNumber; $a++) { $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>'; } $code .= ' </select> </div> </div> </div> </div> '; // Making the number of new-folder boxes needed: for ($a = 0; $a < $this->number; $a++) { $code .= ' <div class="form-section"> <div class="form-group"> <label for="folder_new_' . $a . '">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfolder') . ' ' . ($a + 1) . ':</label> <div class="form-control-wrap"> <input type="text" class="form-control" id="folder_new_' . $a . '" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" /> <input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" /> </div> </div> </div>'; } // Making submit button for folder creation: $code .= ' </div><div class="form-group"> <input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; // Switching form tags: $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfolders'), $code); $pageContent .= $this->doc->sectionEnd() . '</form>'; } if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) { $pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform2">'; // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc. $fileExtList = array(); $textFileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE); foreach ($textFileExt as $fileExt) { if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) { $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>'; } } // Add form fields for creation of a new, blank text file: $code = ' <div class="form-group"> <div class="form-section"> <div class="form-group"> <label for="newfile">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfile') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . '</label> <div class="form-control-wrap"> <input class="form-control" type="text" id="newfile" name="file[newfile][0][data]" onchange="changed=true;" /> <input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" /> </div> <div class="help-block"> ' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:cm.allowedFileExtensions') . '<br> ' . implode(' ', $fileExtList) . ' </div> </div> </div> </div> '; // Submit button for creation of a new file: $code .= ' <div class="form-group"> <input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code); $pageContent .= $this->doc->sectionEnd(); $pageContent .= '</form>'; } $docHeaderButtons = array('back' => ''); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Creating the module output. * * @return void * @todo Define visibility */ public function main() { if ($this->id && $this->access) { // Init position map object: $posMap = GeneralUtility::makeInstance('ext_posMap'); $posMap->cur_sys_language = $this->sys_language; $posMap->backPath = $GLOBALS['BACK_PATH']; // If a column is pre-set: if (isset($this->colPos)) { if ($this->uid_pid < 0) { $row = array(); $row['uid'] = abs($this->uid_pid); } else { $row = ''; } $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language); } else { $this->onClickEvent = ''; } // *************************** // Creating content // *************************** // use a wrapper div $this->content .= '<div id="user-setup-wrapper">'; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); // Wizard $code = ''; $wizardItems = $this->getWizardItems(); // Wrapper for wizards $this->elementWrapper['section'] = array('<ul class="contentelement-wizard list-unstyled">', '</ul>'); // Copy wrapper for tabs $this->elementWrapperForTabs = $this->elementWrapper; // Hook for manipulating wizardItems, wrapper, onClickEvent etc. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Wizard\\NewContentElementWizardHookInterface', 1227834741); } $hookObject->manipulateWizardItems($wizardItems, $this); } } if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) { // Restore wrapper for tabs if they are overwritten in hook $this->elementWrapper = $this->elementWrapperForTabs; } // Add document inline javascript $this->doc->JScode = $this->doc->wrapScriptTags(' function goToalt_doc() { // ' . $this->onClickEvent . ' } if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '); // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc = $key = 0; $menuItems = array(); foreach ($wizardItems as $k => $wInfo) { if ($wInfo['header']) { $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]); $key = count($menuItems) - 1; } else { $content = ''; if (!$this->onClickEvent) { // Radio button: $oC = 'document.editForm.defValues.value=unescape(\'' . rawurlencode($wInfo['params']) . '\');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : ''); $content .= '<div class="contentelement-wizard-item-input"><input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" /></div>'; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $oC . 'return false;'; } else { $aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : ''); } $menuItems[$key]['content'] .= '<li> <div class="contentelement-wizard-item"> ' . $content . ' <div class="contentelement-wizard-item-icon"> <a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <img' . IconUtility::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /> </a> </div> <div class="contentelement-wizard-item-text"> <a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <strong>' . htmlspecialchars($wInfo['title']) . '</strong> <br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a> </div> </div> </li>'; $cc++; } } // Add closing section-tag foreach ($menuItems as $key => $val) { $menuItems[$key]['content'] .= $this->elementWrapper['section'][1]; } // Add the wizard table to the content, wrapped in tabs: if ($this->config['renderMode'] == 'tabs') { $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', FALSE, FALSE); } else { $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />'; foreach ($menuItems as $section) { $code .= '<h3 class="divider">' . $section['label'] . '</h3>' . $section['content']; } } $this->content .= $this->doc->section(!$this->onClickEvent ? $GLOBALS['LANG']->getLL('1_selectType') : '', $code, 0, 1); // If the user must also select a column: if (!$this->onClickEvent) { // Add anchor "sel2" $this->content .= $this->doc->section('', '<a name="sel2"></a>'); $this->content .= $this->doc->spacer(20); // Select position $code = $GLOBALS['LANG']->getLL('sel2', 1) . '<br /><br />'; // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->id, 'mod.SHARED'); $colPosList = trim($modTSconfig_SHARED['properties']['colPos_list']) !== '' ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3'; $colPosList = implode(',', array_unique(GeneralUtility::intExplode(',', $colPosList))); // Removing duplicates, if any // Finally, add the content of the column selector to the content: $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('2_selectPosition'), $code, 0, 1); } // Close wrapper div $this->content .= '</div>'; } else { // In case of no access: $this->content = ''; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('newContentElement')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->sectionEnd(); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Shows the copy wizard * * @param int $uidClip Uid of the clipped item * @param int $uidTarget Uid of target * @param string $command Command * * @return void */ protected function showCopyWizard($uidClip, $uidTarget, $command) { $language = $this->getLanguageService(); $str = ''; $this->pageinfo = Tx_Commerce_Utility_BackendUtility::readCategoryAccess($uidTarget, Tx_Commerce_Utility_BackendUtility::getCategoryPermsClause(1)); $str .= $this->doc->header($language->getLL('Copy')); $str .= $this->doc->spacer(5); // flag if neither sorting nor localizations // are existing and we can immediately copy $noActionReq = FALSE; // First prepare user defined objects (if any) // for hooks which extend this function: $hookObjectsArr = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/mod_cce/class.tx_commerce_cce_db.php']['copyWizardClass'])) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(' hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/mod_cce/class.tx_commerce_cce_db.php\'][\'copyWizardClass\'] is deprecated since commerce 1.0.0, it will be removed in commerce 1.4.0, please use instead $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/Classes/Utility/DataHandlerUtility.php\'][\'copyWizard\'] '); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/mod_cce/class.tx_commerce_cce_db.php']['copyWizardClass'] as $classRef) { $hookObjectsArr[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Utility/DataHandlerUtility.php']['copyWizard'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Utility/DataHandlerUtility.php']['copyWizard'] as $classRef) { $hookObjectsArr[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); } } switch ($command) { case 'overwrite': // pass through // pass through case 'pasteProduct': // chose local to copy from product /** * Product * * @var Tx_Commerce_Domain_Model_Product $product */ $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $uidClip); $product->loadData(); $prods = $product->getL18nProducts(); if (count($prods)) { $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1> <h2>' . $language->getLL('copy.product') . ': ' . $product->getTitle() . '</h2> <ul>'; // walk the l18n and get the selector box $l = count($prods); for ($i = 0; $i < $l; $i++) { $tmpProd = $prods[$i]; $flag = $tmpProd['flag'] != '' ? '<img src="' . $this->doc->backPath . 'gfx/flags/' . $tmpProd['flag'] . '" alt="Flag" />' : ''; $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpProd['uid'] . '" value="' . $tmpProd['sys_language'] . '" /><label for="loc_' . $tmpProd['uid'] . '">' . $flag . $tmpProd['title'] . '</label></li>'; } $str .= '</ul>'; } $records = array(); // chose sorting position if ($command != 'overwrite') { // Initialize tree object: /** * Product data * * @var Tx_Commerce_Tree_Leaf_ProductData $treedb */ $treedb = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_ProductData'); $treedb->init(); $records = $treedb->getRecordsDbList($uidTarget); } $l = count($records['pid'][$uidTarget]); // Hook: beforeFormClose $userIgnoreClose = FALSE; foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'beforeFormClose')) { // set $user_ignoreClose to true if you want to // force the script to print out the execute button $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose); } } if (0 >= $l && (0 != count($prods) || $userIgnoreClose)) { // no child object - sorting position is irrelevant - just print a submit button // and notify users that there are not products in the category yet $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />'; } elseif (0 < $l) { // at least 1 item - offer choice $icon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />'; $prodIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getIconImage('tx_commerce_products', array('uid' => $uidTarget), $this->doc->backPath, 'align="top" class="c-recIcon"'); $str .= '<h1>' . $language->getLL('copy.position') . '</h1>'; $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; for ($i = 0; $i < $l; $i++) { $record = $records['pid'][$uidTarget][$i]; $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"'; $str .= '<span class="nobr">' . $prodIcon . $record['title'] . '</span><br />'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; } } else { $noActionReq = TRUE; } break; case 'pasteCategory': // chose locale to copy from category /** * Category * * @var Tx_Commerce_Domain_Model_Category $category */ $category = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Category', $uidClip); $category->loadData(); $cats = $category->getL18nCategories(); if (0 != count($cats)) { $str .= '<h1>' . $language->getLL('copy.head.l18n') . '</h1> <h2>' . $language->getLL('copy.category') . ': ' . $category->getTitle() . '</h2> <ul>'; // walk the l18n and get the selector box $l = count($cats); for ($i = 0; $i < $l; $i++) { $tmpCat = $cats[$i]; $flag = $tmpCat['flag'] != '' ? '<img src="' . $this->doc->backPath . 'gfx/flags/' . $tmpCat['flag'] . '" alt="Flag" />' : ''; $str .= '<li><input type="checkbox" name="locale[]" id="loc_' . $tmpCat['uid'] . '" value="' . $tmpCat['sys_language'] . '" /><label for="loc_' . $tmpCat['uid'] . '">' . $flag . $tmpCat['title'] . '</label></li>'; } $str .= '</ul>'; } // chose sorting position // Initialize tree object: /** * Category data * * @var Tx_Commerce_Tree_Leaf_CategoryData $treedb */ $treedb = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Tree_Leaf_CategoryData'); $treedb->init(); $records = $treedb->getRecordsDbList($uidTarget); $l = count($records['pid'][$uidTarget]); // Hook: beforeFormClose $userIgnoreClose = FALSE; foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'beforeFormClose')) { $str .= $hookObj->beforeFormClose($uidClip, $uidTarget, $command, $userIgnoreClose); } } if (0 == $l && (0 != count($cats) || $userIgnoreClose)) { // no child object - sorting position is irrelevant - just print a submit button $str .= '<input type="submit" value="' . $language->getLL('copy.submit') . '" />'; } elseif (0 < $l) { // at least 1 item - offer choice $icon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/newrecord_marker_d.gif', 'width="281" height="8"') . ' alt="" title="Insert the category" />'; $catIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getIconImage('tx_commerce_categories', array('uid' => $uidTarget), $this->doc->backPath, 'align="top" class="c-recIcon"'); $str .= '<h1>' . $language->getLL('copy.position') . '</h1>'; $onClickAction = 'onclick="submitForm(' . $records['pid'][$uidTarget][0]['uid'] . ')"'; $str .= '<span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; for ($i = 0; $i < $l; $i++) { $record = $records['pid'][$uidTarget][$i]; $onClickAction = 'onclick="submitForm(-' . $record['uid'] . ')"'; $str .= '<span class="nobr">' . $catIcon . $record['title'] . '</span><br /> <span class="nobr"><a href="javascript:void(0)" ' . $onClickAction . '>' . $icon . '</a></span><br />'; } } else { $noActionReq = TRUE; } break; default: die('unknown command'); } // skip transforming and execute the command // if there are no locales and no positions if ($noActionReq) { $this->commitCommand($uidClip, $uidTarget, $command); return; } // Hook: beforeTransform foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'beforeTransform')) { $str .= $hookObj->beforeTransform($uidClip, $uidTarget, $command); } } $this->content .= $str; $markers = array('CSH' => '', 'CONTENT' => $this->content, 'CATINFO' => '', 'CATPATH' => ''); $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode'])); $this->content = $this->doc->startPage($language->getLL('Copy')); $this->content .= $this->doc->moduleBody($this->pageinfo, array(), $markers); $this->content .= $this->doc->endPage(); }
/** * [Describe function...] * * @return void * @todo Define visibility */ public function main() { $arrayBrowser = GeneralUtility::makeInstance('TYPO3\\CMS\\Lowlevel\\Utility\\ArrayBrowser'); $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']]; $search_field = GeneralUtility::_GP('search_field'); $this->content = $this->doc->header($GLOBALS['LANG']->getLL('configuration', TRUE)); $this->content .= '<h2>' . $label . '</h2>'; $this->content .= '<div id="lowlevel-config"> <label for="search_field">' . $GLOBALS['LANG']->getLL('enterSearchPhrase', TRUE) . '</label> <input type="text" id="search_field" name="search_field" value="' . htmlspecialchars($search_field) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' /> <input type="submit" name="search" id="search" value="' . $GLOBALS['LANG']->getLL('search', TRUE) . '" />'; $this->content .= BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"') . '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', TRUE) . '</label>'; $this->content .= BackendUtility::getFuncCheck(0, 'SET[fixedLgd]', $this->MOD_SETTINGS['fixedLgd'], '', '', 'id="checkFixedLgd"') . '<label for="checkFixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', TRUE) . '</label> </div>'; $this->content .= $this->doc->spacer(5); switch ($this->MOD_SETTINGS['function']) { case 0: $theVar = $GLOBALS['TYPO3_CONF_VARS']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TYPO3_CONF_VARS'; break; case 1: $theVar = $GLOBALS['TCA']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TCA'; break; case 2: $theVar = $GLOBALS['TCA_DESCR']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TCA_DESCR'; break; case 3: $theVar = $GLOBALS['TYPO3_LOADED_EXT']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TYPO3_LOADED_EXT'; break; case 4: $theVar = $GLOBALS['T3_SERVICES']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$T3_SERVICES'; break; case 5: $theVar = $GLOBALS['TBE_MODULES']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TBE_MODULES'; break; case 6: $theVar = $GLOBALS['TBE_MODULES_EXT']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TBE_MODULES_EXT'; break; case 7: $theVar = $GLOBALS['TBE_STYLES']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TBE_STYLES'; break; case 8: $theVar = $GLOBALS['BE_USER']->uc; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$BE_USER->uc'; break; case 9: $theVar = $GLOBALS['TYPO3_USER_SETTINGS']; GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TYPO3_USER_SETTINGS'; break; default: $theVar = array(); } // Update node: $update = 0; $node = GeneralUtility::_GET('node'); // If any plus-signs were clicked, it's registred. if (is_array($node)) { $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]); $update = 1; } if ($update) { $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $this->MOD_SETTINGS); } $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]; $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch']; $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd']; $arrayBrowser->searchKeysToo = TRUE; // If any POST-vars are send, update the condition array if (GeneralUtility::_POST('search') && trim($search_field)) { $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array()); } // mask the encryption key to not show it as plaintext in the configuration module if ($theVar == $GLOBALS['TYPO3_CONF_VARS']) { $theVar['SYS']['encryptionKey'] = '***** (length: ' . strlen($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . ' characters)'; } $tree = $arrayBrowser->tree($theVar, '', ''); $this->content .= $this->doc->sectionEnd(); // Variable name: if (GeneralUtility::_GP('varname')) { $line = GeneralUtility::_GP('_') ? GeneralUtility::_GP('_') : GeneralUtility::_GP('varname'); // Write the line to extTables.php if (GeneralUtility::_GP('writetoexttables')) { // change value to $GLOBALS $length = strpos($line, '['); $var = substr($line, 0, $length); $changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length); // load current extTables.php $extTables = GeneralUtility::getUrl(PATH_typo3conf . TYPO3_extTableDef_script); if ($var === '$TCA') { // check if we are editing the TCA preg_match_all('/\\[\'([^\']+)\'\\]/', $line, $parts); } // insert line in extTables.php $extTables = preg_replace('/<\\?php|\\?>/is', '', $extTables); $extTables = '<?php' . (empty($extTables) ? LF : '') . $extTables . $changedLine . LF . '?>'; $success = GeneralUtility::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables); if ($success) { // show flash message $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . nl2br(htmlspecialchars($changedLine)) . '</strong>'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK); } else { // Error: show flash message $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessageFailed', TRUE), TYPO3_extTableDef_script), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); } $this->content .= $flashMessage->render(); } $this->content .= '<div id="lowlevel-config-var"> <strong>' . $GLOBALS['LANG']->getLL('variable', TRUE) . '</strong><br /> <input type="text" name="_" value="' . trim(htmlspecialchars($line)) . '" size="120" /><br/>'; if (TYPO3_extTableDef_script !== '' && ($this->MOD_SETTINGS['function'] === '1' || $this->MOD_SETTINGS['function'] === '4')) { // write only for $TCA and TBE_STYLES if TYPO3_extTableDef_script is defined $this->content .= '<br /><input type="submit" name="writetoexttables" value="' . $GLOBALS['LANG']->getLL('writeValue', TRUE) . '" /></div>'; } else { $this->content .= $GLOBALS['LANG']->getLL('copyPaste', TRUE) . LF . '</div>'; } } $this->content .= '<div class="nowrap">' . $tree . '</div>'; // 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('Configuration', $this->content); }
/** * Main function, rendering the main module content * * @return void */ public function main() { // Start content compilation $this->content .= $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle')); // Make page header: $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle')); $pageContent .= $this->doc->spacer(5); $pageContent .= $this->doc->divider(5); if ($this->folderObject->checkActionPermission('add')) { $code = '<form action="tce_file.php" method="post" name="editform">'; // Making the selector box for the number of concurrent folder-creations $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10); $code .= ' <div id="c-select"> <label for="number-of-new-folders">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . '</label> <select name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">'; for ($a = 1; $a <= $this->folderNumber; $a++) { $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>'; } $code .= ' </select> </div> '; // Making the number of new-folder boxes needed: $code .= ' <div id="c-createFolders"> '; for ($a = 0; $a < $this->number; $a++) { $code .= ' <input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" /> <input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" /><br /> '; } $code .= ' </div> '; // Making submit button for folder creation: $code .= ' <div id="c-submitFolders"> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; // CSH: $code .= BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'], '<br />'); $pageContent .= $code; // Add spacer: $pageContent .= $this->doc->spacer(10); // Switching form tags: $pageContent .= $this->doc->sectionEnd() . '</form>'; } if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) { $pageContent .= '<form action="tce_file.php" method="post" name="editform2">'; // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc. $fileExtList = array(); $textfileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE); foreach ($textfileExt as $fileExt) { if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) { $fileExtList[] = '*.' . $fileExt; } } // Add form fields for creation of a new, blank text file: $code = ' <div id="c-newFile"> <p>[' . htmlspecialchars(implode(', ', $fileExtList)) . ']</p> <input' . $this->doc->formWidth(20) . ' type="text" name="file[newfile][0][data]" onchange="changed=true;" /> <input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" /> </div> '; // Submit button for creation of a new file: $code .= ' <div id="c-submitFiles"> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; // CSH: $code .= BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'], '<br />'); $pageContent .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code); $pageContent .= $this->doc->sectionEnd(); $pageContent .= '</form>'; } $docHeaderButtons = array('back' => ''); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }