/** * Administrative links for a table / record * * @param string $table Table name * @param array $row Record for which administrative links are generated. * * @return string HTML link tags. */ public function adminLinks($table, array $row) { if ($table !== 'tx_commerce_products') { return parent::adminLinks($table, $row); } else { $language = $this->getLanguageService(); // Edit link: $adminLink = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', TRUE))) . '</a>'; // Delete link: $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', TRUE))) . '</a>'; if ($row['pid'] == -1) { // get page TSconfig $pagesTyposcriptConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) { $previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid']; } else { $previewPageId = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']['previewPageID']; } $sysLanguageUid = (int) $row['sys_language_uid']; /** * Product * * @var $product Tx_Commerce_Domain_Model_Product */ $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $row['t3ver_oid'], $sysLanguageUid); $product->loadData(); $getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory()); $adminLink .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($previewPageId, $this->doc->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } return $adminLink; } }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array all available buttons as an associated array */ protected function getButtons() { $buttons = array('view' => '', 'shortcut' => ''); if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('tx_impexp', '', $this->MCONF['name']); } // Input data grabbed: $inData = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_impexp'); if ((string) $inData['action'] == 'import') { if ($this->id && is_array($this->pageinfo) || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { if (is_array($this->pageinfo) && $this->pageinfo['uid']) { // View $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->pageinfo['uid'], $this->doc->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } } } return $buttons; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. */ protected function getButtons() { $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); // CSH $cshButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_web_func')->setFieldName(''); $buttonBar->addButton($cshButton); if ($this->id && is_array($this->pageinfo)) { // View page $viewButton = $buttonBar->makeLinkButton()->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage'))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#'); $buttonBar->addButton($viewButton); // Shortcut $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['id', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU)); $buttonBar->addButton($shortcutButton); } }
/** * 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() { $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); $lang = $this->getLanguageService(); if ($this->id && $this->access) { // View page $viewButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.showPage'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 99); if ($this->extClassConf['name'] === TypoScriptTemplateInformationModuleFunctionController::class) { // NEW button $urlParameters = ['id' => $this->id, 'template' => 'all', 'createExtension' => 'new']; if (!empty($this->e) && !GeneralUtility::_POST('_saveandclosedok')) { $saveButton = $buttonBar->makeInputButton()->setName('_savedok')->setValue('1')->setForm('TypoScriptTemplateModuleController')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.saveDoc')); $saveAndCloseButton = $buttonBar->makeInputButton()->setName('_saveandclosedok')->setValue('1')->setForm('TypoScriptTemplateModuleController')->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.saveCloseDoc'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-close', Icon::SIZE_SMALL)); $splitButtonElement = $buttonBar->makeSplitButton()->addItem($saveButton)->addItem($saveAndCloseButton); $buttonBar->addButton($splitButtonElement, ButtonBar::BUTTON_POSITION_LEFT, 3); // CLOSE button $closeButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('web_ts', ['id' => $this->id]))->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.closeDoc'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL)); $buttonBar->addButton($closeButton); } else { $newButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('web_ts', $urlParameters))->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:db_new.php.pagetitle'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)); $buttonBar->addButton($newButton); } } elseif ($this->extClassConf['name'] === TypoScriptTemplateConstantEditorModuleFunctionController::class && !empty($this->MOD_MENU['constant_editor_cat'])) { // SAVE button $saveButton = $buttonBar->makeInputButton()->setName('_savedok')->setValue('1')->setForm('TypoScriptTemplateModuleController')->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:rm.saveDoc'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))->setShowLabelText(true); $buttonBar->addButton($saveButton); } elseif ($this->extClassConf['name'] === TypoScriptTemplateObjectBrowserModuleFunctionController::class) { if (!empty($this->sObj)) { // BACK $urlParameters = ['id' => $this->id]; $backButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('web_ts', $urlParameters))->setClasses('typo3-goBack')->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.goBack'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL)); $buttonBar->addButton($backButton); } } } // Shortcut $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->MCONF['name'])->setGetVariables(['id', 'M']); $buttonBar->addButton($shortcutButton); }
/** * Administrative links for a table / record * * @param string $table Table name * @param array $row Record for which administrative links are generated. * @return string HTML link tags. */ public function adminLinks($table, $row) { // Edit link: $editUrl = BackendUtility::getModuleUrl('record_edit', ['edit' => [$table => [$row['uid'] => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]); $adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; // Delete link: $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>'; if ($table === 'pages') { // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; // Perform some access checks: $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list'); $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule); $adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(' . GeneralUtility::quoteJSvalue($pageModule) . '); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>'; $adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</a>'; // "View page" icon is added: $adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], '', BackendUtility::BEgetRootLine($row['uid']))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>'; } else { if ($row['pid'] == -1) { $getVars = '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid']; // "View page" icon is added: $adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], '', BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>'; } } return '<div class="btn-group btn-group-sm" role="group">' . $adminLink . '</div>'; }
/** * Returns the rendered record actions * * @param string $table * @param int $uid * @return string */ protected function getRecordActions($table, $uid) { if ($table === '' || $uid < 0) { return ''; } // Edit button $urlParameters = ['edit' => [$table => [$uid => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $url = BackendUtility::getModuleUrl('record_edit', $urlParameters); $pageActionIcons = ' <a class="btn btn-default btn-sm" href="' . htmlspecialchars($url) . '"> ' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . ' </a>'; // History button $urlParameters = ['element' => $table . ':' . $uid, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $url = BackendUtility::getModuleUrl('record_history', $urlParameters); $pageActionIcons .= ' <a class="btn btn-default btn-sm" href="' . htmlspecialchars($url) . '"> ' . $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render() . ' </a>'; if ($table === 'pages') { // Recordlist button $url = BackendUtility::getModuleUrl('web_list', array('id' => $uid, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'))); $pageActionIcons .= ' <a class="btn btn-default btn-sm" href="' . htmlspecialchars($url) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList') . '"> ' . $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . ' </a>'; // View page button $viewOnClick = BackendUtility::viewOnClick($uid, '', BackendUtility::BEgetRootLine($uid)); $pageActionIcons .= ' <a class="btn btn-default btn-sm" href="#" onclick="' . htmlspecialchars($viewOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '"> ' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . ' </a>'; } return ' <div class="btn-group" role="group"> ' . $pageActionIcons . ' </div>'; }
/** * Creates the control panel for a single record in the listing. * * @param string $table The table * @param mixed[] $row The record for which to make the control panel. * @throws \UnexpectedValueException * @return string HTML table with the control panel (unless disabled) */ public function makeControl($table, $row) { $module = $this->getModule(); $rowUid = $row['uid']; if (ExtensionManagementUtility::isLoaded('version') && isset($row['_ORIG_uid'])) { $rowUid = $row['_ORIG_uid']; } $cells = array('primary' => array(), 'secondary' => array()); // If the listed table is 'pages' we have to request the permission settings for each page: $localCalcPerms = 0; if ($table == 'pages') { $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $row['uid'])); } $permsEdit = $table === 'pages' && $this->getBackendUserAuthentication()->checkLanguageAccess(0) && $localCalcPerms & Permission::PAGE_EDIT || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT; $permsEdit = $this->overlayEditLockPermissions($table, $row, $permsEdit); // "Show" link (only pages and tt_content elements) if ($table == 'pages' || $table == 'tt_content') { $viewAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($table === 'tt_content' ? $this->id : $row['uid'], '', '', $table === 'tt_content' ? '#' . $row['uid'] : '')) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>'; $this->addActionToCellGroup($cells, $viewAction, 'view'); } // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id) if ($permsEdit) { $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $iconIdentifier = 'actions-open'; $overlayIdentifier = !$this->isEditable($table) ? 'overlay-readonly' : null; $editAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . $this->getLanguageService()->getLL('edit', true) . '">' . $this->iconFactory->getIcon($iconIdentifier, Icon::SIZE_SMALL, $overlayIdentifier)->render() . '</a>'; } else { $editAction = $this->spaceIcon; } $this->addActionToCellGroup($cells, $editAction, 'edit'); // "Info": (All records) $onClick = 'top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . (int) $row['uid'] . '); return false;'; $viewBigAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('showInfo', true) . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>'; $this->addActionToCellGroup($cells, $viewBigAction, 'viewBig'); // "Move" wizard link for pages/tt_content elements: if ($permsEdit && ($table === 'tt_content' || $table === 'pages')) { $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('move_element') . '&table=' . $table . '&uid=' . $row['uid']) . ');'; $linkTitleLL = $this->getLanguageService()->getLL('move_' . ($table === 'tt_content' ? 'record' : 'page'), true); $icon = $table == 'pages' ? $this->iconFactory->getIcon('actions-page-move', Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL); $moveAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $linkTitleLL . '">' . $icon->render() . '</a>'; $this->addActionToCellGroup($cells, $moveAction, 'move'); } // If the table is NOT a read-only table, then show these links: if ($this->isEditable($table)) { // "Revert" link (history/undo) $moduleUrl = BackendUtility::getModuleUrl('record_history', array('element' => $table . ':' . $row['uid'])); $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($moduleUrl) . ',\'#latest\');'; $historyAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('history', true) . '">' . $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render() . '</a>'; $this->addActionToCellGroup($cells, $historyAction, 'history'); // Versioning: if (ExtensionManagementUtility::isLoaded('version') && !ExtensionManagementUtility::isLoaded('workspaces')) { $vers = BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $this->getBackendUserAuthentication()->workspace, false, $row); // If table can be versionized. if (is_array($vers)) { $href = BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $row['uid'])); $versionAction = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="' . $this->getLanguageService()->getLL('displayVersions', true) . '">' . $this->iconFactory->getIcon('actions-version-page-open', Icon::SIZE_SMALL)->render() . '</a>'; $this->addActionToCellGroup($cells, $versionAction, 'version'); } } // "Edit Perms" link: if ($table === 'pages' && $this->getBackendUserAuthentication()->check('modules', 'system_BeuserTxPermission') && ExtensionManagementUtility::isLoaded('beuser')) { $href = BackendUtility::getModuleUrl('system_BeuserTxPermission') . '&id=' . $row['uid'] . '&return_id=' . $row['uid'] . '&edit=1'; $permsAction = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="' . $this->getLanguageService()->getLL('permissions', true) . '">' . $this->iconFactory->getIcon('status-status-locked', Icon::SIZE_SMALL)->render() . '</a>'; $this->addActionToCellGroup($cells, $permsAction, 'perms'); } // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row // or if default values can depend on previous record): if (($GLOBALS['TCA'][$table]['ctrl']['sortby'] || $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) && $permsEdit) { if ($table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT || $table === 'pages' && $this->calcPerms & Permission::PAGE_NEW) { if ($this->showNewRecLink($table)) { $params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new'; $icon = $table == 'pages' ? $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL); $newAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . $this->getLanguageService()->getLL('new' . ($table == 'pages ' ? 'Page' : 'Record'), true) . '">' . $icon->render() . '</a>'; $this->addActionToCellGroup($cells, $newAction, 'new'); } } } // "Up/Down" links if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) { if (isset($this->currentTable['prev'][$row['uid']])) { // Up $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']]; $moveUpAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('moveUp', true) . '">' . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>'; } else { $moveUpAction = $this->spaceIcon; } $this->addActionToCellGroup($cells, $moveUpAction, 'moveUp'); if ($this->currentTable['next'][$row['uid']]) { // Down $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']]; $moveDownAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('moveDown', true) . '">' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>'; } else { $moveDownAction = $this->spaceIcon; } $this->addActionToCellGroup($cells, $moveDownAction, 'moveDown'); } // "Hide/Unhide" links: $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $this->getBackendUserAuthentication()->check('non_exclude_fields', $table . ':' . $hiddenField))) { if ($this->isRecordCurrentBackendUser($table, $row)) { $hideAction = $this->spaceIcon; } else { $hideTitle = $this->getLanguageService()->getLL('hide' . ($table == 'pages' ? 'Page' : ''), true); $unhideTitle = $this->getLanguageService()->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), true); if ($row[$hiddenField]) { $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0'; $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"' . ' data-params="' . htmlspecialchars($params) . '"' . ' title="' . $unhideTitle . '"' . ' data-toggle-title="' . $hideTitle . '">' . $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL)->render() . '</a>'; } else { $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1'; $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"' . ' data-params="' . htmlspecialchars($params) . '"' . ' title="' . $hideTitle . '"' . ' data-toggle-title="' . $unhideTitle . '">' . $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL)->render() . '</a>'; } } $this->addActionToCellGroup($cells, $hideAction, 'hide'); } // "Delete" link: if ($permsEdit && ($table === 'pages' && $localCalcPerms & Permission::PAGE_DELETE || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT)) { // Check if the record version is in "deleted" state, because that will switch the action to "restore" if ($this->getBackendUserAuthentication()->workspace > 0 && isset($row['t3ver_state']) && (int) $row['t3ver_state'] === 2) { $actionName = 'restore'; $refCountMsg = ''; } else { $actionName = 'delete'; $refCountMsg = BackendUtility::referenceCount($table, $row['uid'], ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToRecord'), $this->getReferenceCount($table, $row['uid'])) . BackendUtility::translationCount($table, $row['uid'], ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord')); } if ($this->isRecordCurrentBackendUser($table, $row)) { $deleteAction = $this->spaceIcon; } else { $titleOrig = BackendUtility::getRecordTitle($table, $row, false, true); $title = GeneralUtility::slashJS(GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL), true); $warningText = $this->getLanguageService()->getLL($actionName . 'Warning') . ' "' . $title . '" ' . '[' . $table . ':' . $row['uid'] . ']' . $refCountMsg; $params = 'cmd[' . $table . '][' . $row['uid'] . '][delete]=1'; $icon = $this->iconFactory->getIcon('actions-edit-' . $actionName, Icon::SIZE_SMALL)->render(); $linkTitle = $this->getLanguageService()->getLL($actionName, true); $deleteAction = '<a class="btn btn-default t3js-record-delete" href="#" ' . ' data-l10parent="' . htmlspecialchars($row['l10n_parent']) . '"' . ' data-params="' . htmlspecialchars($params) . '" data-title="' . htmlspecialchars($titleOrig) . '"' . ' data-message="' . htmlspecialchars($warningText) . '" title="' . $linkTitle . '"' . '>' . $icon . '</a>'; } } else { $deleteAction = $this->spaceIcon; } $this->addActionToCellGroup($cells, $deleteAction, 'delete'); // "Levels" links: Moving pages into new levels... if ($permsEdit && $table == 'pages' && !$this->searchLevels) { // Up (Paste as the page right after the current parent page) if ($this->calcPerms & Permission::PAGE_NEW) { $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id; $moveLeftAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('prevLevel', true) . '">' . $this->iconFactory->getIcon('actions-move-left', Icon::SIZE_SMALL)->render() . '</a>'; $this->addActionToCellGroup($cells, $moveLeftAction, 'moveLeft'); } // Down (Paste as subpage to the page right above) if ($this->currentTable['prevUid'][$row['uid']]) { $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']])); if ($localCalcPerms & Permission::PAGE_NEW) { $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']]; $moveRightAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('return jumpToUrl(' . BackendUtility::getLinkToDataHandlerAction($params, -1) . ');') . '" title="' . $this->getLanguageService()->getLL('nextLevel', true) . '">' . $this->iconFactory->getIcon('actions-move-right', Icon::SIZE_SMALL)->render() . '</a>'; } else { $moveRightAction = $this->spaceIcon; } } else { $moveRightAction = $this->spaceIcon; } $this->addActionToCellGroup($cells, $moveRightAction, 'moveRight'); } } /** * @hook recStatInfoHooks: Allows to insert HTML before record icons on various places */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) { $stat = ''; $_params = array($table, $row['uid']); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) { $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this); } $this->addActionToCellGroup($cells, $stat, 'stat'); } /** * @hook makeControl: Allows to change control icons of records in list-module * @usage This hook method gets passed the current $cells array as third parameter. * This array contains values for the icons/actions generated for each record in Web>List. * Each array entry is accessible by an index-key. * The order of the icons is depending on the order of those array entries. */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { // for compatibility reason, we move all icons to the rootlevel // before calling the hooks foreach ($cells as $section => $actions) { foreach ($actions as $actionKey => $action) { $cells[$actionKey] = $action; } } foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567840); } $cells = $hookObject->makeControl($table, $row, $cells, $this); } // now sort icons again into primary and secondary sections // after all hooks are processed $hookCells = $cells; foreach ($hookCells as $key => $value) { if ($key === 'primary' || $key === 'secondary') { continue; } $this->addActionToCellGroup($cells, $value, $key); } } $output = '<!-- CONTROL PANEL: ' . $table . ':' . $row['uid'] . ' -->'; foreach ($cells as $classification => $actions) { $visibilityClass = $classification !== 'primary' && !$module->MOD_SETTINGS['bigControlPanel'] ? 'collapsed' : 'expanded'; if ($visibilityClass === 'collapsed') { $cellOutput = ''; foreach ($actions as $action) { $cellOutput .= $action; } $output .= ' <div class="btn-group">' . '<span id="actions_' . $table . '_' . $row['uid'] . '" class="btn-group collapse collapse-horizontal width">' . $cellOutput . '</span>' . '<a href="#actions_' . $table . '_' . $row['uid'] . '" class="btn btn-default collapsed" data-toggle="collapse" aria-expanded="false"><span class="t3-icon fa fa-ellipsis-h"></span></a>' . '</div>'; } else { $output .= ' <div class="btn-group" role="group">' . implode('', $actions) . '</div>'; } } return $output; }
/** * Rendering the information * * @param array The Page tree data * @return string HTML for the information table. */ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) { // Initialize: $searchPath = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pathPrefixSearch')); $cmd = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('cmd'); $entry = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('entry'); $searchForm_replace = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_replace'); $searchForm_delete = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_delete'); $trackSameUrl = array(); $this->searchResultCounter = 0; // Traverse tree: $output = ''; $cc = 0; foreach ($tree->tree as $row) { // Get all pagepath entries for page: $pathCacheInfo = $this->getPathCache($row['row']['uid']); // Row title: $rowTitle = $row['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $row['row'], true); $cellAttrib = $row['row']['_CSSCLASS'] ? ' class="' . $row['row']['_CSSCLASS'] . '"' : ''; // Add at least one empty element: if (!count($pathCacheInfo)) { // Add title: $tCells = array(); $tCells[] = '<td nowrap="nowrap"' . $cellAttrib . '>' . $rowTitle . '</td>'; // Empty row: $tCells[] = '<td colspan="10" align="center"> </td>'; // Compile Row: $output .= ' <tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '"> ' . implode(' ', $tCells) . ' </tr>'; $cc++; } else { foreach ($pathCacheInfo as $c => $inf) { // Init: $deletedEntry = false; $hash = $inf['pagepath'] . '|' . $inf['rootpage_id'] . '|' . $inf['language_id']; // MP is not a part of this because the path itself should be different simply because the MP makes a different path! (see UriGeneratorAndResolver::pagePathtoID()) // Add icon/title and ID: $tCells = array(); if (!$c) { $tCells[] = '<td nowrap="nowrap" rowspan="' . count($pathCacheInfo) . '"' . $cellAttrib . '>' . $rowTitle . '</td>'; $tCells[] = '<td rowspan="' . count($pathCacheInfo) . '">' . $inf['page_id'] . '</td>'; } // Add values from alternative field used to generate URL: $baseRow = $row['row']; // page row as base. $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages][' . $row['row']['uid'] . ']=edit&columnsOnly=title,nav_title,alias,tx_realurl_pathsegment', $this->pObj->doc->backPath); $editIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . '</a>'; $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $this->pObj->doc->backPath, '', '', '', ''); $editIcon .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $this->pObj->doc->backPath) . '</a>'; if ($inf['language_id'] > 0) { // For alternative languages, show another list of fields, form page overlay record: $editIcon = ''; list($olRec) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $row['row']['uid'], ' AND sys_language_uid=' . intval($inf['language_id'])); if (is_array($olRec)) { $baseRow = array_merge($baseRow, $olRec); $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages_language_overlay][' . $olRec['uid'] . ']=edit&columnsOnly=title,nav_title', $this->pObj->doc->backPath); $editIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . '</a>'; $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $this->pObj->doc->backPath, '', '', '', '&L=' . $olRec['sys_language_uid']); $editIcon .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $this->pObj->doc->backPath) . '</a>'; } else { $baseRow = array(); } } $tCells[] = '<td>' . $editIcon . '</td>'; // Sources for segment: $sources = count($baseRow) ? implode(' | ', array($baseRow['tx_realurl_pathsegment'], $baseRow['alias'], $baseRow['nav_title'], $baseRow['title'])) : ''; $tCells[] = '<td nowrap="nowrap">' . htmlspecialchars($sources) . '</td>'; // Show page path: if (strcmp($searchPath, '') && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($inf['pagepath'], $searchPath) && !$inf['expire']) { // Delete entry: if ($searchForm_delete) { $this->deletePathCacheEntry($inf['cache_id']); $deletedEntry = true; $pagePath = '[DELETED]'; } elseif ($searchForm_replace) { $replacePart = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('pathPrefixReplace')); $this->editPathCacheEntry($inf['cache_id'], $replacePart . substr($inf['pagepath'], strlen($searchPath))); $pagePath = '<span class="typo3-red">' . htmlspecialchars($replacePart) . '</span>' . htmlspecialchars(substr($inf['pagepath'], strlen($searchPath))); } else { $pagePath = '<span class="typo3-red">' . htmlspecialchars(substr($inf['pagepath'], 0, strlen($searchPath))) . '</span>' . htmlspecialchars(substr($inf['pagepath'], strlen($searchPath))); $this->searchResultCounter++; } } else { // Delete entries: if ($cmd === 'edit' && (!strcmp($entry, $inf['cache_id']) || !strcmp($entry, 'ALL'))) { $pagePath = '<input type="text" name="edit[' . $inf['cache_id'] . ']" value="' . htmlspecialchars($inf['pagepath']) . '" size="40" />'; if ($cmd === 'edit' && $entry != 'ALL') { $pagePath .= $this->saveCancelButtons(); } } else { $pagePath = htmlspecialchars($inf['pagepath']); } } $tCells[] = '<td' . ($inf['expire'] ? ' style="font-style: italic; color:#999999;"' : '') . '>' . $pagePath . '</td>'; if ($deletedEntry) { $tCells[] = '<td> </td>'; } else { $tCells[] = '<td>' . '<a href="' . $this->linkSelf('&cmd=delete&entry=' . $inf['cache_id']) . '">' . $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete') . '</a>' . '<a href="' . $this->linkSelf('&cmd=edit&entry=' . $inf['cache_id']) . '">' . $this->getIcon('gfx/edit2.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Edit') . '</a>' . '<a href="' . $this->linkSelf('&pathPrefixSearch=' . rawurlencode($inf['pagepath'])) . '">' . $this->getIcon('gfx/napshot.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Use for search') . '</a>' . '<a href="' . $this->linkSelf('&cmd=copy&entry=' . $inf['cache_id']) . '">' . $this->getIcon('gfx/clip_copy.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Copy entry') . '</a>' . '</td>'; } $tCells[] = '<td' . ($inf['expire'] && $inf['expire'] < time() ? ' style="color: red;"' : '') . '>' . ($inf['expire'] ? htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($inf['expire'], -1)) : '') . ($inf['expire'] ? '<a href="' . $this->linkSelf('&cmd=raiseExpire&entry=' . $inf['cache_id']) . '">' . $this->getIcon('gfx/up.gif', 'width="14" height="14"', $this->pObj->doc->backPath, 'Set expire time to 30 days') . '</a>' : '') . '</td>'; // Set error msg: $error = ''; if (!strcmp($inf['pagepath'], '')) { if ($row['row']['uid'] != $this->pObj->id) { // Show error of "Empty" only for levels under the root. Yes, we cannot know that the pObj->id is the true root of the site, but at least any SUB page should probably have a path string! $error = $this->pObj->doc->icons(2) . 'Empty'; } } elseif (isset($trackSameUrl[$hash])) { $error = $this->pObj->doc->icons(2) . 'Already used on page ID ' . $trackSameUrl[$hash]; } else { $error = ' '; } $tCells[] = '<td>' . $error . '</td>'; $tCells[] = '<td>' . htmlspecialchars($inf['language_id']) . '</td>'; $tCells[] = '<td>' . htmlspecialchars($inf['mpvar']) . '</td>'; $tCells[] = '<td>' . htmlspecialchars($inf['rootpage_id']) . '</td>'; #$tCells[]='<td nowrap="nowrap">'.htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::datetime($inf['expire'])).' / '.htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($inf['expire']-time())).'</td>'; $trackSameUrl[$hash] = $inf['page_id']; // Compile Row: $rowClass = 'bgColor' . ($cc % 2 ? '-20' : '-10'); $output .= ' <tr class="' . $rowClass . '"> ' . implode(' ', $tCells) . ' </tr>'; $cc++; } } } // Create header: $tCells = array(); $tCells[] = '<td>Title:</td>'; $tCells[] = '<td>ID:</td>'; $tCells[] = '<td> </td>'; $tCells[] = '<td>PathSegment | Alias | NavTitle | Title:</td>'; $tCells[] = '<td>Pagepath:</td>'; $tCells[] = '<td>' . '<a href="' . $this->linkSelf('&cmd=delete&entry=ALL') . '" onclick="return confirm(\'Are you sure you want to flush all cached page paths?\');">' . $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . '</a>' . '<a href="' . $this->linkSelf('&cmd=edit&entry=ALL') . '">' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . '</a>' . '</td>'; $tCells[] = '<td>Expires:' . '<a href="' . $this->linkSelf('&cmd=flushExpired') . '">' . $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Flush all expired') . '</a>' . '</td>'; $tCells[] = '<td>Errors:</td>'; $tCells[] = '<td>Lang:</td>'; $tCells[] = '<td>&MP:</td>'; $tCells[] = '<td>RootPage ID:</td>'; #$tCells[]='<td>Expire:</td>'; $output = ' <tr class="bgColor5 tableheader"> ' . implode(' ', $tCells) . ' </tr>' . $output; // Compile final table and return: $output = ' <table border="0" cellspacing="1" cellpadding="0" id="tx-realurl-pathcacheTable" class="lrPadding c-list">' . $output . ' </table>'; if ($cmd === 'edit' && $entry == 'ALL') { $output .= $this->saveCancelButtons(); } return $output; }
/** * Makes link to page $id in frontend (view page) * Returns an icon which links to the frontend index.php document for viewing the page with id $id * $id must be a page-uid * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url) * * @param int $id The page id * @param string $_ @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 * @return string HTML string with linked icon(s) */ public function viewPageIcon($id, $_ = '') { // If access to Web>List for user, then link to that module. $str = BackendUtility::getListViewLink(array('id' => $id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList')); // Make link to view page $str .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($id, '', BackendUtility::BEgetRootLine($id))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>'; return $str; }
/** * Makes link to page $id in frontend (view page) * Returns an magnifier-glass icon which links to the frontend index.php document for viewing the page with id $id * $id must be a page-uid * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url) * * @param integer $id The page id * @param string $backPath The current "BACK_PATH" (the back relative to the typo3/ directory) * @param string $addParams Additional parameters for the image tag(s) * @return string HTML string with linked icon(s) * @todo Define visibility */ public function viewPageIcon($id, $backPath, $addParams = 'hspace="3"') { // If access to Web>List for user, then link to that module. $str = BackendUtility::getListViewLink(array('id' => $id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList')); // Make link to view page $str .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($id, $backPath, BackendUtility::BEgetRootLine($id))) . '">' . '<img' . IconUtility::skinImg($backPath, 'gfx/zoom.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '"' . ($addParams ? ' ' . trim($addParams) : '') . ' hspace="3" alt="" />' . '</a>'; return $str; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @param string $function Identifier for function of module * @return array all available buttons as an assoc. array */ protected function getButtons($function = '') { $lang = $this->getLanguageService(); $buttons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'edit_language' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'save_close' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => ''); // View page $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; // Shortcut if ($this->getBackendUser()->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']); } // Cache if (!$this->modTSconfig['properties']['disableAdvanced']) { $buttons['cache'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_layout', array('id' => $this->pageinfo['uid'], 'clear_cache' => '1'))) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>'; } if (!$this->modTSconfig['properties']['disableIconToolbar']) { // Move record if (MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) { $urlParameters = ['table' => $this->eRParts[0], 'uid' => $this->eRParts[1], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $buttons['move_record'] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('move_element', $urlParameters)) . '">' . IconUtility::getSpriteIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move', array('class' => 'c-inputButton', 'title' => $lang->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), TRUE))) . '</a>'; } // Edit page properties and page language overlay icons if ($this->CALC_PERMS & Permission::PAGE_EDIT) { // Edit localized page_language_overlay only when one specific language is selected if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) { $overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', 'pid = ' . (int) $this->id . ' ' . 'AND sys_language_uid = ' . (int) $this->current_sys_language . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::versioningPlaceholderClause('pages_language_overlay'), '', '', '', 'sys_language_uid'); $editLanguageOnClick = htmlspecialchars(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit')); $buttons['edit_language'] = '<a href="#" ' . 'onclick="' . $editLanguageOnClick . '"' . 'title="' . $lang->getLL('editPageLanguageOverlayProperties', TRUE) . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay') . '</a>'; } // Edit page properties $editPageOnClick = htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit')); $buttons['edit_page'] = '<a href="#" ' . 'onclick="' . $editPageOnClick . '"' . 'title="' . $lang->getLL('editPageProperties', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; } // Add CSH (Context Sensitive Help) icon to tool bar if ($function == 'quickEdit') { $buttons['csh'] = BackendUtility::cshItem($this->descrTable, 'quickEdit'); } else { $buttons['csh'] = BackendUtility::cshItem($this->descrTable, 'columns_' . $this->MOD_SETTINGS['function']); } if ($function == 'quickEdit') { // Save record $buttons['savedok'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />')); // Save and close $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />')); // Save record and show page $buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-save-view') . '</a>'; // Close record $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;') . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>'; // Delete record if ($this->deleteButton) { $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');') . '" title="' . $lang->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; } if ($this->undoButton) { // Undo button $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'revert' => 'ALL_FIELDS', 'sumUp' => -1, 'returnUrl' => $this->R_URI))) . '; return false;') . '" title="' . htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>'; // History button $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'returnUrl' => $this->R_URI)) . '#latest') . ');return false;') . '" title="' . $lang->getLL('recordHistory', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>'; } } } return $buttons; }
/** * Returns a JavaScript string for viewing the page id, $id * It will detect the correct domain name if needed and provide the link with the right back path. * Also it will re-use any window already open. * * @param int $pageUid Page UID * @param string $backPath Must point back to TYPO3_mainDir (where the site is assumed to be one level above) * @param array|NULL $rootLine If root line is supplied the function will look for the first found domain record and use that URL instead (if found) * @param string $anchorSection Optional anchor to the URL * @param string $alternativeUrl An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL! * @param string $additionalGetVars Additional GET variables. * @param bool $switchFocus If TRUE, then the preview window will gain the focus. * @return string */ public function viewOnClick($pageUid, $backPath = '', $rootLine = NULL, $anchorSection = '', $alternativeUrl = '', $additionalGetVars = '', $switchFocus = TRUE) { return BackendUtility::viewOnClick($pageUid, $backPath, $rootLine, $anchorSection, $alternativeUrl, $additionalGetVars, $switchFocus); }
/** * Renders Content Elements from the tt_content table from page id * * @param integer $id Page id * @return string HTML for the listing * @todo Define visibility */ public function getTable_tt_content($id) { $this->initializeLanguages(); $this->initializeClipboard(); // Initialize: $RTE = $this->getBackendUser()->isRTE(); $lMarg = 1; $showHidden = $this->tt_contentConfig['showHidden'] ? '' : BackendUtility::BEenableFields('tt_content'); $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), TRUE)); /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $this->getPageLayoutController()->doc->getPageRenderer(); $pageRenderer->loadExtJs(); $pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js'); // 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 = ''; // Select display mode: // MULTIPLE column display mode, side by side: if (!$this->tt_contentConfig['single']) { // 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 (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), $showHidden . $showLanguage); // For each column, render the content into a variable: foreach ($cList as $key) { if (!$lP) { $defLanguageCount[$key] = array(); } // Start wrapping div $content[$key] .= '<div class="t3-page-ce-wrapper'; if (count($contentRecordsPerColumn[$key]) === 0) { $content[$key] .= ' t3-page-ce-empty'; } $content[$key] .= '">'; // Add new content at the top most position $content[$key] .= ' <div class="t3-page-ce" id="' . uniqid() . '"> <div class="t3-page-ce-dropzone" id="colpos-' . $key . '-' . 'page-' . $id . '-' . uniqid() . '"> <div class="t3-page-ce-wrapper-new-ce"> <a href="#" onclick="' . htmlspecialchars($this->newContentElementOnClick($id, $key, $lP)) . '" title="' . $this->getLanguageService()->getLL('newRecordHere', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a> </div> </div> </div> '; $editUidList = ''; $rowArr = $contentRecordsPerColumn[$key]; $this->generateTtContentDataArray($rowArr); foreach ((array) $rowArr as $rKey => $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); } } 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][] = $row['uid']; } $editUidList .= $row['uid'] . ','; $disableMoveAndNewButtons = $this->defLangBinding && $lP > 0; if (!$this->tt_contentConfig['languageMode']) { $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . uniqid() . '">'; } $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig['showInfo'] ? 15 : 5, $disableMoveAndNewButtons, TRUE, !$this->tt_contentConfig['languageMode']); $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext'); $innerContent = '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row, $isRTE) . '</div>'; $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>' . $this->tt_content_drawFooter($row); // NOTE: this is the end tag for <div class="t3-page-ce-body"> // because of bad (historic) conception, starting tag has to be placed inside tt_content_drawHeader() $singleElementHTML .= '</div>'; $statusHidden = $this->isDisabled('tt_content', $row) ? ' t3-page-ce-hidden' : ''; $singleElementHTML = '<div class="t3-page-ce' . $statusHidden . '" id="element-tt_content-' . $row['uid'] . '">' . $singleElementHTML . '</div>'; if ($this->tt_contentConfig['languageMode']) { $singleElementHTML .= '<div class="t3-page-ce">'; } $singleElementHTML .= '<div class="t3-page-ce-dropzone" id="colpos-' . $key . '-' . 'page-' . $id . '-' . uniqid() . '">'; // Add icon "new content element below" if (!$disableMoveAndNewButtons) { // New content element: if ($this->option_newWizard) { $onClick = 'window.location.href=\'db_new_content_el.php?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, $this->backPath); } $singleElementHTML .= ' <div class="t3-page-ce-wrapper-new-ce"> <a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('newRecordHere', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a> </div> '; } $singleElementHTML .= '</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->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 && count($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 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); } } } else { $backendLayout = $this->getBackendLayoutView()->getSelectedBackendLayout($this->id); // GRID VIEW: $grid = '<div class="t3-gridContainer"><table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" class="t3-page-columns t3-gridTable">'; // 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 . '"' : '') . ' class="t3-gridCell t3-page-column t3-page-column-' . $columnKey . (!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '' ? ' t3-gridCell-unassigned' : '') . (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey] ? ' t3-gridCell-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]) { $grid .= $head[$columnKey] . $content[$columnKey]; } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '') { $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'), '', ''); } elseif (isset($columnConfig['name']) && strlen($columnConfig['name']) > 0) { $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', $GLOBALS['BACK_PATH']); } // 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-lang-column"> <h3>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</h3> </td>'; // "View page" icon is added: $onClick = BackendUtility::viewOnClick($this->id, $this->backPath, BackendUtility::BEgetRootLine($this->id), '', '', '&L=' . $lP); $viewLink = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</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; $lPLabel = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon(IconUtility::getSpriteIconForRecord('pages_language_overlay', $lpRecord), 'pages_language_overlay', $lpRecord['uid']) . $viewLink . ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay') ? '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath)) . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>' : '') . htmlspecialchars(GeneralUtility::fixed_lgd_cs($lpRecord['title'], 20)); } else { $lPLabel = $viewLink; } $sCont[$lP] = ' <td nowrap="nowrap" class="t3-page-lang-column t3-page-lang-label">' . $lPLabel . '</td>'; } // Add headers: $out .= '<tr>' . implode($cCont) . '</tr>'; $out .= '<tr>' . implode($sCont) . '</tr>'; // Traverse previously built content for the columns: foreach ($languageColumn as $cKey => $cCont) { $out .= ' <tr> <td valign="top" class="t3-gridCell t3-page-column t3-page-lang-column">' . implode('</td>' . ' <td valign="top" class="t3-gridCell t3-page-column t3-page-lang-column">', $cCont) . '</td> </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); } $out .= ' <tr> <td valign="top" class="t3-page-lang-column">' . implode('</td>' . ' <td valign="top" class="t3-page-lang-column">', $cCont) . '</td> </tr>'; } // Create spacer: $cCont = array_fill(0, count($langListArr), ' '); $out .= ' <tr> <td valign="top" class="t3-page-lang-column">' . implode('</td>' . ' <td valign="top" class="t3-page-lang-column">', $cCont) . '</td> </tr>'; } } // Finally, wrap it all in a table and add the language selector on top of it: $out = $languageSelector . ' <div class="t3-lang-gridContainer"> <table cellpadding="0" cellspacing="0" class="t3-page-langMode"> ' . $out . ' </table> </div>'; // CSH: $out .= BackendUtility::cshItem($this->descrTable, 'language_list', $GLOBALS['BACK_PATH']); } } else { // SINGLE column mode (columns shown beneath each other): if ($this->tt_contentConfig['sys_language_uid'] == 0 || !$this->defLangBinding) { // Initialize: if ($this->defLangBinding && $this->tt_contentConfig['sys_language_uid'] == 0) { $showLanguage = ' AND sys_language_uid IN (0,-1)'; $lP = 0; } else { $showLanguage = ' AND sys_language_uid=' . $this->tt_contentConfig['sys_language_uid']; $lP = $this->tt_contentConfig['sys_language_uid']; } $cList = explode(',', $this->tt_contentConfig['showSingleCol']); $out = ''; // Expand the table to some preset dimensions: $out .= ' <tr> <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td> <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td> <td><img src="clear.gif" width="10" height="1" alt="" /></td> <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td> </tr>'; // Select content records per column $contentRecordsPerColumn = $this->getContentRecordsPerColumn('tt_content', $id, array_values($cList), $showHidden . $showLanguage); // Traverse columns to display top-on-top foreach ($cList as $counter => $key) { $c = 0; $rowArr = $contentRecordsPerColumn[$key]; $this->generateTtContentDataArray($rowArr); $numberOfContentElementsInColumn = count($rowArr); $rowOut = ''; // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script: if ($this->doEdit && $this->option_showBigButtons && !(int) $key && $numberOfContentElementsInColumn == 0) { $onClick = 'window.location.href=\'db_new_content_el.php?id=' . $id . '&colPos=' . (int) $key . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';'; $theNewButton = $this->getPageLayoutController()->doc->t3Button($onClick, $this->getLanguageService()->getLL('newPageContent')); $theNewButton = '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton; } else { $theNewButton = ''; } $editUidList = ''; // Traverse any selected elements: foreach ($rowArr as $rKey => $row) { if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) { $c++; $editUidList .= $row['uid'] . ','; $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext'); // Create row output: $rowOut .= ' <tr> <td></td> <td valign="top">' . $this->tt_content_drawHeader($row) . '</td> <td> </td> <td' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . ' valign="top">' . $this->tt_content_drawItem($row, $isRTE) . '</td> </tr>'; // If the element was not the last element, add a divider line: if ($c != $numberOfContentElementsInColumn) { $rowOut .= ' <tr> <td></td> <td colspan="3"><img' . IconUtility::skinImg($this->backPath, 'gfx/stiblet_medium2.gif', 'width="468" height="1"') . ' class="c-divider" alt="" /></td> </tr>'; } } else { unset($rowArr[$rKey]); } } // Add spacer between sections in the vertical list if ($counter) { $out .= ' <tr> <td></td> <td colspan="3"><br /><br /><br /><br /></td> </tr>'; } // Add section header: $newP = $this->newContentElementOnClick($id, $key, $this->tt_contentConfig['sys_language_uid']); $pasteP = array('colPos' => $key, 'sys_language_uid' => $this->tt_contentConfig['sys_language_uid']); $out .= ' <!-- Column header: --> <tr> <td></td> <td valign="top" colspan="3">' . $this->tt_content_drawColHeader(BackendUtility::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP, $pasteP) . $theNewButton . '<br /></td> </tr>'; // Finally, add the content from the records in this column: $out .= $rowOut; } // Finally, wrap all table rows in one, big table: $out = ' <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode"> ' . $out . ' </table>'; // CSH: $out .= BackendUtility::cshItem($this->descrTable, 'columns_single', $GLOBALS['BACK_PATH']); } else { $out = '<br/><br/>' . $this->getPageLayoutController()->doc->icons(1) . 'Sorry, you cannot view a single language in this localization mode (Default Language Binding is enabled)<br/><br/>'; } } // Add the big buttons to page: if ($this->option_showBigButtons) { $bArray = array(); if (!$this->getPageLayoutController()->current_sys_language) { if ($this->ext_CALC_PERMS & 2) { $bArray[0] = $this->getPageLayoutController()->doc->t3Button(BackendUtility::editOnClick('&edit[pages][' . $id . ']=edit', $this->backPath, ''), $this->getLanguageService()->getLL('editPageProperties')); } } else { if ($this->doEdit && $this->getBackendUser()->check('tables_modify', 'pages_language_overlay')) { list($languageOverlayRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . (int) $this->getPageLayoutController()->current_sys_language); $bArray[0] = $this->getPageLayoutController()->doc->t3Button(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $languageOverlayRecord['uid'] . ']=edit', $this->backPath, ''), $this->getLanguageService()->getLL('editPageProperties_curLang')); } } if ($this->ext_CALC_PERMS & 4 || $this->ext_CALC_PERMS & 2) { $bArray[1] = $this->getPageLayoutController()->doc->t3Button('window.location.href=\'' . $this->backPath . 'move_el.php?table=pages&uid=' . $id . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';', $this->getLanguageService()->getLL('move_page')); } if ($this->ext_CALC_PERMS & 8) { $bArray[2] = $this->getPageLayoutController()->doc->t3Button('window.location.href=\'' . $this->backPath . 'db_new.php?id=' . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';', $this->getLanguageService()->getLL('newPage2')); } if ($this->doEdit && $this->ext_function == 1) { $bArray[3] = $this->getPageLayoutController()->doc->t3Button('window.location.href=\'db_new_content_el.php?id=' . $id . '&sys_language_uid=' . $this->getPageLayoutController()->current_sys_language . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';', $this->getLanguageService()->getLL('newPageContent2')); } $out = ' <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons"> <tr> <td>' . implode('</td> <td>', $bArray) . '</td> <td>' . BackendUtility::cshItem($this->descrTable, 'button_panel', $GLOBALS['BACK_PATH']) . '</td> </tr> </table> <br /> ' . $out; } // Return content: return $out; }
/** * @return string */ protected function generatePreviewCode() { $currentPageId = MathUtility::convertToPositiveInteger($this->popViewId); $table = $this->previewData['table']; $recordId = $this->previewData['id']; $pageTsConfig = BackendUtility::getPagesTSconfig($currentPageId); $previewConfiguration = isset($pageTsConfig['TCEMAIN.']['preview.'][$table . '.']) ? $pageTsConfig['TCEMAIN.']['preview.'][$table . '.'] : array(); $recordArray = BackendUtility::getRecord($table, $recordId); // find the right preview page id $previewPageId = 0; if (isset($previewConfiguration['previewPageId'])) { $previewPageId = $previewConfiguration['previewPageId']; } // if no preview page was configured if (!$previewPageId) { $rootPageData = null; $rootLine = BackendUtility::BEgetRootLine($currentPageId); $currentPage = reset($rootLine); if ((int) $currentPage['doktype'] === PageRepository::DOKTYPE_DEFAULT) { // try the current page $previewPageId = $currentPageId; } else { // or search for the root page foreach ($rootLine as $page) { if ($page['is_siteroot']) { $rootPageData = $page; break; } } $previewPageId = isset($rootPageData) ? (int) $rootPageData['uid'] : $currentPageId; } } $linkParameters = ['no_cache' => 1]; // language handling $languageField = isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) ? $GLOBALS['TCA'][$table]['ctrl']['languageField'] : ''; if ($languageField && !empty($recordArray[$languageField])) { $l18nPointer = isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] : ''; if ($l18nPointer && !empty($recordArray[$l18nPointer]) && isset($previewConfiguration['useDefaultLanguageRecord']) && !$previewConfiguration['useDefaultLanguageRecord']) { // use parent record $recordId = $recordArray[$l18nPointer]; } $linkParameters['L'] = $recordArray[$languageField]; } // map record data to GET parameters if (isset($previewConfiguration['fieldToParameterMap.'])) { foreach ($previewConfiguration['fieldToParameterMap.'] as $field => $parameterName) { $value = $recordArray[$field]; if ($field === 'uid') { $value = $recordId; } $linkParameters[$parameterName] = $value; } } // add/override parameters by configuration if (isset($previewConfiguration['additionalGetParameters.'])) { $additionalGetParameters = []; $this->parseAdditionalGetParameters($additionalGetParameters, $previewConfiguration['additionalGetParameters.']); $linkParameters = array_replace($linkParameters, $additionalGetParameters); } $this->popViewId = $previewPageId; $this->popViewId_addParams = GeneralUtility::implodeArrayForUrl('', $linkParameters, '', false, true); $previewPageRootline = BackendUtility::BEgetRootLine($this->popViewId); return ' if (window.opener) { ' . BackendUtility::viewOnClick($this->popViewId, '', $previewPageRootline, '', $this->viewUrl, $this->popViewId_addParams, false) . ' } else { ' . BackendUtility::viewOnClick($this->popViewId, '', $previewPageRootline, '', $this->viewUrl, $this->popViewId_addParams) . ' }'; }
/** * 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); } } }
/** * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for 'pages'-records a link to the level of that record...) * * @param string $table Table name * @param int $uid Item uid * @param string $code Item title (not htmlspecialchars()'ed yet) * @param mixed[] $row Item row * @return string The item title. Ready for HTML output (is htmlspecialchars()'ed) */ public function linkWrapItems($table, $uid, $code, $row) { $lang = $this->getLanguageService(); $origCode = $code; // If the title is blank, make a "no title" label: if ((string) $code === '') { $code = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', 1) . ']</i> - ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $row), $this->getBackendUserAuthentication()->uc['titleLen'])); } else { $code = htmlspecialchars(GeneralUtility::fixed_lgd_cs($code, $this->fixedL), ENT_QUOTES, 'UTF-8', false); if ($code != htmlspecialchars($origCode)) { $code = '<span title="' . htmlspecialchars($origCode, ENT_QUOTES, 'UTF-8', false) . '">' . $code . '</span>'; } } switch ((string) $this->clickTitleMode) { case 'edit': // If the listed table is 'pages' we have to request the permission settings for each page: if ($table == 'pages') { $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $row['uid'])); $permsEdit = $localCalcPerms & Permission::PAGE_EDIT; } else { $permsEdit = $this->calcPerms & Permission::CONTENT_EDIT; } // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id) if ($permsEdit) { $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . $lang->getLL('edit', true) . '">' . $code . '</a>'; } break; case 'show': // "Show" link (only pages and tt_content elements) if ($table == 'pages' || $table == 'tt_content') { $code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($table == 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid'])) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $code . '</a>'; } break; case 'info': // "Info": (All records) $code = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $lang->getLL('showInfo', true) . '">' . $code . '</a>'; break; default: // Output the label now: if ($table == 'pages') { $code = '<a href="' . htmlspecialchars($this->listURL($uid, '', 'firstElementNumber')) . '" onclick="setHighlight(' . $uid . ')">' . $code . '</a>'; } else { $code = $this->linkUrlMail($code, $origCode); } } return $code; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. */ protected function getButtons() { $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); // CSH $cshButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_web_info')->setFieldName(''); $buttonBar->addButton($cshButton, ButtonBar::BUTTON_POSITION_LEFT, 0); // View page $viewButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 1); // Shortcut $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setGetVariables(['M', 'id', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU)); $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT); }
/** * 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('back' => '', 'close' => '', 'new' => '', 'save' => '', 'save_close' => '', 'view' => '', 'shortcut' => ''); if ($this->id && $this->access) { // 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) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; if ($this->extClassConf['name'] == 'TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController') { // NEW button $buttons['new'] = '<input type="image" class="c-inputButton" name="createExtension" value="New"' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle', TRUE) . '" />'; if (!empty($this->e) && !GeneralUtility::_POST('abort') && !GeneralUtility::_POST('saveclose')) { // no NEW-button while edit $buttons['new'] = ''; // SAVE button $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>')); // SAVE AND CLOSE button $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="saveclose" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" ' . '/>')); // CLOSE button $buttons['close'] = IconUtility::getSpriteIcon('actions-document-close', array('html' => '<input type="image" class="c-inputButton" name="abort" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" ' . '/>')); } } elseif ($this->extClassConf['name'] == 'TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateConstantEditorModuleFunctionController' && count($this->MOD_MENU['constant_editor_cat'])) { // SAVE button $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>')); } elseif ($this->extClassConf['name'] == 'TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController') { if (!empty($this->sObj)) { // BACK $urlParameters = array('id' => $this->id); $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); $buttons['back'] = '<a href="' . htmlspecialchars($aHref) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</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']); } } else { // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('id', '', $this->MCONF['name']); } } return $buttons; }
/** * Adding CM element for View Page * * @param int $id Page uid (PID) * @param string $anchor Anchor, if any * @return array Item array, element in $menuItems * @internal */ public function DB_view($id, $anchor = '') { $icon = $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render(); return $this->linkItem($this->label('view'), $icon, BackendUtility::viewOnClick($id, '', null, $anchor) . ';'); }
/** * Adding CM element for View Page * * @param integer $id Page uid (PID) * @param string $anchor Anchor, if any * @return array Item array, element in $menuItems * @internal * @todo Define visibility */ public function DB_view($id, $anchor = '') { return $this->linkItem($this->label('view'), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view')), \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($id, $this->PH_backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($id), $anchor) . 'return hideCM();'); }
/** * Creates the control panel for a single record in the listing. * * @param string $table The table * @param array $row The record for which to make the control panel. * @return string HTML table with the control panel (unless disabled) * @todo Define visibility */ public function makeControl($table, $row) { if ($this->dontShowClipControlPanels) { return ''; } $rowUid = $row['uid']; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') && isset($row['_ORIG_uid'])) { $rowUid = $row['_ORIG_uid']; } // Initialize: \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table); $cells = array(); // If the listed table is 'pages' we have to request the permission settings for each page: if ($table == 'pages') { $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $row['uid'])); } // This expresses the edit permissions for this particular element: $permsEdit = $table == 'pages' && $localCalcPerms & 2 || $table != 'pages' && $this->calcPerms & 16; // "Show" link (only pages and tt_content elements) if ($table == 'pages' || $table == 'tt_content') { $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $cells['view'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($table == 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid'], $this->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } elseif (!$this->table) { $cells['view'] = $this->spaceIcon; } // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id) if ($permsEdit) { $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $cells['edit'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . ($GLOBALS['TCA'][$table]['ctrl']['readOnly'] ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open-read-only') : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open')) . '</a>'; } elseif (!$this->table) { $cells['edit'] = $this->spaceIcon; } // "Move" wizard link for pages/tt_content elements: if ($table == 'tt_content' && $permsEdit || $table == 'pages') { $cells['move'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'move_el.php?table=' . $table . '&uid=' . $row['uid'] . '\');') . '" title="' . $GLOBALS['LANG']->getLL('move_' . ($table == 'tt_content' ? 'record' : 'page'), TRUE) . '">' . ($table == 'tt_content' ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-move') : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-move')) . '</a>'; } elseif (!$this->table) { $cells['move'] = $this->spaceIcon; } // If the extended control panel is enabled OR if we are seeing a single table: if ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] || $this->table) { // "Info": (All records) $cells['viewBig'] = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $GLOBALS['LANG']->getLL('showInfo', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-info') . '</a>'; // If the table is NOT a read-only table, then show these links: if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) { // "Revert" link (history/undo) $cells['history'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'show_rechis.php?element=' . rawurlencode($table . ':' . $row['uid']) . '\',\'#latest\');') . '" title="' . $GLOBALS['LANG']->getLL('history', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-history-open') . '</a>'; // Versioning: if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version') && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) { $vers = \TYPO3\CMS\Backend\Utility\BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row); // If table can be versionized. if (is_array($vers)) { $versionIcon = 'no-version'; if (count($vers) > 1) { $versionIcon = count($vers) - 1; } $cells['version'] = '<a href="' . htmlspecialchars($this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'cm1/index.php?table=' . rawurlencode($table) . '&uid=' . rawurlencode($row['uid'])) . '" title="' . $GLOBALS['LANG']->getLL('displayVersions', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-version-' . $versionIcon) . '</a>'; } elseif (!$this->table) { $cells['version'] = $this->spaceIcon; } } // "Edit Perms" link: if ($table == 'pages' && $GLOBALS['BE_USER']->check('modules', 'web_perm') && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('perm')) { $cells['perms'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('perm') . 'mod1/index.php' . '?id=' . $row['uid'] . '&return_id=' . $row['uid'] . '&edit=1') . '" title="' . $GLOBALS['LANG']->getLL('permissions', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-locked') . '</a>'; } elseif (!$this->table && $GLOBALS['BE_USER']->check('modules', 'web_perm')) { $cells['perms'] = $this->spaceIcon; } // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record): if ($GLOBALS['TCA'][$table]['ctrl']['sortby'] || $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) { if ($table != 'pages' && $this->calcPerms & 16 || $table == 'pages' && $this->calcPerms & 8) { if ($this->showNewRecLink($table)) { $params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new'; $cells['new'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('new' . ($table == 'pages ' ? 'Page' : 'Record'), TRUE) . '">' . ($table == 'pages' ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new') : \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new')) . '</a>'; } } } elseif (!$this->table) { $cells['new'] = $this->spaceIcon; } // "Up/Down" links if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) { if (isset($this->currentTable['prev'][$row['uid']])) { // Up $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']]; $cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-move-up') . '</a>'; } else { $cells['moveUp'] = $this->spaceIcon; } if ($this->currentTable['next'][$row['uid']]) { // Down $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']]; $cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-move-down') . '</a>'; } else { $cells['moveDown'] = $this->spaceIcon; } } elseif (!$this->table) { $cells['moveUp'] = $this->spaceIcon; $cells['moveDown'] = $this->spaceIcon; } // "Hide/Unhide" links: $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) { if ($row[$hiddenField]) { $params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0'; $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>'; } else { $params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1'; $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('hide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-hide') . '</a>'; } } elseif (!$this->table) { $cells['hide'] = $this->spaceIcon; } // "Delete" link: if ($table == 'pages' && $localCalcPerms & 4 || $table != 'pages' && $this->calcPerms & 16) { $titleOrig = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row, FALSE, TRUE); $title = \TYPO3\CMS\Core\Utility\GeneralUtility::slashJS(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL), 1); $params = '&cmd[' . $table . '][' . $row['uid'] . '][delete]=1'; $refCountMsg = \TYPO3\CMS\Backend\Utility\BackendUtility::referenceCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'), $this->getReferenceCount($table, $row['uid'])) . \TYPO3\CMS\Backend\Utility\BackendUtility::translationCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord')); $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars('if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning') . ' "' . $title . '" ' . $refCountMsg) . ')) {jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');} return false;') . '" title="' . $GLOBALS['LANG']->getLL('delete', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; } elseif (!$this->table) { $cells['delete'] = $this->spaceIcon; } // "Levels" links: Moving pages into new levels... if ($permsEdit && $table == 'pages' && !$this->searchLevels) { // Up (Paste as the page right after the current parent page) if ($this->calcPerms & 8) { $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id; $cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-move-left') . '</a>'; } // Down (Paste as subpage to the page right above) if ($this->currentTable['prevUid'][$row['uid']]) { $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']])); if ($localCalcPerms & 8) { $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']]; $cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-move-right') . '</a>'; } else { $cells['moveRight'] = $this->spaceIcon; } } else { $cells['moveRight'] = $this->spaceIcon; } } elseif (!$this->table) { $cells['moveLeft'] = $this->spaceIcon; $cells['moveRight'] = $this->spaceIcon; } } } /** * @hook recStatInfoHooks: Allows to insert HTML before record icons on various places * @date 2007-09-22 * @request Kasper Skårhøj <*****@*****.**> */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) { $stat = ''; $_params = array($table, $row['uid']); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) { $stat .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this); } $cells['stat'] = $stat; } /** * @hook makeControl: Allows to change control icons of records in list-module * @date 2007-11-20 * @request Bernhard Kraft <*****@*****.**> * @usage This hook method gets passed the current $cells array as third parameter. This array contains values for the icons/actions generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries. */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567840); } $cells = $hookObject->makeControl($table, $row, $cells, $this); } } // Compile items into a DIV-element: return ' <!-- CONTROL PANEL: ' . $table . ':' . $row['uid'] . ' --> <div class="typo3-DBctrl">' . implode('', $cells) . '</div>'; }
/** * Returns the title (based on $code) of a record (from table $table) with * the proper link around (that is for 'tx_commerce_categories'-records * a link to the level of that record...) * * @param string $table Table name * @param int $uid Item uid * @param string $code Item title (not htmlspecialchars()'ed yet) * @param array $row Item row * * @return string The item title. Ready for HTML output */ public function linkWrapItems($table, $uid, $code, array $row) { $language = $this->getLanguageService(); $backendUser = $this->getBackendUser(); // If the title is blank, make a "no title" label: if (!strcmp($code, '')) { $code = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']</i> - ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $row), $backendUser->uc['titleLen'])); } else { $code = htmlspecialchars(GeneralUtility::fixed_lgd_cs($code, $this->fixedL)); } switch ((string) $this->clickTitleMode) { case 'edit': // If the listed table is 'tx_commerce_categories' we have to // request the permission settings for each page: if ($table == 'tx_commerce_categories') { $localCalcPerms = $backendUser->calcPerms(BackendUtility::getRecord('tx_commerce_categories', $row['uid'])); $permsEdit = $localCalcPerms & 2; } else { $permsEdit = $this->calcPerms & 16; } // "Edit" link: ( Only if permissions to edit the page-record // of the content of the parent page ($this->id) if ($permsEdit) { $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $language->getLL('edit', 1) . '">' . $code . '</a>'; } break; case 'show': // "Show" link (only tx_commerce_categories and tx_commerce_products elements) if ($table == 'tx_commerce_categories' || $table == 'tx_commerce_products') { $code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($table == 'tx_commerce_products' ? $this->id . '#' . $row['uid'] : $row['uid'])) . '" title="' . $language->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' . $code . '</a>'; } break; case 'info': // "Info": (All records) $code = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $language->getLL('showInfo', 1) . '">' . $code . '</a>'; break; default: // Output the label now: if ($table == 'tx_commerce_categories') { $code = '<a href="' . htmlspecialchars($this->listURL($uid, '')) . '">' . $code . '</a>'; } } return $code; }
/** * Main function, rendering the document with the iFrame with the RTE in. * * @return void */ public function main() { $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post" enctype="multipart/form-data" id="RteController" name="editform" ' . ' onsubmit="return TBE_EDITOR.checkSubmit(1);">'; // Translate id to the workspace version: if ($versionedRecord = BackendUtility::getWorkspaceVersionOfRecord($this->getBackendUserAuthentication()->workspace, $this->P['table'], $this->P['uid'], 'uid')) { $this->P['uid'] = $versionedRecord['uid']; } // If all parameters are available: if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) { /** @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); $formDataCompilerInput = ['vanillaUid' => (int) $this->P['uid'], 'tableName' => $this->P['table'], 'command' => 'edit', 'disabledWizards' => true]; $formData = $formDataCompiler->compile($formDataCompilerInput); $formData['fieldListToRender'] = $this->P['field']; $formData['renderType'] = 'outerWrapContainer'; $formResult = $nodeFactory->create($formData)->render(); /** @var FormResultCompiler $formResultCompiler */ $formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class); $formResultCompiler->mergeResult($formResult); // override the default jumpToUrl $this->moduleTemplate->addJavaScriptCode('RteWizardInlineCode', 'function jumpToUrl(URL,formEl) { if (document.editform) { if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else { window.location.href = URL; } } '); // Setting JavaScript of the pid value for viewing: if ($this->popView) { $this->moduleTemplate->addJavaScriptCode('PopupViewInlineJS', BackendUtility::viewOnClick($formData['databaseRow']['pid'], '', BackendUtility::BEgetRootLine($formData['databaseRow']['pid']))); } $pageTsConfigMerged = $formData['pageTsConfigMerged']; if ((string) $pageTsConfigMerged['TCEFORM.'][$this->P['table'] . '.'][$this->P['field'] . '.']['RTEfullScreenWidth'] !== '') { $width = (string) $pageTsConfigMerged['TCEFORM.'][$this->P['table'] . '.'][$this->P['field'] . '.']['RTEfullScreenWidth']; } else { $width = '100%'; } // Get the form field and wrap it in the table with the buttons: $formContent = $formResult['html']; $formContent = ' <table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard"> <tr> <td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td> <td></td> </tr> </table>'; // Adding hidden fields: $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" /> <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />'; // Finally, add the whole setup: $this->content .= $formResultCompiler->JStop() . $formContent . $formResultCompiler->printNeededJSFunctions(); } else { // ERROR: $this->content .= '<h2>' . $this->getLanguageService()->getLL('forms_title', true) . '</h2>' . '<div><span class="text-danger">' . $this->getLanguageService()->getLL('table_noData', true) . '</span></div>'; } // Setting up the buttons and markers for docHeader $this->getButtons(); // Build the <body> for the module $this->content .= '</form>'; $this->moduleTemplate->setContent($this->content); }
/** * Returns the view link of a given node * * @param \stdClass $nodeData * @return string */ public static function getViewLink($nodeData) { /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array) $nodeData); $javascriptLink = BackendUtility::viewOnClick($node->getId()); $extractedLink = ''; if (preg_match('/window\\.open\\(\'([^\']+)\'/i', $javascriptLink, $match)) { // Clean JSON-serialized ampersands ('&') // @see GeneralUtility::quoteJSvalue() $extractedLink = json_decode('"' . trim($match[1], '"') . '"', JSON_HEX_AMP); } return $extractedLink; }
/** * Main function, rendering the document with the iframe with the RTE in. * * @return void * @todo Define visibility */ public function main() { // Translate id to the workspace version: if ($versionRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) { $this->P['uid'] = $versionRec['uid']; } // If all parameters are available: if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) { // Getting the raw record (we need only the pid-value from here...) $rawRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']); \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($this->P['table'], $rawRec); // Setting JavaScript, including the pid value for viewing: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL,formEl) { // if (document.editform) { if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else window.location.href = URL; } ' . ($this->popView ? \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($rawRec['pid'], '', \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($rawRec['pid'])) : '') . ' '); // Initialize TCeforms - for rendering the field: $tceforms = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); // Init... $tceforms->initDefaultBEMode(); // SPECIAL: Disables all wizards - we are NOT going to need them. $tceforms->disableWizards = 1; // SPECIAL: Setting background color of the RTE to ordinary background $tceforms->colorScheme[0] = $this->doc->bgColor; // Initialize style for RTE object: // Getting reference to the RTE object used to render the field! $RTEobj = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEgetObj(); if ($RTEobj->ID == 'rte') { $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;'; } // Fetching content of record: $trData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor'); $trData->lockRecords = 1; $trData->fetchRecord($this->P['table'], $this->P['uid'], ''); // Getting the processed record content out: $rec = reset($trData->regTableItems_data); $rec['uid'] = $this->P['uid']; $rec['pid'] = $rawRec['pid']; // TSconfig, setting width: $fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']); if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) { $width = $fieldTSConfig['RTEfullScreenWidth']; } else { $width = '100%'; } // Get the form field and wrap it in the table with the buttons: $formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']); $formContent = ' <!-- RTE wizard: --> <table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard"> <tr> <td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td> <td></td> </tr> </table>'; // Adding hidden fields: $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" /> <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Finally, add the whole setup: $this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions(); } else { // ERROR: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('forms_title'), '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('table_noData', 1) . '</span>', 0, 1); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage(''); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Add entries for a single record * * @param string $table Table name * @param int $uid Record uid * @param array $lines Output lines array (is passed by reference and modified) * @param string $preCode Pre-HTML code * @param bool $checkImportInPidRecord If you want import validation, you can set this so it checks if the import can take place on the specified page. * @return void */ public function singleRecordLines($table, $uid, &$lines, $preCode, $checkImportInPidRecord = false) { // Get record: $record = $this->dat['header']['records'][$table][$uid]; unset($this->remainHeader['records'][$table][$uid]); if (!is_array($record) && !($table === 'pages' && !$uid)) { $this->error('MISSING RECORD: ' . $table . ':' . $uid); } // Begin to create the line arrays information record, pInfo: $pInfo = array(); $pInfo['ref'] = $table . ':' . $uid; // Unknown table name: $lang = $this->getLanguageService(); if ($table === '_SOFTREF_') { $pInfo['preCode'] = $preCode; $pInfo['title'] = '<em>' . $lang->getLL('impexpcore_singlereco_softReferencesFiles', true) . '</em>'; } elseif (!isset($GLOBALS['TCA'][$table])) { // Unknown table name: $pInfo['preCode'] = $preCode; $pInfo['msg'] = 'UNKNOWN TABLE \'' . $pInfo['ref'] . '\''; $pInfo['title'] = '<em>' . htmlspecialchars($record['title']) . '</em>'; } else { // Otherwise, set table icon and title. // Import Validation (triggered by $this->display_import_pid_record) will show messages if import is not possible of various items. if (is_array($this->display_import_pid_record) && !empty($this->display_import_pid_record)) { if ($checkImportInPidRecord) { if (!$this->getBackendUser()->doesUserHaveAccess($this->display_import_pid_record, $table === 'pages' ? 8 : 16)) { $pInfo['msg'] .= '\'' . $pInfo['ref'] . '\' cannot be INSERTED on this page! '; } if (!$this->checkDokType($table, $this->display_import_pid_record['doktype']) && !$GLOBALS['TCA'][$table]['ctrl']['rootLevel']) { $pInfo['msg'] .= '\'' . $table . '\' cannot be INSERTED on this page type (change page type to \'Folder\'.) '; } } if (!$this->getBackendUser()->check('tables_modify', $table)) { $pInfo['msg'] .= 'You are not allowed to CREATE \'' . $table . '\' tables! '; } if ($GLOBALS['TCA'][$table]['ctrl']['readOnly']) { $pInfo['msg'] .= 'TABLE \'' . $table . '\' is READ ONLY! '; } if ($GLOBALS['TCA'][$table]['ctrl']['adminOnly'] && !$this->getBackendUser()->isAdmin()) { $pInfo['msg'] .= 'TABLE \'' . $table . '\' is ADMIN ONLY! '; } if ($GLOBALS['TCA'][$table]['ctrl']['is_static']) { $pInfo['msg'] .= 'TABLE \'' . $table . '\' is a STATIC TABLE! '; } if ((int) $GLOBALS['TCA'][$table]['ctrl']['rootLevel'] === 1) { $pInfo['msg'] .= 'TABLE \'' . $table . '\' will be inserted on ROOT LEVEL! '; } $diffInverse = false; $recInf = null; if ($this->update) { // In case of update-PREVIEW we swap the diff-sources. $diffInverse = true; $recInf = $this->doesRecordExist($table, $uid, $this->showDiff ? '*' : ''); $pInfo['updatePath'] = $recInf ? htmlspecialchars($this->getRecordPath($recInf['pid'])) : '<strong>NEW!</strong>'; // Mode selector: $optValues = array(); $optValues[] = $recInf ? $lang->getLL('impexpcore_singlereco_update') : $lang->getLL('impexpcore_singlereco_insert'); if ($recInf) { $optValues['as_new'] = $lang->getLL('impexpcore_singlereco_importAsNew'); } if ($recInf) { if (!$this->global_ignore_pid) { $optValues['ignore_pid'] = $lang->getLL('impexpcore_singlereco_ignorePid'); } else { $optValues['respect_pid'] = $lang->getLL('impexpcore_singlereco_respectPid'); } } if (!$recInf && $this->getBackendUser()->isAdmin()) { $optValues['force_uid'] = sprintf($lang->getLL('impexpcore_singlereco_forceUidSAdmin'), $uid); } $optValues['exclude'] = $lang->getLL('impexpcore_singlereco_exclude'); if ($table === 'sys_file') { $pInfo['updateMode'] = ''; } else { $pInfo['updateMode'] = $this->renderSelectBox('tx_impexp[import_mode][' . $table . ':' . $uid . ']', $this->import_mode[$table . ':' . $uid], $optValues); } } // Diff view: if ($this->showDiff) { // For IMPORTS, get new id: if ($newUid = $this->import_mapId[$table][$uid]) { $diffInverse = false; $recInf = $this->doesRecordExist($table, $newUid, '*'); BackendUtility::workspaceOL($table, $recInf); } if (is_array($recInf)) { $pInfo['showDiffContent'] = $this->compareRecords($recInf, $this->dat['records'][$table . ':' . $uid]['data'], $table, $diffInverse); } } } $pInfo['preCode'] = $preCode . '<span title="' . htmlspecialchars($table . ':' . $uid) . '">' . $this->iconFactory->getIconForRecord($table, (array) $this->dat['records'][$table . ':' . $uid]['data'], Icon::SIZE_SMALL)->render() . '</span>'; $pInfo['title'] = htmlspecialchars($record['title']); // View page: if ($table === 'pages') { $viewID = $this->mode === 'export' ? $uid : ($this->doesImport ? $this->import_mapId['pages'][$uid] : 0); if ($viewID) { $pInfo['title'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($viewID)) . 'return false;">' . $pInfo['title'] . '</a>'; } } } $pInfo['class'] = $table == 'pages' ? 'bgColor4-20' : 'bgColor4'; $pInfo['type'] = 'record'; $pInfo['size'] = $record['size']; $lines[] = $pInfo; // File relations: if (is_array($record['filerefs'])) { $this->addFiles($record['filerefs'], $lines, $preCode); } // DB relations if (is_array($record['rels'])) { $this->addRelations($record['rels'], $lines, $preCode); } // Soft ref if (!empty($record['softrefs'])) { $preCode_A = $preCode . ' '; $preCode_B = $preCode . ' '; foreach ($record['softrefs'] as $info) { $pInfo = array(); $pInfo['preCode'] = $preCode_A . $this->iconFactory->getIcon('status-status-reference-soft', Icon::SIZE_SMALL)->render(); $pInfo['title'] = '<em>' . $info['field'] . ', "' . $info['spKey'] . '" </em>: <span title="' . htmlspecialchars($info['matchString']) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($info['matchString'], 60)) . '</span>'; if ($info['subst']['type']) { if (strlen($info['subst']['title'])) { $pInfo['title'] .= '<br/>' . $preCode_B . '<strong>' . $lang->getLL('impexpcore_singlereco_title', true) . '</strong> ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($info['subst']['title'], 60)); } if (strlen($info['subst']['description'])) { $pInfo['title'] .= '<br/>' . $preCode_B . '<strong>' . $lang->getLL('impexpcore_singlereco_descr', true) . '</strong> ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($info['subst']['description'], 60)); } $pInfo['title'] .= '<br/>' . $preCode_B . ($info['subst']['type'] == 'file' ? $lang->getLL('impexpcore_singlereco_filename', true) . ' <strong>' . $info['subst']['relFileName'] . '</strong>' : '') . ($info['subst']['type'] == 'string' ? $lang->getLL('impexpcore_singlereco_value', true) . ' <strong>' . $info['subst']['tokenValue'] . '</strong>' : '') . ($info['subst']['type'] == 'db' ? $lang->getLL('impexpcore_softrefsel_record', true) . ' <strong>' . $info['subst']['recordRef'] . '</strong>' : ''); } $pInfo['ref'] = 'SOFTREF'; $pInfo['size'] = ''; $pInfo['class'] = 'bgColor3'; $pInfo['type'] = 'softref'; $pInfo['_softRefInfo'] = $info; $pInfo['type'] = 'softref'; $mode = $this->softrefCfg[$info['subst']['tokenID']]['mode']; if ($info['error'] && $mode !== 'editable' && $mode !== 'exclude') { $pInfo['msg'] .= $info['error']; } $lines[] = $pInfo; // Add relations: if ($info['subst']['type'] == 'db') { list($tempTable, $tempUid) = explode(':', $info['subst']['recordRef']); $this->addRelations(array(array('table' => $tempTable, 'id' => $tempUid, 'tokenID' => $info['subst']['tokenID'])), $lines, $preCode_B, array(), ''); } // Add files: if ($info['subst']['type'] == 'file') { $this->addFiles(array($info['file_ID']), $lines, $preCode_B, '', $info['subst']['tokenID']); } } } }
/** * This creates the buttons for die modules * * @param string $function Identifier for function of module * @return void */ protected function makeButtons($function = '') { $lang = $this->getLanguageService(); // View page if (!VersionState::cast($this->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) { $viewButton = $this->buttonBar->makeLinkButton()->setOnClick(htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']))))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#'); $this->buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 3); } // Shortcut $shortcutButton = $this->buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['id', 'M', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU)); $this->buttonBar->addButton($shortcutButton); // Cache if (!$this->modTSconfig['properties']['disableAdvanced']) { $clearCacheButton = $this->buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->pageinfo['uid'], 'clear_cache' => '1']))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true))->setIcon($this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL)); $this->buttonBar->addButton($clearCacheButton, ButtonBar::BUTTON_POSITION_RIGHT, 1); } if (!$this->modTSconfig['properties']['disableIconToolbar']) { // Move record if (MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) { $urlParameters = ['table' => $this->eRParts[0], 'uid' => $this->eRParts[1], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $moveButton = $this->buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('move_element', $urlParameters))->setTitle($lang->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), true))->setIcon($this->iconFactory->getIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move', Icon::SIZE_SMALL)); $this->buttonBar->addButton($moveButton, ButtonBar::BUTTON_POSITION_LEFT, 2); } // Edit page properties and page language overlay icons if ($this->pageIsNotLockedForEditors() && $this->getBackendUser()->checkLanguageAccess(0)) { // Edit localized page_language_overlay only when one specific language is selected if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) { $overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', 'pid = ' . (int) $this->id . ' ' . 'AND sys_language_uid = ' . (int) $this->current_sys_language . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::versioningPlaceholderClause('pages_language_overlay'), '', '', ''); $editLanguageButton = $this->buttonBar->makeLinkButton()->setHref('#')->setTitle($lang->getLL('editPageLanguageOverlayProperties', true))->setOnClick(htmlspecialchars(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit')))->setIcon($this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)); $this->buttonBar->addButton($editLanguageButton, ButtonBar::BUTTON_POSITION_LEFT, 3); } $editPageButton = $this->buttonBar->makeLinkButton()->setHref('#')->setTitle($lang->getLL('editPageProperties', true))->setOnClick(htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit')))->setIcon($this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)); $this->buttonBar->addButton($editPageButton, ButtonBar::BUTTON_POSITION_LEFT, 3); } // Add CSH (Context Sensitive Help) icon to tool bar $contextSensitiveHelpButton = $this->buttonBar->makeHelpButton()->setModuleName($this->descrTable)->setFieldName($function === 'quickEdit' ? 'quickEdit' : 'columns_' . $this->MOD_SETTINGS['function']); $this->buttonBar->addButton($contextSensitiveHelpButton); // QuickEdit if ($function == 'quickEdit') { // Close Record $closeButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;'))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL)); $this->buttonBar->addButton($closeButton, ButtonBar::BUTTON_POSITION_LEFT, 0); // Save Record $saveButtonDropdown = $this->buttonBar->makeSplitButton(); $saveButton = $this->buttonBar->makeInputButton()->setName('_savedok')->setValue('1')->setForm('PageLayoutController')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL)); $saveButtonDropdown->addItem($saveButton); $saveAndCloseButton = $this->buttonBar->makeInputButton()->setName('_saveandclosedok')->setValue('1')->setForm('PageLayoutController')->setOnClick('document.editform.redirect.value=\'' . $this->closeUrl . '\';')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-save-close', Icon::SIZE_SMALL)); $saveButtonDropdown->addItem($saveAndCloseButton); $saveAndShowPageButton = $this->buttonBar->makeInputButton()->setName('_savedokview')->setValue('1')->setForm('PageLayoutController')->setOnClick('document.editform.redirect.value+=\'&popView=1\';')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', true))->setIcon($this->iconFactory->getIcon('actions-document-save-view', Icon::SIZE_SMALL)); $saveButtonDropdown->addItem($saveAndShowPageButton); $this->buttonBar->addButton($saveButtonDropdown, ButtonBar::BUTTON_POSITION_LEFT, 1); // Delete record if ($this->deleteButton) { $deleteButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');'))->setTitle($lang->getLL('deleteItem', true))->setIcon($this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)); $this->buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4); } // History if ($this->undoButton) { $undoButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'revert' => 'ALL_FIELDS', 'sumUp' => -1, 'returnUrl' => $this->R_URI))) . '; return false;'))->setTitle(htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))))->setIcon($this->iconFactory->getIcon('actions-edit-undo', Icon::SIZE_SMALL)); $this->buttonBar->addButton($undoButton, ButtonBar::BUTTON_POSITION_LEFT, 5); $historyButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'returnUrl' => $this->R_URI)) . '#latest') . ');return false;'))->setTitle($lang->getLL('recordHistory', true))->setIcon($this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)); $this->buttonBar->addButton($historyButton, ButtonBar::BUTTON_POSITION_LEFT, 3); } } } }
/** * Registers the Icons into the docheader * * @return void * @throws \InvalidArgumentException */ protected function registerDocHeaderButtons() { /** @var ButtonBar $buttonBar */ $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar(); $currentRequest = $this->request; $moduleName = $currentRequest->getPluginName(); $getVars = $this->request->getArguments(); $extensionName = $currentRequest->getControllerExtensionName(); if (empty($getVars)) { $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName); $getVars = array('id', 'M', $modulePrefix); } $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setGetVariables($getVars); $buttonBar->addButton($shortcutButton); if ($this->id > 0) { $iconFactory = $this->view->getModuleTemplate()->getIconFactory(); $viewButton = $buttonBar->makeLinkButton()->setOnClick(htmlspecialchars(BackendUtility::viewOnClick($this->pageInfo['uid'], '', BackendUtility::BEgetRootLine($this->pageInfo['uid']))))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#'); $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 3); } }
/** * 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; }