/** * Initialize editor * * @param integer $pageId * @param integer $template_uid * @return integer * @todo Define visibility */ public function initialize_editor($pageId, $template_uid = 0) { // Initializes the module. Done in this function because we may need to re-initialize if data is submitted! global $tmpl, $tplRow, $theConstants; $tmpl = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService'); // Defined global here! $tmpl->tt_track = 0; // Do not log time-performance information $tmpl->init(); $tmpl->ext_localGfxPrefix = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('tstemplate_ceditor'); $tmpl->ext_localWebGfxPrefix = $GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('tstemplate_ceditor'); // Get the row of the first VISIBLE template of the page. whereclause like the frontend. $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid); // IF there was a template... if (is_array($tplRow)) { // Gets the rootLine $sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $rootLine = $sys_page->getRootLine($pageId); // This generates the constants/config + hierarchy info for the template. $tmpl->runThroughTemplates($rootLine, $template_uid); // The editable constants are returned in an array. $theConstants = $tmpl->generateConfig_constants(); // The returned constants are sorted in categories, that goes into the $tmpl->categories array $tmpl->ext_categorizeEditableConstants($theConstants); // This array will contain key=[expanded constantname], value=linenumber in template. (after edit_divider, if any) $tmpl->ext_regObjectPositions($tplRow['constants']); return 1; } }
/** * Initializes the Module * * @return void */ public function initialize() { parent::init(); $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'mod1/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setExtDirectStateProvider(); $this->pageRenderer = $this->doc->getPageRenderer(); $this->relativePath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('recycler'); $this->pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->isCurrentUserAdmin(); //don't access in workspace if ($GLOBALS['BE_USER']->workspace !== 0) { $this->isAccessibleForCurrentUser = FALSE; } //read configuration $modTS = $GLOBALS['BE_USER']->getTSConfig('mod.recycler'); if ($this->isCurrentUserAdmin()) { $this->allowDelete = TRUE; } else { $this->allowDelete = $modTS['properties']['allowDelete'] == '1'; } if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) { $this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']); } }
/** * Renders the icon * * @param string $icon Icon to be used * @param string $title Optional title * @return strin Content rendered image */ public function render($icon, $title = '') { if (!empty($icon)) { $absIconPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFilename($icon); if (file_exists($absIconPath)) { $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath); } } else { $icon = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('reports') . 'Resources/Public/moduleicon.gif'; } $content = '<img' . \t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />'; return $content; }
/** * Main Task center module * * @return string HTML content. * @todo Define visibility */ public function main() { if ($id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display')) { return $this->urlInIframe($this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id, 1); } else { // Thumbnail folder and files: $tempDir = $this->userTempFolder(); if ($tempDir) { $thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1); } $clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames(); // Create preset links: $presets = $this->getPresets(); $opt = array(); $opt[] = ' <tr class="bgColor5 tableheader"> <td>Icon:</td> <td>Preset Title:</td> <td>Public</td> <td>Owner:</td> <td>Page:</td> <td>Path:</td> <td>Meta data:</td> </tr>'; if (is_array($presets)) { foreach ($presets as $presetCfg) { $configuration = unserialize($presetCfg['preset_data']); $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']]; $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']'; $opt[] = ' <tr class="bgColor4"> <td>' . ($thumbnailFile ? '<img src="' . $this->backPath . '../' . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile) . '" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br />' : ' ') . '</td> <td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display=' . $presetCfg['uid'] . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, 30)) . '</a> </td> <td>' . ($presetCfg['public'] ? 'Yes' : ' ') . '</td> <td>' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? 'Own' : '[' . $usernames[$presetCfg['user_uid']]['username'] . ']') . '</td> <td>' . ($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : ' ') . '</td> <td>' . htmlspecialchars($configuration['pagetree']['id'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20) : '[Single Records]') . '</td> <td> <strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . htmlspecialchars($configuration['meta']['description']) . ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . ' </td> </tr>'; } $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">' . implode('', $opt) . '</table>'; } } // Output: $theOutput .= $this->pObj->doc->spacer(5); $theOutput .= $this->pObj->doc->section('Export presets', $content, 0, 1); return $theOutput; }
/** * Shows warning message about ENABLE_INSTALL_TOOL file and a button to create this file * * @return void */ protected function showInstallToolEnableRequest() { // Create instance of object for output of data $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('install') . 'mod/mod_template.html'); $this->doc->form = '<form method="post" id="t3-install-form-unlock" action="">'; $this->doc->addStyleSheet('install', 'stylesheets/install/install.css'); $this->doc->addStyleSheet('mod-install', \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('install') . 'mod/mod_styles.css'); $markers = $buttons = array(); $markers['CONTENT'] = $this->renderMessage(); $content = $this->doc->moduleBody('', $buttons, $markers); $this->doc->postCode = '<input type="hidden" name="enableInstallTool" value="1" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('installToolEnableToken'); echo $this->doc->render('', $content); }
/** * Initialization * * @return void * @todo Define visibility */ public function init() { $this->MCONF = $GLOBALS['MCONF']; $this->menuConfig(); $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->form = '<form action="" method="post">'; $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('indexed_search') . '/mod/mod_template.html'); // JavaScript $this->doc->JScodeArray['indexed_search'] = ' script_ended = 0; function jumpToUrl(URL) { window.location.href = URL; }'; $this->doc->tableLayout = array('defRow' => array('0' => array('<td valign="top" nowrap>', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width=10 height=1></td><td valign="top" nowrap>', '</td>'))); $indexer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\IndexedSearch\\Indexer'); $indexer->initializeExternalParsers(); }
/** * Generates the module content * * @return void * @todo Define visibility */ public function moduleContent() { switch ((string) $this->MOD_SETTINGS['function']) { case 1: $content = '<div align="left"><strong>' . $GLOBALS['LANG']->getLL('referenceExplanation') . '</strong></div>'; $content .= '<p>' . $GLOBALS['LANG']->getLL('referenceExplanationDetailed') . '</p><br />'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('displayReferences'), $content, 0, 1); $this->content .= '<a href="#" onclick="vHWin=window.open(\'' . $GLOBALS['BACK_PATH'] . 'wizard_tsconfig.php?mode=tsref&P[formName]=editForm\',\'popUp\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;" title="TSref reference">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-typoscript-documentation-open') . 'TSREF</a><br />'; $this->content .= '<a href="#" onclick="vHWin=window.open(\'' . $GLOBALS['BACK_PATH'] . 'wizard_tsconfig.php?mode=beuser&P[formName]=editForm\',\'popUp\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;" title="TSref reference">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-typoscript-documentation-open') . 'USER TSCONFIG</a><br />'; $this->content .= '<a href="#" onclick="vHWin=window.open(\'' . $GLOBALS['BACK_PATH'] . 'wizard_tsconfig.php?mode=page&P[formName]=editForm\',\'popUp\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;" title="TSref reference">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-typoscript-documentation-open') . 'PAGE TSCONFIG</a><br />'; break; case 2: if ($GLOBALS['BE_USER']->user['admin']) { if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_rebuild')) { // remove all data from the database $this->purgeSQLContents(); // get all loaded extension keys $extArray = $GLOBALS['TYPO3_LOADED_EXT']; $content = '<div align="left"><strong>' . $GLOBALS['LANG']->getLL('loadedTSfrom') . '</strong></div><br />'; // parse the extension names only (no need for all details from the TYPO3_LOADED_EXT table foreach ($extArray as $extName => $dummy) { // check that the extension is really loaded (which should always be the case) if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extName)) { // extract the content.xml from the manual.sxw ZIP file $manual = $this->getZIPFileContents(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath($extName) . 'doc/manual.sxw', 'content.xml'); // check if the manual file actually exists and if the content.xml could be loaded if ($manual != '') { // if the manual file exists, proceed with the load into the SQL database $content .= '<p>Extension ' . $extName . '...'; // run the extraction processing and import the data into SQL. Return the number of TS tables found in the open office document $number = $this->loadExtensionManual($extName, $manual); // print a status message with a link to the openoffice manual $content .= $number . ' ' . $GLOBALS['LANG']->getLL('sections') . ' (<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($extName) . 'doc/manual.sxw">manual</a>)</p>'; } } else { // This should never happen! die('Fatal error : loaded extension not actually loaded? Please file a bug report at http://forge.typo3.org!'); } } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('rebuildTS'), $content . '<br />', 0, 1); // Issue warnings about duplicate or empty obj_strings, if any // An obj_string should be unique. It should appear in only one extension manual and then only once // If the sum of all occurrences of a given obj_string is more than one, issue a list of duplicate entries as a warning $duplicateWarnings = ''; $emptyWarnings = ''; foreach ($this->objStringsPerExtension as $obj_string => $extensions) { if (empty($obj_string)) { $emptyWarnings = '<p class="typo3-red">' . $GLOBALS['LANG']->getLL('warning_manualsWithoutMarkers'); foreach ($extensions as $extensionKey => $counter) { $emptyWarnings .= ' ' . $extensionKey . ' (' . $counter . ')<br />'; } $emptyWarnings .= '</p><br />'; } else { if (array_sum($extensions) > 1) { $duplicateWarnings .= $obj_string . ':'; foreach ($extensions as $extensionKey => $counter) { $duplicateWarnings .= ' ' . $extensionKey . ' (' . $counter . ')'; } $duplicateWarnings .= '<br />'; } } } $warnings = $emptyWarnings; if (!empty($duplicateWarnings)) { $warnings .= '<p class="typo3-red">' . $GLOBALS['LANG']->getLL('warning_duplicateMarkers') . '<br />' . $duplicateWarnings . '</p>'; } if (!empty($warnings)) { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('updateWarnings'), '<div>' . $warnings . '</div>', 0, 1); } } $content = '<p>' . $GLOBALS['LANG']->getLL('rebuildExplanation') . '</p><br />'; $content .= $GLOBALS['LANG']->getLL('rebuild') . ' <input type="submit" name="_rebuild" value="Rebuild" /><br />'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('rebuildTS'), $content, 0, 1); } else { $this->content .= '<p>' . $GLOBALS['LANG']->getLL('adminAccessOnly') . '</p><br />'; } break; } }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } // Add static template for Click-enlarge rendering \TYPO3\CMS\Core\Extension\ExtensionManager::addStaticFile($_EXTKEY, 'static/clickenlarge/', 'Clickenlarge Rendering'); // Add configuration of soft references on image tags in RTE content require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'hooks/softref/ext_tables.php'; // Add acronyms table $GLOBALS['TCA']['tx_rtehtmlarea_acronym'] = array('ctrl' => array('title' => 'LLL:EXT:rtehtmlarea/locallang_db.xml:TYPO3\\CMS\\Rtehtmlarea\\Extension\\Acronym', 'label' => 'term', 'default_sortby' => 'ORDER BY term', 'sortby' => 'sorting', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime'), 'dynamicConfigFile' => \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'tca.php', 'iconfile' => \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($_EXTKEY) . 'extensions/Acronym/skin/images/acronym.gif')); \TYPO3\CMS\Core\Extension\ExtensionManager::allowTableOnStandardPages('tx_rtehtmlarea_acronym'); \TYPO3\CMS\Core\Extension\ExtensionManager::addLLrefForTCAdescr('tx_rtehtmlarea_acronym', 'EXT:' . $_EXTKEY . '/locallang_csh_abbreviation.xml'); // Add contextual help files $htmlAreaRteContextHelpFiles = array('General' => 'EXT:' . $_EXTKEY . '/locallang_csh.xlf', 'Acronym' => 'EXT:' . $_EXTKEY . '/extensions/Acronym/locallang_csh.xlf', 'EditElement' => 'EXT:' . $_EXTKEY . '/extensions/EditElement/locallang_csh.xlf', 'Language' => 'EXT:' . $_EXTKEY . '/extensions/Language/locallang_csh.xlf', 'MicrodataSchema' => 'EXT:' . $_EXTKEY . '/extensions/MicrodataSchema/locallang_csh.xlf', 'PlainText' => 'EXT:' . $_EXTKEY . '/extensions/PlainText/locallang_csh.xlf', 'RemoveFormat' => 'EXT:' . $_EXTKEY . '/extensions/RemoveFormat/locallang_csh.xlf', 'TableOperations' => 'EXT:' . $_EXTKEY . '/extensions/TableOperations/locallang_csh.xlf'); foreach ($htmlAreaRteContextHelpFiles as $key => $file) { \TYPO3\CMS\Core\Extension\ExtensionManager::addLLrefForTCAdescr('xEXT_' . $_EXTKEY . '_' . $key, $file); } unset($htmlAreaRteContextHelpFiles); // Extend TYPO3 User Settings Configuration if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('setup') && is_array($GLOBALS['TYPO3_USER_SETTINGS'])) { $GLOBALS['TYPO3_USER_SETTINGS']['columns'] = array_merge($GLOBALS['TYPO3_USER_SETTINGS']['columns'], array('rteWidth' => array('type' => 'text', 'label' => 'LLL:EXT:rtehtmlarea/locallang.xml:rteWidth', 'csh' => 'xEXT_rtehtmlarea_General:rteWidth'), 'rteHeight' => array('type' => 'text', 'label' => 'LLL:EXT:rtehtmlarea/locallang.xml:rteHeight', 'csh' => 'xEXT_rtehtmlarea_General:rteHeight'), 'rteResize' => array('type' => 'check', 'label' => 'LLL:EXT:rtehtmlarea/locallang.xml:rteResize', 'csh' => 'xEXT_rtehtmlarea_General:rteResize'), 'rteMaxHeight' => array('type' => 'text', 'label' => 'LLL:EXT:rtehtmlarea/locallang.xml:rteMaxHeight', 'csh' => 'xEXT_rtehtmlarea_General:rteMaxHeight'), 'rteCleanPasteBehaviour' => array('type' => 'select', 'label' => 'LLL:EXT:rtehtmlarea/htmlarea/plugins/PlainText/locallang.xml:rteCleanPasteBehaviour', 'items' => array('plainText' => 'LLL:EXT:rtehtmlarea/htmlarea/plugins/PlainText/locallang.xml:plainText', 'pasteStructure' => 'LLL:EXT:rtehtmlarea/htmlarea/plugins/PlainText/locallang.xml:pasteStructure', 'pasteFormat' => 'LLL:EXT:rtehtmlarea/htmlarea/plugins/PlainText/locallang.xml:pasteFormat'), 'csh' => 'xEXT_rtehtmlarea_PlainText:behaviour'))); $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] .= ',--div--;LLL:EXT:rtehtmlarea/locallang.xml:rteSettings,rteWidth,rteHeight,rteResize,rteMaxHeight,rteCleanPasteBehaviour'; }
/** * Shows an overview list of available reports. * * @return string List of available reports */ protected function indexAction() { $content = ''; $tasks = array(); $icon = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('taskcenter') . 'task/task.gif'; // Render the tasks only if there are any available if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) && count($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) > 0) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'] as $extKey => $extensionReports) { foreach ($extensionReports as $taskClass => $task) { if (!$this->checkAccess($extKey, $taskClass)) { continue; } $link = 'mod.php?M=user_task&SET[function]=' . $extKey . '.' . $taskClass; $taskTitle = $GLOBALS['LANG']->sL($task['title']); $taskDescriptionHtml = ''; // Check for custom icon if (!empty($task['icon'])) { $icon = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFilename($task['icon']); } if (class_exists($taskClass)) { $taskInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($taskClass, $this); if ($taskInstance instanceof \TYPO3\CMS\Taskcenter\TaskInterface) { $taskDescriptionHtml = $taskInstance->getOverview(); } } // Generate an array of all tasks $uniqueKey = $this->getUniqueKey($extKey . '.' . $taskClass); $tasks[$uniqueKey] = array('title' => $taskTitle, 'descriptionHtml' => $taskDescriptionHtml, 'description' => $GLOBALS['LANG']->sL($task['description']), 'icon' => $icon, 'link' => $link, 'uid' => $extKey . '.' . $taskClass); } } $content .= $this->renderListMenu($tasks, TRUE); } else { $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('no-tasks', TRUE), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $this->content .= $flashMessage->render(); } return $content; }
/** * 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\Extension\ExtensionManager::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\Extension\ExtensionManager::isLoaded('version') && !\TYPO3\CMS\Core\Extension\ExtensionManager::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\Extension\ExtensionManager::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\Extension\ExtensionManager::isLoaded('perm')) { $cells['perms'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Extension\ExtensionManager::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 quick-edit view. * * @return void * @todo Define visibility */ public function renderQuickEdit() { // Alternative template $this->doc->setModuleTemplate('templates/db_layout_quickedit.html'); // Alternative form tag; Quick Edit submits its content to tce_db.php. $this->doc->form = '<form action="' . htmlspecialchars($GLOBALS['BACK_PATH'] . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Set the edit_record value for internal use in this function: $edit_record = $this->edit_record; // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php: if (substr($edit_record, 0, 9) == '_EDIT_COL') { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_content')) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_content') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting'); $idListA = array(); while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $idListA[] = $cRow['uid']; } $url = $GLOBALS['BACK_PATH'] . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => ''))); \TYPO3\CMS\Core\Utility\HttpUtility::redirect($url); } // If the former record edited was the creation of a NEW record, this will look up the created records uid: if ($this->new_unique_uid) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log')); $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (is_array($sys_log_row)) { $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid']; } } // Creating the selector box, allowing the user to select which element to edit: $opt = array(); $is_selected = 0; $languageOverlayRecord = ''; if ($this->current_sys_language) { list($languageOverlayRecord) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language)); } if (is_array($languageOverlayRecord)) { $inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editLanguageHeader', 1) . ' ]</option>'; } else { $inValue = 'pages:' . $this->id; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editPageProperties', 1) . ' ]</option>'; } // Selecting all content elements from this language and allowed colPos: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_content')) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_content') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting'); $colPos = ''; $first = 1; // Page is the pid if no record to put this after. $prev = $this->id; while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('tt_content', $cRow); if (is_array($cRow)) { if ($first) { if (!$edit_record) { $edit_record = 'tt_content:' . $cRow['uid']; } $first = 0; } if (strcmp($cRow['colPos'], $colPos)) { $colPos = $cRow['colPos']; $opt[] = '<option value=""></option>'; $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>'; } $inValue = 'tt_content:' . $cRow['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $GLOBALS['BE_USER']->uc['titleLen'])) . '</option>'; $prev = -$cRow['uid']; } } // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element: if (!$edit_record) { $edit_record = 'tt_content:new/' . $prev . '/' . $colPos; $inValue = 'tt_content:new/' . $prev . '/' . $colPos; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>'; } // If none is yet selected... if (!$is_selected) { $opt[] = '<option value=""></option>'; $opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>'; } // Splitting the edit-record cmd value into table/uid: $this->eRParts = explode(':', $edit_record); // Delete-button flag? $this->deleteButton = \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4); // If undo-button should be rendered (depends on available items in sys_history) $this->undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1'); if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $this->undoButton = 1; } // Setting up the Return URL for coming back to THIS script (if links take the user to another script) $R_URL_parts = parse_url(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $R_URL_getvars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(); unset($R_URL_getvars['popView']); unset($R_URL_getvars['new_unique_uid']); $R_URL_getvars['edit_record'] = $edit_record; $this->R_URI = $R_URL_parts['path'] . '?' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $R_URL_getvars); // Setting close url/return url for exiting this script: // Goes to 'Columns' view if close is pressed (default) $this->closeUrl = $this->local_linkThisScript(array('SET' => array('function' => 1))); if ($GLOBALS['BE_USER']->uc['condensedMode']) { $this->closeUrl = $GLOBALS['BACK_PATH'] . 'alt_db_navframe.php'; } if ($this->returnUrl) { $this->closeUrl = $this->returnUrl; } // Return-url for JavaScript: $retUrlStr = $this->returnUrl ? '+\'&returnUrl=\'+\'' . rawurlencode($this->returnUrl) . '\'' : ''; // Drawing the edit record selectbox $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>'; // Creating editing form: if ($GLOBALS['BE_USER']->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] !== 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] === 'pages' && $this->CALC_PERMS & 1)) { // Splitting uid parts for special features, if new: list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]); // Convert $uidVal to workspace version if any: if ($uidVal != 'new') { if ($draftRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) { $uidVal = $draftRecord['uid']; } } // Initializing transfer-data object: $trData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor'); $trData->addRawData = TRUE; $trData->defVals[$this->eRParts[0]] = array('colPos' => intval($ex_colPos), 'sys_language_uid' => intval($this->current_sys_language)); $trData->disableRTE = $this->MOD_SETTINGS['disableRTE']; $trData->lockRecords = 1; // 'new' $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal); // Getting/Making the record: reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); if ($uidVal == 'new') { $new_unique_uid = uniqid('NEW'); $rec['uid'] = $new_unique_uid; $rec['pid'] = intval($ex_pid) ? intval($ex_pid) : $this->id; $recordAccess = TRUE; } else { $rec['uid'] = $uidVal; // Checking internals access: $recordAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($this->eRParts[0], $uidVal); } if (!$recordAccess) { // If no edit access, print error message: $content .= $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />' . ($GLOBALS['BE_USER']->errorMsg ? 'Reason: ' . $GLOBALS['BE_USER']->errorMsg . '<br /><br />' : ''), 0, 1); } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-) // Create instance of TCEforms, setting defaults: $tceforms = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); $tceforms->backPath = $GLOBALS['BACK_PATH']; $tceforms->initDefaultBEMode(); $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder']; $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes']; $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE']; $tceforms->enableClickMenu = TRUE; // Clipboard is initialized: // Start clipboard $tceforms->clipObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard'); // Initialize - reads the clipboard content from the user session $tceforms->clipObj->initializeClipboard(); if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] !== 'text' && $this->MOD_SETTINGS['showDescriptions']) { $tceforms->edit_showFieldHelp = 'text'; } // Render form, wrap it: $panel = ''; $panel .= $tceforms->getMainFields($this->eRParts[0], $rec); $panel = $tceforms->wrapTotal($panel, $rec, $this->eRParts[0]); // Add hidden fields: $theCode = $panel; if ($uidVal == 'new') { $theCode .= '<input type="hidden" name="data[' . $this->eRParts[0] . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; } $theCode .= ' <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="_disableRTE" value="' . $tceforms->disableRTE . '" /> <input type="hidden" name="edit_record" value="' . $edit_record . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($uidVal == 'new' ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('cms') . 'layout/db_layout.php?id=' . $this->id . '&new_unique_uid=' . $new_unique_uid . '&returnUrl=' . rawurlencode($this->returnUrl) : $this->R_URI) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Add JavaScript as needed around the form: $theCode = $tceforms->printNeededJSFunctions_top() . $theCode . $tceforms->printNeededJSFunctions(); // Add warning sign if record was "locked": if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked($this->eRParts[0], $rec['uid'])) { $lockedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($lockInfo['msg']), '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($lockedMessage); } // Add whole form as a document section: $content .= $this->doc->section('', $theCode); } } else { // If no edit access, print error message: $content .= $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />', 0, 1); } // Bottom controls (function menus): $q_count = $this->getNumberOfHiddenElements(); $h_func_b = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE', 1)) : $GLOBALS['LANG']->getLL('hiddenCE', 1) . ' (' . $q_count . ')') . '</label>'; $h_func_b .= '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], 'db_layout.php', '', 'id="checkShowPalettes"') . '<label for="checkShowPalettes">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes', 1) . '</label>'; if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('context_help') && $GLOBALS['BE_USER']->uc['edit_showFieldHelp'] !== 'text') { $h_func_b .= '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[showDescriptions]', $this->MOD_SETTINGS['showDescriptions'], 'db_layout.php', '', 'id="checkShowDescriptions"') . '<label for="checkShowDescriptions">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions', 1) . '</label>'; } if ($GLOBALS['BE_USER']->isRTE()) { $h_func_b .= '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[disableRTE]', $this->MOD_SETTINGS['disableRTE'], 'db_layout.php', '', 'id="checkDisableRTE"') . '<label for="checkDisableRTE">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE', 1) . '</label>'; } // Add the function menus to bottom: $content .= $this->doc->section('', $h_func_b, 0, 0); $content .= $this->doc->spacer(10); // Select element matrix: if ($this->eRParts[0] == 'tt_content' && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) { $posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap'); $posMap->backPath = $GLOBALS['BACK_PATH']; $posMap->cur_sys_language = $this->current_sys_language; $HTMLcode = ''; // CSH: $HTMLcode .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement', $GLOBALS['BACK_PATH'], '|<br />'); $HTMLcode .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI); $content .= $this->doc->spacer(20); $content .= $this->doc->section($GLOBALS['LANG']->getLL('CEonThisPage'), $HTMLcode, 0, 1); $content .= $this->doc->spacer(20); } // Finally, if comments were generated in TCEforms object, print these as a HTML comment: if (count($tceforms->commentMessages)) { $content .= ' <!-- TCEFORM messages ' . htmlspecialchars(implode(LF, $tceforms->commentMessages)) . ' --> '; } return $content; }
--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended, '), (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER => array('showitem' => '--palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.standard;standard, --palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.title;titleonly, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, --palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.visibility;hiddenonly, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.resources, --palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.media;media, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended, '), (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER => array('showitem' => '--palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.standard;standard, --palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.title;titleonly, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, --palette--;LLL:EXT:cms/locallang_tca.xml:pages.palettes.visibility;hiddenonly, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.extended, ')), 'palettes' => array('5' => array('showitem' => 'author,author_email', 'canNotCollapse' => TRUE), 'standard' => array('showitem' => 'doktype;LLL:EXT:cms/locallang_tca.xml:pages.doktype_formlabel, sys_language_uid', 'canNotCollapse' => 1), 'shortcut' => array('showitem' => 'doktype;LLL:EXT:cms/locallang_tca.xml:pages.doktype_formlabel, sys_language_uid, shortcut_mode;LLL:EXT:cms/locallang_tca.xml:pages.shortcut_mode_formlabel', 'canNotCollapse' => 1), 'shortcutpage' => array('showitem' => 'shortcut;LLL:EXT:cms/locallang_tca.xml:pages.shortcut_formlabel', 'canNotCollapse' => 1), 'external' => array('showitem' => 'doktype;LLL:EXT:cms/locallang_tca.xml:pages.doktype_formlabel, sys_language_uid, urltype;LLL:EXT:cms/locallang_tca.xml:pages.urltype_formlabel, url;LLL:EXT:cms/locallang_tca.xml:pages.url_formlabel', 'canNotCollapse' => 1), 'title' => array('showitem' => 'title;LLL:EXT:cms/locallang_tca.xml:pages.title_formlabel, --linebreak--, nav_title;LLL:EXT:cms/locallang_tca.xml:pages.nav_title_formlabel, --linebreak--, subtitle;LLL:EXT:cms/locallang_tca.xml:pages.subtitle_formlabel', 'canNotCollapse' => 1), 'titleonly' => array('showitem' => 'title;LLL:EXT:cms/locallang_tca.xml:pages.title_formlabel', 'canNotCollapse' => 1), 'hiddenonly' => array('showitem' => 'hidden;LLL:EXT:cms/locallang_tca.xml:pages.hidden_formlabel', 'canNotCollapse' => 1), 'access' => array('showitem' => 'starttime;LLL:EXT:cms/locallang_tca.xml:pages.starttime_formlabel, endtime;LLL:EXT:cms/locallang_tca.xml:pages.endtime_formlabel', 'canNotCollapse' => 1), 'abstract' => array('showitem' => 'abstract;LLL:EXT:cms/locallang_tca.xml:pages.abstract_formlabel', 'canNotCollapse' => 1), 'metatags' => array('showitem' => 'keywords;LLL:EXT:cms/locallang_tca.xml:pages.keywords_formlabel, --linebreak--, description;LLL:EXT:cms/locallang_tca.xml:pages.description_formlabel', 'canNotCollapse' => 1), 'editorial' => array('showitem' => 'author;LLL:EXT:cms/locallang_tca.xml:pages.author_formlabel, author_email;LLL:EXT:cms/locallang_tca.xml:pages.author_email_formlabel', 'canNotCollapse' => 1), 'language' => array('showitem' => 'l18n_cfg;LLL:EXT:cms/locallang_tca.xml:pages.l18n_cfg_formlabel', 'canNotCollapse' => 1), 'media' => array('showitem' => 'media;LLL:EXT:cms/locallang_tca.xml:pages.media_formlabel', 'canNotCollapse' => 1))); // Keep old code (pre-FAL) for installations that haven't upgraded yet. // @deprecated since TYPO3 6.0, please remove in TYPO3 7.0 // existing installation - and files are merged, nothing to do if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard']) || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard'], 'pages_language_overlay:media')) && !\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('6.0')) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('This installation hasn\'t been migrated to FAL for the field $TCA[pages_language_overlay][columns][media] yet. Please do so before TYPO3 v7.'); // Existing installation and no upgrade wizard was executed - and files haven't been merged: use the old code $TCA['pages_language_overlay']['columns']['media']['config'] = array('type' => 'group', 'internal_type' => 'file', 'allowed' => $TCA['pages']['columns']['media']['config']['allowed'], 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 'uploadfolder' => 'uploads/media', 'show_thumbs' => '1', 'size' => '3', 'maxitems' => '100', 'minitems' => '0'); } // sys_template $TCA['sys_template'] = array('ctrl' => $TCA['sys_template']['ctrl'], 'interface' => array('showRecordFieldList' => 'title,clear,root,basedOn,nextLevel,sitetitle,description,hidden,starttime,endtime'), 'columns' => array('title' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.title', 'config' => array('type' => 'input', 'size' => '25', 'max' => '256', 'eval' => 'required')), 'hidden' => array('label' => 'LLL:EXT:lang/locallang_general.xml:LGL.disable', 'exclude' => 1, 'config' => array('type' => 'check', 'default' => '0')), 'starttime' => array('label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', 'exclude' => 1, 'config' => array('type' => 'input', 'size' => '13', 'max' => '20', 'eval' => 'datetime', 'default' => '0')), 'endtime' => array('label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', 'exclude' => 1, 'config' => array('type' => 'input', 'size' => '13', 'max' => '20', 'eval' => 'datetime', 'default' => '0', 'range' => array('upper' => mktime(0, 0, 0, 12, 31, 2020)))), 'root' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.root', 'config' => array('type' => 'check')), 'clear' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.clear', 'config' => array('type' => 'check', 'items' => array(array('Constants', ''), array('Setup', '')), 'cols' => 2)), 'sitetitle' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.sitetitle', 'config' => array('type' => 'input', 'size' => '25', 'max' => '256')), 'constants' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.constants', 'config' => array('type' => 'text', 'cols' => '48', 'rows' => '10', 'wrap' => 'OFF', 'softref' => 'TStemplate,email[subst],url[subst]'), 'defaultExtras' => 'fixed-font : enable-tab'), 'nextLevel' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.nextLevel', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'sys_template', 'show_thumbs' => '1', 'size' => '1', 'maxitems' => '1', 'minitems' => '0', 'default' => '', 'wizards' => array('suggest' => array('type' => 'suggest')))), 'include_static_file' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.include_static_file', 'config' => array('type' => 'select', 'size' => 10, 'maxitems' => 100, 'items' => array(), 'softref' => 'ext_fileref')), 'basedOn' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.basedOn', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'sys_template', 'show_thumbs' => '1', 'size' => '3', 'maxitems' => '50', 'autoSizeMax' => 10, 'minitems' => '0', 'default' => '', 'wizards' => array('_PADDING' => 4, '_VERTICAL' => 1, 'suggest' => array('type' => 'suggest'), 'edit' => array('type' => 'popup', 'title' => 'Edit template', 'script' => 'wizard_edit.php', 'popup_onlyOpenIfSelected' => 1, 'icon' => 'edit2.gif', 'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1'), 'add' => array('type' => 'script', 'title' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.basedOn_add', 'icon' => 'add.gif', 'params' => array('table' => 'sys_template', 'pid' => '###CURRENT_PID###', 'setValue' => 'prepend'), 'script' => 'wizard_add.php')))), 'includeStaticAfterBasedOn' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.includeStaticAfterBasedOn', 'exclude' => 1, 'config' => array('type' => 'check', 'default' => '0')), 'config' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.config', 'config' => array('type' => 'text', 'rows' => 10, 'cols' => 48, 'wizards' => array('_PADDING' => 4, '0' => array('title' => 'TSref online', 'script' => 'wizard_tsconfig.php?mode=tsref', 'icon' => 'wizard_tsconfig.gif', 'JSopenParams' => 'height=500,width=780,status=0,menubar=0,scrollbars=1')), 'wrap' => 'OFF', 'softref' => 'TStemplate,email[subst],url[subst]'), 'defaultExtras' => 'fixed-font : enable-tab'), 'description' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.description', 'config' => array('type' => 'text', 'rows' => 5, 'cols' => 48)), 'static_file_mode' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:sys_template.static_file_mode', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:cms/locallang_tca.xml:sys_template.static_file_mode.0', '0'), array('LLL:EXT:cms/locallang_tca.xml:sys_template.static_file_mode.1', '1'), array('LLL:EXT:cms/locallang_tca.xml:sys_template.static_file_mode.2', '2'), array('LLL:EXT:cms/locallang_tca.xml:sys_template.static_file_mode.3', '3')), 'default' => '0')), 'tx_impexp_origuid' => array('config' => array('type' => 'passthrough')), 't3ver_label' => array('label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel', 'config' => array('type' => 'input', 'size' => '30', 'max' => '255'))), 'types' => array('1' => array('showitem' => ' hidden,title;;1;;2-2-2, sitetitle, constants;;;;3-3-3, config, description;;;;4-4-4, --div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.options, clear, root, nextLevel, --div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.include, includeStaticAfterBasedOn,6-6-6, include_static_file, basedOn, static_file_mode, --div--;LLL:EXT:cms/locallang_tca.xml:sys_template.tabs.access, starttime, endtime'))); // backend_layout $TCA['backend_layout'] = array('ctrl' => $TCA['backend_layout']['ctrl'], 'interface' => array('showRecordFieldList' => 'title,config,description,hidden,icon'), 'columns' => array('title' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:backend_layout.title', 'config' => array('type' => 'input', 'size' => '25', 'max' => '256', 'eval' => 'required')), 'description' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:backend_layout.description', 'config' => array('type' => 'text', 'rows' => '5', 'cols' => '25')), 'config' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:backend_layout.config', 'config' => array('type' => 'text', 'rows' => '5', 'cols' => '25', 'wizards' => array('_PADDING' => 4, 0 => array('title' => 'LLL:EXT:cms/locallang_tca.xml:backend_layout.wizard', 'type' => 'popup', 'icon' => \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('cms') . 'layout/wizard_backend_layout.png', 'script' => \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('cms') . 'layout/wizard_backend_layout.php', 'JSopenParams' => 'height=800,width=800,status=0,menubar=0,scrollbars=0')))), 'hidden' => array('label' => 'LLL:EXT:lang/locallang_general.xml:LGL.disable', 'exclude' => 1, 'config' => array('type' => 'check', 'default' => '0')), 'icon' => array('label' => 'LLL:EXT:cms/locallang_tca.xml:backend_layout.icon', 'exclude' => 1, 'config' => array('type' => 'group', 'internal_type' => 'file', 'allowed' => 'jpg,gif,png', 'uploadfolder' => 'uploads/media', 'show_thumbs' => 1, 'size' => 1, 'maxitems' => 1))), 'types' => array('1' => array('showitem' => 'hidden,title;;1;;2-2-2, icon, description, config')));
/** * Adding CM element for Create new wizard (either db_new.php or sysext/cms/layout/db_new_content_el.php or custom wizard) * * @param string $table Table name * @param integer $uid UID for the current record. * @param array $rec Record. * @return array Item array, element in $menuItems * @internal * @todo Define visibility */ public function DB_newWizard($table, $uid, $rec) { // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead: $tmpTSc = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); $tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension']; $newContentWizScriptPath = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($tmpTSc) ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($tmpTSc) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php'; $url = $table == 'pages' || !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms') ? 'db_new.php?id=' . $uid . '&pagesOnly=1' : $newContentWizScriptPath . '?id=' . $rec['pid'] . '&sys_language_uid=' . intval($rec['sys_language_uid']); return $this->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document') . '-new')), $this->urlRefForCM($url, 'returnUrl'), 0); }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } // Add Default TS to Include static (from extensions) \TYPO3\CMS\Core\Extension\ExtensionManager::addStaticFile($_EXTKEY, 'Configuration/TypoScript/', 'Default TS'); $TCA['tt_content']['columns']['bodytext']['config']['wizards']['forms'] = array('notNewRecords' => 1, 'enableByTypeConfig' => 1, 'type' => 'script', 'title' => 'Form wizard', 'icon' => 'wizard_forms.gif', 'script' => \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('form') . 'Classes/Controller/Wizard.php', 'params' => array('xmlOutput' => 0)); $TCA['tt_content']['types']['mailform']['showitem'] = ' CType;;4;;1-1-1, hidden, header;;3;;2-2-2, linkToTop;;;;3-3-3, --div--;LLL:EXT:cms/locallang_ttc.xml:CType.I.8, bodytext;LLL:EXT:cms/locallang_ttc.php:bodytext.ALT.mailform;;nowrap:wizards[forms];3-3-3, --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime, fe_group ';
/** * Initialization of the class * * @return void */ public function init() { // Setting GPvars: $this->id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id')); $this->edit = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('edit'); $this->return_id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('return_id'); $this->lastEdited = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('lastEdited'); // Module name; $this->MCONF = $GLOBALS['MCONF']; // Page select clause: $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); // Initializing document template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/perm.html'); $this->doc->form = '<form action="' . $GLOBALS['BACK_PATH'] . 'tce_db.php" method="post" name="editform">'; $this->doc->loadJavascriptLib('../t3lib/jsfunc.updateform.js'); $this->doc->getPageRenderer()->loadPrototype(); $this->doc->loadJavascriptLib(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('perm') . 'mod1/perm.js'); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Set up menus: $this->menuConfig(); }
/** * Adds the necessary CSS to the backend * * @return void */ protected function addCssToBackend() { $this->backendReference->addCssFile('opendocs', \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($this->EXTKEY) . 'opendocs.css'); }
/** * Returns an array of all stylesheet directories belonging to core and skins * * @return array Stylesheet directories */ public function getSkinStylesheetDirectories() { $stylesheetDirectories = array(); // Add default core stylesheets foreach ($this->stylesheetsCore as $stylesheetDir) { $stylesheetDirectories[] = $stylesheetDir; } // Stylesheets from skins // merge default css directories ($this->stylesheetsSkin) with additional ones and include them if (is_array($GLOBALS['TBE_STYLES']['skins'])) { // loop over all registered skins foreach ($GLOBALS['TBE_STYLES']['skins'] as $skinExtKey => $skin) { $skinStylesheetDirs = $this->stylesheetsSkins; // Skins can add custom stylesheetDirectories using // $GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'] if (is_array($skin['stylesheetDirectories'])) { $skinStylesheetDirs = array_merge($skinStylesheetDirs, $skin['stylesheetDirectories']); } // Add all registered directories foreach ($skinStylesheetDirs as $stylesheetDir) { // for EXT:myskin/stylesheets/ syntax if (substr($stylesheetDir, 0, 4) === 'EXT:') { list($extKey, $path) = explode('/', substr($stylesheetDir, 4), 2); if (strcmp($extKey, '') && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey) && strcmp($path, '')) { $stylesheetDirectories[] = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($extKey) . $path; } } else { // For relative paths $stylesheetDirectories[] = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($skinExtKey) . $stylesheetDir; } } } } return $stylesheetDirectories; }
/** * Adds the neccessary css ot the backend * * @return void */ protected function addCssToBackend() { $this->backendReference->addCssFile('sysaction', \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($this->EXTKEY) . 'toolbarmenu/tx_sysactions.css'); }
/** * 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 integer $pid The pid. * @param integer $newPagePID New page id. * @return string Onclick attribute content * @todo Define visibility */ public function onClickEvent($pid, $newPagePID) { $TSconfigProp = $this->getModConfig($newPagePID); if ($TSconfigProp['overrideWithExtension']) { if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($TSconfigProp['overrideWithExtension'])) { $onclick = 'window.location.href=\'' . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($TSconfigProp['overrideWithExtension']) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid . '\';'; return $onclick; } } $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1'; return \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, '', $this->R_URI); }
/** * Import part of module * * @param array $inData Content of POST VAR tx_impexp[].. * @return void Setting content in $this->content * @todo Define visibility */ public function importData($inData) { global $LANG; $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } if ($inData['new_import']) { unset($inData['import_mode']); } /** @var $import \TYPO3\CMS\Impexp\ImportExport */ $import = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Impexp\\ImportExport'); $import->init(0, 'import'); $import->update = $inData['do_update']; $import->import_mode = $inData['import_mode']; $import->enableLogging = $inData['enableLogging']; $import->global_ignore_pid = $inData['global_ignore_pid']; $import->force_all_UIDS = $inData['force_all_UIDS']; $import->showDiff = !$inData['notShowDiff']; $import->allowPHPScripts = $inData['allowPHPScripts']; $import->softrefInputValues = $inData['softrefInputValues']; // OUTPUT creation: $menuItems = array(); // Make input selector: // must have trailing slash. $path = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']; $filesInDir = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir(PATH_site . $path, 't3d,xml', 1, 1); $userPath = $this->userSaveFolder(); //Files from User-Dir $filesInUserDir = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($userPath, 't3d,xml', 1, 1); $filesInDir = array_merge($filesInUserDir, $filesInDir); if (is_dir(PATH_site . $path . 'export/')) { $filesInDir = array_merge($filesInDir, \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir(PATH_site . $path . 'export/', 't3d,xml', 1, 1)); } $tempFolder = $this->userTempFolder(); if ($tempFolder) { $temp_filesInDir = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempFolder, 't3d,xml', 1, 1); $filesInDir = array_merge($filesInDir, $temp_filesInDir); } // Configuration $row = array(); $opt = array(''); foreach ($filesInDir as $file) { $opt[$file] = substr($file, strlen(PATH_site)); } $row[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_selectFileToImport', 1) . '</strong></td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_file', 1) . '</strong>' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_tx_impexp', 'importFile', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . $this->renderSelectBox('tx_impexp[file]', $inData['file'], $opt) . '<br />' . sprintf($LANG->getLL('importdata_fromPathS', 1), $path) . (!$import->compress ? '<br /><span class="typo3-red">' . $LANG->getLL('importdata_noteNoDecompressorAvailable', 1) . '</span>' : '') . '</td> </tr>'; $row[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_importOptions', 1) . '</strong></td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_update', 1) . '</strong>' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_tx_impexp', 'update', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="checkbox" name="tx_impexp[do_update]" id="checkDo_update" value="1"' . ($inData['do_update'] ? ' checked="checked"' : '') . ' /> <label for="checkDo_update">' . $LANG->getLL('importdata_updateRecords', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_thisOptionRequiresThat', 1) . ')</em>' . ($inData['do_update'] ? ' <hr/> <input type="checkbox" name="tx_impexp[global_ignore_pid]" id="checkGlobal_ignore_pid" value="1"' . ($inData['global_ignore_pid'] ? ' checked="checked"' : '') . ' /> <label for="checkGlobal_ignore_pid">' . $LANG->getLL('importdata_ignorePidDifferencesGlobally', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_ifYouSetThis', 1) . ')</em> ' : '') . '</td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_options', 1) . '</strong>' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_tx_impexp', 'options', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="checkbox" name="tx_impexp[notShowDiff]" id="checkNotShowDiff" value="1"' . ($inData['notShowDiff'] ? ' checked="checked"' : '') . ' /> <label for="checkNotShowDiff">' . $LANG->getLL('importdata_doNotShowDifferences', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_greenValuesAreFrom', 1) . ')</em> <br/><br/> ' . ($GLOBALS['BE_USER']->isAdmin() ? ' <input type="checkbox" name="tx_impexp[allowPHPScripts]" id="checkAllowPHPScripts" value="1"' . ($inData['allowPHPScripts'] ? ' checked="checked"' : '') . ' /> <label for="checkAllowPHPScripts">' . $LANG->getLL('importdata_allowToWriteBanned', 1) . '</label><br/>' : '') . (!$inData['do_update'] && $GLOBALS['BE_USER']->isAdmin() ? ' <br/> <input type="checkbox" name="tx_impexp[force_all_UIDS]" id="checkForce_all_UIDS" value="1"' . ($inData['force_all_UIDS'] ? ' checked="checked"' : '') . ' /> <label for="checkForce_all_UIDS"><span class="typo3-red">' . $LANG->getLL('importdata_force_all_UIDS', 1) . '</span></label><br/> <em>(' . $LANG->getLL('importdata_force_all_UIDS_descr', 1) . ')</em>' : '') . ' </td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_action', 1) . '</strong>' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_tx_impexp', 'action', $GLOBALS['BACK_PATH'], '') . '</td> <td>' . (!$inData['import_file'] ? '<input type="submit" value="' . $LANG->getLL('importdata_preview', 1) . '" />' . ($inData['file'] ? ' - <input type="submit" value="' . ($inData['do_update'] ? $LANG->getLL('importdata_update_299e', 1) : $LANG->getLL('importdata_import', 1)) . '" name="tx_impexp[import_file]" onclick="return confirm(\'' . $LANG->getLL('importdata_areYouSure', 1) . '\');" />' : '') : '<input type="submit" name="tx_impexp[new_import]" value="' . $LANG->getLL('importdata_newImport', 1) . '" />') . ' <input type="hidden" name="tx_impexp[action]" value="import" /></td> </tr>'; $row[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_enableLogging', 1) . '</strong>' . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_tx_impexp', 'enableLogging', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="checkbox" name="tx_impexp[enableLogging]" id="checkEnableLogging" value="1"' . ($inData['enableLogging'] ? ' checked="checked"' : '') . ' /> <label for="checkEnableLogging">' . $LANG->getLL('importdata_writeIndividualDbActions', 1) . '</label><br/> <em>(' . $LANG->getLL('importdata_thisIsDisabledBy', 1) . ')</em> </td> </tr>'; $menuItems[] = array('label' => $LANG->getLL('importdata_import', 1), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> ' . implode(' ', $row) . ' </table> '); // Upload file: $tempFolder = $this->userTempFolder(); if ($tempFolder) { $row = array(); $row[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_uploadFileFromLocal', 1) . '</strong></td> </tr>'; $row[] = '<tr class="bgColor4"> <td>' . $LANG->getLL('importdata_browse', 1) . \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_tx_impexp', 'upload', $GLOBALS['BACK_PATH'], '') . '</td> <td> <input type="file" name="upload_1"' . $this->doc->formWidth(35) . ' size="40" /> <input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($tempFolder) . '" /> <input type="hidden" name="file[upload][1][data]" value="1" /><br /> <input type="submit" name="_upload" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit', 1) . '" /> <input type="checkbox" name="overwriteExistingFiles" id="checkOverwriteExistingFiles" value="1" checked="checked" /> <label for="checkOverwriteExistingFiles">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:overwriteExistingFiles', 1) . '</label> </td> </tr>'; if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_upload')) { $row[] = '<tr class="bgColor4"> <td>' . $LANG->getLL('importdata_uploadStatus', 1) . '</td> <td>' . ($this->fileProcessor->internalUploadMap[1] ? $LANG->getLL('importdata_success', 1) . ' ' . substr($this->fileProcessor->internalUploadMap[1], strlen(PATH_site)) : '<span class="typo3-red">' . $LANG->getLL('importdata_failureNoFileUploaded', 1) . '</span>') . '</td> </tr>'; } $menuItems[] = array('label' => $LANG->getLL('importdata_upload'), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> ' . implode(' ', $row) . ' </table> '); } // Perform import or preview depending: $overviewContent = ''; $extensionInstallationMessage = ''; $emURL = ''; $inFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($inData['file']); if ($inFile && @is_file($inFile)) { $trow = array(); if ($import->loadFile($inFile, 1)) { // Check extension dependencies: $extKeysToInstall = array(); if (is_array($import->dat['header']['extensionDependencies'])) { foreach ($import->dat['header']['extensionDependencies'] as $extKey) { if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey)) { $extKeysToInstall[] = $extKey; } } } if (count($extKeysToInstall)) { $passParams = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tx_impexp'); unset($passParams['import_mode']); unset($passParams['import_file']); $thisScriptUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') . '?M=xMOD_tximpexp&id=' . $this->id . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('tx_impexp', $passParams); $emURL = $this->doc->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('em') . 'classes/index.php?CMD[requestInstallExtensions]=' . implode(',', $extKeysToInstall) . '&returnUrl=' . rawurlencode($thisScriptUrl); $extensionInstallationMessage = 'Before you can install this T3D file you need to install the extensions "' . implode('", "', $extKeysToInstall) . '". Clicking Import will first take you to the Extension Manager so these dependencies can be resolved.'; } if ($inData['import_file']) { if (!count($extKeysToInstall)) { $import->importData($this->id); \TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updatePageTree'); } else { \TYPO3\CMS\Core\Utility\HttpUtility::redirect($emURL); } } $import->display_import_pid_record = $this->pageinfo; $overviewContent = $import->displayContentOverview(); } // Meta data output: $trow[] = '<tr class="bgColor5"> <td colspan="2"><strong>' . $LANG->getLL('importdata_metaData', 1) . '</strong></td> </tr>'; $opt = array(''); foreach ($filesInDir as $file) { $opt[$file] = substr($file, strlen(PATH_site)); } $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_title', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['title'])) . '</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_description', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['description'])) . '</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_notes', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])) . '</td> </tr>'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_packager', 1) . '</strong></td> <td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'] . ' (' . $import->dat['header']['meta']['packager_username'] . ')')) . '<br/> ' . $LANG->getLL('importdata_email', 1) . ' ' . $import->dat['header']['meta']['packager_email'] . '</td> </tr>'; // Thumbnail icon: if (is_array($import->dat['header']['thumbnail'])) { $pI = pathinfo($import->dat['header']['thumbnail']['filename']); if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('gif,jpg,png,jpeg', strtolower($pI['extension']))) { // Construct filename and write it: $fileName = PATH_site . 'typo3temp/importthumb.' . $pI['extension']; \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($fileName, $import->dat['header']['thumbnail']['content']); // Check that the image really is an image and not a malicious PHP script... if (getimagesize($fileName)) { // Create icon tag: $iconTag = '<img src="' . $this->doc->backPath . '../' . substr($fileName, strlen(PATH_site)) . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3] . ' vspace="5" style="border: solid black 1px;" alt="" />'; $trow[] = '<tr class="bgColor4"> <td><strong>' . $LANG->getLL('importdata_icon', 1) . '</strong></td> <td>' . $iconTag . '</td> </tr>'; } else { \TYPO3\CMS\Core\Utility\GeneralUtility::unlink_tempfile($fileName); } } } $menuItems[] = array('label' => $LANG->getLL('importdata_metaData_1387'), 'content' => ' <table border="0" cellpadding="1" cellspacing="1"> ' . implode(' ', $trow) . ' </table> '); } // Print errors that might be: $errors = $import->printErrorLog(); $menuItems[] = array('label' => $LANG->getLL('importdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0); // Output tabs: $content = $this->doc->getDynTabMenu($menuItems, 'tx_impexp_import', -1); if ($extensionInstallationMessage) { $content = '<div style="border: 1px black solid; margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;">' . $this->doc->icons(1) . htmlspecialchars($extensionInstallationMessage) . '</div>' . $content; } $this->content .= $this->doc->section('', $content, 0, 1); // Print overview: if ($overviewContent) { $this->content .= $this->doc->section($inData['import_file'] ? $LANG->getLL('importdata_structureHasBeenImported', 1) : $LANG->getLL('filterpage_structureToBeImported', 1), $overviewContent, 0, 1); } } }
/** * Generates the JavaScript code for the backend. * * @return void */ protected function generateJavascript() { $pathTYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::dirname(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/'; // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; if (!$GLOBALS['BE_USER']->check('modules', $pageModule)) { $pageModule = ''; } $menuFrameName = 'menu'; if ($GLOBALS['BE_USER']->uc['noMenuMode'] === 'icons') { $menuFrameName = 'topmenuFrame'; } // Determine security level from conf vars and default to super challenged if ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) { $this->loginSecurityLevel = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']; } else { $this->loginSecurityLevel = 'superchallenged'; } $t3Configuration = array('siteUrl' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), 'PATH_typo3' => $pathTYPO3, 'PATH_typo3_enc' => rawurlencode($pathTYPO3), 'username' => htmlspecialchars($GLOBALS['BE_USER']->user['username']), 'uniqueID' => \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5(uniqid('')), 'securityLevel' => $this->loginSecurityLevel, 'TYPO3_mainDir' => TYPO3_mainDir, 'pageModule' => $pageModule, 'condensedMode' => $GLOBALS['BE_USER']->uc['condensedMode'] ? 1 : 0, 'inWorkspace' => $GLOBALS['BE_USER']->workspace !== 0 ? 1 : 0, 'workspaceFrontendPreviewEnabled' => $GLOBALS['BE_USER']->user['workspace_preview'] ? 1 : 0, 'veriCode' => $GLOBALS['BE_USER']->veriCode(), 'denyFileTypes' => PHP_EXTENSIONS_DEFAULT, 'moduleMenuWidth' => $this->menuWidth - 1, 'topBarHeight' => isset($GLOBALS['TBE_STYLES']['dims']['topFrameH']) ? intval($GLOBALS['TBE_STYLES']['dims']['topFrameH']) : 30, 'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ? intval($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) : FALSE, 'listModulePath' => \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('recordlist') ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('recordlist') . 'mod1/' : '', 'debugInWindow' => $GLOBALS['BE_USER']->uc['debugInWindow'] ? 1 : 0, 'ContextHelpWindows' => array('width' => 600, 'height' => 400), 'firstWebmountPid' => intval($GLOBALS['WEBMOUNTS'][0])); $this->js .= ' TYPO3.configuration = ' . json_encode($t3Configuration) . '; /** * TypoSetup object. */ function typoSetup() { // this.PATH_typo3 = TYPO3.configuration.PATH_typo3; this.PATH_typo3_enc = TYPO3.configuration.PATH_typo3_enc; this.username = TYPO3.configuration.username; this.uniqueID = TYPO3.configuration.uniqueID; this.navFrameWidth = 0; this.securityLevel = TYPO3.configuration.securityLevel; this.veriCode = TYPO3.configuration.veriCode; this.denyFileTypes = TYPO3.configuration.denyFileTypes; } var TS = new typoSetup(); //backwards compatibility /** * Frameset Module object * * Used in main modules with a frameset for submodules to keep the ID between modules * Typically that is set by something like this in a Web>* sub module: * if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'"; * if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)..."; */ function fsModules() { // this.recentIds=new Array(); // used by frameset modules to track the most recent used id for list frame. this.navFrameHighlightedID=new Array(); // used by navigation frames to track which row id was highlighted last time this.currentMainLoaded=""; this.currentBank="0"; } var fsMod = new fsModules(); top.goToModule = function(modName, cMR_flag, addGetVars) { TYPO3.ModuleMenu.App.showModule(modName, addGetVars); } ' . $this->setStartupModule(); // Check editing of page: $this->handlePageEditing(); }
public function getFullFileName($filename) { if (substr($filename, 0, 4) == 'EXT:') { // extension list($extKey, $local) = explode('/', substr($filename, 4), 2); $newFilename = ''; if (strcmp($extKey, '') && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey) && strcmp($local, '')) { $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath($extKey) : $this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($extKey)) . $local; } } elseif (substr($filename, 0, 1) != '/') { $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . $filename; } else { $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . substr($filename, 1); } return \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($newFilename); }
/** * Generate the HTML after reading and converting images * Displays the verification and the converted image if succeeded * Adds error messages if needed * * @param string $imageFile The file name of the converted image * @param array $IMcommands The ImageMagick commands used * @param string $note Additional note for image operation * @return array Contains content and highest error level * @todo Define visibility */ public function displayTwinImage($imageFile, $IMcommands = array(), $note = '') { // Get the template file $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'DisplayTwinImage.html'); // Get the template part from the file $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###TEMPLATE###'); $content = ''; $errorLevels = array(-1); if ($imageFile) { // Get the subpart for the images $imageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###IMAGE###'); $verifyFile = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('install') . 'verify_imgs/' . basename($imageFile); $destImg = @getImageSize($imageFile); $destImgCode = '<img src="' . $this->backPath . '../' . substr($imageFile, strlen(PATH_site)) . '" ' . $destImg[3] . '>'; $verifyImg = @getImageSize($verifyFile); $verifyImgCode = '<img src="' . $this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('install') . 'verify_imgs/' . basename($verifyFile) . '" ' . $verifyImg[3] . '>'; clearstatcache(); $destImg['filesize'] = @filesize($imageFile); clearstatcache(); $verifyImg['filesize'] = @filesize($verifyFile); // Define the markers content $imageMarkers = array('destWidth' => $destImg[0], 'destHeight' => $destImg[1], 'destUrl' => $this->backPath . '../' . substr($imageFile, strlen(PATH_site)), 'verifyWidth' => $verifyImg[0], 'verifyHeight' => $verifyImg[1], 'verifyUrl' => $this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('install') . 'verify_imgs/' . basename($verifyFile), 'yourServer' => 'Your server:', 'yourServerInformation' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($destImg['filesize']) . ', ' . $destImg[0] . 'x' . $destImg[1] . ' pixels', 'reference' => 'Reference:', 'referenceInformation' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($verifyImg['filesize']) . ', ' . $verifyImg[0] . 'x' . $verifyImg[1] . ' pixels'); if ($destImg[0] != $verifyImg[0] || $destImg[1] != $verifyImg[1]) { // Get the subpart for the different pixel dimensions message $differentPixelDimensionsSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($imageSubpart, '###DIFFERENTPIXELDIMENSIONS###'); // Define the markers content $differentPixelDimensionsMarkers = array('message' => 'Pixel dimension are not equal!'); // Fill the markers in the subpart $differentPixelDimensionsSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($differentPixelDimensionsSubpart, $differentPixelDimensionsMarkers, '###|###', TRUE, FALSE); $errorLevels[] = 2; } // Substitute the subpart for different pixel dimensions message $imageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($imageSubpart, '###DIFFERENTPIXELDIMENSIONS###', $differentPixelDimensionsSubpart); if ($note) { // Get the subpart for the note $noteSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($imageSubpart, '###NOTE###'); // Define the markers content $noteMarkers = array('message' => $note[0], 'label' => $note[1]); // Fill the markers in the subpart $noteSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($noteSubpart, $noteMarkers, '###|###', TRUE, FALSE); } // Substitute the subpart for the note $imageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($imageSubpart, '###NOTE###', $noteSubpart); if ($this->dumpImCommands && count($IMcommands)) { $commands = $this->formatImCmds($IMcommands); // Get the subpart for the ImageMagick commands $imCommandsSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($imageSubpart, '###IMCOMMANDS###'); // Define the markers content $imCommandsMarkers = array('message' => 'ImageMagick commands executed:', 'rows' => \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(count($commands), 2, 10), 'commands' => htmlspecialchars(implode(LF, $commands))); // Fill the markers in the subpart $imCommandsSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($imCommandsSubpart, $imCommandsMarkers, '###|###', TRUE, FALSE); } // Substitute the subpart for the ImageMagick commands $imageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($imageSubpart, '###IMCOMMANDS###', $imCommandsSubpart); // Fill the markers $imageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($imageSubpart, $imageMarkers, '###|###', TRUE, FALSE); } else { // Get the subpart when no image has been generated $noImageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###NOIMAGE###'); $commands = $this->formatImCmds($IMcommands); if (count($commands)) { // Get the subpart for the ImageMagick commands $commandsSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($noImageSubpart, '###COMMANDSAVAILABLE###'); // Define the markers content $commandsMarkers = array('rows' => \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(count($commands), 2, 10), 'commands' => htmlspecialchars(implode(LF, $commands))); // Fill the markers in the subpart $commandsSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($commandsSubpart, $commandsMarkers, '###|###', TRUE, FALSE); } // Substitute the subpart for the ImageMagick commands $noImageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($noImageSubpart, '###COMMANDSAVAILABLE###', $commandsSubpart); // Define the markers content $noImageMarkers = array('message' => 'There was no result from the ImageMagick operation', 'label' => 'Below there\'s a dump of the ImageMagick commands executed:'); // Fill the markers $noImageSubpart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($noImageSubpart, $noImageMarkers, '###|###', TRUE, FALSE); $errorLevels[] = 3; } // Substitute the subpart when image has been generated $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($template, '###IMAGE###', $imageSubpart); // Substitute the subpart when no image has been generated $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($content, '###NOIMAGE###', $noImageSubpart); return array($content, max($errorLevels)); }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } $TCA['sys_note'] = array('ctrl' => array('label' => 'subject', 'default_sortby' => 'ORDER BY crdate', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser', 'prependAtCopy' => 'LLL:EXT:lang/locallang_general.xlf:LGL.prependAtCopy', 'delete' => 'deleted', 'title' => 'LLL:EXT:sys_note/Resources/Private/Language/locallang_tca.xlf:sys_note', 'iconfile' => \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($_EXTKEY) . 'ext_icon.gif', 'sortby' => 'sorting', 'dynamicConfigFile' => \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'Configuration/Tca/SysNote.php')); \TYPO3\CMS\Core\Extension\ExtensionManager::allowTableOnStandardPages('sys_note'); \TYPO3\CMS\Core\Extension\ExtensionManager::addLLrefForTCAdescr('sys_note', 'EXT:sys_note/Resources/Private/Language/locallang_csh_sysnote.xlf');
/** * Prints the clipboard * * @return string HTML output * @todo Define visibility */ public function printClipboard() { $out = array(); $elCount = count($this->elFromTable($this->fileMode ? '_FILE' : '')); // Upper header $out[] = ' <tr class="t3-row-header"> <td colspan="3">' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_clipboard', $this->clLabel('clipboard', 'buttons')) . '</td> </tr>'; // Button/menu header: $thumb_url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('setThumb' => $this->clipData['_setThumb'] ? 0 : 1))); $rmall_url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('removeAll' => $this->current))); // Copymode Selector menu $copymode_url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(); $moveLabel = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:moveElements')); $copyLabel = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:copyElements')); $opt = array(); $opt[] = '<option style="padding-left: 20px; background-image: url(\'' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/clip_cut.gif', '', 1) . '\'); background-repeat: no-repeat;" value="" ' . ($this->currentMode() == 'copy' ? '' : 'selected="selected"') . '>' . $moveLabel . '</option>'; $opt[] = '<option style="padding-left: 20px; background-image: url(\'' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/clip_copy.gif', '', 1) . '\'); background-repeat: no-repeat;" value="1" ' . ($this->currentMode() == 'copy' ? 'selected="selected"' : '') . '>' . $copyLabel . '</option>'; $copymode_selector = ' <select name="CB[setCopyMode]" onchange="this.form.method=\'POST\'; this.form.action=\'' . htmlspecialchars($copymode_url . '&CB[setCopyMode]=') . '\'+(this.options[this.selectedIndex].value); this.form.submit(); return true;" >' . implode('', $opt) . '</select>'; // Selector menu + clear button $opt = array(); $opt[] = '<option value="" selected="selected">' . $this->clLabel('menu', 'rm') . '</option>'; // Import / Export link: if ($elCount && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('impexp')) { $opt[] = '<option value="' . htmlspecialchars('window.location.href=\'' . $this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('impexp') . 'app/index.php' . $this->exportClipElementParameters() . '\';') . '">' . $this->clLabel('export', 'rm') . '</option>'; } // Edit: if (!$this->fileMode && $elCount) { $opt[] = '<option value="' . htmlspecialchars('window.location.href=\'' . $this->editUrl() . '&returnUrl=\'+top.rawurlencode(window.location.href);') . '">' . $this->clLabel('edit', 'rm') . '</option>'; } // Delete: if ($elCount) { if ($GLOBALS['BE_USER']->jsConfirmation(4)) { $js = ' if (confirm(' . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.deleteClip'), $elCount)) . ')){ window.location.href=\'' . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . '&redirect=\'+top.rawurlencode(window.location.href); } '; } else { $js = ' window.location.href=\'' . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . '&redirect=\'+top.rawurlencode(window.location.href); '; } $opt[] = '<option value="' . htmlspecialchars($js) . '">' . $this->clLabel('delete', 'rm') . '</option>'; } $selector_menu = '<select name="_clipMenu" onchange="eval(this.options[this.selectedIndex].value);this.selectedIndex=0;">' . implode('', $opt) . '</select>'; $out[] = ' <tr class="typo3-clipboard-head"> <td nowrap="nowrap">' . '<a href="' . htmlspecialchars($thumb_url) . '#clip_head">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/thumb_' . ($this->clipData['_setThumb'] ? 's' : 'n') . '.gif', 'width="21" height="16"') . ' vspace="2" border="0" title="' . $this->clLabel('thumbmode_clip') . '" alt="" />' . '</a>' . '</td> <td width="95%" nowrap="nowrap">' . $copymode_selector . ' ' . $selector_menu . '</td> <td>' . '<a href="' . htmlspecialchars($rmall_url) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:buttons.clear', TRUE))) . '</a></td> </tr>'; // Print header and content for the NORMAL tab: $out[] = ' <tr class="bgColor5"> <td colspan="3"><a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('setP' => 'normal')))) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-table-' . ($this->current == 'normal' ? 'collapse' : 'expand')) . $this->padTitleWrap('Normal', 'normal') . '</a></td> </tr>'; if ($this->current == 'normal') { $out = array_merge($out, $this->printContentFromTab('normal')); } // Print header and content for the NUMERIC tabs: for ($a = 1; $a <= $this->numberTabs; $a++) { $out[] = ' <tr class="bgColor5"> <td colspan="3"><a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('setP' => 'tab_' . $a)))) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-table-' . ($this->current == 'tab_' . $a ? 'collapse' : 'expand')) . $this->padTitleWrap($this->clLabel('cliptabs') . $a, 'tab_' . $a) . '</a></td> </tr>'; if ($this->current == 'tab_' . $a) { $out = array_merge($out, $this->printContentFromTab('tab_' . $a)); } } // Wrap accumulated rows in a table: $output = '<a name="clip_head"></a> <!-- TYPO3 Clipboard: --> <table cellpadding="0" cellspacing="1" border="0" width="290" id="typo3-clipboard"> ' . implode('', $out) . ' </table>'; // Wrap in form tag: $output = '<form action="">' . $output . '</form>'; // Return the accumulated content: return $output; }
/** * Creates the tool bar links for the "edit" section of the Admin Panel. * * @return string A string containing images wrapped in <a>-tags linking them to proper functions. */ public function ext_makeToolBar() { // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead: $tsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); $tsConfig = $tsConfig['properties']['newContentWiz.']['overrideWithExtension']; $newContentWizScriptPath = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($tsConfig) ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($tsConfig) . 'mod1/db_new_content_el.php' : TYPO3_mainDir . 'sysext/cms/layout/db_new_content_el.php'; $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page); $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid); $id = $GLOBALS['TSFE']->id; $toolBar = '<a href="' . htmlspecialchars(TYPO3_mainDir . 'show_rechis.php?element=' . rawurlencode('pages:' . $id) . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '#latest">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/history2.gif', 'width="13" height="12"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_recordHistory') . '" alt="" /></a>'; if ($perms & 16 && $langAllowed) { $params = ''; if ($GLOBALS['TSFE']->sys_language_uid) { $params = '&sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid; } $toolBar .= '<a href="' . htmlspecialchars($newContentWizScriptPath . '?id=' . $id . $params . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/new_record.gif', 'width="16" height="12"') . ' hspace="1" border="0" align="top" title="' . $this->extGetLL('edit_newContentElement') . '" alt="" /></a>'; } if ($perms & 2) { $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'move_el.php?table=pages&uid=' . $id . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/move_page.gif', 'width="11" height="12') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_move_page') . '" alt="" /></a>'; } if ($perms & 8) { $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'db_new.php?id=' . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/new_page.gif', 'width="13" height="12"') . ' hspace="0" border="0" align="top" title="' . $this->extGetLL('edit_newPage') . '" alt="" /></a>'; } if ($perms & 2) { $params = '&edit[pages][' . $id . ']=edit'; $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/edit2.gif', 'width="11" height="12"') . 'hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_editPageProperties') . '" alt="" /></a>'; if ($GLOBALS['TSFE']->sys_language_uid && $langAllowed) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,t3ver_state', 'sys_language_overlay', 'pid=' . intval($id) . ' AND sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid . $GLOBALS['TSFE']->sys_page->enableFields('sys_language_overlay'), '', '', '1'); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $GLOBALS['TSFE']->sys_page->versionOL('sys_language_overlay', $row); if (is_array($row)) { $params = '&edit[sys_language_overlay][' . $row['uid'] . ']=edit'; $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'))) . '">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/edit3.gif', 'width="11" height="12"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_editPageOverlay') . '" alt="" /></a>'; } } } if ($GLOBALS['BE_USER']->check('modules', 'web_list')) { $urlParams = array(); $urlParams['id'] = $id; $urlParams['returnUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'); $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParams)) . '">' . '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(TYPO3_mainDir, 'gfx/list.gif', 'width="11" height="11"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_db_list') . '" alt="" /></a>'; } return $toolBar; }
/** * Assemble display of list of scheduled tasks * * @return string Table of pending tasks */ protected function listTasks() { // Define display format for dates $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']; $content = ''; // Get list of registered classes $registeredClasses = self::getRegisteredClasses(); // Get all registered tasks $query = array('SELECT' => '*', 'FROM' => 'tx_scheduler_task', 'WHERE' => '1=1', 'ORDERBY' => 'nextexecution'); $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($query); $numRows = $GLOBALS['TYPO3_DB']->sql_num_rows($res); // No tasks defined, display information message if ($numRows == 0) { /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('msg.noTasks'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $content .= $flashMessage->render(); } else { // Load ExtJS framework and specific JS library /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $this->doc->getPageRenderer(); $pageRenderer->loadExtJS(); $pageRenderer->addJsFile(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler') . 'res/tx_scheduler_be.js'); // Initialise table layout $tableLayout = array('table' => array('<table border="0" cellspacing="0" cellpadding="0" class="typo3-dblist">', '</table>'), '0' => array('tr' => array('<tr class="t3-row-header">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td style="width: 36px;">', '</td>'), '3' => array('<td colspan="2">', '</td>')), 'defRow' => array('tr' => array('<tr class="db_list_normal">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td class="right">', '</td>'), '2' => array('<td class="right">', '</td>'))); $disabledTaskRow = array('tr' => array('<tr class="db_list_normal disabled">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td class="right">', '</td>'), '2' => array('<td class="right">', '</td>')); $rowWithSpan = array('tr' => array('<tr class="db_list_normal">', '</tr>'), 'defCol' => array('<td>', '</td>'), '1' => array('<td class="right">', '</td>'), '2' => array('<td class="right">', '</td>'), '3' => array('<td colspan="6">', '</td>')); $table = array(); $tr = 0; // Header row $table[$tr][] = '<a href="#" onclick="toggleCheckboxes();" title="' . $GLOBALS['LANG']->getLL('label.checkAll', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-select') . '</a>'; $table[$tr][] = ' '; $table[$tr][] = $GLOBALS['LANG']->getLL('label.id'); $table[$tr][] = $GLOBALS['LANG']->getLL('task'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.type'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.frequency'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.parallel'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.lastExecution'); $table[$tr][] = $GLOBALS['LANG']->getLL('label.nextExecution'); $tr++; // Loop on all tasks while ($schedulerRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Define action icons $editAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:edit', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>'; $deleteAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('msg.delete') . '\');" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:delete', TRUE) . '" class="icon">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; $stopAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('msg.stop') . '\');" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:stop', TRUE) . '" class="icon"><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler') . '/res/gfx/stop.png') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:stop') . '" /></a>'; // Define some default values $lastExecution = '-'; $isRunning = FALSE; $executionStatus = 'scheduled'; $executionStatusOutput = ''; $name = ''; $nextDate = '-'; $execType = '-'; $frequency = '-'; $multiple = '-'; $startExecutionElement = ' '; // Restore the serialized task and pass it a reference to the scheduler object /** @var $task \TYPO3\CMS\Scheduler\Task */ $task = unserialize($schedulerRecord['serialized_task_object']); // Assemble information about last execution $context = ''; if (!empty($schedulerRecord['lastexecution_time'])) { $lastExecution = date($dateFormat, $schedulerRecord['lastexecution_time']); if ($schedulerRecord['lastexecution_context'] == 'CLI') { $context = $GLOBALS['LANG']->getLL('label.cron'); } else { $context = $GLOBALS['LANG']->getLL('label.manual'); } $lastExecution .= ' (' . $context . ')'; } if ($this->scheduler->isValidTaskObject($task)) { // The task object is valid $name = htmlspecialchars($registeredClasses[$schedulerRecord['classname']]['title'] . ' (' . $registeredClasses[$schedulerRecord['classname']]['extension'] . ')'); $name .= '<br /> '; $additionalInformation = $task->getAdditionalInformation(); if ($task instanceof \TYPO3\CMS\Scheduler\ProgressProviderInterface) { $progress = round(floatval($task->getProgress()), 2); $name .= $this->renderTaskProgressBar($progress); } if (!empty($additionalInformation)) { $name .= '[' . htmlspecialchars($additionalInformation) . ']'; } // Check if task currently has a running execution if (!empty($schedulerRecord['serialized_executions'])) { $isRunning = TRUE; $executionStatus = 'running'; } // Prepare display of next execution date // If task is currently running, date is not displayed (as next hasn't been calculated yet) // Also hide the date if task is disabled (the information doesn't make sense, as it will not run anyway) if ($isRunning || $schedulerRecord['disable'] == 1) { $nextDate = '-'; } else { $nextDate = date($dateFormat, $schedulerRecord['nextexecution']); if (empty($schedulerRecord['nextexecution'])) { $nextDate = $GLOBALS['LANG']->getLL('none'); } elseif ($schedulerRecord['nextexecution'] < $GLOBALS['EXEC_TIME']) { // Next execution is overdue, highlight date $nextDate = '<span class="late" title="' . $GLOBALS['LANG']->getLL('status.legend.scheduled') . '">' . $nextDate . '</span>'; $executionStatus = 'late'; } } // Get execution type if ($task->getExecution()->getInterval() == 0 && $task->getExecution()->getCronCmd() == '') { $execType = $GLOBALS['LANG']->getLL('label.type.single'); $frequency = '-'; } else { $execType = $GLOBALS['LANG']->getLL('label.type.recurring'); if ($task->getExecution()->getCronCmd() == '') { $frequency = $task->getExecution()->getInterval(); } else { $frequency = $task->getExecution()->getCronCmd(); } } // Get multiple executions setting if ($task->getExecution()->getMultiple()) { $multiple = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); } else { $multiple = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no'); } // Define checkbox $startExecutionElement = '<input type="checkbox" name="TYPO3\\CMS\\Scheduler\\Scheduler[execute][]" value="' . $schedulerRecord['uid'] . '" id="task_' . $schedulerRecord['uid'] . '" class="checkboxes" />'; // Show no action links (edit, delete) if task is running $actions = $editAction . $deleteAction; if ($isRunning) { $actions = $stopAction; } // Check the disable status // Row is shown dimmed if task is disabled, unless it is still running if ($schedulerRecord['disable'] == 1 && !$isRunning) { $tableLayout[$tr] = $disabledTaskRow; $executionStatus = 'disabled'; } // Check if the last run failed $failureOutput = ''; if (!empty($schedulerRecord['lastexecution_failure'])) { // Try to get the stored exception object /** @var $exception Exception */ $exception = unserialize($schedulerRecord['lastexecution_failure']); // If the exception could not be unserialized, issue a default error message if ($exception === FALSE || $exception instanceof \__PHP_Incomplete_Class) { $failureDetail = $GLOBALS['LANG']->getLL('msg.executionFailureDefault'); } else { $failureDetail = sprintf($GLOBALS['LANG']->getLL('msg.executionFailureReport'), $exception->getCode(), $exception->getMessage()); } $failureOutput = ' <img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_failure.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.failure')) . '" title="' . htmlspecialchars($failureDetail) . '" />'; } // Format the execution status, // including failure feedback, if any $executionStatusOutput = '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_' . $executionStatus . '.png') . ' id="executionstatus_' . $schedulerRecord['uid'] . '" alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.' . $executionStatus)) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.legend.' . $executionStatus)) . '" />' . $failureOutput; $table[$tr][] = $startExecutionElement; $table[$tr][] = $actions; $table[$tr][] = $schedulerRecord['uid']; $table[$tr][] = $executionStatusOutput; $table[$tr][] = $name; $table[$tr][] = $execType; $table[$tr][] = $frequency; $table[$tr][] = $multiple; $table[$tr][] = $lastExecution; $table[$tr][] = $nextDate; } else { // The task object is not valid // Prepare to issue an error /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('msg.invalidTaskClass'), $schedulerRecord['classname']), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); $executionStatusOutput = $flashMessage->render(); $tableLayout[$tr] = $rowWithSpan; $table[$tr][] = $startExecutionElement; $table[$tr][] = $deleteAction; $table[$tr][] = $schedulerRecord['uid']; $table[$tr][] = $executionStatusOutput; } $tr++; } // Render table $content .= $this->doc->table($table, $tableLayout); $content .= '<input type="submit" class="button" name="go" id="scheduler_executeselected" value="' . $GLOBALS['LANG']->getLL('label.executeSelected') . '" />'; } if (!count($registeredClasses) > 0) { /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('msg.noTasksDefined'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $content .= $flashMessage->render(); } // Display legend, if there's at least one registered task // Also display information about the usage of server time if ($numRows > 0) { $content .= $this->doc->spacer(20); $content .= '<h4>' . $GLOBALS['LANG']->getLL('status.legend') . '</h4> <ul> <li><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_failure.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.failure')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.failure')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.failure') . '</li> <li><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_late.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.late')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.late')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.late') . '</li> <li><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_running.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.running')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.running')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.running') . '</li> <li><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_scheduled.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.scheduled')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.scheduled')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.scheduled') . '</li> <li><img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('scheduler'), 'res/gfx/status_disabled.png') . ' alt="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.disabled')) . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('status.disabled')) . '" /> ' . $GLOBALS['LANG']->getLL('status.legend.disabled') . '</li> </ul>'; $content .= $this->doc->spacer(10); $content .= $this->displayServerTime(); } $GLOBALS['TYPO3_DB']->sql_free_result($res); return $content; }
/** * Create a regular new element (pages and records) * * @return void * @todo Define visibility */ public function regularNew() { $doNotShowFullDescr = FALSE; // Initialize array for accumulating table rows: $this->tRows = array(); // tree images $halfLine = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' alt="" />'; $firstLevel = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />'; $secondLevel = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" /> <img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />'; $secondLevelLast = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" /> <img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/joinbottom.gif', 'width="18" height="16"') . ' alt="" />'; // Get TSconfig for current page $pageTS = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->id); // Finish initializing new pages options with TSconfig // Each new page option may be hidden by TSconfig // Enabled option for the position of a new page $this->newPagesSelectPosition = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']); // Pseudo-boolean (0/1) for backward compatibility $this->newPagesInto = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']) ? 1 : 0; $this->newPagesAfter = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']) ? 1 : 0; // Slight spacer from header: $this->code .= $halfLine; // New Page $table = 'pages'; $v = $GLOBALS['TCA'][$table]; $pageIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array()); $newPageIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-page-new'); $rowContent = ''; // New pages INSIDE this pages $newPageLinks = array(); if ($this->newPagesInto && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, 'pages')) { // Create link to new page inside: $newPageLinks[] = $this->linkWrap(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array()) . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.inside', 1) . ')', $table, $this->id); } // New pages AFTER this pages if ($this->newPagesAfter && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) { $newPageLinks[] = $this->linkWrap($pageIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after', 1) . ')', 'pages', -$this->id); } // New pages at selection position if ($this->newPagesSelectPosition) { // Link to page-wizard: $newPageLinks[] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($GLOBALS['LANG']->getLL('pageSelectPosition')) . '</a>'; } // Assemble all new page links $numPageLinks = count($newPageLinks); for ($i = 0; $i < $numPageLinks; $i++) { // For the last link, use the "branch bottom" icon if ($i == $numPageLinks - 1) { $treeComponent = $secondLevelLast; } else { $treeComponent = $secondLevel; } $rowContent .= '<br />' . $treeComponent . $newPageLinks[$i]; } // Add row header and half-line if not empty if (!empty($rowContent)) { $rowContent .= '<br />' . $halfLine; $rowContent = $firstLevel . $newPageIcon . ' <strong>' . $GLOBALS['LANG']->getLL('createNewPage') . '</strong>' . $rowContent; } // Compile table row to show the icon for "new page (select position)" $startRows = array(); if ($this->showNewRecLink('pages') && !empty($rowContent)) { $startRows[] = ' <tr> <td nowrap="nowrap">' . $rowContent . '</td> <td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($table, '') . '</td> </tr> '; } // New tables (but not pages) INSIDE this pages $isAdmin = $GLOBALS['BE_USER']->isAdmin(); $newContentIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new'); if ($this->newContentInto) { if (is_array($GLOBALS['TCA'])) { $groupName = ''; foreach ($GLOBALS['TCA'] as $table => $v) { $count = count($GLOBALS['TCA'][$table]); $counter = 1; if ($table != 'pages' && $this->showNewRecLink($table) && $this->isTableAllowedForThisPage($this->pageinfo, $table) && $GLOBALS['BE_USER']->check('tables_modify', $table) && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1) && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, $table)) { $newRecordIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, array()); $rowContent = ''; // Create new link for record: $newLink = $this->linkWrap($newRecordIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1), $table, $this->id); // If the table is 'tt_content' (from "cms" extension), create link to wizard if ($table == 'tt_content') { $groupName = $GLOBALS['LANG']->getLL('createNewContent'); $rowContent = $firstLevel . $newContentIcon . ' <strong>' . $GLOBALS['LANG']->getLL('createNewContent') . '</strong>'; // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead: $overrideExt = $this->web_list_modTSconfig['properties']['newContentWiz.']['overrideWithExtension']; $pathToWizard = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($overrideExt) ? \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($overrideExt) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php'; $href = $pathToWizard . '?id=' . $this->id . '&returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $rowContent .= '<br />' . $secondLevel . $newLink . '<br />' . $secondLevelLast . '<a href="' . htmlspecialchars($href) . '">' . $newContentIcon . htmlspecialchars($GLOBALS['LANG']->getLL('clickForWizard')) . '</a>'; // Half-line added: $rowContent .= '<br />' . $halfLine; } else { // Get the title if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) { continue; } if ($v['ctrl']['adminOnly'] && !$isAdmin) { continue; } $nameParts = explode('_', $table); $thisTitle = ''; if ($nameParts[0] == 'tx' || $nameParts[0] == 'tt') { // Try to extract extension name if (substr($v['ctrl']['title'], 0, 8) == 'LLL:EXT:') { $_EXTKEY = substr($v['ctrl']['title'], 8); $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY, '/')); if ($_EXTKEY != '') { // First try to get localisation of extension title $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY))); $langFile = $temp[0]; $thisTitle = $GLOBALS['LANG']->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title'); // If no localisation available, read title from ext_emconf.php if (!$thisTitle && is_file(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'ext_emconf.php')) { include \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'ext_emconf.php'; $thisTitle = $EM_CONF[$_EXTKEY]['title']; } $iconFile[$_EXTKEY] = '<img ' . 'src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($_EXTKEY) . $GLOBALS['TYPO3_LOADED_EXT'][$_EXTKEY]['ext_icon'] . '" ' . 'width="16" height="16" ' . 'alt="' . $thisTitle . '" />'; } else { $thisTitle = $nameParts[1]; $iconFile[$_EXTKEY] = ''; } } else { $thisTitle = $nameParts[1]; $iconFile[$_EXTKEY] = ''; } } else { $_EXTKEY = 'system'; $thisTitle = $GLOBALS['LANG']->getLL('system_records'); $iconFile['system'] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-pagetree-root'); } if ($groupName == '' || $groupName != $_EXTKEY) { $groupName = empty($v['ctrl']['groupName']) ? $_EXTKEY : $v['ctrl']['groupName']; } $rowContent .= $newLink; $counter++; } // Compile table row: if ($table == 'tt_content') { $startRows[] = ' <tr> <td nowrap="nowrap">' . $rowContent . '</td> <td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($table, '') . '</td> </tr>'; } else { $this->tRows[$groupName]['title'] = $thisTitle; $this->tRows[$groupName]['html'][] = $rowContent; $this->tRows[$groupName]['table'][] = $table; } } } } } // User sort if (isset($pageTS['mod.']['wizards.']['newRecord.']['order'])) { $this->newRecordSortList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $pageTS['mod.']['wizards.']['newRecord.']['order'], TRUE); } uksort($this->tRows, array($this, 'sortNewRecordsByConfig')); // Compile table row: $finalRows = array(); $finalRows[] = implode('', $startRows); foreach ($this->tRows as $key => $value) { $row = '<tr> <td nowrap="nowrap">' . $halfLine . '<br />' . $firstLevel . '' . $iconFile[$key] . ' <strong>' . $value['title'] . '</strong>' . '</td><td> <br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($key, '') . '</td> </tr>'; $count = count($value['html']) - 1; foreach ($value['html'] as $recordKey => $record) { $row .= ' <tr> <td nowrap="nowrap">' . ($recordKey < $count ? $secondLevel : $secondLevelLast) . $record . '</td> <td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp($value['table'][$recordKey], '') . '</td> </tr>'; } $finalRows[] = $row; } // end of tree $finalRows[] = ' <tr> <td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/ol/stopper.gif', 'width="18" height="16"') . ' alt="" /></td> <td></td> </tr> '; // Make table: $this->code .= ' <table border="0" cellpadding="0" cellspacing="0" id="typo3-newRecord"> ' . implode('', $finalRows) . ' </table> '; }
/** * Main Task center module * * @return string HTML content. */ public function main() { $content = ''; $id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display')); // If a preset is found, it is rendered using an iframe if ($id > 0) { $url = $GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id; return $this->taskObject->urlInIframe($url, 1); } else { // Header $content .= $this->taskObject->description($GLOBALS['LANG']->getLL('.alttitle'), $GLOBALS['LANG']->getLL('.description')); $thumbnails = $lines = array(); // Thumbnail folder and files: $tempDir = $this->userTempFolder(); if ($tempDir) { $thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1); } $clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames(); // Create preset links: $presets = $this->getPresets(); // If any presets found if (is_array($presets)) { foreach ($presets as $key => $presetCfg) { $configuration = unserialize($presetCfg['preset_data']); $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']]; $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']'; $icon = 'EXT:impexp/export.gif'; $description = array(); // Is public? if ($presetCfg['public']) { $description[] = $GLOBALS['LANG']->getLL('task.public') . ': ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); } // Owner $description[] = $GLOBALS['LANG']->getLL('task.owner') . ': ' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? $GLOBALS['LANG']->getLL('task.own') : '[' . htmlspecialchars($usernames[$presetCfg['user_uid']]['username']) . ']'); // Page & path if ($configuration['pagetree']['id']) { $description[] = $GLOBALS['LANG']->getLL('task.page') . ': ' . $configuration['pagetree']['id']; $description[] = $GLOBALS['LANG']->getLL('task.path') . ': ' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20)); } else { $description[] = $GLOBALS['LANG']->getLL('single-record'); } // Meta information if ($configuration['meta']['title'] || $configuration['meta']['description'] || $configuration['meta']['notes']) { $metaInformation = ''; if ($configuration['meta']['title']) { $metaInformation .= '<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />'; } if ($configuration['meta']['description']) { $metaInformation .= htmlspecialchars($configuration['meta']['description']); } if ($configuration['meta']['notes']) { $metaInformation .= '<br /><br /> <strong>' . $GLOBALS['LANG']->getLL('notes') . ': </strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>'; } $description[] = '<br />' . $metaInformation; } // Collect all preset information $lines[$key] = array('icon' => $icon, 'title' => $title, 'descriptionHtml' => implode('<br />', $description), 'link' => 'mod.php?M=user_task&SET[function]=impexp.tx_impexp_task&display=' . $presetCfg['uid']); } // Render preset list $content .= $this->taskObject->renderListMenu($lines); } else { // No presets found $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('no-presets'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE); $content .= $flashMessage->render(); } } return $content; }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } if (TYPO3_MODE == 'BE') { $TCA['sys_action'] = array('ctrl' => array('label' => 'title', 'tstamp' => 'tstamp', 'default_sortby' => 'ORDER BY title', 'sortby' => 'sorting', 'prependAtCopy' => 'LLL:EXT:lang/locallang_general.php:LGL.prependAtCopy', 'title' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'adminOnly' => 1, 'rootLevel' => -1, 'setToDefaultOnCopy' => 'assign_to_groups', 'enablecolumns' => array('disabled' => 'hidden'), 'typeicon_classes' => array('default' => 'mimetypes-x-sys_action'), 'type' => 'type', 'iconfile' => \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($_EXTKEY) . 'x-sys_action.png', 'dynamicConfigFile' => \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'tca.php')); $GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('sys_action') . 'toolbarmenu/registerToolbarItem.php'; \TYPO3\CMS\Core\Extension\ExtensionManager::addLLrefForTCAdescr('sys_action', 'EXT:sys_action/locallang_csh_sysaction.xml'); $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']['sys_action']['tx_sysaction_task'] = array('title' => 'LLL:EXT:sys_action/locallang_tca.xml:sys_action', 'description' => 'LLL:EXT:sys_action/locallang_csh_sysaction.xml:.description', 'icon' => 'EXT:sys_action/x-sys_action.png'); }