/** * MAIN function for page information of localization * * @return string Output HTML for the module. * @todo Define visibility */ public function main() { global $BACK_PATH, $LANG, $SOBE; $theOutput = $this->pObj->doc->header($LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_title')); if ($this->pObj->id) { // Depth selector: $h_func = BackendUtility::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $h_func .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[lang]', $this->pObj->MOD_SETTINGS['lang'], $this->pObj->MOD_MENU['lang']); $theOutput .= $h_func; // Add CSH: $theOutput .= BackendUtility::cshItem('_MOD_web_info', 'lang', $GLOBALS['BACK_PATH'], '|<br />'); // Showing the tree: // Initialize starting point of page tree: $treeStartingPoint = (int) $this->pObj->id; $treeStartingRecord = BackendUtility::getRecordWSOL('pages', $treeStartingPoint); $depth = $this->pObj->MOD_SETTINGS['depth']; // Initialize tree object: $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView'); $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)); $tree->addField('l18n_cfg'); // Creating top icon; the current page $HTML = IconUtility::getSpriteIconForRecord('pages', $treeStartingRecord); $tree->tree[] = array('row' => $treeStartingRecord, 'HTML' => $HTML); // Create the tree from starting point: if ($depth) { $tree->getTree($treeStartingPoint, $depth, ''); } // Render information table: $theOutput .= $this->renderL10nTable($tree); } return $theOutput; }
/** * MAIN function for page information display * * @return string Output HTML for the module. */ public function main() { $theOutput = $this->pObj->doc->header($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:page_title')); $dblist = GeneralUtility::makeInstance(PageLayoutView::class); $dblist->descrTable = '_MOD_web_info'; $dblist->thumbs = 0; $dblist->script = BackendUtility::getModuleUrl('web_info'); $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'); $dblist->pI_showUser = 1; // PAGES: $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth']; // ONLY for the sake of dblist module which uses this value. $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput .= $this->pObj->doc->section('', BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', null, '|<br />') . '<div class="form-inline form-inline-spaced">' . $h_func . '</div>' . $dblist->HTMLcode, 0, 1); // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $theOutput .= GeneralUtility::callUserFunction($hook, $params, $this); } } return $theOutput; }
/** * MAIN function for page information of localization * * @return string Output HTML for the module. */ public function main() { $theOutput = '<h1>' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:lang_title')) . '</h1>'; if ($this->pObj->id) { // Depth selector: $theOutput .= '<div class="form-inline form-inline-spaced">'; $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[lang]', $this->pObj->MOD_SETTINGS['lang'], $this->pObj->MOD_MENU['lang']); $theOutput .= $h_func; // Add CSH: $theOutput .= BackendUtility::cshItem('_MOD_web_info', 'lang', null, '<div class="form-group"><span class="btn btn-default btn-sm">|</span></div><br />'); $theOutput .= '</div>'; // Showing the tree: // Initialize starting point of page tree: $treeStartingPoint = (int) $this->pObj->id; $treeStartingRecord = BackendUtility::getRecordWSOL('pages', $treeStartingPoint); $depth = $this->pObj->MOD_SETTINGS['depth']; // Initialize tree object: $tree = GeneralUtility::makeInstance(PageTreeView::class); $tree->init('AND ' . $this->getBackendUser()->getPagePermsClause(1)); $tree->addField('l18n_cfg'); // Creating top icon; the current page $HTML = $this->iconFactory->getIconForRecord('pages', $treeStartingRecord, Icon::SIZE_SMALL)->render(); $tree->tree[] = ['row' => $treeStartingRecord, 'HTML' => $HTML]; // Create the tree from starting point: if ($depth) { $tree->getTree($treeStartingPoint, $depth, ''); } // Render information table: $theOutput .= $this->renderL10nTable($tree); } return $theOutput; }
/** * MAIN function for page information display * * @return string Output HTML for the module. * @todo Define visibility */ public function main() { global $BACK_PATH, $LANG, $SOBE; $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView'); $dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name']; $dblist->backPath = $BACK_PATH; $dblist->thumbs = 0; $dblist->script = 'index.php'; $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'); $dblist->pI_showUser = 1; // PAGES: $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth']; // ONLY for the sake of dblist module which uses this value. $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php'); $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages'], 'index.php'); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput .= $this->pObj->doc->header($LANG->getLL('page_title')); $theOutput .= $this->pObj->doc->section('', \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1); // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $theOutput .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this); } } return $theOutput; }
/** * Render context sensitive help (CSH) for the given table * * @param string $table Table name ('_MOD_'+module name). If not set, the current module name will be used * @param string $field Field name (CSH locallang main key) * @param boolean $iconOnly If set, the full text will never be shown (only icon) * @param string $styleAttributes Additional style-attribute content for wrapping table (full text mode only) * @return string the rendered CSH icon */ public function render($table = NULL, $field = '', $iconOnly = FALSE, $styleAttributes = '') { if ($table === NULL) { $currentRequest = $this->controllerContext->getRequest(); $moduleName = $currentRequest->getPluginName(); $table = '_MOD_' . $moduleName; } $cshButton = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($table, $field, $GLOBALS['BACK_PATH'], '', $iconOnly, $styleAttributes); return '<div class="docheader-csh">' . $cshButton . '</div>'; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'back' => ''); // CSH $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'history_log', $GLOBALS['BACK_PATH'], '', TRUE); // Start history object $historyObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\History\\RecordHistory'); if ($historyObj->returnUrl) { $buttons['back'] = '<a href="' . htmlspecialchars($historyObj->returnUrl) . '" class="typo3-goBack">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } return $buttons; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $table = $arguments['table']; $field = $arguments['field']; $wrap = $arguments['wrap']; if ($table === null) { $currentRequest = $renderingContext->getControllerContext()->getRequest(); $moduleName = $currentRequest->getPluginName(); $table = '_MOD_' . $moduleName; } return '<div class="docheader-csh">' . BackendUtility::cshItem($table, $field, '', $wrap) . '</div>'; }
/** * MAIN function for page information display * * @return string Output HTML for the module. */ public function main() { $theOutput = '<h1>' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:page_title')) . '</h1>'; $dblist = GeneralUtility::makeInstance(PageLayoutView::class); $dblist->descrTable = '_MOD_web_info'; $dblist->thumbs = 0; $dblist->script = BackendUtility::getModuleUrl('web_info'); $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears'); $dblist->pI_showUser = 1; switch ((int) $this->pObj->MOD_SETTINGS['pages']) { case 1: $dblist->fieldArray = ['title', 'uid'] + array_keys($this->cleanTableNames()); break; case 2: $dblist->fieldArray = ['title', 'uid', 'lastUpdated', 'newUntil', 'no_cache', 'cache_timeout', 'php_tree_stop', 'TSconfig', 'is_siteroot', 'fe_login_mode']; break; default: $dblist->fieldArray = ['title', 'uid', 'alias', 'starttime', 'endtime', 'fe_group', 'target', 'url', 'shortcut', 'shortcut_mode']; } // PAGES: $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth']; // ONLY for the sake of dblist module which uses this value. $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput .= '<div>'; $theOutput .= BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', null, '<span class="btn btn-default btn-sm">|</span><br />') . '<div class="form-inline form-inline-spaced">' . $h_func . '</div>' . $dblist->HTMLcode; $theOutput .= '</div>'; // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = []; $theOutput .= GeneralUtility::callUserFunction($hook, $params, $this); } } return $theOutput; }
/** * Create the panel of buttons for submitting the form * or otherwise perform operations. * * @param array $row Data * * @return array all available buttons as an assoc. array */ public function getButtons(array $row) { $language = $this->getLanguageService(); $buttons = array('csh' => '', 'view' => '', 'edit' => '', 'hide_unhide' => '', 'move' => '', 'new_record' => '', 'paste' => '', 'level_up' => '', 'cache' => '', 'reload' => '', 'shortcut' => '', 'back' => '', 'csv' => '', 'export' => ''); // Get users permissions for this row: $localCalcPerms = $this->getBackendUser()->calcPerms($row); // CSH if (!strlen($this->id)) { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_commerce', 'list_module_noId', $GLOBALS['BACK_PATH'], '', TRUE); } elseif (!$this->id) { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_commerce', 'list_module_root', $GLOBALS['BACK_PATH'], '', TRUE); } else { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_commerce', 'list_module', $GLOBALS['BACK_PATH'], '', TRUE); } if (isset($this->id)) { // New record if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink']) { $params = '&parentCategory=' . $this->parentUid; $buttons['new_record'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'db_new.php?id=' . $this->id . $params . '\');') . '" title="' . $language->getLL('newRecordGeneral', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>'; } // If edit permissions are set, see // \TYPO3\CMS\Core\Authentication\BackendUserAuthentication if ($localCalcPerms & 2 && !empty($this->id)) { // Edit $params = '&edit[tx_commerce_categories][' . $this->pageRow['uid'] . ']=edit'; $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $language->getLL('editPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; } // Paste if (($localCalcPerms & 8 || $localCalcPerms & 16) && $this->parentUid) { $elFromTable = $this->clipObj->elFromTable(''); if (count($elFromTable)) { $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id)) . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg('tx_commerce_categories', $this->pageRow, 'into', $elFromTable)) . '" title="' . $language->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>'; } } if ($this->table && (!isset($GLOBALS['SOBE']->modTSconfig['properties']['noExportRecordsLinks']) || isset($GLOBALS['SOBE']->modTSconfig['properties']['noExportRecordsLinks']) && !$GLOBALS['SOBE']->modTSconfig['properties']['noExportRecordsLinks'])) { // CSV $buttons['csv'] = '<a href="' . htmlspecialchars($this->listURL() . '&csv=1') . '" title="' . $language->sL('LLL:EXT:lang/locallang_core.xlf:labels.csv', TRUE) . '">' . IconUtility::getSpriteIcon('mimetypes-text-csv') . '</a>'; // Export if (ExtensionManagementUtility::isLoaded('impexp')) { $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export')); $buttons['export'] = '<a href="' . htmlspecialchars($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id)) . '" title="' . $language->sL('LLL:EXT:lang/locallang_core.xlf:rm.export', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-export-t3d') . '</a>'; } } // Reload $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $language->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>'; // Shortcut if ($this->getBackendUser()->mayMakeShortcut()) { $buttons['shortcut'] = $this->getDocumentTemplate()->makeShortcutIcon('id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_list'); } // Back if ($this->returnUrl) { $buttons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack" title="' . $language->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } if (!empty($this->parentUid)) { // Setting title of page + the "Go up" link: $temp = $this->parentUid; $this->parentUid = $this->pageRow['pid']; $buttons['level_up'] = '<a href="' . htmlspecialchars($this->listURL($this->id)) . '" onclick="setHighlight(' . $this->pageRow['pid'] . ')" title="' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-up') . '</a>'; $this->parentUid = $temp; } } return $buttons; }
/** * Main function, creating content in the frame * * @return void * @todo Define visibility */ public function main() { // By default, 5 groups are set $this->groupLabels = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1); $bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups'); if (is_array($bookmarkGroups) && count($bookmarkGroups)) { foreach ($bookmarkGroups as $k => $v) { if (strcmp('', $v) && strcmp('0', $v)) { $this->groupLabels[$k] = (string) $v; } elseif ($GLOBALS['BE_USER']->isAdmin()) { unset($this->groupLabels[$k]); } } } // List of global groups that will be loaded. All global groups have negative IDs. $globalGroups = -100; // Group -100 is kind of superglobal and can't be changed. if (count($this->groupLabels)) { $globalGroups .= ',' . implode(',', array_keys($this->groupLabels)); $globalGroups = str_replace(',', ',-', $globalGroups); } // Fetching shortcuts to display for this user: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_be_shortcuts', '((userid=' . $GLOBALS['BE_USER']->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . $globalGroups . '))', '', 'sc_group,sorting'); // Init vars: $this->lines = array(); $this->linesPre = array(); $this->editSC_rec = ''; $this->selOpt = array(); $formerGr = ''; // Traverse shortcuts while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $mParts = explode('|', $row['module_name']); $row['module_name'] = $mParts[0]; $row['M_module_name'] = $mParts[1]; $mParts = explode('_', $row['M_module_name'] ? $row['M_module_name'] : $row['module_name']); $qParts = parse_url($row['url']); if (!$GLOBALS['BE_USER']->isAdmin()) { // Check for module access if (!isset($GLOBALS['LANG']->moduleLabels['tabs_images'][implode('_', $mParts) . '_tab'])) { // Nice hack to check if the user has access to this module - otherwise the translation label would not have been loaded :-) continue; } $page_id = $this->getLinkedPageId($row['url']); if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($page_id)) { // Check for webmount access if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) { continue; } // Check for record access $pageRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $page_id); if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) { continue; } } } if ($this->editSC && $row['uid'] == $this->editSC) { $this->editSC_rec = $row; } $sc_group = $row['sc_group']; if ($sc_group && strcmp($formerGr, $sc_group)) { if ($sc_group != -100) { if ($this->groupLabels[abs($sc_group)] && strcmp('1', $this->groupLabels[abs($sc_group)])) { $label = $this->groupLabels[abs($sc_group)]; } else { $label = $GLOBALS['LANG']->getLL('shortcut_group_' . abs($sc_group), 1); // Fallback label if (!$label) { $label = $GLOBALS['LANG']->getLL('shortcut_group', 1) . ' ' . abs($sc_group); } } if ($sc_group >= 0) { $onC = 'if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('bookmark_delAllInCat')) . ')){window.location.href=\'alt_shortcut.php?deleteCategory=' . $sc_group . '\';}return false;'; $this->linesPre[] = '<td> </td><td class="bgColor5"><a href="#" onclick="' . htmlspecialchars($onC) . '" title="' . $GLOBALS['LANG']->getLL('bookmark_delAllInCat', 1) . '">' . $label . '</a></td>'; } else { // Fallback label $label = $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . ($label ? $label : abs($sc_group)); $this->lines[] = '<td> </td><td class="bgColor5">' . $label . '</td>'; } unset($label); } } $bgColorClass = $row['uid'] == $this->editSC ? 'bgColor5' : ($row['sc_group'] < 0 ? 'bgColor6' : 'bgColor4'); if ($row['description'] && $row['uid'] != $this->editSC) { $label = $row['description']; } else { $label = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(rawurldecode($qParts['query']), 150); } $titleA = $this->itemLabel($label, $row['module_name'], $row['M_module_name']); $editSH = $row['sc_group'] >= 0 || $GLOBALS['BE_USER']->isAdmin() ? 'editSh(' . intval($row['uid']) . ');' : 'alert(\'' . $GLOBALS['LANG']->getLL('bookmark_onlyAdmin') . '\')'; $jumpSC = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $mParts) . '\',\'' . $mParts[0] . '\');'; $onC = 'if (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){' . $editSH . '}else{' . $jumpSC . '}return false;'; // user defined groups show up first if ($sc_group >= 0) { $this->linesPre[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>'; } else { $this->lines[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>'; } if (trim($row['description'])) { $kkey = strtolower(substr($row['description'], 0, 20)) . '_' . $row['uid']; $this->selOpt[$kkey] = '<option value="' . htmlspecialchars($jumpSC) . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['description'], 50)) . '</option>'; } $formerGr = $row['sc_group']; } ksort($this->selOpt); array_unshift($this->selOpt, '<option>[' . $GLOBALS['LANG']->getLL('bookmark_selSC', 1) . ']</option>'); $this->editLoadedFunc(); $this->editPageIdFunc(); if (!$this->editLoaded && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) { $editIdCode = '<td nowrap="nowrap">' . $GLOBALS['LANG']->getLL('bookmark_editID', 1) . ': <input type="text" value="' . ($this->editError ? htmlspecialchars($this->editPage) : '') . '" name="editPage"' . $this->doc->formWidth(15) . ' onchange="submitEditPage(this.value);" />' . ($this->editError ? ' <strong><span class="typo3-red">' . htmlspecialchars($this->editError) . '</span></strong>' : '') . (is_array($this->theEditRec) ? ' <strong>' . $GLOBALS['LANG']->getLL('bookmark_loadEdit', 1) . ' \'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $this->theEditRec, TRUE) . '\'</strong> (' . htmlspecialchars($this->editPath) . ')' : '') . ($this->searchFor ? ' ' . $GLOBALS['LANG']->getLL('bookmark_searchFor', 1) . ' <strong>\'' . htmlspecialchars($this->searchFor) . '\'</strong>' : '') . '</td>'; } else { $editIdCode = ''; } // Adding CSH: $editIdCode .= '<td> ' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'bookmarks', $GLOBALS['BACK_PATH'], '', TRUE) . '</td>'; // Compile it all: $this->content .= ' <table border="0" cellpadding="0" cellspacing="0" width="99%"> <tr> <td> <!-- Shortcut Display Table: --> <table border="0" cellpadding="0" cellspacing="2" id="typo3-shortcuts"> <tr> '; if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks')) { $this->content .= implode(' ', $this->lines); } $this->content .= $editIdCode . ' </tr> </table> </td> <td align="right">'; if ($this->hasWorkspaceAccess()) { $this->content .= $this->workspaceSelector() . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'], '', TRUE); } $this->content .= ' </td> </tr> </table> '; // Launch Edit page: if ($this->theEditRec['uid']) { $this->content .= $this->doc->wrapScriptTags('top.loadEditId(' . $this->theEditRec['uid'] . ');'); } // Load alternative table/uid into editing form. if (count($this->alternativeTableUid) == 2 && isset($GLOBALS['TCA'][$this->alternativeTableUid[0]]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->alternativeTableUid[1])) { $JSaction = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $this->alternativeTableUid[0] . '][' . $this->alternativeTableUid[1] . ']=edit', '', 'dummy.php'); $this->content .= $this->doc->wrapScriptTags('function editArbitraryElement() { top.content.' . $JSaction . '; } editArbitraryElement();'); } // Load search for something. if ($this->searchFor) { $urlParameters = array(); $urlParameters['id'] = intval($GLOBALS['WEBMOUNTS'][0]); $urlParameters['search_field'] = $this->searchFor; $urlParameters['search_levels'] = 4; $this->content .= $this->doc->wrapScriptTags('jump(unescape("' . rawurlencode(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters, '')) . '"), "web_list", "web");'); } }
/** * The main function. * * @return void */ public function main() { $this->CMD = GeneralUtility::_GP('CMD'); $this->pages_uid = intval(GeneralUtility::_GP('pages_uid')); $this->sys_dmail_uid = intval(GeneralUtility::_GP('sys_dmail_uid')); $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $GLOBALS["BE_USER"]->user['admin'] && !$this->id) { // Draw the header. $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS["BACK_PATH"]; $this->doc->setModuleTemplate('EXT:direct_mail/Resources/Private/Templates/Module.html'); $this->doc->form = '<form action="" method="post" name="' . $this->formname . '" enctype="multipart/form-data">'; $this->doc->addStyleSheet('direct_mail', ExtensionManagementUtility::extRelPath('direct_mail') . '/Resources/Public/StyleSheets/modules.css'); // Add CSS $this->doc->inDocStylesArray['dmail'] = '.toggleTitle { width: 70%; }'; // JavaScript $this->doc->JScode = ' <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } function jumpToUrlD(URL) { // window.location.href = URL+"&sys_dmail_uid=' . $this->sys_dmail_uid . '"; } function toggleDisplay(toggleId, e, countBox) { // if (!e) { e = window.event; } if (!document.getElementById) { return false; } prefix = toggleId.split("-"); for (i=1; i<=countBox; i++){ newToggleId = prefix[0]+"-"+i; body = document.getElementById(newToggleId); image = document.getElementById(toggleId + "_toggle"); if (newToggleId != toggleId){ if (body.style.display == "block"){ body.style.display = "none"; if (image) { image.className = image.className.replace( /expand/ , "collapse"); } } } } var body = document.getElementById(toggleId); if (!body) { return false; } var image = document.getElementById(toggleId + "_toggle"); if (body.style.display == "none") { body.style.display = "block"; if (image) { image.className = image.className.replace( /collapse/ , "expand"); } } else { body.style.display = "none"; if (image) { image.className = image.className.replace( /expand/ , "collapse"); } } if (e) { // Stop the event from propagating, which // would cause the regular HREF link to // be followed, ruining our hard work. e.cancelBubble = true; if (e.stopPropagation) { e.stopPropagation(); } } } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds[\'web\'] = ' . intval($this->id) . '; </script> '; $markers = array('FLASHMESSAGES' => '', 'CONTENT' => ''); $docHeaderButtons = array('PAGEPATH' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.path') . ': ' . GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50), 'SHORTCUT' => '', 'CSH' => BackendUtility::cshItem($this->cshTable, '', $GLOBALS["BACK_PATH"])); // shortcut icon if ($GLOBALS["BE_USER"]->mayMakeShortcut()) { $docHeaderButtons['SHORTCUT'] = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); } $module = $this->pageinfo['module']; if (!$module) { $pidrec = BackendUtility::getRecord('pages', intval($this->pageinfo['pid'])); $module = $pidrec['module']; } if ($module == 'dmail') { // Direct mail module if ($this->pageinfo['doktype'] == 254 && $this->pageinfo['module'] == 'dmail') { $markers['CONTENT'] = '<h1>' . $this->getLanguageService()->getLL('header_conf') . '</h1>' . $this->moduleContent(); } elseif ($this->id != 0) { /** * Generate flash message * @var \TYPO3\CMS\Core\Messaging\FlashMessage */ $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $this->getLanguageService()->getLL('dmail_noRegular'), $this->getLanguageService()->getLL('dmail_newsletters'), FlashMessage::WARNING); $markers['FLASHMESSAGES'] = $flashMessage->render(); } } else { $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $this->getLanguageService()->getLL('select_folder'), $this->getLanguageService()->getLL('header_conf'), FlashMessage::WARNING); $markers['FLASHMESSAGES'] = $flashMessage->render(); } $this->content = $this->doc->startPage($this->getLanguageService()->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, array()); } else { // If no access or if ID == zero $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS["BACK_PATH"]; $this->content .= $this->doc->startPage($this->getLanguageService()->getLL('title')); $this->content .= $this->doc->header($this->getLanguageService()->getLL('title')); $this->content .= '<div style="padding-top: 15px;"></div>'; } }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'new_page' => '', 'refresh' => '', 'filter' => ''); // New Page $onclickNewPageWizard = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'db_new.php?pagesOnly=1&id=\'+Tree.pageID;'; $buttons['new_page'] = '<a href="#" onclick="' . $onclickNewPageWizard . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:newPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new') . '</a>'; // Refresh $buttons['refresh'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.refresh', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>'; // CSH $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH'], '', TRUE)); // Filter if ($this->hasFilterBox) { $buttons['filter'] = '<a href="#" id="tree-toolbar-filter-item">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-tree-search-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:labels.filter', 1))) . '</a>'; } return $buttons; }
/** * Gets the buttons that shall be rendered in the docHeader * * @return array Available buttons for the docHeader */ protected function getDocHeaderButtons() { return array('csh' => BackendUtility::cshItem('_MOD_web_func', ''), 'shortcut' => $this->getShortcutButton(), 'save' => ''); }
/** * Create the panel of buttons for submitting the form or otherwise perform * operations. * * @return string[] All available buttons as an assoc. array */ public function getButtons() { $module = $this->getModule(); $backendUser = $this->getBackendUserAuthentication(); $lang = $this->getLanguageService(); $buttons = array('csh' => '', 'view' => '', 'edit' => '', 'hide_unhide' => '', 'move' => '', 'new_record' => '', 'paste' => '', 'level_up' => '', 'cache' => '', 'reload' => '', 'shortcut' => '', 'back' => '', 'csv' => '', 'export' => ''); // Get users permissions for this page record: $localCalcPerms = $backendUser->calcPerms($this->pageRow); // CSH if ((string) $this->id === '') { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_noId'); } elseif (!$this->id) { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_root'); } else { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module'); } if (isset($this->id)) { // View Exclude doktypes 254,255 Configuration: // mod.web_list.noViewWithDokTypes = 254,255 if (isset($module->modTSconfig['properties']['noViewWithDokTypes'])) { $noViewDokTypes = GeneralUtility::trimExplode(',', $module->modTSconfig['properties']['noViewWithDokTypes'], true); } else { //default exclusion: doktype 254 (folder), 255 (recycler) $noViewDokTypes = array(PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_RECYCLER); } if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) { $onClick = htmlspecialchars(BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id))); $buttons['view'] = '<a href="#" onclick="' . $onClick . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>'; } // New record on pages that are not locked by editlock if (!$module->modTSconfig['properties']['noCreateRecordsLink'] && $this->editLockPermissions()) { $onClick = htmlspecialchars('return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', ['id' => $this->id])) . ');'); $buttons['new_record'] = '<a href="#" onclick="' . $onClick . '" title="' . $lang->getLL('newRecordGeneral', true) . '">' . $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render() . '</a>'; } // If edit permissions are set, see // \TYPO3\CMS\Core\Authentication\BackendUserAuthentication if ($localCalcPerms & Permission::PAGE_EDIT && !empty($this->id) && $this->editLockPermissions() && $this->getBackendUserAuthentication()->checkLanguageAccess(0)) { // Edit $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit'; $onClick = htmlspecialchars(BackendUtility::editOnClick($params, '', -1)); $buttons['edit'] = '<a href="#" onclick="' . $onClick . '" title="' . $lang->getLL('editPage', true) . '">' . $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>'; } // Paste if (($localCalcPerms & Permission::PAGE_NEW || $localCalcPerms & Permission::CONTENT_EDIT) && $this->editLockPermissions()) { $elFromTable = $this->clipObj->elFromTable(''); if (!empty($elFromTable)) { $onClick = htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable)); $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id)) . '" onclick="' . $onClick . '" title="' . $lang->getLL('clip_paste', true) . '">' . $this->iconFactory->getIcon('actions-document-paste-after', Icon::SIZE_SMALL)->render() . '</a>'; } } // Cache $buttons['cache'] = '<a href="' . htmlspecialchars($this->listURL() . '&clear_cache=1') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true) . '">' . $this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL)->render() . '</a>'; if ($this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks']) || isset($module->modTSconfig['properties']['noExportRecordsLinks']) && !$module->modTSconfig['properties']['noExportRecordsLinks'])) { // CSV $buttons['csv'] = '<a href="' . htmlspecialchars($this->listURL() . '&csv=1') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.csv', true) . '">' . $this->iconFactory->getIcon('actions-document-export-csv', Icon::SIZE_SMALL)->render() . '</a>'; // Export if (ExtensionManagementUtility::isLoaded('impexp')) { $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export')); $buttons['export'] = '<a href="' . htmlspecialchars($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id)) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.export', true) . '">' . $this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL)->render() . '</a>'; } } // Reload $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', true) . '">' . $this->iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)->render() . '</a>'; // Shortcut if ($backendUser->mayMakeShortcut()) { $buttons['shortcut'] = $this->getDocumentTemplate()->makeShortcutIcon('id, M, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_list'); } // Back if ($this->returnUrl) { $href = htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl, array('id' => $this->id))); $buttons['back'] = '<a href="' . $href . '" class="typo3-goBack" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL)->render() . '</a>'; } } return $buttons; }
/** * Main function of class * * @return string HTML output */ public function main() { $pageId = (int) GeneralUtility::_GP('id'); if ($pageId === 0) { $this->view->assign('pageZero', 1); $this->view->assign('overviewOfPagesUsingTSConfig', $this->getOverviewOfPagesUsingTSConfig()); } else { if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) { $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true); $lines = array(); $pUids = array(); foreach ($TSparts as $k => $v) { if ($k != 'uid_0') { $line = array(); if ($k == 'defaultPageTSconfig') { $line['defaultPageTSconfig'] = 1; } else { $pUids[] = substr($k, 4); $row = BackendUtility::getRecordWSOL('pages', substr($k, 4)); $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL); $editIdList = substr($k, 4); $urlParameters = ['edit' => ['pages' => [$editIdList => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $line['editIcon'] = BackendUtility::getModuleUrl('record_edit', $urlParameters); $line['editTitle'] = 'editTSconfig'; $line['title'] = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']) . ' ' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $row)); } $tsparser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class); $tsparser->lineNumberOffset = 0; $line['content'] = $tsparser->doSyntaxHighlight(trim($v) . LF); $lines[] = $line; } } if (!empty($pUids)) { $urlParameters = ['edit' => ['pages' => [implode(',', $pUids) => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $url = BackendUtility::getModuleUrl('record_edit', $urlParameters); $editIcon = htmlspecialchars($url); $editTitle = 'editTSconfig_all'; } else { $editIcon = ''; $editTitle = ''; } $this->view->assign('tsconfParts99', 1); $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_edit', null, '|')); $this->view->assign('lines', $lines); $this->view->assign('editIcon', $editIcon); $this->view->assign('editTitle', $editTitle); } else { $this->view->assign('tsconfParts99', 0); // Defined global here! $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class); // Do not log time-performance information $tmpl->tt_track = 0; $tmpl->fixedLgd = 0; $tmpl->linkObjects = 0; $tmpl->bType = ''; $tmpl->ext_expandAllNotes = 1; $tmpl->ext_noPMicons = 1; $beUser = $this->getBackendUser(); switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) { case '1': $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod'); break; case '1a': $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1b': $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1c': $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1d': $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1e': $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1f': $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '1g': $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '2': $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '5': $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '6': $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '3': $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id)); break; case '4': $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id)); break; default: $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id); } $modTSconfig = $modTSconfig['properties']; if (!is_array($modTSconfig)) { $modTSconfig = array(); } $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '|')); $this->view->assign('tree', $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'])); } $this->view->assign('alphaSort', BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"')); $this->view->assign('dropdownMenu', BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts'])); } return $this->view->render(); }
/** * Create the panel of buttons for submitting the * form or otherwise perform operations. * * @return array all available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'refresh' => ''); // Refresh $buttons['refresh'] = '<a href="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>'; // CSH $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', BackendUtility::cshItem('xMOD_csh_commercebe', 'categorytree', $this->doc->backPath)); return $buttons; }
/** * Builds the buttons for the docheader and returns them as an array * * @return array */ public function getButtons() { $lang = $this->getLanguageService(); $buttons = array(); // CSH button $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_edit'); // Save button $theIcon = IconUtility::getSpriteIcon('actions-document-save'); $buttons['SAVE'] = '<a href="#" onclick="document.editform.submit();" title="' . $lang->makeEntities($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.submit', TRUE)) . '">' . $theIcon . '</a>'; // Save and Close button $theIcon = IconUtility::getSpriteIcon('actions-document-save-close'); $buttons['SAVE_CLOSE'] = '<a href="#" onclick="document.editform.redirect.value=' . GeneralUtility::quoteJSvalue(htmlspecialchars($this->returnUrl)) . '; document.editform.submit();" title="' . $lang->makeEntities($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.saveAndClose', TRUE)) . '">' . $theIcon . '</a>'; // Cancel button $theIcon = IconUtility::getSpriteIcon('actions-document-close'); $buttons['CANCEL'] = '<a href="#" onclick="backToList(); return false;" title="' . $lang->makeEntities($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE)) . '">' . $theIcon . '</a>'; return $buttons; }
/** * Main function creating the content for the module. * * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj */ public function main() { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->getLanguageService()->includeLLFile('EXT:wizard_crpages/Resources/Private/Language/locallang.xlf'); $theCode = ''; $this->tsConfig = BackendUtility::getPagesTSconfig($this->pObj->id); $this->pagesTsConfig = isset($this->tsConfig['TCEFORM.']['pages.']) ? $this->tsConfig['TCEFORM.']['pages.'] : array(); // Create new pages here? $pageRecord = BackendUtility::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $this->getBackendUser()->getPagePermsClause(8)); $pageRepository = GeneralUtility::makeInstance(PageRepository::class); $menuItems = $pageRepository->getMenu($this->pObj->id, '*', 'sorting', '', false); if (is_array($pageRecord)) { $data = GeneralUtility::_GP('data'); if (is_array($data['pages'])) { if (GeneralUtility::_GP('createInListEnd')) { $endI = end($menuItems); $thePid = -(int) $endI['uid']; if (!$thePid) { $thePid = $this->pObj->id; } } else { $thePid = $this->pObj->id; } $firstRecord = true; $previousIdentifier = ''; foreach ($data['pages'] as $identifier => $dat) { if (!trim($dat['title'])) { unset($data['pages'][$identifier]); } else { $data['pages'][$identifier]['hidden'] = GeneralUtility::_GP('hidePages') ? 1 : 0; $data['pages'][$identifier]['nav_hide'] = GeneralUtility::_GP('hidePagesInMenus') ? 1 : 0; if ($firstRecord) { $firstRecord = false; $data['pages'][$identifier]['pid'] = $thePid; } else { $data['pages'][$identifier]['pid'] = '-' . $previousIdentifier; } $previousIdentifier = $identifier; } } if (!empty($data['pages'])) { reset($data); $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); $dataHandler->stripslashes_values = 0; // set default TCA values specific for the user $TCAdefaultOverride = $this->getBackendUser()->getTSConfigProp('TCAdefaults'); if (is_array($TCAdefaultOverride)) { $dataHandler->setDefaultsFromUserTS($TCAdefaultOverride); } $dataHandler->start($data, array()); $dataHandler->process_datamap(); BackendUtility::setUpdateSignal('updatePageTree'); $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_create')); } else { $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_noCreate'), FlashMessage::ERROR); } $theCode .= $flashMessage->render(); // Display result: $menuItems = $pageRepository->getMenu($this->pObj->id, '*', 'sorting', '', false); $lines = array(); foreach ($menuItems as $record) { BackendUtility::workspaceOL('pages', $record); if (is_array($record)) { $lines[] = '<span class="text-nowrap" title="' . BackendUtility::titleAttribForPages($record, '', false) . '">' . $this->iconFactory->getIconForRecord('pages', $record, Icon::SIZE_SMALL)->render() . htmlspecialchars(GeneralUtility::fixed_lgd_cs($record['title'], $this->getBackendUser()->uc['titleLen'])) . '</span>'; } } $theCode .= '<h4>' . $this->getLanguageService()->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines); } else { // Display create form $this->typeSelectHtml = $this->getTypeSelectHtml(); $tableData = array(); for ($a = 0; $a < 5; $a++) { $tableData[] = $this->getFormLine($a); } $theCode .= ' <h4>' . $this->getLanguageService()->getLL('wiz_newPages') . ':</h4> <div class="form-group t3js-wizardcrpages-container"> ' . implode(LF, $tableData) . ' </div> <div class="form-group"> <input class="btn btn-default t3js-wizardcrpages-createnewfields" type="button" value="' . $this->getLanguageService()->getLL('wiz_newPages_addMoreLines') . '" /> </div> <div class="form-group"> <div class="checkbox"> <label for="createInListEnd"> <input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> ' . $this->getLanguageService()->getLL('wiz_newPages_listEnd') . ' </label> </div> <div class="checkbox"> <label for="hidePages"> <input type="checkbox" name="hidePages" id="hidePages" value="1" /> ' . $this->getLanguageService()->getLL('wiz_newPages_hidePages') . ' </label> </div> <div class="checkbox"> <label for="hidePagesInMenus"> <input type="checkbox" name="hidePagesInMenus" id="hidePagesInMenus" value="1" /> ' . $this->getLanguageService()->getLL('wiz_newPages_hidePagesInMenus') . ' </label> </div> </div> <div class="form-group"> <input class="btn btn-default" type="submit" name="create" value="' . $this->getLanguageService()->getLL('wiz_newPages_lCreate') . '" /> <input class="btn btn-default" type="reset" value="' . $this->getLanguageService()->getLL('wiz_newPages_lReset') . '" /> </div>'; $this->getPageRenderer()->loadJquery(); $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/WizardCrpages/WizardCreatePages'); // Add inline code $inlineJavaScriptCode = 'var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label;'; $this->getPageRenderer()->addJsInlineCode('wizard_crpages', $inlineJavaScriptCode); } } else { $theCode .= GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_errorMsg1'), FlashMessage::ERROR)->render(); } // CSH $theCode .= BackendUtility::cshItem('_MOD_web_func', 'tx_wizardcrpages', null, '<div class="t3-help">|</div>'); $out = $this->pObj->doc->header($this->getLanguageService()->getLL('wiz_crMany')); $out .= $this->pObj->doc->section('', $theCode, false, true); return $out; }
/** * Main function, rendering the main module content * * @return void */ public function main() { $lang = $this->getLanguageService(); $pageContent = '<h1>' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle') . '</h1>'; 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 = 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') . '</label> ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . ' <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) . '" /> </div> '; // Switching form tags: $pageContent .= '<h3>' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfolders', true) . '</h3>'; $pageContent .= '<div>' . $code . '</form></div>'; } if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) { $pageContent .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('online_media')) . '" method="post" name="editform2">'; // Create a list of allowed file extensions with the readable format "youtube, vimeo" etc. $fileExtList = array(); $onlineMediaFileExt = OnlineMediaHelperRegistry::getInstance()->getSupportedFileExtensions(); foreach ($onlineMediaFileExt as $fileExt) { if (GeneralUtility::verifyFilenameAgainstDenyPattern($fileExt)) { $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>'; } } // Add form fields for adding media files: $code = ' <div class="form-group"> <div class="form-section"> <div class="form-group"> <label for="newMedia">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.label', true) . '</label> ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newMedia') . ' <div class="form-control-wrap"> <input class="form-control" type="text" id="newMedia" name="file[newMedia][0][url]" placeholder="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.placeholder', true) . '" /> <input type="hidden" name="file[newMedia][0][target]" value="' . htmlspecialchars($this->target) . '" /> </div> <div class="help-block"> ' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.allowedProviders', true) . '<br> ' . implode(' ', $fileExtList) . ' </div> </div> </div> </div> '; // Submit button for creation of a new media: $code .= ' <div class="form-group"> <input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.submit', true) . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> </div> '; $pageContent .= '<h3>' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media', true) . '</h3>'; $pageContent .= '<div>' . $code . '</div>'; $pageContent .= '</form>'; $pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform3">'; // 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 (GeneralUtility::verifyFilenameAgainstDenyPattern($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', true) . '</label> ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . ' <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', true) . '<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) . '" /> </div> '; $pageContent .= '<h3>' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile', true) . '</h3>'; $pageContent .= '<div>' . $code . '</div>'; $pageContent .= '</form>'; } $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); // Back if ($this->returnUrl) { $backButton = $buttonBar->makeLinkButton()->setHref(GeneralUtility::linkThisUrl($this->returnUrl))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL)); $buttonBar->addButton($backButton); } $this->content .= '<div>' . $pageContent . '</div>'; $this->moduleTemplate->setContent($this->content); }
/** * Create the panel of buttons for submitting the form * or otherwise perform operations. * * @return array all available buttons as an assoc. array */ protected function getHeaderButtons() { $backendUser = $this->getBackendUser(); $language = $this->getLanguageService(); $buttons = array('csh' => '', 'level_up' => '', 'back' => '', 'new_record' => '', 'paste' => '', 'view' => '', 'edit' => '', 'move' => '', 'hide_unhide' => '', 'csv' => '', 'export' => '', 'cache' => '', 'reload' => '', 'shortcut' => ''); // CSH $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_commerce_statistic', '', $this->getBackPath(), '', true); // Shortcut if ($backendUser->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); } // If access to Web>List for user, then link to that module. if ($backendUser->check('modules', 'web_list')) { $href = $this->getBackPath() . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-folder-list', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1))) . '</a>'; } return $buttons; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'view' => '', 'shortcut' => ''); // CSH $buttons['csh'] = BackendUtility::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE); // View page $buttons['view'] = '<a href="#" ' . 'onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); } return $buttons; }
/** * 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); }
/** * Rendering the quick-edit view. * * @return string */ public function renderQuickEdit() { $databaseConnection = $this->getDatabaseConnection(); $beUser = $this->getBackendUser(); $lang = $this->getLanguageService(); // Set the edit_record value for internal use in this function: $edit_record = $this->edit_record; // If a command to edit all records in a column is issue, then select all those elements, and redirect to FormEngine if (substr($edit_record, 0, 9) == '_EDIT_COL') { $res = $databaseConnection->exec_SELECTquery('*', 'tt_content', 'pid=' . (int) $this->id . ' AND colPos=' . (int) substr($edit_record, 10) . ' AND sys_language_uid=' . (int) $this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting'); $idListA = array(); while ($cRow = $databaseConnection->sql_fetch_assoc($res)) { $idListA[] = $cRow['uid']; } $url = BackendUtility::getModuleUrl('record_edit', array('edit[tt_content][' . implode(',', $idListA) . ']' => 'edit', 'returnUrl' => $this->local_linkThisScript(array('edit_record' => '')))); HttpUtility::redirect($url); } // If the former record edited was the creation of a NEW record, this will look up the created records uid: if ($this->new_unique_uid) { $res = $databaseConnection->exec_SELECTquery('*', 'sys_log', 'userid=' . (int) $beUser->user['uid'] . ' AND NEWid=' . $databaseConnection->fullQuoteStr($this->new_unique_uid, 'sys_log')); $sys_log_row = $databaseConnection->sql_fetch_assoc($res); if (is_array($sys_log_row)) { $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid']; } } $edit_record = $this->makeQuickEditMenu($edit_record); // Splitting the edit-record cmd value into table/uid: $this->eRParts = explode(':', $edit_record); $tableName = $this->eRParts[0]; // Delete-button flag? $this->deleteButton = MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($tableName !== 'pages' && $this->EDIT_CONTENT || $tableName === 'pages' && $this->CALC_PERMS & Permission::PAGE_DELETE); // If undo-button should be rendered (depends on available items in sys_history) $this->undoButton = false; $undoRes = $databaseConnection->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $databaseConnection->fullQuoteStr($tableName, 'sys_history') . ' AND recuid=' . (int) $this->eRParts[1], '', 'tstamp DESC', '1'); if ($this->undoButtonR = $databaseConnection->sql_fetch_assoc($undoRes)) { $this->undoButton = true; } // Setting up the Return URL for coming back to THIS script (if links take the user to another script) $R_URL_parts = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI')); $R_URL_getvars = GeneralUtility::_GET(); unset($R_URL_getvars['popView']); unset($R_URL_getvars['new_unique_uid']); $R_URL_getvars['edit_record'] = $edit_record; $this->R_URI = $R_URL_parts['path'] . '?' . GeneralUtility::implodeArrayForUrl('', $R_URL_getvars); // Creating editing form: if ($edit_record) { // Splitting uid parts for special features, if new: list($uidVal, $neighborRecordUid, $ex_colPos) = explode('/', $this->eRParts[1]); if ($uidVal === 'new') { $command = 'new'; // Page id of this new record $theUid = $this->id; if ($neighborRecordUid) { $theUid = $neighborRecordUid; } } else { $command = 'edit'; $theUid = $uidVal; // Convert $uidVal to workspace version if any: $draftRecord = BackendUtility::getWorkspaceVersionOfRecord($beUser->workspace, $tableName, $theUid, 'uid'); if ($draftRecord) { $theUid = $draftRecord['uid']; } } // @todo: Hack because DatabaseInitializeNewRow reads from _GP directly $GLOBALS['_GET']['defVals'][$tableName] = array('colPos' => (int) $ex_colPos, 'sys_language_uid' => (int) $this->current_sys_language); /** @var TcaDatabaseRecord $formDataGroup */ $formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class); /** @var FormDataCompiler $formDataCompiler */ $formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup); /** @var NodeFactory $nodeFactory */ $nodeFactory = GeneralUtility::makeInstance(NodeFactory::class); try { $formDataCompilerInput = ['tableName' => $tableName, 'vanillaUid' => (int) $theUid, 'command' => $command]; $formData = $formDataCompiler->compile($formDataCompilerInput); if ($command !== 'new') { BackendUtility::lockRecords($tableName, $formData['databaseRow']['uid'], $tableName === 'tt_content' ? $formData['databaseRow']['pid'] : 0); } $formData['renderType'] = 'outerWrapContainer'; $formResult = $nodeFactory->create($formData)->render(); $panel = $formResult['html']; $formResult['html'] = ''; /** @var FormResultCompiler $formResultCompiler */ $formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class); $formResultCompiler->mergeResult($formResult); $row = $formData['databaseRow']; $new_unique_uid = ''; if ($command === 'new') { $new_unique_uid = $row['uid']; } // Add hidden fields: if ($uidVal == 'new') { $panel .= '<input type="hidden" name="data[' . $tableName . '][' . $row['uid'] . '][pid]" value="' . $row['pid'] . '" />'; } $redirect = $uidVal == 'new' ? BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->id, 'new_unique_uid' => $new_unique_uid, 'returnUrl' => $this->returnUrl]) : $this->R_URI; $panel .= ' <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="edit_record" value="' . $edit_record . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($redirect) . '" /> '; // Add JavaScript as needed around the form: $content = $formResultCompiler->JStop() . $panel . $formResultCompiler->printNeededJSFunctions(); // Display "is-locked" message: if ($command === 'edit') { $lockInfo = BackendUtility::isRecordLocked($tableName, $formData['databaseRow']['uid']); if ($lockInfo) { /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', FlashMessage::WARNING); /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } } } catch (AccessDeniedException $e) { // If no edit access, print error message: $content = '<h2>' . $lang->getLL('noAccess', true) . '</h2>'; $content .= '<div>' . $lang->getLL('noAccess_msg') . '<br /><br />' . ($beUser->errorMsg ? 'Reason: ' . $beUser->errorMsg . '<br /><br />' : '') . '</div>'; } } else { // If no edit access, print error message: $content = '<h2>' . $lang->getLL('noAccess') . '</h2>'; $content .= '<div>' . $lang->getLL('noAccess_msg') . '</div>'; } // Element selection matrix: if ($tableName === 'tt_content' && MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) { $content .= '<h2>' . $lang->getLL('CEonThisPage') . '</h2>'; // PositionMap $posMap = GeneralUtility::makeInstance(ContentLayoutPagePositionMap::class); $posMap->cur_sys_language = $this->current_sys_language; $content .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI); // Toggle hidden ContentElements $numberOfHiddenElements = $this->getNumberOfHiddenElements(); if ($numberOfHiddenElements) { $content .= '<div class="checkbox">'; $content .= '<label for="checkTt_content_showHidden">'; $content .= BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"'); $content .= !$numberOfHiddenElements ? '<span class="text-muted">' . $lang->getLL('hiddenCE', true) . '</span>' : $lang->getLL('hiddenCE', true) . ' (' . $numberOfHiddenElements . ')'; $content .= '</label>'; $content .= '</div>'; } // CSH $content .= BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement'); } return $content; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ public function getButtons() { $buttons = array('csh' => '', 'view' => '', 'edit' => '', 'hide_unhide' => '', 'move' => '', 'new_record' => '', 'paste' => '', 'level_up' => '', 'cache' => '', 'reload' => '', 'shortcut' => '', 'back' => '', 'csv' => '', 'export' => ''); // Get users permissions for this page record: $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageRow); // CSH if (!strlen($this->id)) { $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_noId', $GLOBALS['BACK_PATH'], '', TRUE); } elseif (!$this->id) { $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_root', $GLOBALS['BACK_PATH'], '', TRUE); } else { $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'list_module', $GLOBALS['BACK_PATH'], '', TRUE); } if (isset($this->id)) { // View Exclude doktypes 254,255 Configuration: mod.web_list.noViewWithDokTypes = 254,255 if (isset($GLOBALS['SOBE']->modTSconfig['properties']['noViewWithDokTypes'])) { $noViewDokTypes = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['SOBE']->modTSconfig['properties']['noViewWithDokTypes'], TRUE); } else { //default exclusion: doktype 254 (folder), 255 (recycler) $noViewDokTypes = array(\TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER, \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER); } if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) { $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->id, $this->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->id))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } // New record if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink']) { $buttons['new_record'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'db_new.php?id=' . $this->id . '\');') . '" title="' . $GLOBALS['LANG']->getLL('newRecordGeneral', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new') . '</a>'; } // If edit permissions are set (see class.t3lib_userauthgroup.php) if ($localCalcPerms & 2 && !empty($this->id)) { // Edit $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit'; $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('editPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-open') . '</a>'; } // Paste if ($localCalcPerms & 8 || $localCalcPerms & 16) { $elFromTable = $this->clipObj->elFromTable(''); if (count($elFromTable)) { $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id)) . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>'; } } // Cache $buttons['cache'] = '<a href="' . htmlspecialchars($this->listURL() . '&clear_cache=1') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>'; if ($this->table) { // CSV $buttons['csv'] = '<a href="' . htmlspecialchars($this->listURL() . '&csv=1') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.csv', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('mimetypes-text-csv') . '</a>'; // Export if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('impexp')) { $url = $this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export'; $buttons['export'] = '<a href="' . htmlspecialchars($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.export', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-export-t3d') . '</a>'; } } // Reload $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>'; // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $GLOBALS['TBE_TEMPLATE']->makeShortcutIcon('id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_list'); } // Back if ($this->returnUrl) { $buttons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } } return $buttons; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'save' => '', 'shortcut' => ''); $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'], '|', TRUE); $buttons['save'] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="data[save]" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />')); if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('', '', $this->MCONF['name']); } return $buttons; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'refresh' => ''); $iconFactory = GeneralUtility::makeInstance(IconFactory::class); // Refresh $buttons['refresh'] = '<a href="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '">' . $iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)->render() . '</a>'; // CSH $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', BackendUtility::cshItem('xMOD_csh_corebe', 'filetree')); return $buttons; }
/** * Renders Content Elements from the tt_content table from page id * * @param int $id Page id * @return string HTML for the listing */ public function getTable_tt_content($id) { $backendUser = $this->getBackendUser(); $this->pageinfo = BackendUtility::readPageAccess($this->id, $backendUser->getPagePermsClause($this->ext_CALC_PERMS)); $this->initializeLanguages(); $this->initializeClipboard(); $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), true)); /** @var $pageRenderer PageRenderer */ $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/DragDrop'); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); $userCanEditPage = $this->ext_CALC_PERMS & Permission::PAGE_EDIT && !empty($this->id) && ($backendUser->isAdmin() || (int) $this->pageinfo['editlock'] === 0); if ($this->tt_contentConfig['languageColsPointer'] > 0) { $userCanEditPage = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay'); } if ($userCanEditPage) { $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) { PageActions.setPageId(' . (int) $this->id . '); PageActions.setLanguageOverlayId(' . $this->tt_contentConfig['languageColsPointer'] . '); PageActions.initializePageTitleRenaming(); }'); } // Get labels for CTypes and tt_content element fields in general: $this->CType_labels = array(); foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) { $this->CType_labels[$val[1]] = $this->getLanguageService()->sL($val[0]); } $this->itemLabels = array(); foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) { $this->itemLabels[$name] = $this->getLanguageService()->sL($val['label']); } $languageColumn = array(); $out = ''; // Setting language list: $langList = $this->tt_contentConfig['sys_language_uid']; if ($this->tt_contentConfig['languageMode']) { if ($this->tt_contentConfig['languageColsPointer']) { $langList = '0,' . $this->tt_contentConfig['languageColsPointer']; } else { $langList = implode(',', array_keys($this->tt_contentConfig['languageCols'])); } $languageColumn = array(); } $langListArr = GeneralUtility::intExplode(',', $langList); $defLanguageCount = array(); $defLangBinding = array(); // For each languages... : // If not languageMode, then we'll only be through this once. foreach ($langListArr as $lP) { $lP = (int) $lP; if (!isset($this->contentElementCache[$lP])) { $this->contentElementCache[$lP] = array(); } if (count($langListArr) === 1 || $lP === 0) { $showLanguage = ' AND sys_language_uid IN (' . $lP . ',-1)'; } else { $showLanguage = ' AND sys_language_uid=' . $lP; } $cList = explode(',', $this->tt_contentConfig['cols']); $content = array(); $head = array(); // Select content records per column $contentRecordsPerColumn = $this->getContentRecordsPerColumn('table', $id, array_values($cList), $showLanguage); // For each column, render the content into a variable: foreach ($cList as $key) { if (!isset($this->contentElementCache[$lP][$key])) { $this->contentElementCache[$lP][$key] = array(); } if (!$lP) { $defLanguageCount[$key] = array(); } // Start wrapping div $content[$key] .= '<div data-colpos="' . $key . '" data-language-uid="' . $lP . '" class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-' . $lP . ' t3-page-ce-wrapper'; if (empty($contentRecordsPerColumn[$key])) { $content[$key] .= ' t3-page-ce-empty'; } $content[$key] .= '">'; // Add new content at the top most position $link = ''; if ($this->getPageLayoutController()->pageIsNotLockedForEditors() && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) { $link = '<a href="#" onclick="' . htmlspecialchars($this->newContentElementOnClick($id, $key, $lP)) . '" title="' . $this->getLanguageService()->getLL('newContentElement', true) . '" class="btn btn-default btn-sm">' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . ' ' . $this->getLanguageService()->getLL('content', true) . '</a>'; } $content[$key] .= ' <div class="t3-page-ce t3js-page-ce" data-page="' . (int) $id . '" id="' . StringUtility::getUniqueId() . '"> <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">' . $link . '</div> <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div> </div> '; $editUidList = ''; $rowArr = $contentRecordsPerColumn[$key]; $this->generateTtContentDataArray($rowArr); foreach ((array) $rowArr as $rKey => $row) { $this->contentElementCache[$lP][$key][$row['uid']] = $row; if ($this->tt_contentConfig['languageMode']) { $languageColumn[$key][$lP] = $head[$key] . $content[$key]; if (!$this->defLangBinding) { $languageColumn[$key][$lP] .= $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP, $key); } } if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) { $singleElementHTML = ''; if (!$lP && ($this->defLangBinding || $row['sys_language_uid'] != -1)) { $defLanguageCount[$key][] = isset($row['_ORIG_uid']) ? $row['_ORIG_uid'] : $row['uid']; } $editUidList .= $row['uid'] . ','; $disableMoveAndNewButtons = $this->defLangBinding && $lP > 0; if (!$this->tt_contentConfig['languageMode']) { $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility::getUniqueId() . '">'; } $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig['showInfo'] ? 15 : 5, $disableMoveAndNewButtons, !$this->tt_contentConfig['languageMode'], $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)); $innerContent = '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row) . '</div>'; $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>' . $this->tt_content_drawFooter($row); $isDisabled = $this->isDisabled('tt_content', $row); $statusHidden = $isDisabled ? ' t3-page-ce-hidden t3js-hidden-record' : ''; $displayNone = !$this->tt_contentConfig['showHidden'] && $isDisabled ? ' style="display: none;"' : ''; $singleElementHTML = '<div class="t3-page-ce t3js-page-ce t3js-page-ce-sortable ' . $statusHidden . '" id="element-tt_content-' . $row['uid'] . '" data-table="tt_content" data-uid="' . $row['uid'] . '"' . $displayNone . '>' . $singleElementHTML . '</div>'; if ($this->tt_contentConfig['languageMode']) { $singleElementHTML .= '<div class="t3-page-ce t3js-page-ce">'; } $singleElementHTML .= '<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">'; // Add icon "new content element below" if (!$disableMoveAndNewButtons && $this->getPageLayoutController()->pageIsNotLockedForEditors() && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) { // New content element: if ($this->option_newWizard) { $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('new_content_element') . '&id=' . $row['pid'] . '&sys_language_uid=' . $row['sys_language_uid'] . '&colPos=' . $row['colPos'] . '&uid_pid=' . -$row['uid'] . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';'; } else { $params = '&edit[tt_content][' . -$row['uid'] . ']=new'; $onClick = BackendUtility::editOnClick($params); } $singleElementHTML .= ' <a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('newContentElement', true) . '" class="btn btn-default btn-sm">' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . ' ' . $this->getLanguageService()->getLL('content', true) . '</a> '; } $singleElementHTML .= '</div></div><div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div></div>'; if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) { $defLangBinding[$key][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML; } else { $content[$key] .= $singleElementHTML; } } else { unset($rowArr[$rKey]); } } $content[$key] .= '</div>'; // Add new-icon link, header: $newP = $this->newContentElementOnClick($id, $key, $lP); $colTitle = BackendUtility::getProcessedValue('tt_content', 'colPos', $key); $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $id, $this); foreach ($tcaItems as $item) { if ($item[1] == $key) { $colTitle = $this->getLanguageService()->sL($item[0]); } } $pasteP = array('colPos' => $key, 'sys_language_uid' => $lP); $editParam = $this->doEdit && !empty($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : ''; $head[$key] .= $this->tt_content_drawColHeader($colTitle, $editParam, $newP, $pasteP); } // For each column, fit the rendered content into a table cell: $out = ''; if ($this->tt_contentConfig['languageMode']) { // in language mode process the content elements, but only fill $languageColumn. output will be generated later $sortedLanguageColumn = array(); foreach ($cList as $key) { $languageColumn[$key][$lP] = $head[$key] . $content[$key]; if (!$this->defLangBinding) { $languageColumn[$key][$lP] .= $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP, $key); } // We sort $languageColumn again according to $cList as it may contain data already from above. $sortedLanguageColumn[$key] = $languageColumn[$key]; } $languageColumn = $sortedLanguageColumn; } else { $backendLayout = $this->getBackendLayoutView()->getSelectedBackendLayout($this->id); // GRID VIEW: $grid = '<div class="t3-grid-container"><table border="0" cellspacing="0" cellpadding="0" width="100%" class="t3-page-columns t3-grid-table t3js-page-columns">'; // Add colgroups $colCount = (int) $backendLayout['__config']['backend_layout.']['colCount']; $rowCount = (int) $backendLayout['__config']['backend_layout.']['rowCount']; $grid .= '<colgroup>'; for ($i = 0; $i < $colCount; $i++) { $grid .= '<col style="width:' . 100 / $colCount . '%"></col>'; } $grid .= '</colgroup>'; // Cycle through rows for ($row = 1; $row <= $rowCount; $row++) { $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.']; if (!isset($rowConfig)) { continue; } $grid .= '<tr>'; for ($col = 1; $col <= $colCount; $col++) { $columnConfig = $rowConfig['columns.'][$col . '.']; if (!isset($columnConfig)) { continue; } // Which tt_content colPos should be displayed inside this cell $columnKey = (int) $columnConfig['colPos']; // Render the grid cell $colSpan = (int) $columnConfig['colspan']; $rowSpan = (int) $columnConfig['rowspan']; $grid .= '<td valign="top"' . ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') . ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') . ' data-colpos="' . (int) $columnConfig['colPos'] . '" data-language-uid="' . $lP . '" class="t3js-page-lang-column-' . $lP . ' t3js-page-column t3-grid-cell t3-page-column t3-page-column-' . $columnKey . (!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '' ? ' t3-grid-cell-unassigned' : '') . (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey] || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ' t3-grid-cell-restricted' : '') . ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') . ($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">'; // Draw the pre-generated header with edit and new buttons if a colPos is assigned. // If not, a new header without any buttons will be generated. if (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey] && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])) { $grid .= $head[$columnKey] . $content[$columnKey]; } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])) { $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'), '', ''); } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])) { $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) . ' (' . $this->getLanguageService()->getLL('noAccess') . ')', '', ''); } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') { $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', ''); } else { $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('notAssigned'), '', ''); } $grid .= '</td>'; } $grid .= '</tr>'; } $out .= $grid . '</table></div>'; } // CSH: $out .= BackendUtility::cshItem($this->descrTable, 'columns_multi'); } // If language mode, then make another presentation: // Notice that THIS presentation will override the value of $out! // But it needs the code above to execute since $languageColumn is filled with content we need! if ($this->tt_contentConfig['languageMode']) { // Get language selector: $languageSelector = $this->languageSelector($id); // Reset out - we will make new content here: $out = ''; // Traverse languages found on the page and build up the table displaying them side by side: $cCont = array(); $sCont = array(); foreach ($langListArr as $lP) { // Header: $lP = (int) $lP; $cCont[$lP] = ' <td valign="top" class="t3-page-column" data-language-uid="' . $lP . '"> <h2>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</h2> </td>'; // "View page" icon is added: $viewLink = ''; if (!VersionState::cast($this->getPageLayoutController()->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) { $onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id), '', '', '&L=' . $lP); $viewLink = '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>'; } // Language overlay page header: if ($lP) { list($lpRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . $lP); BackendUtility::workspaceOL('pages_language_overlay', $lpRecord); $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP; $recordIcon = BackendUtility::wrapClickMenuOnIcon($this->iconFactory->getIconForRecord('pages_language_overlay', $lpRecord, Icon::SIZE_SMALL)->render(), 'pages_language_overlay', $lpRecord['uid']); $editLink = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay') ? '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params)) . '" title="' . $this->getLanguageService()->getLL('edit', true) . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>' : ''; $lPLabel = '<div class="btn-group">' . $viewLink . $editLink . '</div>' . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($lpRecord['title'], 20)); } else { $params = '&edit[pages][' . $this->id . ']=edit'; $recordIcon = BackendUtility::wrapClickMenuOnIcon($this->iconFactory->getIconForRecord('pages', $this->pageRecord, Icon::SIZE_SMALL)->render(), 'pages', $this->id); $editLink = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay') ? '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params)) . '" title="' . $this->getLanguageService()->getLL('edit', true) . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>' : ''; $lPLabel = '<div class="btn-group">' . $viewLink . $editLink . '</div>' . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->pageRecord['title'], 20)); } $sCont[$lP] = ' <td nowrap="nowrap" class="t3-page-column t3-page-lang-label">' . $lPLabel . '</td>'; } // Add headers: $out .= '<tr>' . implode($cCont) . '</tr>'; $out .= '<tr>' . implode($sCont) . '</tr>'; unset($cCont, $sCont); // Traverse previously built content for the columns: foreach ($languageColumn as $cKey => $cCont) { $out .= '<tr>'; foreach ($cCont as $languageId => $columnContent) { $out .= '<td valign="top" class="t3-grid-cell t3-page-column t3js-page-column t3js-page-lang-column t3js-page-lang-column-' . $languageId . '">' . $columnContent . '</td>'; } $out .= '</tr>'; if ($this->defLangBinding) { // "defLangBinding" mode foreach ($defLanguageCount[$cKey] as $defUid) { $cCont = array(); foreach ($langListArr as $lP) { $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . $this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP), $lP, $cKey); } $out .= ' <tr> <td valign="top" class="t3-grid-cell">' . implode('</td>' . ' <td valign="top" class="t3-grid-cell">', $cCont) . '</td> </tr>'; } } } // Finally, wrap it all in a table and add the language selector on top of it: $out = $languageSelector . ' <div class="t3-grid-container"> <table cellpadding="0" cellspacing="0" class="t3-page-columns t3-grid-table t3js-page-columns"> ' . $out . ' </table> </div>'; // CSH: $out .= BackendUtility::cshItem($this->descrTable, 'language_list'); } return $out; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function getButtons() { $buttons = array('csh' => '', 'back' => ''); if ($this->id && $this->access) { $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'new_ce', $GLOBALS['BACK_PATH'], '', TRUE); if ($this->R_URI) { $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->getLL('goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } } return $buttons; }
/** * Index action * * @return void */ public function indexAction() { if (!$this->id) { $this->pageInfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } if ($this->getBackendUser()->workspace != 0) { // Adding section with the permission setting matrix: $this->addFlashMessage(LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarningText', 'beuser'), LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarning', 'beuser'), FlashMessage::WARNING); } // depth options $depthOptions = array(); $url = $this->uriBuilder->reset()->setArguments(array('action' => 'index', 'depth' => '__DEPTH__', 'id' => $this->id))->buildBackendUri(); foreach (array(1, 2, 3, 4, 10) as $depthLevel) { $depthOptions[$depthLevel] = $depthLevel . ' ' . LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:levels', 'beuser'); } $this->view->assign('depthBaseUrl', $url); $this->view->assign('depth', $this->depth); $this->view->assign('depthOptions', $depthOptions); $beUserArray = BackendUtility::getUserNames(); $this->view->assign('beUsers', $beUserArray); $beGroupArray = BackendUtility::getGroupNames(); $this->view->assign('beGroups', $beGroupArray); /** @var $tree PageTreeView */ $tree = GeneralUtility::makeInstance(PageTreeView::class); $tree->init(); $tree->addField('perms_user', true); $tree->addField('perms_group', true); $tree->addField('perms_everybody', true); $tree->addField('perms_userid', true); $tree->addField('perms_groupid', true); $tree->addField('hidden'); $tree->addField('fe_group'); $tree->addField('starttime'); $tree->addField('endtime'); $tree->addField('editlock'); // Create the tree from $this->id if ($this->id) { $tree->tree[] = array('row' => $this->pageInfo, 'HTML' => $tree->getIcon($this->id)); } else { $tree->tree[] = array('row' => $this->pageInfo, 'HTML' => $tree->getRootIcon($this->pageInfo)); } $tree->getTree($this->id, $this->depth); $this->view->assign('viewTree', $tree->tree); // CSH for permissions setting $this->view->assign('cshItem', BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module')); }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. */ protected function getButtons() { $lang = $this->getLanguageService(); $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); // Regular new element: if (!$this->pagesOnly) { // New page if ($this->showNewRecLink('pages')) { $newPageButton = $buttonBar->makeLinkButton()->setHref(GeneralUtility::linkThisScript(array('pagesOnly' => '1')))->setTitle($lang->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newPage'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-page-new', Icon::SIZE_SMALL)); $buttonBar->addButton($newPageButton, ButtonBar::BUTTON_POSITION_LEFT, 20); } // CSH $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('new_regular'); $buttonBar->addButton($cshButton); } elseif ($this->showNewRecLink('pages')) { // Pages only wizard // CSH $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'new_pages'); $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('new_pages'); $buttonBar->addButton($cshButton); } // Back if ($this->returnUrl) { $returnButton = $buttonBar->makeLinkButton()->setHref($this->returnUrl)->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL)); $buttonBar->addButton($returnButton, ButtonBar::BUTTON_POSITION_LEFT, 10); } if (is_array($this->pageinfo) && $this->pageinfo['uid']) { // View $pagesTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid']); if (isset($pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'])) { $excludeDokTypes = GeneralUtility::intExplode(',', $pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'], true); } else { // exclude sysfolders and recycler by default $excludeDokTypes = array(PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_SPACER); } if (!in_array((int) $this->pageinfo['doktype'], $excludeDokTypes, true)) { $viewButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 30); } } }