/** * 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; } }
/** * Preview of a content element. * * @param array $row : Record row of tt_content * @return string */ private function getPi1Preview($row) { if ($row['image']) { $image = \TYPO3\CMS\Backend\Utility\BackendUtility::thumbCode($row, 'tt_content', 'image', $GLOBALS['BACK_PATH']); } $previewHtml = '<a href="#" onclick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit') . '" />' . $text . '</a>' . $image; return $previewHtml; }
/** * Returns a link with edit on click handler * * @see BackendUtility::editOnClick * * @param string $parameters * @param string|int $redirectUrl * @return string */ public function render($parameters, $redirectUrl = '') { $onClickAttribute = BackendUtility::editOnClick('&' . $parameters, '', $redirectUrl); $this->tag->addAttribute('href', '#'); $this->tag->addAttribute('onclick', $onClickAttribute); $this->tag->setContent($this->renderChildren()); $this->tag->forceClosingTag(TRUE); return $this->tag->render(); }
/** * Will create a link on the input string and possibly a big button after the string which links to editing in the RTE. * Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button * * @param string $str String to link. Must be prepared for HTML output. * @param array $row The row. * @return string If the whole thing was editable ($this->doEdit) $str is return with link around. Otherwise just $str. * @see getTable_tt_content() */ public function linkEditContent($str, $row) { $addButton = ''; $onClick = ''; if ($this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) { // Setting onclick action for content link: $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit'); } // Return link return $onClick ? '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '"> ' . $str . '</a>' . $addButton : $str; }
/** * Links the string $code to a create-new form for a record * in $table created on page $pid * * @param string $linkText Link text * @param string $table Table name (in which to create new record) * @param int $pid PID value for the * "&edit['.$table.']['.$pid.']=new" command (positive/negative) * @param bool $addContentTable If $addContentTable is set, * then a new contentTable record is created together with pages * * @return string The link. */ public function linkWrap($linkText, $table, $pid, $addContentTable = FALSE) { $parameters = '&edit[' . $table . '][' . $pid . ']=new'; if ($table == 'pages' && $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] && isset($GLOBALS['TCA'][$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']]) && $addContentTable) { $parameters .= '&edit[' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] . '][prev]=new&returnNewPageId=1'; } elseif ($table == 'pages_language_overlay') { $parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageinfo['doktype']; } $parameters = $this->addCommerceParameter($parameters, $table); $onClick = BackendUtility::editOnClick($parameters, '', $this->returnUrl); return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $linkText . '</a>'; }
/** * Creates the localization panel * * @param string $table The table * @param array $row The record for which to make the localization panel. * * @return array */ public function getLocalizedRecords($table, $row) { $records = array(); $translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row); if (is_array($translations) && is_array($translations['translations'])) { foreach ($translations['translations'] as $sysLanguageUid => $translationData) { if (!$GLOBALS['BE_USER']->checkLanguageAccess($sysLanguageUid)) { continue; } if (isset($translations['translations'][$sysLanguageUid])) { $records[$sysLanguageUid] = array('editIcon' => $this->getLanguageIconLink($sysLanguageUid, BackendUtility::editOnClick('&edit[' . $table . '][' . $translationData['uid'] . ']=edit'), $translationData['uid']), 'uid' => $translations['translations'][$sysLanguageUid]['uid']); } } } return $records; }
/** * 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>'; }
/** * 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; }
/** * Creates the onclick event for the insert-icons. * * TSconfig mod.newPageWizard.override may contain an alternative module / route which can be * used instead of the normal create new page wizard. * * @param int $pid The pid. * @param int $newPagePID New page id. * @return string Onclick attribute content */ public function onClickEvent($pid, $newPagePID) { $TSconfig = BackendUtility::getModTSconfig($newPagePID, 'mod.newPageWizard'); $TSconfig = $TSconfig['properties']; if (isset($TSconfig['override']) && !empty($TSconfig['override'])) { $url = BackendUtility::getModuleUrl($TSconfig['override'], ['positionPid' => $pid, 'newPageId' => $newPagePID, 'cmd' => 'crPage', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]); return 'window.location.href=' . GeneralUtility::quoteJSvalue($url) . ';'; } $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1'; return BackendUtility::editOnClick($params, '', $this->R_URI); }
/** * The main processing method if this class * * @return string Information of the template status or the taken actions as HTML string * @todo Define visibility */ public function main() { global $BACK_PATH; global $tmpl, $tplRow, $theConstants; $this->pObj->MOD_MENU['includeTypoScriptFileContent'] = TRUE; $edit = $this->pObj->edit; $e = $this->pObj->e; \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_template'); // Checking for more than one template an if, set a menu... $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage']; } // Initialize $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); if ($existTemplate) { $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; } // Create extension template $newId = $this->pObj->createTemplate($this->pObj->id, $saveId); if ($newId) { // Switch to new template $urlParameters = array('id' => $this->pObj->id, 'SET[templatesOnPage]' => $newId); $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters); \TYPO3\CMS\Core\Utility\HttpUtility::redirect($aHref); } if ($existTemplate) { // Update template ? $POST = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST(); if ($POST['submit'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) { // Set the data to be saved $recData = array(); $alternativeFileName = array(); $tmp_upload_name = ''; // Set this to blank $tmp_newresource_name = ''; if (is_array($POST['data'])) { foreach ($POST['data'] as $field => $val) { switch ($field) { case 'constants': case 'config': case 'title': case 'sitetitle': case 'description': $recData['sys_template'][$saveId][$field] = $val; break; } } } if (count($recData)) { $recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]); // Create new tce-object $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tce->alternativeFileName = $alternativeFileName; // Initialize $tce->start($recData, array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd('all'); // tce were processed successfully $this->tce_processed = TRUE; // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); } // If files has been edited: if (is_array($edit)) { if ($edit['filename'] && $tplRow['resources'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($tplRow['resources'], $edit['filename'])) { // Check if there are resources, and that the file is in the resourcelist. $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $edit['filename']; $fI = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($edit['filename']); if (@is_file($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) { // checks that have already been done.. Just to make sure // @TODO: Check if the hardcorded value already has a config member, otherwise create one // Checks that have already been done.. Just to make sure if (filesize($path) < 30720) { \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($path, $edit['file']); $theOutput .= $this->pObj->doc->spacer(10); $theOutput .= $this->pObj->doc->section('<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>', sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']), 0, 0, 0, 1); // Clear cache - the file has probably affected the template setup // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible! /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */ $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tce->start(array(), array()); $tce->clear_cacheCmd('all'); } } } } } // Hook post updating template/TCE processing if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) { $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook']; if (is_array($postTCEProcessingHook)) { $hookParameters = array('POST' => $POST, 'tce' => $tce); foreach ($postTCEProcessingHook as $hookFunction) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } $content = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('sys_template', $tplRow) . '<strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : ''); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), $content, 0, 1); if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu); } $theOutput .= $this->pObj->doc->spacer(10); $numberOfRows = 35; // If abort pressed, nothing should be edited: if ($POST['abort'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) { unset($e); } if ($e['title']) { $outCode = '<input type="Text" name="data[title]" value="' . htmlspecialchars($tplRow['title']) . '"' . $this->pObj->doc->formWidth() . '>'; $outCode .= '<input type="Hidden" name="e[title]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode, TRUE); } if ($e['sitetitle']) { $outCode = '<input type="Text" name="data[sitetitle]" value="' . htmlspecialchars($tplRow['sitetitle']) . '"' . $this->pObj->doc->formWidth() . '>'; $outCode .= '<input type="Hidden" name="e[sitetitle]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode, TRUE); } if ($e['description']) { $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, '', '') . '>' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['description']) . '</textarea>'; $outCode .= '<input type="Hidden" name="e[description]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode, TRUE); } if ($e['constants']) { $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['constants']) . '</textarea>'; $outCode .= '<input type="Hidden" name="e[constants]" value="1">'; // Display "Include TypoScript file content?" checkbox $outCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[constants]=1', 'id="checkIncludeTypoScriptFileContent"'); $outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '', TRUE); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } if ($e['file']) { $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $e[file]; $fI = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($e[file]); if (@is_file($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) { if (filesize($path) < $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size'] * 1024) { $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($path); $outCode = $GLOBALS['LANG']->getLL('file') . ' <strong>' . $e[file] . '</strong><BR>'; $outCode .= '<textarea name="edit[file]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($fileContent) . '</textarea>'; $outCode .= '<input type="Hidden" name="edit[filename]" value="' . $e[file] . '">'; $outCode .= '<input type="Hidden" name="e[file]" value="' . htmlspecialchars($e[file]) . '">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), ''); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } else { $theOutput .= $this->pObj->doc->spacer(15); $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']); $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']); $theOutput .= $this->pObj->doc->section('<font color=red>' . $fileToBig . '</font>', $filesizeNotAllowed, 0, 0, 0, 1); } } } if ($e['config']) { $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['config']) . '</textarea>'; $outCode .= '<input type="Hidden" name="e[config]" value="1">'; // Display "Include TypoScript file content?" checkbox $outCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[config]=1', 'id="checkIncludeTypoScriptFileContent"'); $outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />'; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tsconfig_help')) { $url = $BACK_PATH . 'wizard_tsconfig.php?mode=tsref'; $params = array('formName' => 'editForm', 'itemName' => 'data[config]'); $outCode .= '<a href="#" onClick="vHWin=window.open(\'' . $url . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', array('P' => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-typoscript-documentation-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef', TRUE))) . '</a>'; } $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '', TRUE); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } // Processing: $outCode = ''; $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('title'), htmlspecialchars($tplRow['title']), 'title'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('constants'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0), 'constants'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('setup'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0), 'config'); $outCode = '<table class="t3-table-info">' . $outCode . '</table>'; // Edit all icon: $outCode .= '<br /><a href="#" onClick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick(rawurlencode('&createExtension=0') . '&edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editTemplateRecord'))) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>'; $theOutput .= $this->pObj->doc->section('', $outCode); // hook after compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) { $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook']; if (is_array($postOutputProcessingHook)) { $hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows); foreach ($postOutputProcessingHook as $hookFunction) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } } else { $theOutput .= $this->pObj->noTemplate(1); } return $theOutput; }
/** * 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; }
/** * Creates onclick-attribute content for a new content element * * @param int $id Page id where to create the element. * @param int $colPos Preset: Column position value * @param int $sys_language Preset: Sys langauge value * @return string String for onclick attribute. * @see getTable_tt_content() */ public function newContentElementOnClick($id, $colPos, $sys_language) { if ($this->option_newWizard) { $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('new_content_element') . '&id=' . $id . '&colPos=' . $colPos . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';'; } else { $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]=' . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language); } return $onClick; }
/** * 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. * * @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 an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params. * REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution) * * @param string $params Parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123. * @param string $backPath Must point back to the TYPO3_mainDir directory (where alt_doc.php is) * @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI. * * @return string * @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand() */ public function editOnClick($params, $backPath = '', $requestUri = '') { return BackendUtility::editOnClick($params, $backPath, $requestUri); }
/** * Creates the edit control section * * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing. * @return string HTML-table * @todo Define visibility */ public function makeEdit($fileOrFolderObject) { $cells = array(); $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier(); // Edit metadata of file try { if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) { $metaData = $fileOrFolderObject->_getMetaData(); $data = array('sys_file_metadata' => array($metaData['uid'] => 'edit')); $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl()); $title = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata')); $cells['editmetadata'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $title . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } else { $cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty'); } } catch (\Exception $e) { $cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty'); } // Edit file content (if editable) if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) { $editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;'; $cells['edit'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; } else { $cells['edit'] = IconUtility::getSpriteIcon('empty-empty'); } // rename the file if ($fileOrFolderObject->checkActionPermission('rename')) { $renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+\'file_rename.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;'; $cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>'; } else { $cells['rename'] = IconUtility::getSpriteIcon('empty-empty'); } if ($fileOrFolderObject->checkActionPermission('read')) { if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\Folder')) { $infoOnClick = 'top.launchView( \'_FOLDER\', \'' . $fullIdentifier . '\');return false;'; } elseif (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File')) { $infoOnClick = 'top.launchView( \'_FILE\', \'' . $fullIdentifier . '\');return false;'; } $cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>'; } else { $cells['info'] = IconUtility::getSpriteIcon('empty-empty'); } // delete the file if ($fileOrFolderObject->checkActionPermission('delete')) { $identifier = $fileOrFolderObject->getIdentifier(); if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)'); } else { $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)'); } if ($GLOBALS['BE_USER']->jsConfirmation(4)) { $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')'; } else { $confirmationCheck = '1 == 1'; } $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};'; $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; } else { $cells['delete'] = IconUtility::getSpriteIcon('empty-empty'); } // Hook for manipulating edit icons. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) { $cells['__fileOrFolderObject'] = $fileOrFolderObject; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Filelist\FileListEditIconHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797); } $hookObject->manipulateEditIcons($cells, $this); } unset($cells['__fileOrFolderObject']); } // Compile items into a DIV-element: return ' <!-- EDIT CONTROLS: --> <div class="typo3-editCtrl"> ' . implode(' ', $cells) . ' </div>'; }
/** * Render list header * * @param string $table Table * @param array $currentIdList Current id list * @param array $headerColumns Header columns * @param Tx_Commerce_ViewHelpers_CategoryRecordList $parentObject Parent * * @return array */ public function renderListHeader($table, $currentIdList, $headerColumns, &$parentObject) { $language = $this->getLanguageService(); if (get_class($parentObject) == 'Tx_Commerce_ViewHelpers_OrderRecordList') { $icon = ''; foreach ($parentObject->fieldArray as $fCol) { // Calculate users permissions to edit records in the table: $permsEdit = $parentObject->calcPerms & ($table == 'pages' ? 2 : 16); switch ((string) $fCol) { // Path case '_PATH_': $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_', 1) . ']</i>'; break; // References // References case '_REF_': $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_', 1) . ']</i>'; break; // Path // Path case '_LOCALIZATION_': $headerColumns[$fCol] = '<i>[' . $language->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_', 1) . ']</i>'; break; // Path // Path case '_LOCALIZATION_b': $headerColumns[$fCol] = $language->getLL('Localize', 1); break; // Clipboard: // Clipboard: case '_CLIPBOARD_': if ($parentObject->id && !$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']) { $headerColumns[$fCol] = $language->getLL('moveorderto'); } else { $headerColumns[$fCol] = ''; } break; // Control panel: // Control panel: case '_CONTROL_': if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) { // If new records can be created on this page, add links: if ($parentObject->calcPerms & ($table == 'pages' ? 8 : 16) && $parentObject->showNewRecLink($table)) { if ($table == 'pages') { $sprite = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new'); } else { $sprite = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new'); } if ($table == 'tt_content' && $parentObject->newWizards) { // If mod.web_list.newContentWiz.overrideWithExtension is set, // use that extension's create new content wizard instead: $tmpTypoScript = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($parentObject->id, 'mod.web_list'); $tmpTypoScript = $tmpTypoScript['properties']['newContentWiz.']['overrideWithExtension']; $newContentWizScriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($tmpTypoScript) ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($tmpTypoScript) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php'; $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $parentObject->id . '\');') . '" title="' . $language->getLL('new', TRUE) . '">' . $sprite . '</a>'; } elseif ($table == 'pages' && $parentObject->newWizards) { $icon = '<a href="' . htmlspecialchars($parentObject->backPath . 'db_new.php?id=' . $parentObject->id . '&pagesOnly=1&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '" title="' . $language->getLL('new', TRUE) . '">' . $sprite . '</a>'; } else { $params = '&edit[' . $table . '][' . $parentObject->id . ']=new'; if ($table == 'pages_language_overlay') { $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $parentObject->pageRow['doktype']; } $icon = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . $language->getLL('new', TRUE) . '">' . $sprite . '</a>'; } } // If the table can be edited, add link for editing // ALL SHOWN fields for all listed records: if ($permsEdit && $parentObject->table && is_array($currentIdList)) { $editIdList = implode(',', $currentIdList); if ($parentObject->clipNumPane()) { $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'"; } $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $parentObject->fieldArray) . '&disHelp=1'; $icon .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . $language->getLL('editShownColumns', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } // add an empty entry, so column count fits again after moving this into $icon $headerColumns[$fCol] = ' '; } break; // space column // space column case '_AFTERCONTROL_': // space column // space column case '_AFTERREF_': $headerColumns[$fCol] = ' '; break; // Regular fields header: // Regular fields header: default: $headerColumns[$fCol] = ''; if ($parentObject->table && is_array($currentIdList)) { // If the numeric clipboard pads are selected, show duplicate sorting link: if ($parentObject->clipNumPane()) { $headerColumns[$fCol] .= '<a href="' . htmlspecialchars($parentObject->listURL('', -1) . '&duplicateField=' . $fCol) . '" title="' . $language->getLL('clip_duplicates', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>'; } // If the table can be edited, add link for // editing THIS field for all listed records: if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) { $editIdList = implode(',', $currentIdList); if ($parentObject->clipNumPane()) { $editIdList = "'+editList('" . $table . "','" . $editIdList . "')+'"; } $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1'; $iTitle = sprintf($language->getLL('editThisColumn'), rtrim(trim($language->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($table, $fCol))), ':')); $headerColumns[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $parentObject->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } } $headerColumns[$fCol] .= $parentObject->addSortLink($language->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($table, $fCol, 'LLL:EXT:commerce/Resources/Private/Language/locallang_mod_orders.xml:|')), $fCol, $table); } } } return $headerColumns; }
/** * 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. * @todo Define visibility */ public function adminLinks($table, $row) { // Edit link: $adminLink = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; // Delete link: $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</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 acccess checks: $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list'); $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule); $adminLink .= '<a href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'' . $pageModule . '\'); return false;">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; $adminLink .= '<a href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . IconUtility::getSpriteIcon('actions-system-list-open') . '</a>'; // "View page" icon is added: $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], $this->doc->backPath, BackendUtility::BEgetRootLine($row['uid']))) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } else { if ($row['pid'] == -1) { $getVars = '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid']; // "View page" icon is added: $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], $this->doc->backPath, BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } } return $adminLink; }
/** * [Describe function...] * * @param array $row * @param array $conf * @param string $table * @return string * @todo Define visibility */ public function resultRowDisplay($row, $conf, $table) { static $even = FALSE; $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $SET = $GLOBALS['SOBE']->MOD_SETTINGS; $out = '<tr class="bgColor' . ($even ? '6' : '4') . '">'; $even = !$even; foreach ($row as $fN => $fV) { if (GeneralUtility::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') { if ($SET['search_result_labels']) { $fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />'); } else { $fVnew = htmlspecialchars($fV); } $out .= '<td>' . $fVnew . '</td>'; } } $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $out .= '<td nowrap>'; if (!$row['deleted']) { $out .= '<a href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ',\'' . $GLOBALS['BACK_PATH'] . '\');return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-dialog-information') . '</a>'; $out .= '<a href="#" onClick="' . BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], GeneralUtility::getIndpEnv('REQUEST_URI') . GeneralUtility::implodeArrayForUrl('SET', (array) GeneralUtility::_POST('SET'))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } else { $out .= '<a href="' . GeneralUtility::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => GeneralUtility::linkThisScript(array()))) . BackendUtility::getUrlToken('tceAction') . '">'; $out .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-restore', array('title' => 'undelete only')) . '</a>'; $out .= '<a href="' . GeneralUtility::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => GeneralUtility::linkThisUrl('alt_doc.php', array('edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 'returnUrl' => GeneralUtility::linkThisScript(array()))))) . BackendUtility::getUrlToken('tceAction') . '">'; $out .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-restore-edit', array('title' => 'undelete and edit')) . '</a>'; } $_params = array($table => $row); if (is_array($this->hookArray['additionalButtons'])) { foreach ($this->hookArray['additionalButtons'] as $_funcRef) { $out .= GeneralUtility::callUserFunction($_funcRef, $_params, $this); } } $out .= '</td> </tr> '; return $out; }
/** * 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); } } } }
/** * Creates the onclick event for the insert-icons. * * TSconfig mod.web_list.newPageWiz.overrideWithExtension may contain an extension which provides a module * to be used instead of the normal create new page wizard. * * @param int $pid The pid. * @param int $newPagePID New page id. * @return string Onclick attribute content */ public function onClickEvent($pid, $newPagePID) { $TSconfigProp = $this->getModConfig($newPagePID); if ($TSconfigProp['overrideWithExtension']) { if (ExtensionManagementUtility::isLoaded($TSconfigProp['overrideWithExtension'])) { $onclick = 'window.location.href=' . GeneralUtility::quoteJSvalue(ExtensionManagementUtility::extRelPath($TSconfigProp['overrideWithExtension']) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid) . ';'; return $onclick; } } $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1'; return BackendUtility::editOnClick($params, '', $this->R_URI); }
/** * Shows user's info and categories * * @return string HTML showing user's info and the categories */ function cmd_displayUserInfo() { $uid = intval(GeneralUtility::_GP('uid')); $indata = GeneralUtility::_GP('indata'); $table = GeneralUtility::_GP('table'); $mmTable = $GLOBALS["TCA"][$table]['columns']['module_sys_dmail_category']['config']['MM']; if (GeneralUtility::_GP('submit')) { $indata = GeneralUtility::_GP('indata'); if (!$indata) { $indata['html'] = 0; } } switch ($table) { case 'tt_address': // see fe_users // see fe_users case 'fe_users': if (is_array($indata)) { $data = array(); if (is_array($indata['categories'])) { reset($indata['categories']); foreach ($indata["categories"] as $recValues) { $enabled = array(); foreach ($recValues as $k => $b) { if ($b) { $enabled[] = $k; } } $data[$table][$uid]['module_sys_dmail_category'] = implode(',', $enabled); } } $data[$table][$uid]['module_sys_dmail_html'] = $indata['html'] ? 1 : 0; /* @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */ $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tce->start($data, array()); $tce->process_datamap(); } break; default: // do nothing } switch ($table) { case 'tt_address': $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('tt_address.*', 'tt_address LEFT JOIN pages ON pages.uid=tt_address.pid', 'tt_address.uid=' . intval($uid) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('tt_address') . BackendUtility::deleteClause('tt_address')); break; case 'fe_users': $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('fe_users.*', 'fe_users LEFT JOIN pages ON pages.uid=fe_users.pid', 'fe_users.uid=' . intval($uid) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('fe_users') . BackendUtility::deleteClause('fe_users')); break; default: // do nothing } $row = array(); if ($res) { $row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res); $GLOBALS["TYPO3_DB"]->sql_free_result($res); } $theOutput = ""; if (is_array($row)) { $categories = ''; $resCat = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('uid_foreign', $mmTable, 'uid_local=' . $row['uid']); while ($rowCat = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($resCat)) { $categories .= $rowCat['uid_foreign'] . ','; } $categories = rtrim($categories, ","); $GLOBALS["TYPO3_DB"]->sql_free_result($resCat); $editParameters = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $out = ''; $out .= $this->iconFactory->getIconForRecord($table, $row)->render() . htmlspecialchars($row['name'] . ' <' . $row['email'] . '>'); $out .= ' <a href="#" onClick="' . BackendUtility::editOnClick($editParameters, $GLOBALS["BACK_PATH"], '') . '" title="' . $this->getLanguageService()->getLL("dmail_edit") . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) . $this->getLanguageService()->getLL('dmail_edit') . '</b></a>'; $theOutput = $this->doc->section($this->getLanguageService()->getLL('subscriber_info'), $out); $out = ''; $this->categories = DirectMailUtility::makeCategories($table, $row, $this->sys_language_uid); foreach ($this->categories as $pKey => $pVal) { $out .= '<input type="hidden" name="indata[categories][' . $row['uid'] . '][' . $pKey . ']" value="0" />' . '<input type="checkbox" name="indata[categories][' . $row['uid'] . '][' . $pKey . ']" value="1"' . (GeneralUtility::inList($categories, $pKey) ? ' checked="checked"' : '') . ' /> ' . htmlspecialchars($pVal) . '<br />'; } $out .= '<br /><br /><input type="checkbox" name="indata[html]" value="1"' . ($row['module_sys_dmail_html'] ? ' checked="checked"' : '') . ' /> '; $out .= $this->getLanguageService()->getLL('subscriber_profile_htmlemail') . '<br />'; $out .= '<input type="hidden" name="table" value="' . $table . '" />' . '<input type="hidden" name="uid" value="' . $uid . '" />' . '<input type="hidden" name="CMD" value="' . $this->CMD . '" /><br />' . '<input type="submit" name="submit" value="' . htmlspecialchars($this->getLanguageService()->getLL('subscriber_profile_update')) . '" />'; $theOutput .= '<div style="padding-top: 20px;"></div>'; $theOutput .= $this->doc->section($this->getLanguageService()->getLL('subscriber_profile'), $this->getLanguageService()->getLL('subscriber_profile_instructions') . '<br /><br />' . $out); } return $theOutput; }
/** * 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; }
/** * Creates onclick-attribute content for a new content element * * @param int $id Page id where to create the element. * @param int $colPos Preset: Column position value * @param int $sys_language Preset: Sys langauge value * @return string String for onclick attribute. * @see getTable_tt_content() */ public function newContentElementOnClick($id, $colPos, $sys_language) { if ($this->option_newWizard) { $tsConfig = BackendUtility::getModTSconfig($id, 'mod'); $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override']) ? $tsConfig['properties']['newContentElementWizard.']['override'] : 'new_content_element'; $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($moduleName) . '&id=' . $id . '&colPos=' . $colPos . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';'; } else { $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]=' . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language); } return $onClick; }
/** * Displays one line of the broken links table * * @param string $table Name of database table * @param array $row Record row to be processed * @param array $brokenLinksItemTemplate Markup of the template to be used * @return string HTML of the rendered row */ protected function renderTableRow($table, array $row, $brokenLinksItemTemplate) { $markerArray = array(); $fieldName = ''; // Restore the linktype object $hookObj = $this->hookObjectsArr[$row['link_type']]; // Construct link to edit the content element $requestUri = GeneralUtility::getIndpEnv('REQUEST_URI') . '&id=' . $this->pObj->id . '&search_levels=' . $this->searchLevel; $actionLink = '<a href="#" onclick="'; $actionLink .= htmlspecialchars(BackendUtility::editOnClick('&edit[' . $table . '][' . $row['record_uid'] . ']=edit', '', $requestUri)); $actionLink .= '" title="' . $this->getLanguageService()->getLL('list.edit') . '">'; $actionLink .= IconUtility::getSpriteIcon('actions-document-open'); $actionLink .= '</a>'; $elementHeadline = $row['headline']; if (empty($elementHeadline)) { $elementHeadline = '<i>' . $this->getLanguageService()->getLL('list.no.headline') . '</i>'; } // Get the language label for the field from TCA if ($GLOBALS['TCA'][$table]['columns'][$row['field']]['label']) { $fieldName = $this->getLanguageService()->sL($GLOBALS['TCA'][$table]['columns'][$row['field']]['label']); // Crop colon from end if present if (substr($fieldName, '-1', '1') === ':') { $fieldName = substr($fieldName, '0', strlen($fieldName) - 1); } } // Fallback, if there is no label $fieldName = !empty($fieldName) ? $fieldName : $row['field']; // column "Element" $element = IconUtility::getSpriteIconForRecord($table, $row, array('title' => $table . ':' . $row['record_uid'])); $element .= $elementHeadline; $element .= ' ' . sprintf($this->getLanguageService()->getLL('list.field'), $fieldName); $markerArray['actionlink'] = $actionLink; $markerArray['path'] = BackendUtility::getRecordPath($row['record_pid'], '', 0, 0); $markerArray['element'] = $element; $markerArray['headlink'] = $row['link_title']; $markerArray['linktarget'] = $hookObj->getBrokenUrl($row); $response = unserialize($row['url_response']); if ($response['valid']) { $linkMessage = '<span class="valid">' . $this->getLanguageService()->getLL('list.msg.ok') . '</span>'; } else { $linkMessage = '<span class="error">' . $hookObj->getErrorMessage($response['errorParams']) . '</span>'; } $markerArray['linkmessage'] = $linkMessage; $lastRunDate = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['last_check']); $lastRunTime = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row['last_check']); $markerArray['lastcheck'] = sprintf($this->getLanguageService()->getLL('list.msg.lastRun'), $lastRunDate, $lastRunTime); // Return the table html code as string return HtmlParser::substituteMarkerArray($brokenLinksItemTemplate, $markerArray, '###|###', TRUE, TRUE); }
/** * The main processing method if this class * * @return string Information of the template status or the taken actions as HTML string */ public function main() { $lang = $this->getLanguageService(); $lang->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_info.xlf'); $this->pObj->MOD_MENU['includeTypoScriptFileContent'] = TRUE; $e = $this->pObj->e; // Checking for more than one template an if, set a menu... $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage']; } // Initialize $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); $tplRow = $GLOBALS['tplRow']; $saveId = 0; if ($existTemplate) { $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; } // Create extension template $newId = $this->pObj->createTemplate($this->pObj->id, $saveId); if ($newId) { // Switch to new template $urlParameters = array('id' => $this->pObj->id, 'SET[templatesOnPage]' => $newId); $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters); HttpUtility::redirect($aHref); } $tce = NULL; $theOutput = ''; if ($existTemplate) { // Update template ? $POST = GeneralUtility::_POST(); if ($POST['submit'] || MathUtility::canBeInterpretedAsInteger($POST['submit_x']) && MathUtility::canBeInterpretedAsInteger($POST['submit_y']) || $POST['saveclose'] || MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) { // Set the data to be saved $recData = array(); $alternativeFileName = array(); if (is_array($POST['data'])) { foreach ($POST['data'] as $field => $val) { switch ($field) { case 'constants': case 'config': $recData['sys_template'][$saveId][$field] = $val; break; } } } if (!empty($recData)) { $recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]); // Create new tce-object $tce = GeneralUtility::makeInstance(DataHandler::class); $tce->stripslashes_values = FALSE; $tce->alternativeFileName = $alternativeFileName; // Initialize $tce->start($recData, array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd('all'); // tce were processed successfully $this->tce_processed = TRUE; // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); $tplRow = $GLOBALS['tplRow']; // reload template menu $manyTemplatesMenu = $this->pObj->templateMenu(); } } // Hook post updating template/TCE processing if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) { $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook']; if (is_array($postTCEProcessingHook)) { $hookParameters = array('POST' => $POST, 'tce' => $tce); foreach ($postTCEProcessingHook as $hookFunction) { GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } $content = '<a href="#" class="t3-js-clickmenutrigger" data-table="sys_template" data-uid="' . $tplRow['uid'] . '" data-listframe="1">' . IconUtility::getSpriteIconForRecord('sys_template', $tplRow) . '</a><strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : ''); $theOutput .= $this->pObj->doc->section($lang->getLL('templateInformation'), $content, 0, 1); if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu); } $theOutput .= $this->pObj->doc->spacer(10); $numberOfRows = 35; // If abort pressed, nothing should be edited: if ($POST['saveclose'] || MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) { unset($e); } if (isset($e['constants'])) { $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="text-monospace enable-tab"' . $this->pObj->doc->formWidth(48, TRUE, 'width:98%;height:70%') . ' class="text-monospace">' . htmlspecialchars($tplRow['constants']) . '</textarea>'; $outCode .= '<input type="hidden" name="e[constants]" value="1">'; // Display "Include TypoScript file content?" checkbox $outCode .= '<div class="checkbox"><label for="checkIncludeTypoScriptFileContent">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[constants]=1', 'id="checkIncludeTypoScriptFileContent"'); $outCode .= $lang->getLL('includeTypoScriptFileContent') . '</label></div><br />'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($lang->getLL('constants'), '', TRUE); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } if (isset($e['config'])) { $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="text-monospace enable-tab"' . $this->pObj->doc->formWidth(48, TRUE, 'width:98%;height:70%') . ' class="text-monospace">' . htmlspecialchars($tplRow['config']) . '</textarea>'; $outCode .= '<input type="hidden" name="e[config]" value="1">'; // Display "Include TypoScript file content?" checkbox $outCode .= '<div class="checkbox"><label for="checkIncludeTypoScriptFileContent">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[config]=1', 'id="checkIncludeTypoScriptFileContent"'); $outCode .= $lang->getLL('includeTypoScriptFileContent') . '</label></div><br />'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($lang->getLL('setup'), '', TRUE); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } // Processing: $outCode = ''; $outCode .= $this->tableRow($lang->getLL('title'), htmlspecialchars($tplRow['title']), 'title', $tplRow['uid']); $outCode .= $this->tableRow($lang->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle', $tplRow['uid']); $outCode .= $this->tableRow($lang->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description', $tplRow['uid']); $outCode .= $this->tableRow($lang->getLL('constants'), sprintf($lang->getLL('editToView'), trim($tplRow['constants']) ? count(explode(LF, $tplRow['constants'])) : 0), 'constants', $tplRow['uid']); $outCode .= $this->tableRow($lang->getLL('setup'), sprintf($lang->getLL('editToView'), trim($tplRow['config']) ? count(explode(LF, $tplRow['config'])) : 0), 'config', $tplRow['uid']); $outCode = '<div class="table-fit"><table class="table table-striped table-hover">' . $outCode . '</table></div>'; // Edit all icon: $editOnClick = BackendUtility::editOnClick('&createExtension=0&edit[sys_template][' . $tplRow['uid'] . ']=edit'); $icon = IconUtility::getSpriteIcon('actions-document-open', array('title' => $lang->getLL('editTemplateRecord'))) . $lang->getLL('editTemplateRecord'); $outCode .= '<br /><a href="#" onclick="' . htmlspecialchars($editOnClick) . '"><strong>' . $icon . '</strong></a>'; $theOutput .= $this->pObj->doc->section('', $outCode); // hook after compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) { $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook']; if (is_array($postOutputProcessingHook)) { $hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows); foreach ($postOutputProcessingHook as $hookFunction) { GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } } else { $theOutput .= $this->pObj->noTemplate(1); } return $theOutput; }
/** * Draw header for a content element column: * * @param string $colName Column name * @param string $editParams Edit params (Syntax: &edit[...] for alt_doc.php) * @param PageLayoutView $parentObject * * @return string HTML table */ function tt_content_drawColHeader($colName, $editParams, &$parentObject) { $icons = ''; // Create command links: if ($parentObject->tt_contentConfig['showCommands']) { // Edit whole of column: if ($editParams) { $icons .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams, $parentObject->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('editColumn', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } $icons .= '<a href="#" class="toggle-content toggle-up" title="' . $this->lang->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_togglecontent') . '">' . IconUtility::getSpriteIcon('actions-move-to-top') . '</a>'; $icons .= '<a href="#" class="toggle-content toggle-down" title="' . $this->lang->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_togglecontent') . '">' . IconUtility::getSpriteIcon('actions-move-to-bottom') . '</a>'; } if (strlen($icons)) { $icons = '<div class="t3-page-colHeader-icons">' . $icons . '</div>'; } // Create header row: $out = '<div class="t3-page-colHeader t3-row-header"> ' . $icons . ' <div class="t3-page-colHeader-label">' . htmlspecialchars($colName) . '</div> </div>'; return $out; }
/** * Rendering the localization information table. * * @param array $tree The Page tree data * @return string HTML for the localization information table. * @todo Define visibility */ public function renderL10nTable(&$tree) { global $LANG; // System languages retrieved: $languages = $this->getSystemLanguages(); // Title length: $titleLen = $GLOBALS['BE_USER']->uc['titleLen']; // Put together the TREE: $output = ''; $newOL_js = array(); $langRecUids = array(); foreach ($tree->tree as $data) { $tCells = array(); $langRecUids[0][] = $data['row']['uid']; // Page icons / titles etc. $tCells[] = '<td' . ($data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '') . '>' . $data['HTML'] . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($data['row']['title'], $titleLen)) . ((string) $data['row']['nav_title'] !== '' ? ' [Nav: <em>' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($data['row']['nav_title'], $titleLen)) . '</em>]' : '') . '</td>'; // DEFAULT language: // "View page" link is created: $viewPageLink = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($data['row']['uid'], $GLOBALS['BACK_PATH'], '', '', '', '&L=###LANG_UID###')) . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_viewPage') . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; $status = $data['row']['l18n_cfg'] & 1 ? 'c-blocked' : 'c-ok'; // Create links: $info = ''; $editUid = $data['row']['uid']; $params = '&edit[pages][' . $editUid . ']=edit'; $info .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_editDefaultLanguagePage') . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; $info .= '<a href="#" onclick="' . htmlspecialchars('top.loadEditId(' . (int) $data['row']['uid'] . ',"&SET[language]=0"); return false;') . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_editPage') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; $info .= str_replace('###LANG_UID###', '0', $viewPageLink); $info .= ' '; $info .= $data['row']['l18n_cfg'] & 1 ? '<span title="' . $LANG->sL('LLL:EXT:cms/locallang_tca.xlf:pages.l18n_cfg.I.1', TRUE) . '">D</span>' : ' '; $info .= \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated($data['row']['l18n_cfg']) ? '<span title="' . $LANG->sL('LLL:EXT:cms/locallang_tca.xlf:pages.l18n_cfg.I.2', TRUE) . '">N</span>' : ' '; // Put into cell: $tCells[] = '<td class="' . $status . ' c-leftLine">' . $info . '</td>'; $tCells[] = '<td class="' . $status . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_CEcount') . '" align="center">' . $this->getContentElementCount($data['row']['uid'], 0) . '</td>'; $modSharedTSconfig = BackendUtility::getModTSconfig($data['row']['uid'], 'mod.SHARED'); $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages']) ? \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], TRUE) : array(); // Traverse system languages: foreach ($languages as $langRow) { if ($this->pObj->MOD_SETTINGS['lang'] == 0 || (int) $this->pObj->MOD_SETTINGS['lang'] === (int) $langRow['uid']) { $row = $this->getLangStatus($data['row']['uid'], $langRow['uid']); $info = ''; if (is_array($row)) { $langRecUids[$langRow['uid']][] = $row['uid']; $status = $row['_HIDDEN'] ? \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated($data['row']['l18n_cfg']) || $data['row']['l18n_cfg'] & 1 ? 'c-blocked' : 'c-fallback' : 'c-ok'; $icon = IconUtility::getSpriteIconForRecord('pages_language_overlay', $row, array('class' => 'c-recIcon')); $info = $icon . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $titleLen)) . ((string) $row['nav_title'] !== '' ? ' [Nav: <em>' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['nav_title'], $titleLen)) . '</em>]' : '') . ($row['_COUNT'] > 1 ? '<div>' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_badThingThereAre') . '</div>' : ''); $tCells[] = '<td class="' . $status . ' c-leftLine">' . $info . '</td>'; // Edit whole record: $info = ''; $editUid = $row['uid']; $params = '&edit[pages_language_overlay][' . $editUid . ']=edit'; $info .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_editLanguageOverlayRecord') . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; $info .= '<a href="#" onclick="' . htmlspecialchars('top.loadEditId(' . (int) $data['row']['uid'] . ',"&SET[language]=' . $langRow['uid'] . '"); return false;') . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_editPageLang') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; $info .= str_replace('###LANG_UID###', $langRow['uid'], $viewPageLink); $tCells[] = '<td class="' . $status . '">' . $info . '</td>'; $tCells[] = '<td class="' . $status . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_CEcount') . '" align="center">' . $this->getContentElementCount($data['row']['uid'], $langRow['uid']) . '</td>'; } else { if (in_array($langRow['uid'], $disableLanguages)) { // Language has been disabled for this page $status = 'c-blocked'; $info = ''; } else { $status = \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated($data['row']['l18n_cfg']) || $data['row']['l18n_cfg'] & 1 ? 'c-blocked' : 'c-fallback'; $info = '<input type="checkbox" name="newOL[' . $langRow['uid'] . '][' . $data['row']['uid'] . ']" value="1" />'; $newOL_js[$langRow['uid']] .= ' +(document.webinfoForm[\'newOL[' . $langRow['uid'] . '][' . $data['row']['uid'] . ']\'].checked ? \'&edit[pages_language_overlay][' . $data['row']['uid'] . ']=new\' : \'\') '; } $tCells[] = '<td class="' . $status . ' c-leftLine"> </td>'; $tCells[] = '<td class="' . $status . '"> </td>'; $tCells[] = '<td class="' . $status . '">' . $info . '</td>'; } } } $output .= ' <tr class="bgColor4"> ' . implode(' ', $tCells) . ' </tr>'; } // Put together HEADER: $tCells = array(); $tCells[] = '<td>' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_page') . ':</td>'; if (is_array($langRecUids[0])) { $params = '&edit[pages][' . implode(',', $langRecUids[0]) . ']=edit&columnsOnly=title,nav_title,l18n_cfg,hidden'; $editIco = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_editPageProperties') . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>'; } else { $editIco = ''; } $tCells[] = '<td class="c-leftLine" colspan="2">' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_default') . ':' . $editIco . '</td>'; foreach ($languages as $langRow) { if ($this->pObj->MOD_SETTINGS['lang'] == 0 || (int) $this->pObj->MOD_SETTINGS['lang'] === (int) $langRow['uid']) { // Title: $tCells[] = '<td class="c-leftLine">' . htmlspecialchars($langRow['title']) . '</td>'; // Edit language overlay records: if (is_array($langRecUids[$langRow['uid']])) { $params = '&edit[pages_language_overlay][' . implode(',', $langRecUids[$langRow['uid']]) . ']=edit&columnsOnly=title,nav_title,hidden'; $tCells[] = '<td><a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_renderl10n_editLangOverlays') . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a></td>'; } else { $tCells[] = '<td> </td>'; } // Create new overlay records: $params = '\'' . $newOL_js[$langRow['uid']] . '+\'&columnsOnly=title,hidden,sys_language_uid&defVals[pages_language_overlay][sys_language_uid]=' . $langRow['uid']; $tCells[] = '<td><a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'])) . '" title="' . $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:lang_getlangsta_createNewTranslationHeaders') . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a></td>'; } } $output = ' <tr class="t3-row-header"> ' . implode(' ', $tCells) . ' </tr>' . $output; $output = ' <table border="0" cellspacing="0" cellpadding="0" id="langTable" class="typo3-dblist">' . $output . ' </table>'; return $output; }
/** * This returns tablerows for the files in the array $items['sorting']. * * @param File[] $files File items * @return string HTML table rows. */ public function formatFileList(array $files) { $out = ''; // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages" $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages(); $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) { if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) { return FALSE; } else { return TRUE; } }); foreach ($files as $fileObject) { // Initialization $this->counter++; $this->totalbytes += $fileObject->getSize(); $ext = $fileObject->getExtension(); $fileName = trim($fileObject->getName()); // The icon with link $theIcon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileName . ' [' . (int) $fileObject->getUid() . ']')); if ($this->clickMenus) { $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier()); } // Preparing and getting the data-array $theData = array(); foreach ($this->fieldArray as $field) { switch ($field) { case 'size': $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', TRUE)); break; case 'rw': $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', TRUE) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', TRUE) . '</strong>'); break; case 'fileext': $theData[$field] = strtoupper($ext); break; case 'tstamp': $theData[$field] = BackendUtility::date($fileObject->getModificationTime()); break; case '_CONTROL_': $theData[$field] = $this->makeEdit($fileObject); break; case '_CLIPBOARD_': $theData[$field] = $this->makeClip($fileObject); break; case '_LOCALIZATION_': if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) { $metaDataRecord = $fileObject->_getMetaData(); $translations = $this->getTranslationsForMetaData($metaDataRecord); $languageCode = ''; foreach ($systemLanguages as $language) { $languageId = $language['uid']; $flagIcon = $language['flagIcon']; if (array_key_exists($languageId, $translations)) { $flagButtonIcon = IconUtility::getSpriteIcon('actions-document-open', array('title' => sprintf($GLOBALS['LANG']->getLL('editMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array())); $data = array('sys_file_metadata' => array($translations[$languageId]['uid'] => 'edit')); $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl()); $languageCode .= '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '">' . $flagButtonIcon . '</a>'; } else { $parameters = ['justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId, 'returnUrl' => $this->listURL()]; $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters, $this->backPath) . BackendUtility::getUrlToken('editRecord'); $href = $GLOBALS['SOBE']->doc->issueCommand('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $returnUrl); $flagButtonIcon = IconUtility::getSpriteIcon($flagIcon, array('title' => sprintf($GLOBALS['LANG']->getLL('createMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array())); $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> '; } } // Hide flag button bar when not translated yet $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>'; $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay', array('title' => $GLOBALS['LANG']->getLL('translateMetadata'))) . '</a>'; } break; case '_REF_': $theData[$field] = $this->makeRef($fileObject); break; case 'file': // Edit metadata of file $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject); if ($fileObject->isMissing()) { $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject); $theData[$field] .= $flashMessage->render(); // Thumbnails? } elseif ($this->thumbs && $this->isImage($ext)) { $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array()); if ($processedFile) { $thumbUrl = $processedFile->getPublicUrl(TRUE); $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />'; } } break; default: $theData[$field] = ''; if ($fileObject->hasProperty($field)) { $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL)); } } } $out .= $this->addelement(1, $theIcon, $theData); } return $out; }
/** * Main function, creating content in the frame * * @return void * @todo Define visibility */ public function main() { // By default, 5 groups are set $this->groupLabels = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1); $bookmarkGroups = $GLOBALS['BE_USER']->getTSConfigProp('options.bookmarkGroups'); if (is_array($bookmarkGroups) && count($bookmarkGroups)) { foreach ($bookmarkGroups as $k => $v) { if (strcmp('', $v) && strcmp('0', $v)) { $this->groupLabels[$k] = (string) $v; } elseif ($GLOBALS['BE_USER']->isAdmin()) { unset($this->groupLabels[$k]); } } } // List of global groups that will be loaded. All global groups have negative IDs. $globalGroups = -100; // Group -100 is kind of superglobal and can't be changed. if (count($this->groupLabels)) { $globalGroups .= ',' . implode(',', array_keys($this->groupLabels)); $globalGroups = str_replace(',', ',-', $globalGroups); } // Fetching shortcuts to display for this user: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_be_shortcuts', '((userid=' . $GLOBALS['BE_USER']->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . $globalGroups . '))', '', 'sc_group,sorting'); // Init vars: $this->lines = array(); $this->linesPre = array(); $this->editSC_rec = ''; $this->selOpt = array(); $formerGr = ''; // Traverse shortcuts while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $mParts = explode('|', $row['module_name']); $row['module_name'] = $mParts[0]; $row['M_module_name'] = $mParts[1]; $mParts = explode('_', $row['M_module_name'] ? $row['M_module_name'] : $row['module_name']); $qParts = parse_url($row['url']); if (!$GLOBALS['BE_USER']->isAdmin()) { // Check for module access if (!isset($GLOBALS['LANG']->moduleLabels['tabs_images'][implode('_', $mParts) . '_tab'])) { // Nice hack to check if the user has access to this module - otherwise the translation label would not have been loaded :-) continue; } $page_id = $this->getLinkedPageId($row['url']); if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($page_id)) { // Check for webmount access if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) { continue; } // Check for record access $pageRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $page_id); if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) { continue; } } } if ($this->editSC && $row['uid'] == $this->editSC) { $this->editSC_rec = $row; } $sc_group = $row['sc_group']; if ($sc_group && strcmp($formerGr, $sc_group)) { if ($sc_group != -100) { if ($this->groupLabels[abs($sc_group)] && strcmp('1', $this->groupLabels[abs($sc_group)])) { $label = $this->groupLabels[abs($sc_group)]; } else { $label = $GLOBALS['LANG']->getLL('shortcut_group_' . abs($sc_group), 1); // Fallback label if (!$label) { $label = $GLOBALS['LANG']->getLL('shortcut_group', 1) . ' ' . abs($sc_group); } } if ($sc_group >= 0) { $onC = 'if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('bookmark_delAllInCat')) . ')){window.location.href=\'alt_shortcut.php?deleteCategory=' . $sc_group . '\';}return false;'; $this->linesPre[] = '<td> </td><td class="bgColor5"><a href="#" onclick="' . htmlspecialchars($onC) . '" title="' . $GLOBALS['LANG']->getLL('bookmark_delAllInCat', 1) . '">' . $label . '</a></td>'; } else { // Fallback label $label = $GLOBALS['LANG']->getLL('bookmark_global', 1) . ': ' . ($label ? $label : abs($sc_group)); $this->lines[] = '<td> </td><td class="bgColor5">' . $label . '</td>'; } unset($label); } } $bgColorClass = $row['uid'] == $this->editSC ? 'bgColor5' : ($row['sc_group'] < 0 ? 'bgColor6' : 'bgColor4'); if ($row['description'] && $row['uid'] != $this->editSC) { $label = $row['description']; } else { $label = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(rawurldecode($qParts['query']), 150); } $titleA = $this->itemLabel($label, $row['module_name'], $row['M_module_name']); $editSH = $row['sc_group'] >= 0 || $GLOBALS['BE_USER']->isAdmin() ? 'editSh(' . intval($row['uid']) . ');' : 'alert(\'' . $GLOBALS['LANG']->getLL('bookmark_onlyAdmin') . '\')'; $jumpSC = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $mParts) . '\',\'' . $mParts[0] . '\');'; $onC = 'if (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){' . $editSH . '}else{' . $jumpSC . '}return false;'; // user defined groups show up first if ($sc_group >= 0) { $this->linesPre[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>'; } else { $this->lines[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>'; } if (trim($row['description'])) { $kkey = strtolower(substr($row['description'], 0, 20)) . '_' . $row['uid']; $this->selOpt[$kkey] = '<option value="' . htmlspecialchars($jumpSC) . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['description'], 50)) . '</option>'; } $formerGr = $row['sc_group']; } ksort($this->selOpt); array_unshift($this->selOpt, '<option>[' . $GLOBALS['LANG']->getLL('bookmark_selSC', 1) . ']</option>'); $this->editLoadedFunc(); $this->editPageIdFunc(); if (!$this->editLoaded && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) { $editIdCode = '<td nowrap="nowrap">' . $GLOBALS['LANG']->getLL('bookmark_editID', 1) . ': <input type="text" value="' . ($this->editError ? htmlspecialchars($this->editPage) : '') . '" name="editPage"' . $this->doc->formWidth(15) . ' onchange="submitEditPage(this.value);" />' . ($this->editError ? ' <strong><span class="typo3-red">' . htmlspecialchars($this->editError) . '</span></strong>' : '') . (is_array($this->theEditRec) ? ' <strong>' . $GLOBALS['LANG']->getLL('bookmark_loadEdit', 1) . ' \'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $this->theEditRec, TRUE) . '\'</strong> (' . htmlspecialchars($this->editPath) . ')' : '') . ($this->searchFor ? ' ' . $GLOBALS['LANG']->getLL('bookmark_searchFor', 1) . ' <strong>\'' . htmlspecialchars($this->searchFor) . '\'</strong>' : '') . '</td>'; } else { $editIdCode = ''; } // Adding CSH: $editIdCode .= '<td> ' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'bookmarks', $GLOBALS['BACK_PATH'], '', TRUE) . '</td>'; // Compile it all: $this->content .= ' <table border="0" cellpadding="0" cellspacing="0" width="99%"> <tr> <td> <!-- Shortcut Display Table: --> <table border="0" cellpadding="0" cellspacing="2" id="typo3-shortcuts"> <tr> '; if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks')) { $this->content .= implode(' ', $this->lines); } $this->content .= $editIdCode . ' </tr> </table> </td> <td align="right">'; if ($this->hasWorkspaceAccess()) { $this->content .= $this->workspaceSelector() . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'], '', TRUE); } $this->content .= ' </td> </tr> </table> '; // Launch Edit page: if ($this->theEditRec['uid']) { $this->content .= $this->doc->wrapScriptTags('top.loadEditId(' . $this->theEditRec['uid'] . ');'); } // Load alternative table/uid into editing form. if (count($this->alternativeTableUid) == 2 && isset($GLOBALS['TCA'][$this->alternativeTableUid[0]]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->alternativeTableUid[1])) { $JSaction = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $this->alternativeTableUid[0] . '][' . $this->alternativeTableUid[1] . ']=edit', '', 'dummy.php'); $this->content .= $this->doc->wrapScriptTags('function editArbitraryElement() { top.content.' . $JSaction . '; } editArbitraryElement();'); } // Load search for something. if ($this->searchFor) { $urlParameters = array(); $urlParameters['id'] = intval($GLOBALS['WEBMOUNTS'][0]); $urlParameters['search_field'] = $this->searchFor; $urlParameters['search_levels'] = 4; $this->content .= $this->doc->wrapScriptTags('jump(unescape("' . rawurlencode(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters, '')) . '"), "web_list", "web");'); } }