/** * Constructor * * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference */ public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) { $this->backendReference = $backendReference; $this->cacheActions = array(); $this->optionValues = array('all', 'pages'); // Clear cache for ALL tables! if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_all', TRUE); $this->cacheActions[] = array('id' => 'all', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=all&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); } // Clear cache for either ALL pages if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages', TRUE); $this->cacheActions[] = array('id' => 'pages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=pages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium')); } // Clearing of cache-files in typo3conf/ + menu if ($GLOBALS['BE_USER']->isAdmin()) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf', TRUE); $this->cacheActions[] = array('id' => 'temp_CACHED', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=temp_CACHED&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low')); } // Hook for manipulate cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Add an entry to the CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { $title = LocalizationUtility::translate('cache_action.title', 'cs_clear_images'); $icon = '<img ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ExtensionManagementUtility::extRelPath('cs_clear_images') . 'Resources/Public/Images/clear_cache_icon.png', 'width="16" height="16"') . ' alt="" title="' . $title . '"/>'; // Clearing of processed images $cacheActions[] = array('id' => 'tx_csclearimages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=tx_csclearimages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => $icon); }
/** * Modifies CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) { $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $optionValues[] = 'dyncss'; } }
/** * Constructor * * @throws \UnexpectedValueException */ public function __construct() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ClearCacheMenu'); // Clear all page-related caches if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) { $this->cacheActions[] = array('id' => 'pages', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'pages', 'ajaxCall' => 1]) . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low')); $this->optionValues[] = 'pages'; } // Clear cache for ALL tables! if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { $this->cacheActions[] = array('id' => 'all', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all', 'ajaxCall' => 1]) . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium')); $this->optionValues[] = 'all'; } // Clearing of system cache (core cache, class cache etc) // is only shown explicitly if activated for a BE-user (not activated for admins by default) // or if the system runs in development mode // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins) if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin()) { $this->cacheActions[] = array('id' => 'system', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'system', 'ajaxCall' => 1]) . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $this->optionValues[] = 'system'; } // Hook for manipulating cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Modifies CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) * * @return void */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) { $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.title', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.description', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('extensions-dyncss-lightning-blue')); $optionValues[] = 'dyncss'; } }
/** * Post-processing to define which control items to show. Possibly own icons can be added here. * * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...) * @param string $foreignTable The table (foreign_table) we create control-icons for * @param array $childRecord The current record of that foreign_table * @param array $childConfig TCA configuration of the current field of the child record * @param boolean $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record * @param array $controlItems (reference) Associative array with the currently available control items * * @return void */ public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems) { if ($foreignTable != 'sys_file_reference') { return; } if (!GeneralUtility::isFirstPartOfStr($childRecord['uid_local'], 'sys_file_')) { return; } $parts = BackendUtility::splitTable_Uid($childRecord['uid_local']); if (!isset($parts[1])) { return; } $table = $childRecord['tablenames']; $uid = $parentUid; $arguments = GeneralUtility::_GET(); if ($this->isValidRecord($table, $uid) && isset($arguments['edit'])) { $returnUrl = ['edit' => $arguments['edit'], 'returnUrl' => $arguments['returnUrl']]; if (GeneralUtility::compat_version('7.0')) { $returnUrlGenerated = BackendUtility::getModuleUrl('record_edit', $returnUrl); } else { $returnUrlGenerated = 'alt_doc.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $returnUrl, '', true, true), '&') . BackendUtility::getUrlToken('editRecord'); } $wizardArguments = ['P' => ['referenceUid' => $childRecord['uid'], 'returnUrl' => $returnUrlGenerated]]; $wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments); } else { $wizardUri = 'javascript:alert(\'Please save the base record first, because open this wizard will not save the changes in the current form!\');'; } /** @var WizardService $wizardService */ $wizardService = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\WizardService'); $this->arrayUnshiftAssoc($controlItems, 'focuspoint', $wizardService->getWizardButton($wizardUri)); }
/** * Constructor * * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference * @throws \UnexpectedValueException */ public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) { $this->backendReference = $backendReference; $this->cacheActions = array(); $this->optionValues = array(); $backendUser = $this->getBackendUser(); // Clear all page-related caches if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) { $this->cacheActions[] = array('id' => 'pages', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=pages&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low')); $this->optionValues[] = 'pages'; } // Clear cache for ALL tables! if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { $this->cacheActions[] = array('id' => 'all', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=all&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium')); $this->optionValues[] = 'all'; } // Clearing of system cache (core cache, class cache etc) // is only shown explicitly if activated for a BE-user (not activated for admins by default) // or if the system runs in development mode // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins) if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin()) { $this->cacheActions[] = array('id' => 'system', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=system&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $this->optionValues[] = 'system'; } // Hook for manipulating cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Render link with sprite icon to remove user * * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to * @return string */ public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser) { if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) { return ''; } $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'); $parameters = 'cmd[be_users][' . $backendUser->getUid() . '][delete]=1'; $url = $GLOBALS['BACK_PATH'] . 'tce_db.php?&' . $parameters . '&redirect=' . ($redirectUrl == '' ? '\' + T3_THIS_LOCATION + \'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1'; return '<a href="' . $url . '" onclick="return confirm(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { /** @var BackendUserAuthentication $beUser */ $beUser = $GLOBALS['BE_USER']; $urlParameters = ['vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => $arguments['redirectUrl'] ?: GeneralUtility::getIndpEnv('REQUEST_URI')]; if (isset($arguments['parameters'])) { $parametersArray = GeneralUtility::explodeUrl2Array($arguments['parameters']); $urlParameters += $parametersArray; } return htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction')); }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { /** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */ $backendUser = $arguments['backendUser']; /** @var BackendUserAuthentication $beUser */ $beUser = $GLOBALS['BE_USER']; if ($backendUser->getUid() === (int) $beUser->user['uid']) { return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; } $urlParameters = ['cmd[be_users][' . $backendUser->getUid() . '][delete]' => 1, 'vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')]; $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction'); return '<a class="btn btn-default" href="' . htmlspecialchars($url) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue(LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; }
/** * Returns a URL to link to quick command * * @param string $parameters Is a set of GET params to send to FormEngine * @return string URL to FormEngine module + parameters */ public function render($parameters) { $parameters = GeneralUtility::explodeUrl2Array($parameters); $parameters['vC'] = $this->getBackendUserAuthentication()->veriCode(); $parameters['prErr'] = 1; $parameters['uPT'] = 1; // Make sure record_edit module is available if (GeneralUtility::compat_version('7.0')) { $url = BackendUtility::getModuleUrl('tce_db', $parameters); } else { $url = 'tce_db.php?' . GeneralUtility::implodeArrayForUrl('', $parameters); } return $url . BackendUtility::getUrlToken('tceAction'); }
/** * Renders a link to delete the file * * @param array $arguments * @param Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $veriCode = '&vC='; if ($GLOBALS['BE_USER'] instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) { $veriCode .= $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction'); } if (empty($arguments['returnUrl'])) { $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); } /** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */ $file = $arguments['file']; $params = ['file' => ['delete' => [0 => ['data' => $file->getCombinedIdentifier()]]], 'redirect' => $arguments['returnUrl']]; return BackendUtility::getModuleUrl('tce_file', $params) . $veriCode; }
/** * Returns the URL to a given module * mainly used for visibility settings or deleting * a record via AJAX * * @param string $moduleName Name of the module * @param array $urlParameters URL parameters that should be added as key value pairs * @return string Calculated URL * @todo remove condition for TYPO3 6.2 in upcoming major version */ public static function getModuleUrl($moduleName, $urlParameters = []) { if (GeneralUtility::compat_version('7.2')) { $uri = BackendUtilityCore::getModuleUrl($moduleName, $urlParameters); } else { $uri = 'tce_db.php?' . BackendUtilityCore::getUrlToken('tceAction'); } return $uri; }
/** * Main function. * Creates some general objects and calls other functions for the main rendering of module content. * * @return void */ public function main() { $lang = $this->getLanguageService(); // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access) { // Initialize permission settings: $this->CALC_PERMS = $this->getBackendUser()->calcPerms($this->pageinfo); $this->EDIT_CONTENT = $this->CALC_PERMS & Permission::CONTENT_EDIT ? 1 : 0; // Start document template object: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html'); // override the default jumpToUrl $this->doc->JScodeArray['jumpToUrl'] = ' function jumpToUrl(URL,formEl) { if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?) if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else { window.location.href = URL; } } '; $this->doc->JScode .= $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int) $this->id . '_"+top.fsMod.currentBank; ' . (int) $this->id . '; ' . ($this->popView ? BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->id)) : '') . ' function deleteRecord(table,id,url) { // if (confirm(' . GeneralUtility::quoteJSvalue($lang->getLL('deleteWarning')) . ')) { window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1"; } return false; } '); $this->doc->JScode .= $this->doc->wrapScriptTags(' var DTM_array = new Array(); var DTM_origClass = new String(); // if tabs are used in a popup window the array might not exists if(!top.DTM_currentTabs) { top.DTM_currentTabs = new Array(); } function DTM_activate(idBase,index,doToogle) { // // Hiding all: if (DTM_array[idBase]) { for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { if (DTM_array[idBase][cnt] != idBase+"-"+index) { document.getElementById(DTM_array[idBase][cnt]+"-DIV").className = "tab-pane"; document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").value = "tab"; } } } // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").className === "tab-pane active") { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase] = -1; } else { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active"; } else { DTM_origClass = "active"; } top.DTM_currentTabs[idBase] = index; } } } function DTM_toggle(idBase,index,isInit) { // // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase+"-"+index] = 0; } else { document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active"; } else { DTM_origClass = "active"; } top.DTM_currentTabs[idBase+"-"+index] = 1; } } } '); // Setting doc-header $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_layout', array('id' => $this->id, 'imagemode' => $this->imagemode))) . '" method="post">'; // Creating the top function menu: $this->topFuncMenu = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], '', ''); $languageMenu = count($this->MOD_MENU['language']) > 1 ? $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', TRUE) . BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], '', '') : ''; // Find backend layout / coumns $backendLayout = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getSelectedBackendLayout', $this->id, $this); if (!empty($backendLayout['__colPosList'])) { $this->colPosList = implode(',', $backendLayout['__colPosList']); } // Removing duplicates, if any $this->colPosList = array_unique(GeneralUtility::intExplode(',', $this->colPosList)); // Accessible columns if (isset($this->modSharedTSconfig['properties']['colPos_list']) && trim($this->modSharedTSconfig['properties']['colPos_list']) !== '') { $this->activeColPosList = array_unique(GeneralUtility::intExplode(',', trim($this->modSharedTSconfig['properties']['colPos_list']))); // Match with the list which is present in the colPosList for the current page if (!empty($this->colPosList) && !empty($this->activeColPosList)) { $this->activeColPosList = array_unique(array_intersect($this->activeColPosList, $this->colPosList)); } } else { $this->activeColPosList = $this->colPosList; } $this->activeColPosList = implode(',', $this->activeColPosList); $this->colPosList = implode(',', $this->colPosList); $body = ''; $body .= $this->getHeaderFlashMessagesForCurrentPid(); // Render the primary module content: if ($this->MOD_SETTINGS['function'] == 0) { // QuickEdit $body .= $this->renderQuickEdit(); } else { // Page title $body .= $this->doc->header($this->getLocalizedPageTitle()); // All other listings $body .= $this->renderListContent(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : ''); $this->markers['CSH'] = $docHeaderButtons['csh']; $this->markers['TOP_FUNCTION_MENU'] = $this->topFuncMenu . $this->editSelect; $this->markers['LANGSELECTOR'] = $languageMenu; $this->markers['CONTENT'] = $body; // Build the <body> for the module $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $this->markers); // Renders the module page $this->content = $this->doc->render($lang->getLL('title'), $this->content); } else { // If no access or id value, create empty document: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; '); $body = $this->doc->header($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']); $title = $lang->getLL('clickAPage_header'); $message = $lang->getLL('clickAPage_content'); $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html')); $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO)); $body .= $view->render(); // Setting up the buttons and markers for docheader $docHeaderButtons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => '', 'edit_language' => ''); $this->markers['CSH'] = ''; $this->markers['TOP_FUNCTION_MENU'] = ''; $this->markers['LANGSELECTOR'] = ''; $this->markers['CONTENT'] = $body; $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $this->markers); // Renders the module page $this->content = $this->doc->render($lang->getLL('title'), $this->content); } }
/** * Returns a URL with a command to TYPO3 Core Engine (tce_db.php) * See description of the API elsewhere. * * @param string $params is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World * @param string $redirectUrl Redirect URL if any other that \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') is wished * @return string URL to tce_db.php + parameters (backpath is taken from $this->backPath) * @see \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick() * @todo Define visibility */ public function issueCommand($params, $redirectUrl = '') { $redirectUrl = $redirectUrl ? $redirectUrl : GeneralUtility::getIndpEnv('REQUEST_URI'); $commandUrl = $this->backPath . 'tce_db.php?' . $params . '&redirect=' . ($redirectUrl == -1 ? '\'+T3_THIS_LOCATION+\'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1'; return $commandUrl; }
/** * Creates the edit control section * * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing. * @return string HTML-table * @todo Define visibility */ public function makeEdit($fileOrFolderObject) { $cells = array(); $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier(); // Edit metadata of file try { if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) { $metaData = $fileOrFolderObject->_getMetaData(); $data = array('sys_file_metadata' => array($metaData['uid'] => 'edit')); $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl()); $title = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata')); $cells['editmetadata'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $title . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } else { $cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty'); } } catch (\Exception $e) { $cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty'); } // Edit file content (if editable) if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) { $editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;'; $cells['edit'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; } else { $cells['edit'] = IconUtility::getSpriteIcon('empty-empty'); } // rename the file if ($fileOrFolderObject->checkActionPermission('rename')) { $renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+\'file_rename.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;'; $cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>'; } else { $cells['rename'] = IconUtility::getSpriteIcon('empty-empty'); } if ($fileOrFolderObject->checkActionPermission('read')) { if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\Folder')) { $infoOnClick = 'top.launchView( \'_FOLDER\', \'' . $fullIdentifier . '\');return false;'; } elseif (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File')) { $infoOnClick = 'top.launchView( \'_FILE\', \'' . $fullIdentifier . '\');return false;'; } $cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>'; } else { $cells['info'] = IconUtility::getSpriteIcon('empty-empty'); } // delete the file if ($fileOrFolderObject->checkActionPermission('delete')) { $identifier = $fileOrFolderObject->getIdentifier(); if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)'); } else { $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)'); } if ($GLOBALS['BE_USER']->jsConfirmation(4)) { $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')'; } else { $confirmationCheck = '1 == 1'; } $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};'; $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; } else { $cells['delete'] = IconUtility::getSpriteIcon('empty-empty'); } // Hook for manipulating edit icons. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) { $cells['__fileOrFolderObject'] = $fileOrFolderObject; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Filelist\FileListEditIconHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797); } $hookObject->manipulateEditIcons($cells, $this); } unset($cells['__fileOrFolderObject']); } // Compile items into a DIV-element: return ' <!-- EDIT CONTROLS: --> <div class="typo3-editCtrl"> ' . implode(' ', $cells) . ' </div>'; }
/** * Adding CM element for Delete * * @param string $table Table name * @param integer $uid UID for the current record. * @param array $elInfo Label for including in the confirmation message, EXT:lang/locallang_core.php:mess.delete * @return array Item array, element in $menuItems * @internal */ function DB_delete($table, $uid, $elInfo) { $loc = 'top.content.list_frame'; if ($this->beUser->jsConfirmation(4)) { $conf = "confirm(" . GeneralUtility::quoteJSvalue(sprintf($this->LANG->sL('LLL:EXT:lang/locallang_core.php:mess.delete'), $elInfo[0]) . BackendUtility::referenceCount($table, $uid, ' (There are %s reference(s) to this record!)')) . ")"; } else { $conf = '1==1'; } $editOnClick = 'if(' . $loc . " && " . $conf . " ){" . $loc . ".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(" . $this->backRef->frameLocation($loc . '.document') . ")+'" . "&cmd[" . $table . '][' . $uid . '][DDdelete]=1&prErr=1&vC=' . $this->beUser->veriCode() . BackendUtility::getUrlToken('tceAction') . "';hideCM();}"; return $this->backRef->linkItem($this->LANG->getLLL('delete', $this->LL), $this->backRef->excludeIcon(IconUtility::getSpriteIcon('actions-edit-delete')), $editOnClick . 'return false;'); }
/** * Returns array with parts from which the admin functions can be constructed. * * @param string Backpath. * @return array * @todo Define visibility */ public function adminFunctions($backPath) { $functions = array(); // Clearing of cache-files in typo3conf/ + menu $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf'); $functions[] = array('id' => 'temp_CACHED', 'title' => $title, 'href' => $backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&redirect=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '&cacheCmd=temp_CACHED' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($backPath, 'gfx/clear_cache_files_in_typo3c.gif', 'width="21" height="18"') . ' title="' . htmlspecialchars($title) . '" alt="" />'); // Clear all page cache $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all'); $functions[] = array('id' => 'all', 'title' => $title, 'href' => $backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&redirect=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '&cacheCmd=all' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($backPath, 'gfx/clear_all_cache.gif', 'width="21" height="18"') . ' title="' . htmlspecialchars($title) . '" alt="" />'); // Return functions return $functions; }
/** * Creates the onclick event for the insert-icons. * * @param int $pid The pid. * @param int $newPagePID New page id. * @return string Onclick attribute content */ public function onClickEvent($pid, $newPagePID) { return 'window.location.href=' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('tce_db') . '&cmd[pages][' . $GLOBALS['SOBE']->moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&redirect=' . rawurlencode($this->R_URI) . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction')) . ';return false;'; }
/** * [Describe function...] * * @param array $row * @param array $conf * @param string $table * @return string * @todo Define visibility */ public function resultRowDisplay($row, $conf, $table) { static $even = FALSE; $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $SET = $GLOBALS['SOBE']->MOD_SETTINGS; $out = '<tr class="bgColor' . ($even ? '6' : '4') . '">'; $even = !$even; foreach ($row as $fN => $fV) { if (GeneralUtility::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') { if ($SET['search_result_labels']) { $fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />'); } else { $fVnew = htmlspecialchars($fV); } $out .= '<td>' . $fVnew . '</td>'; } } $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $out .= '<td nowrap>'; if (!$row['deleted']) { $out .= '<a href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ',\'' . $GLOBALS['BACK_PATH'] . '\');return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-dialog-information') . '</a>'; $out .= '<a href="#" onClick="' . BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], GeneralUtility::getIndpEnv('REQUEST_URI') . GeneralUtility::implodeArrayForUrl('SET', (array) GeneralUtility::_POST('SET'))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>'; } else { $out .= '<a href="' . GeneralUtility::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => GeneralUtility::linkThisScript(array()))) . BackendUtility::getUrlToken('tceAction') . '">'; $out .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-restore', array('title' => 'undelete only')) . '</a>'; $out .= '<a href="' . GeneralUtility::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => GeneralUtility::linkThisUrl('alt_doc.php', array('edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 'returnUrl' => GeneralUtility::linkThisScript(array()))))) . BackendUtility::getUrlToken('tceAction') . '">'; $out .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-restore-edit', array('title' => 'undelete and edit')) . '</a>'; } $_params = array($table => $row); if (is_array($this->hookArray['additionalButtons'])) { foreach ($this->hookArray['additionalButtons'] as $_funcRef) { $out .= GeneralUtility::callUserFunction($_funcRef, $_params, $this); } } $out .= '</td> </tr> '; return $out; }
/** * Render * * Render the form token * * @return string */ public function render() { $formToken = \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'); return $formToken; }
/** * Adding CM element for Copying/Moving a Page Into/After from a drag & drop action * * @param integer $srcUid source UID code for the record to modify * @param integer $dstUid destination UID code for the record to modify * @param string $action Action code: either "move" or "copy * @param string $into Parameter code: either "into" or "after * @return array Item array, element in $menuItems * @internal * @todo Define visibility */ public function dragDrop_copymovepage($srcUid, $dstUid, $action, $into) { $negativeSign = $into == 'into' ? '' : '-'; $editOnClick = ''; $loc = 'top.content.list_frame'; $editOnClick = 'if(' . $loc . '){' . $loc . '.document.location=top.TS.PATH_typo3+"tce_db.php?redirect="+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+"' . '&cmd[pages][' . $srcUid . '][' . $action . ']=' . $negativeSign . $dstUid . '&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '";}hideCM();top.nav.refresh();'; return $this->linkItem($this->label($action . 'Page_' . $into), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-paste-' . $into)), $editOnClick . 'return false;', 0); }
/** * Create on-click event value. * * @param mixed $row The record. If this is not an array with the record data the insert will be for the first position * in the column * @param string $vv Column position value. * @param int $moveUid Move uid * @param int $pid PID value. * @param int $sys_lang System language (not used currently) * @return string */ public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) { $table = 'tt_content'; if (is_array($row)) { $location = BackendUtility::getModuleUrl('tce_db') . '&cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=-' . $row['uid'] . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction'); } else { $location = BackendUtility::getModuleUrl('tce_db') . '&cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&data[' . $table . '][' . $moveUid . '][colPos]=' . $vv . '&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction'); } $location .= '&redirect=' . rawurlencode($this->R_URI); // returns to prev. page return 'window.location.href=' . GeneralUtility::quoteJSvalue($location) . ';return false;'; }
/** * Returns a URL with a command to TYPO3 Core Engine (tce_db.php) * * @param string $parameters Is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World * @param string $redirectUrl Redirect URL if any other that t3lib_div::getIndpEnv('REQUEST_URI') is wished * @return string URL to tce_db.php + parameters * @see t3lib_BEfunc::editOnClick() * @see template::issueCommand() */ public function render($parameters, $redirectUrl = '') { $redirectUrl = $redirectUrl ? $redirectUrl : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'); return $GLOBALS['BACK_PATH'] . 'tce_db.php?' . $parameters . '&redirect=' . ($redirectUrl == '' ? '\' + T3_THIS_LOCATION + \'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1'; }
/** * action list * * @param array $filter Filter Array * @return void */ public function listAction($filter = array()) { $users = $this->userRepository->findAllInBackend($filter); $this->view->assign('users', $users); $this->view->assign('token', BackendUtility::getUrlToken('tceAction')); }
/** * Redirects to FormEngine with new parameters to edit a just created localized record * * @param string $justLocalized String passed by GET &justLocalized= * @return void */ public function localizationRedirect($justLocalized) { list($table, $orig_uid, $language) = explode(':', $justLocalized); if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) { $localizedRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int) $language . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int) $orig_uid . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table)); if (is_array($localizedRecord)) { // Create parameters and finally run the classic page module for creating a new page translation $location = BackendUtility::getModuleUrl('record_edit', array('edit[' . $table . '][' . $localizedRecord['uid'] . ']' => 'edit', 'returnUrl' => GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')))); HttpUtility::redirect($location . BackendUtility::getUrlToken('editRecord')); } } }
/** * deleteUrl for current pad * * @param boolean $setRedirect If set, then the redirect URL will point back to the current script, but with CB reset. * @param boolean $file If set, then the URL will link to the tce_file.php script in the typo3/ dir. * @return string * @todo Define visibility */ public function deleteUrl($setRedirect = 1, $file = 0) { $rU = $this->backPath . ($file ? 'tce_file.php' : 'tce_db.php') . '?' . ($setRedirect ? 'redirect=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => ''))) : '') . '&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1' . '&CB[delete]=1' . '&CB[pad]=' . $this->current . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'); return $rU; }
/** * Returns a URL with a command to TYPO3 Core Engine (tce_db.php) * See description of the API elsewhere. * * @param string $params is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World * @param string|int $redirectUrl Redirect URL, default is to use GeneralUtility::getIndpEnv('REQUEST_URI'), -1 means to generate an URL for JavaScript using T3_THIS_LOCATION * @return string URL to tce_db.php + parameters (backpath is taken from $this->backPath) * @see \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick() */ public function issueCommand($params, $redirectUrl = '') { /** @var BackendUserAuthentication $beUser */ $beUser = $GLOBALS['BE_USER']; $urlParameters = ['prErr' => 1, 'uPT' => 1, 'vC' => $beUser->veriCode()]; $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . $params . BackendUtility::getUrlToken('tceAction') . '&redirect='; if ((int) $redirectUrl === -1) { $url = GeneralUtility::quoteJSvalue($url) . '+T3_THIS_LOCATION'; } else { $url .= rawurlencode($redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI')); } return $url; }
/** * Creates the edit control section * * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing. * @return string HTML-table */ public function makeEdit($fileOrFolderObject) { $cells = array(); $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier(); // Edit file content (if editable) if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) { $url = BackendUtility::getModuleUrl('file_edit', array('target' => $fullIdentifier)); $editOnClick = 'top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;'; $cells['edit'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>'; } else { $cells['edit'] = $this->spaceIcon; } if ($fileOrFolderObject instanceof File) { $fileUrl = $fileOrFolderObject->getPublicUrl(TRUE); if ($fileUrl) { $aOnClick = 'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) . ', \'WebFile\');'; $cells['view'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.view') . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } else { $cells['view'] = $this->spaceIcon; } } else { $cells['view'] = $this->spaceIcon; } // rename the file if ($fileOrFolderObject->checkActionPermission('rename')) { $url = BackendUtility::getModuleUrl('file_rename', array('target' => $fullIdentifier)); $renameOnClick = 'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;'; $cells['rename'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>'; } else { $cells['rename'] = $this->spaceIcon; } if ($fileOrFolderObject->checkActionPermission('read')) { $infoOnClick = ''; if ($fileOrFolderObject instanceof Folder) { $infoOnClick = 'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;'; } elseif ($fileOrFolderObject instanceof File) { $infoOnClick = 'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;'; } $cells['info'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>'; } else { $cells['info'] = $this->spaceIcon; } // delete the file if ($fileOrFolderObject->checkActionPermission('delete')) { $identifier = $fileOrFolderObject->getIdentifier(); if ($fileOrFolderObject instanceof Folder) { $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)'); } else { $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' (There are %s reference(s) to this file!)'); } if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) { $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')'; } else { $confirmationCheck = '1 == 1'; } $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_file') . '&file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=') . '+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};'; $cells['delete'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; } else { $cells['delete'] = $this->spaceIcon; } // Hook for manipulating edit icons. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof FileListEditIconHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797); } $hookObject->manipulateEditIcons($cells, $this); } } // Compile items into a DIV-element: return '<div class="btn-group">' . implode('', $cells) . '</div>'; }
/** * Main function. * Creates some general objects and calls other functions for the main rendering of module content. * * @return void * @todo Define visibility */ public function main() { // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access) { // Initialize permission settings: $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); $this->EDIT_CONTENT = $this->CALC_PERMS & 16 ? 1 : 0; // Start document template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_layout.html'); // JavaScript: $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.updateform.js') . '">' . '</script>'; $this->doc->JScode .= $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . intval($this->id) . '_"+top.fsMod.currentBank; ' . intval($this->id) . '; function jumpToUrl(URL,formEl) { // if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?) if (!TBE_EDITOR.isFormChanged()) { // window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else window.location.href = URL; } ' . ($this->popView ? \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->id)) : '') . ' function deleteRecord(table,id,url) { // if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')) . ')) { window.location.href = "' . $GLOBALS['BACK_PATH'] . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1"; } return false; } '); $this->doc->JScode .= $this->doc->wrapScriptTags(' var DTM_array = new Array(); var DTM_origClass = new String(); // if tabs are used in a popup window the array might not exists if(!top.DTM_currentTabs) { top.DTM_currentTabs = new Array(); } function DTM_activate(idBase,index,doToogle) { // // Hiding all: if (DTM_array[idBase]) { for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { if (DTM_array[idBase][cnt] != idBase+"-"+index) { document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none"; document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } } } // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase] = -1; } else { document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; } else { DTM_origClass = "tabact"; } top.DTM_currentTabs[idBase] = index; } } } function DTM_toggle(idBase,index,isInit) { // // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase+"-"+index] = 0; } else { document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; } else { DTM_origClass = "tabact"; } top.DTM_currentTabs[idBase+"-"+index] = 1; } } } function DTM_mouseOver(obj) { // DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue; obj.attributes.getNamedItem(\'class\').nodeValue += "_over"; } function DTM_mouseOut(obj) { // obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass; DTM_origClass = ""; } '); // Setting doc-header $this->doc->form = '<form action="' . htmlspecialchars('db_layout.php?id=' . $this->id . '&imagemode=' . $this->imagemode) . '" method="post">'; // Creating the top function menu: $this->topFuncMenu = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], 'db_layout.php', ''); $this->languageMenu = count($this->MOD_MENU['language']) > 1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language', 1) . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], 'db_layout.php', '') : ''; // Find backend layout / coumns $backendLayout = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', $this->id, $this); if (count($backendLayout['__colPosList'])) { $this->colPosList = implode(',', $backendLayout['__colPosList']); } // Removing duplicates, if any $this->colPosList = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->colPosList))); // Page title $body = $this->doc->header($this->pageinfo['title']); $body .= $this->getHeaderFlashMessagesForCurrentPid(); // Render the primary module content: if ($this->MOD_SETTINGS['function'] == 0) { // QuickEdit $body .= $this->renderQuickEdit(); } else { // All other listings $body .= $this->renderListContent(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : ''); $markers = array('CSH' => $docHeaderButtons['csh'], 'TOP_FUNCTION_MENU' => $this->topFuncMenu . $this->editSelect, 'LANGSELECTOR' => $this->languageMenu, 'CONTENT' => $body); // Build the <body> for the module $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); } else { // If no access or id value, create empty document: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_layout.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('clickAPage_content'), $GLOBALS['LANG']->getLL('clickAPage_header'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $body = $flashMessage->render(); // Setting up the buttons and markers for docheader $docHeaderButtons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => ''); $markers = array('CSH' => \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($this->descrTable, '', $GLOBALS['BACK_PATH'], '', TRUE), 'TOP_FUNCTION_MENU' => '', 'LANGSELECTOR' => '', 'CONTENT' => $body); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); } }