/** * Initialize script class * * @return void * @todo Define visibility */ public function init() { // Setting target, which must be a file reference to a file within the mounts. $this->target = $this->origTarget = $fileIdentifier = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); // create the file object if ($fileIdentifier) { $this->fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileIdentifier); } // Cleaning and checking target directory if (!$this->fileObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586841); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileObject->getIdentifier()); // *************************** // Setting template object // *************************** $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_edit.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' function backToList() { // top.goToModule("file_list"); } '); $this->doc->form = '<form action="tce_file.php" method="post" name="editform">'; }
/** * Initialize. * * @return void */ protected function init() { // Start the template object: $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->bodyTagMargins['x'] = 5; $this->doc->bodyTagMargins['y'] = 5; $this->doc->backPath = $GLOBALS['BACK_PATH']; // Add JS $this->doc->JScode = $this->doc->wrapScriptTags(' function jump(url, modName, mainModName) { // clear information about which entry in nav. tree that might have been highlighted. top.fsMod.navFrameHighlightedID = []; if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } top.nextLoadModuleUrl = url; top.goToModule(modName); } '); // Start the page: $this->content = ''; $this->content .= $this->doc->startPage('TYPO3 Edit Document'); // Loads the backend modules available for the logged in user. $this->loadModules = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader'); $this->loadModules->load($GLOBALS['TBE_MODULES']); }
/** * Initialize script class * * @return void * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException */ protected function init() { // Setting target, which must be a file reference to a file within the mounts. $this->target = $this->origTarget = $fileIdentifier = GeneralUtility::_GP('target'); $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); // create the file object if ($fileIdentifier) { $this->fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileIdentifier); } // Cleaning and checking target directory if (!$this->fileObject) { $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE); $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586841); } if ($this->fileObject->getStorage()->getUid() === 0) { throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889832); } // Setting the title and the icon $icon = IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileObject->getIdentifier()); // Setting template object $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_edit.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' function backToList() { // top.goToModule("file_list"); } '); $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">'; }
/** * Main function, rendering the browsable page tree * * @return void */ public function main() { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'doktype = 254 AND module in (\'dmail\')' . BackendUtility::deleteClause('pages'), '', 'title'); $out = ''; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if (BackendUtility::readPageAccess($row['uid'], $GLOBALS['BE_USER']->getPagePermsClause(1))) { $icon = $iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL)->render(); $out .= '<tr onmouseover="this.style.backgroundColor=\'' . GeneralUtility::modifyHTMLColorAll($this->doc->bgColor, -5) . '\'" onmouseout="this.style.backgroundColor=\'\'">' . '<td id="dmail_' . $row['uid'] . '" > <a href="#" onclick="top.fsMod.recentIds[\'txdirectmailM1\']=' . $row['uid'] . ';jumpTo(\'id=' . $row['uid'] . '\',this,\'dmail_' . $row['uid'] . '\');">' . $icon . ' ' . htmlspecialchars($row['title']) . '</a></td></tr>'; } } $GLOBALS['TYPO3_DB']->sql_free_result($res); $content = '<table cellspacing="0" cellpadding="0" border="0" width="100%">' . $out . '</table>'; // Adding highlight - JavaScript if ($this->doHighlight) { $content .= $this->doc->wrapScriptTags(' hilight_row("",top.fsMod.navFrameHighlightedID["web"]); '); } $docHeaderButtons = array('CSH' => BackendUtility::cshItem('_MOD_txdirectmailM1', 'folders', $GLOBALS['BACK_PATH'], TRUE), 'REFRESH' => '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('unique' => uniqid('directmail_navframe')))) . '">' . $iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL) . '</a>'); $markers = array('HEADLINE' => '', 'CONTENT' => $this->getLanguageService()->getLL('dmail_folders') . $content); // Build the <body> for the module $this->content = $this->doc->startPage('TYPO3 Direct Mail Navigation'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); }
/** * Main function, rendering the browsable page tree * * @return void * @todo Define visibility */ public function main() { // Produce browse-tree: $tree = $this->pagetree->getBrowsableTree(); // Outputting Temporary DB mount notice: if ($this->active_tempMountPoint) { $flashText = ' <a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) . '</a> <br />' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.path', 1) . ': <span title="' . htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->active_tempMountPoint['_thePath'], -50)) . '</span> '; $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $flashText, '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $this->content .= $flashMessage->render(); } // Outputting page tree: $this->content .= '<div id="PageTreeDiv">' . $tree . '</div>'; // Adding javascript for drag & drop activation and highlighting $this->content .= $this->doc->wrapScriptTags(' ' . ($this->doHighlight ? 'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '') . ' Tree.registerDragDropHandlers();'); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('IMG_RESET' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array('id' => 'treeFilterReset', 'alt' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'), 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'))), 'WORKSPACEINFO' => $this->getWorkspaceInfo(), 'CONTENT' => $this->content); $subparts = array(); if (!$this->hasFilterBox) { $subparts['###SECOND_ROW###'] = ''; } // Build the <body> for the module $this->content = $this->doc->startPage('TYPO3 Page Tree'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Initialize module header etc and call extObjContent function * * @return void */ 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 $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); // Template markers $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => ''); $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:func/Resources/Private/Templates/func.html'); // Main if ($this->id && $access) { // JavaScript $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />'; $vContent = $this->doc->getVersionSelector($this->id, TRUE); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } $this->extObjContent(); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); $markers['CONTENT'] = $this->content; } else { // If no access or if ID == zero $title = $this->getLanguageService()->getLL('title'); $message = $this->getLanguageService()->getLL('clickAPage_content'); $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html')); $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO)); $this->content = $view->render(); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; } // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($this->getLanguageService()->getLL('title'), $this->content); }
/** * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for folders. * * @return string HTML content for the module * @todo Define visibility */ public function main_folder() { // include JS files $this->doc->getDragDropCode('folders'); // Setting prefs for foldertree $this->doc->JScode .= $this->doc->wrapScriptTags(' Tree.ajaxID = "SC_alt_file_navframe::expandCollapse"; '); // Starting content: $content = $this->doc->startPage('TBE folder selector'); // Add the FlashMessages if any $content .= $this->doc->getFlashMessages(); // Init variable: $parameters = explode('|', $this->bparams); if ($this->expandFolder) { $this->selectedFolder = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($this->expandFolder); } if ($this->selectedFolder) { $createFolder = $this->createFolder($this->selectedFolder); } else { $createFolder = ''; } // Create folder tree: $folderTree = GeneralUtility::makeInstance('TBE_FolderTree'); $folderTree->thisScript = $this->thisScript; $folderTree->ext_noTempRecyclerDirs = $this->mode == 'filedrag'; $tree = $folderTree->getBrowsableTree(FALSE); list(, , $specUid) = explode('_', $this->PM); if ($this->selectedFolder) { if ($this->mode == 'filedrag') { $folders = $this->TBE_dragNDrop($this->selectedFolder, $parameters[3]); } else { $folders = $this->TBE_expandSubFolders($this->selectedFolder); } } // Putting the parts together, side by side: $content .= ' <!-- Wrapper table for folder tree / folder list: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles"> <tr> <td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('folderTree') . ':') . $tree . '</td> <td class="c-wCell" valign="top">' . $folders . '</td> </tr> </table> '; // Adding create folder if applicable: $content .= $createFolder; // Add some space $content .= '<br /><br />'; // Ending page, returning content: $content .= $this->doc->endPage(); $content = $this->doc->insertStylesAndJS($content); return $content; }
/** * Load the settings * * The settings are defined in pageTSconfig mod.wizards.form * * @return void */ protected function loadSettings() { $record = $this->repository->getRecord(); $pageId = $record->getPageId(); $modTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.wizards.form'); $settings = $modTSconfig['properties']; $this->removeTrailingDotsFromTyposcript($settings); $this->doc->JScode .= $this->doc->wrapScriptTags('TYPO3.Form.Wizard.Settings = ' . json_encode($settings) . ';'); }
/** * @return [type] ... * @todo Define visibility */ public function init() { $this->editorNo = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('editorNo'); $this->siteUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->bodyTagAdditions = 'onload="Init();"'; $this->doc->form = ' <form action="" id="process" name="process" method="post"> <input type="hidden" name="processContent" value="" /> <input type="hidden" name="returnUrl" value="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')) . '" /> '; $JScode = ' var plugin = window.parent.RTEarea[' . GeneralUtility::quoteJSvalue($this->editorNo) . '].editor.getPlugin("UserElements"); var HTMLArea = window.parent.HTMLArea; var editor = plugin.editor; function Init() { }; function insertHTML(content,noHide) { plugin.restoreSelection(); editor.getSelection().insertHtml(content); if(!noHide) plugin.close(); }; function wrapHTML(wrap1,wrap2,noHide) { plugin.restoreSelection(); if(!editor.getSelection().isEmpty()) { editor.getSelection().surroundHtml(wrap1,wrap2); } else { alert(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->getLL('noTextSelection')) . '); } if(!noHide) plugin.close(); }; function processSelection(script) { plugin.restoreSelection(); document.process.action = script; document.process.processContent.value = editor.getSelection().getHtml(); document.process.submit(); }; function jumpToUrl(URL) { var RTEtsConfigParams = "&RTEtsConfigParams=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RTEtsConfigParams')) . '"; var editorNo = "&editorNo=' . rawurlencode($this->editorNo) . '"; theLocation = URL+RTEtsConfigParams+editorNo; window.location.href = theLocation; } '; // unset the default jumpToUrl() function unset($this->doc->JScodeArray['jumpToUrl']); $this->doc->JScode = $this->doc->wrapScriptTags($JScode); $this->modData = $GLOBALS['BE_USER']->getModuleData('user.php', 'ses'); if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('OC_key')) { $parts = explode('|', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('OC_key')); $this->modData['openKeys'][$parts[1]] = $parts[0] == 'O' ? 1 : 0; $GLOBALS['BE_USER']->pushModuleData('user.php', $this->modData); } }
/** * Initialize module header etc and call extObjContent function * * @return void */ 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 $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) { $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html'); $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), 'defRow' => array('0' => array('<td valign="top">', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>'))); // JavaScript $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';'); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">'; $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } $this->extObjContent(); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } else { // If no access or if ID == zero $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); }
/** * Create selector for workspaces and change workspace if command is given to do that. * * @return string HTML * @todo Define visibility */ public function workspaceSelector() { // Changing workspace and if so, reloading entire backend: if (strlen($this->changeWorkspace)) { $GLOBALS['BE_USER']->setWorkspace($this->changeWorkspace); return $this->doc->wrapScriptTags('top.location.href="' . \TYPO3\CMS\Backend\Utility\BackendUtility::getBackendScript() . '";'); } // Changing workspace and if so, reloading entire backend: if (strlen($this->changeWorkspacePreview)) { $GLOBALS['BE_USER']->setWorkspacePreview($this->changeWorkspacePreview); } // Create options array: $options = array(); if ($GLOBALS['BE_USER']->checkWorkspace(array('uid' => 0))) { $options[0] = '[' . $GLOBALS['LANG']->getLL('bookmark_onlineWS') . ']'; } if ($GLOBALS['BE_USER']->checkWorkspace(array('uid' => -1))) { $options[-1] = '[' . $GLOBALS['LANG']->getLL('bookmark_offlineWS') . ']'; } // Add custom workspaces (selecting all, filtering by BE_USER check): if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) { $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers', 'sys_workspace', 'pid=0' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_workspace'), '', 'title'); if (count($workspaces)) { foreach ($workspaces as $rec) { if ($GLOBALS['BE_USER']->checkWorkspace($rec)) { $options[$rec['uid']] = $rec['uid'] . ': ' . $rec['title']; } } } } // Build selector box: if (count($options)) { foreach ($options as $value => $label) { $selected = (int) $GLOBALS['BE_USER']->workspace === $value ? ' selected="selected"' : ''; $options[$value] = '<option value="' . htmlspecialchars($value) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>'; } } else { $options[] = '<option value="-99">' . $GLOBALS['LANG']->getLL('bookmark_noWSfound', 1) . '</option>'; } $selector = ''; // Preview: if ($GLOBALS['BE_USER']->workspace !== 0) { $selector .= '<label for="workspacePreview">Frontend Preview:</label> <input type="checkbox" name="workspacePreview" id="workspacePreview" onclick="changeWorkspacePreview(' . ($GLOBALS['BE_USER']->user['workspace_preview'] ? 0 : 1) . ')"; ' . ($GLOBALS['BE_USER']->user['workspace_preview'] ? 'checked="checked"' : '') . '/> '; } $selector .= '<a href="mod/user/ws/index.php" target="content">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('sys_workspace', array()) . '</a>'; if (count($options) > 1) { $selector .= '<select name="_workspaceSelector" onchange="changeWorkspace(this.options[this.selectedIndex].value);">' . implode('', $options) . '</select>'; } return $selector; }
/** * Main function, creating the content for the access editing forms/listings * * @return void */ 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 $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo); // Checking access: if ($this->id && $access || $GLOBALS['BE_USER']->isAdmin() && !$this->id) { if ($GLOBALS['BE_USER']->isAdmin() && !$this->id) { $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0); } // This decides if the editform can and will be drawn: $this->editingAllowed = $this->pageinfo['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin(); $this->edit = $this->edit && $this->editingAllowed; // If $this->edit then these functions are called in the end of the page... if ($this->edit) { $this->doc->postCode .= $this->doc->wrapScriptTags(' setCheck("check[perms_user]", "data[pages][' . $this->id . '][perms_user]"); setCheck("check[perms_group]", "data[pages][' . $this->id . '][perms_group]"); setCheck("check[perms_everybody]", "data[pages][' . $this->id . '][perms_everybody]"); '); } // Draw the HTML page header. $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('permissions') . ($this->edit ? ': ' . $GLOBALS['LANG']->getLL('Edit') : '')); $this->content .= $this->doc->spacer(5); $vContent = $this->doc->getVersionSelector($this->id, 1); if ($vContent) { $this->content .= $this->doc->section('', $vContent); } // Main function, branching out: if (!$this->edit) { $this->notEdit(); } else { $this->doEdit(); } $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $this->docHeaderButtons['csh']; $markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[mode]', $this->MOD_SETTINGS['mode'], $this->MOD_MENU['mode']); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); } else { // If no access or if ID == zero $this->content = $this->doc->header($GLOBALS['LANG']->getLL('permissions')); } // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('permissions'), $this->content); }
/** * Initialization for the visual parts of the class * Use template rendering only if this is a non-AJAX call * * @return void */ public function initPage() { // Setting highlight mode: $doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight'); // Create template object: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_db_navframe.html'); $this->doc->showFlashMessages = FALSE; // Get HTML-Template // Adding javascript for drag & drop activation and highlighting $dragDropCode = 'Tree.registerDragDropHandlers();'; // If highlighting is active, define the CSS class for the active item depending on the workspace if ($doHighlight) { $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $this->getBackendUser()->workspace; $dragDropCode .= ' Tree.highlightClass = "' . $hlClass . '"; Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);'; } // Adding javascript code for drag&drop and the pagetree as well as the click menu code $this->doc->getDragDropCode('pages', $dragDropCode); $this->doc->getContextMenuCode(); /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $this->doc->getPageRenderer(); $pageRenderer->loadExtJS(); $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . ' // Function, loading the list frame from navigation tree: function jumpTo(id, linkObj, highlightID, bank) { // var theUrl = top.currentSubScript ; if (theUrl.indexOf("?") != -1) { theUrl += "&id=" + id } else { theUrl += "?id=" + id } top.fsMod.currentBank = bank; top.TYPO3.Backend.ContentContainer.setUrl(theUrl); ' . ($doHighlight ? 'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '') . ' if (linkObj) { linkObj.blur(); } return false; } ' . ($this->cMR ? 'jumpTo(top.fsMod.recentIds[\'web\'],\'\');' : '') . ' '); $this->doc->bodyTagId = 'typo3-pagetree'; }
/** * Main method. * * @return void */ public function main() { $listUrl = GeneralUtility::getIndpEnv('REQUEST_URI'); // Access check! // The page will show only if there is a valid page and if user may access it if ($this->id && (is_array($this->pageRow) ? 1 : 0)) { // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { document.location = URL; } function deleteRecord(table, id, url, warning) { if ( confirm(eval(warning)) ) { window.location.href = "' . $this->getBackPath() . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url); } return false; } ' . $this->doc->redirectUrls($listUrl) . ' '); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) { top.fsMod.recentIds["web"] = ' . (int) $this->id . '; } '); $this->doc->inDocStylesArray['mod_systemdata'] = ''; // Render content: $this->moduleContent(); } else { $this->content = 'Access denied or commerce pages not created yet!'; } $docHeaderButtons = $this->getHeaderButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content); $markers['FUNC_MENU'] = $this->doc->funcMenu('', BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'])); // put it all together $this->content = $this->doc->startPage($this->getLanguageService()->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageRow, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main Method, rendering either colorpicker or frameset depending on ->showPicker * * @return void */ public function main() { // Show frameset by default: if (!GeneralUtility::_GP('showPicker')) { $this->frameSet(); } else { // Putting together the items into a form: $content = ' <form name="colorform" method="post" action="' . htmlspecialchars(BackendUtility::getModuleUrl('wizard_colorpicker')) . '"> ' . $this->colorMatrix() . ' ' . $this->colorList() . ' ' . $this->colorImage() . ' <!-- Value box: --> <p class="c-head">' . $GLOBALS['LANG']->getLL('colorpicker_colorValue', TRUE) . '</p> <table border="0" cellpadding="0" cellspacing="3"> <tr> <td><input type="text" ' . $this->doc->formWidth(7) . ' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) . '" /></td> <td style="background-color:' . htmlspecialchars($this->colorValue) . '; border: 1px solid black;"> <span style="color: black;">' . $GLOBALS['LANG']->getLL('colorpicker_black', TRUE) . '</span> <span style="color: white;">' . $GLOBALS['LANG']->getLL('colorpicker_white', TRUE) . '</span> </td> <td><input type="submit" name="save_close" value="' . $GLOBALS['LANG']->getLL('colorpicker_setClose', TRUE) . '" /></td> </tr> </table> <!-- Hidden fields with values that has to be kept constant --> <input type="hidden" name="showPicker" value="1" /> <input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) . '" /> <input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) . '" /> <input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) . '" /> <input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) . '" /> <input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) . '" /> <input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) . '" /> </form>'; // If the save/close button is clicked, then close: if (GeneralUtility::_GP('save_close')) { $content .= $this->doc->wrapScriptTags(' setValue(' . GeneralUtility::quoteJSvalue($this->colorValue) . '); parent.close(); '); } // Output: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('colorpicker_title'), $content, 0, 1); } }
/** * initialization for the visual parts of the class * Use template rendering only if this is a non-AJAX call * * @return void */ public function initPage() { // Setting highlight mode: $this->doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight'); // Create template object: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->bodyTagId = 'ext-backend-Modules-FileSystemNavigationFrame-index-php'; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_file_navframe.html'); $this->doc->showFlashMessages = false; // Adding javascript code for drag&drop and the filetree as well as the click menu code $dragDropCode = ' Tree.ajaxID = "sc_alt_file_navframe_expandtoggle"; Tree.registerDragDropHandlers()'; if ($this->doHighlight) { $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace; $dragDropCode .= ' Tree.highlightClass = "' . $hlClass . '"; Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]); '; } // Adding javascript for drag & drop activation and highlighting $this->doc->getDragDropCode('folders', $dragDropCode); $this->doc->getContextMenuCode(); // Setting JavaScript for menu. $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . ' // Function, loading the list frame from navigation tree: function jumpTo(id, linkObj, highlightID, bank) { var theUrl = top.currentSubScript; if (theUrl.indexOf("?") != -1) { theUrl += "&id=" + id } else { theUrl += "?id=" + id } top.fsMod.currentBank = bank; top.TYPO3.Backend.ContentContainer.setUrl(theUrl); ' . ($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '') . ' if (linkObj) { linkObj.blur(); } return false; } ' . ($this->cMR ? ' jumpTo(top.fsMod.recentIds[\'file\'],\'\');' : '')); }
/** * Initialize * * @return void */ protected function init() { // Initialize GPvars: $this->number = GeneralUtility::_GP('number'); $this->target = $combinedIdentifier = GeneralUtility::_GP('target'); $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); // create the folder object if ($combinedIdentifier) { $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE); $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586845); } if ($this->folderObject->getStorage()->getUid() === 0) { throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889838); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier()); // Setting template object $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_newfolder.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' var path = "' . $this->target . '"; function reload(a) { // if (!changed || (changed && confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.redraw')) . '))) { var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '"; window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('file_newfolder')) . '+params; } } function backToList() { // top.goToModule("file_list"); } var changed = 0; '); }
/** * Initialization * * @return void */ public function init() { $language = $this->getLanguageService(); $language->includeLLFile('EXT:commerce/Resources/Private/Language/locallang_mod_statistic.xml'); $language->includeLLFile('EXT:lang/locallang_mod_web_list.php'); parent::init(); $this->extConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']; $this->excludePids = $this->extConf['excludeStatisticFolders'] != '' ? $this->extConf['excludeStatisticFolders'] : 0; $this->statistics = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Utility_StatisticsUtility'); $this->statistics->init($this->extConf['excludeStatisticFolders'] != '' ? $this->extConf['excludeStatisticFolders'] : 0); $this->orderPageId = current(array_unique(Tx_Commerce_Domain_Repository_FolderRepository::initFolders('Orders', 'Commerce', 0, 'Commerce'))); /** * If we get an id via GP use this, else use the default id */ $this->id = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); if (!$this->id) { $this->id = $this->orderPageId; } $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->docType = 'xhtml_trans'; $this->doc->setModuleTemplate(PATH_TXCOMMERCE . 'Resources/Private/Backend/mod_index.html'); if (!$this->doc->moduleTemplate) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('cannot set moduleTemplate', 'commerce', 2, array('backpath' => $this->doc->backPath, 'filename from TBE_STYLES' => $GLOBALS['TBE_STYLES']['htmlTemplates']['mod_index.html'], 'full path' => $this->doc->backPath . $GLOBALS['TBE_STYLES']['htmlTemplates']['mod_index.html'])); $templateFile = PATH_TXCOMMERCE_REL . 'Resources/Private/Backend/mod_index.html'; $this->doc->moduleTemplate = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL(PATH_site . $templateFile); } $this->doc->form = '<form action="" method="POST" name="editform">'; // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { document.location = URL; } '); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) { top.fsMod.recentIds["web"] = ' . (int) $this->id . '; } '); }
/** * Initialize * * @return void */ protected function init() { // Initialize GPvars: $this->target = GeneralUtility::_GP('target'); $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); // Cleaning and checking target if ($this->target) { $this->fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } if (!$this->fileOrFolderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586844); } if ($this->fileOrFolderObject->getStorage()->getUid() === 0) { throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889840); } // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced // so the redirect will NOT end in a error message // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to // rename the folder if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $parsedUrl = parse_url($this->returnUrl); $queryParts = GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query'])); if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) { $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl); } } // Setting icon and title $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->fileOrFolderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileOrFolderObject->getIdentifier()); // Setting template object $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_rename.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' function backToList() { // top.goToModule("file_list"); } '); }
/** * Main function, rendering the folder tree * * @return void * @todo Define visibility */ public function main() { // Produce browse-tree: $tree = $this->foldertree->getBrowsableTree(); // Outputting page tree: $this->content .= $tree; // Adding javascript for drag & drop activation and highlighting $this->content .= $this->doc->wrapScriptTags(' ' . ($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '') . ' Tree.registerDragDropHandlers();'); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('IMG_RESET' => '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"') . ' id="treeFilterReset" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" />', 'CONTENT' => $this->content); $subparts = array(); // Possible filter/search like in page tree $subparts['###SECOND_ROW###'] = ''; // Build the <body> for the module $this->content = $this->doc->startPage('TYPO3 Folder Tree'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Initialization. * * @return void */ public function init() { $language = $this->getLanguageService(); $language->includeLLFile('EXT:commerce/Resources/Private/Language/locallang_mod_statistic.xml'); $language->includeLLFile('EXT:lang/locallang_mod_web_list.php'); $this->MCONF = $GLOBALS['MCONF']; parent::init(); $this->statistics = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Utility\\StatisticsUtility'); $this->statistics->init((int) SettingsFactory::getInstance()->getExtConf('excludeStatisticFolders')); $this->orderPageId = current(array_unique(\CommerceTeam\Commerce\Domain\Repository\FolderRepository::initFolders('Orders', 'Commerce', 0, 'Commerce'))); /* * If we get an id via GP use this, else use the default id */ $this->id = (int) GeneralUtility::_GP('id'); if (!$this->id) { $this->id = $this->orderPageId; } $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $this->getBackPath(); $this->doc->docType = 'xhtml_trans'; $this->doc->setModuleTemplate(PATH_TXCOMMERCE . 'Resources/Private/Backend/mod_index.html'); $this->doc->form = '<form action="" method="POST" name="editform">'; // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { document.location = URL; } '); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) { top.fsMod.recentIds["web"] = ' . (int) $this->id . '; } '); }
/** * Creating the module output. * * @return void * @todo Define visibility */ public function main() { if ($this->id && $this->access) { // Init position map object: $posMap = GeneralUtility::makeInstance('ext_posMap'); $posMap->cur_sys_language = $this->sys_language; $posMap->backPath = $GLOBALS['BACK_PATH']; // If a column is pre-set: if (isset($this->colPos)) { if ($this->uid_pid < 0) { $row = array(); $row['uid'] = abs($this->uid_pid); } else { $row = ''; } $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language); } else { $this->onClickEvent = ''; } // *************************** // Creating content // *************************** // use a wrapper div $this->content .= '<div id="user-setup-wrapper">'; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); // Wizard $code = ''; $wizardItems = $this->getWizardItems(); // Wrapper for wizards $this->elementWrapper['section'] = array('<ul class="contentelement-wizard list-unstyled">', '</ul>'); // Copy wrapper for tabs $this->elementWrapperForTabs = $this->elementWrapper; // Hook for manipulating wizardItems, wrapper, onClickEvent etc. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Wizard\\NewContentElementWizardHookInterface', 1227834741); } $hookObject->manipulateWizardItems($wizardItems, $this); } } if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) { // Restore wrapper for tabs if they are overwritten in hook $this->elementWrapper = $this->elementWrapperForTabs; } // Add document inline javascript $this->doc->JScode = $this->doc->wrapScriptTags(' function goToalt_doc() { // ' . $this->onClickEvent . ' } if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '); // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc = $key = 0; $menuItems = array(); foreach ($wizardItems as $k => $wInfo) { if ($wInfo['header']) { $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]); $key = count($menuItems) - 1; } else { $content = ''; if (!$this->onClickEvent) { // Radio button: $oC = 'document.editForm.defValues.value=unescape(\'' . rawurlencode($wInfo['params']) . '\');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : ''); $content .= '<div class="contentelement-wizard-item-input"><input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" /></div>'; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $oC . 'return false;'; } else { $aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : ''); } $menuItems[$key]['content'] .= '<li> <div class="contentelement-wizard-item"> ' . $content . ' <div class="contentelement-wizard-item-icon"> <a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <img' . IconUtility::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /> </a> </div> <div class="contentelement-wizard-item-text"> <a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <strong>' . htmlspecialchars($wInfo['title']) . '</strong> <br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a> </div> </div> </li>'; $cc++; } } // Add closing section-tag foreach ($menuItems as $key => $val) { $menuItems[$key]['content'] .= $this->elementWrapper['section'][1]; } // Add the wizard table to the content, wrapped in tabs: if ($this->config['renderMode'] == 'tabs') { $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', FALSE, FALSE); } else { $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />'; foreach ($menuItems as $section) { $code .= '<h3 class="divider">' . $section['label'] . '</h3>' . $section['content']; } } $this->content .= $this->doc->section(!$this->onClickEvent ? $GLOBALS['LANG']->getLL('1_selectType') : '', $code, 0, 1); // If the user must also select a column: if (!$this->onClickEvent) { // Add anchor "sel2" $this->content .= $this->doc->section('', '<a name="sel2"></a>'); $this->content .= $this->doc->spacer(20); // Select position $code = $GLOBALS['LANG']->getLL('sel2', 1) . '<br /><br />'; // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->id, 'mod.SHARED'); $colPosList = trim($modTSconfig_SHARED['properties']['colPos_list']) !== '' ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3'; $colPosList = implode(',', array_unique(GeneralUtility::intExplode(',', $colPosList))); // Removing duplicates, if any // Finally, add the content of the column selector to the content: $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('2_selectPosition'), $code, 0, 1); } // Close wrapper div $this->content .= '</div>'; } else { // In case of no access: $this->content = ''; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('newContentElement')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->sectionEnd(); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function, starting the rendering of the list. * * @return void * @todo Define visibility */ public function main() { // Start document template object: $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:recordlist/Resources/Private/Templates/db_list.html'); // Loading current page record and checking access: $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Apply predefined values for hidden checkboxes // Set predefined value for DisplayBigControlPanel: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') { $this->MOD_SETTINGS['bigControlPanel'] = TRUE; } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') { $this->MOD_SETTINGS['bigControlPanel'] = FALSE; } // Set predefined value for Clipboard: if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') { $this->MOD_SETTINGS['clipBoard'] = TRUE; } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') { $this->MOD_SETTINGS['clipBoard'] = FALSE; } // Set predefined value for LocalizationView: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') { $this->MOD_SETTINGS['localization'] = TRUE; } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') { $this->MOD_SETTINGS['localization'] = FALSE; } // Initialize the dblist object: /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */ $dblist = GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\RecordList\\DatabaseRecordList'); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->script = BackendUtility::getModuleUrl('web_list', array(), ''); $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); $dblist->thumbs = $GLOBALS['BE_USER']->uc['thumbnailsByDefault']; $dblist->returnUrl = $this->returnUrl; $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0; $dblist->localizationView = $this->MOD_SETTINGS['localization']; $dblist->showClipboard = 1; $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView']; $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView']; $dblist->hideTables = $this->modTSconfig['properties']['hideTables']; $dblist->hideTranslations = $this->modTSconfig['properties']['hideTranslations']; $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.']; $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0; $dblist->allowedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], TRUE); $dblist->deniedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], TRUE); $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0; $dblist->pageRow = $this->pageinfo; $dblist->counter++; $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => ''); $dblist->modTSconfig = $this->modTSconfig; $clickTitleMode = trim($this->modTSconfig['properties']['clickTitleMode']); $dblist->clickTitleMode = $clickTitleMode === '' ? 'edit' : $clickTitleMode; // Clipboard is initialized: // Start clipboard $dblist->clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard'); // Initialize - reads the clipboard content from the user session $dblist->clipObj->initializeClipboard(); // Clipboard actions are handled: // CB is the clipboard command array $CB = GeneralUtility::_GET('CB'); if ($this->cmd == 'setCB') { // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. // By merging we get a full array of checked/unchecked elements // This is set to the 'el' array of the CB after being parsed so only the table in question is registered. $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), $this->cmd_table); } if (!$this->MOD_SETTINGS['clipBoard']) { // If the clipboard is NOT shown, set the pad to 'normal'. $CB['setP'] = 'normal'; } // Execute commands. $dblist->clipObj->setCmd($CB); // Clean up pad $dblist->clipObj->cleanCurrent(); // Save the clipboard content $dblist->clipObj->endClipboard(); // This flag will prevent the clipboard panel in being shown. // It is set, if the clickmenu-layer is active AND the extended view is not enabled. $dblist->dontShowClipControlPanels = !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers']; // If there is access to the page or root page is used for searching, then render the list contents and set up the document template object: if ($access || $this->id === 0 && $this->search_levels > 0 && strlen($this->search_field) > 0) { // Deleting records...: // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table. if ($this->cmd == 'delete') { $items = $dblist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), $this->cmd_table, 1); if (count($items)) { $cmd = array(); foreach ($items as $iK => $value) { $iKParts = explode('|', $iK); $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1; } $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); if (isset($cmd['pages'])) { BackendUtility::setUpdateSignal('updatePageTree'); } $tce->printLogErrorMessages(GeneralUtility::getIndpEnv('REQUEST_URI')); } } // Initialize the listing object, dblist, for rendering the list: $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000); $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit); $dblist->setDispFields(); // Render versioning selector: if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) { $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id); } // Render the list of tables: $dblist->generateList(); $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH'])); // Add JavaScript functions to the page: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpExt(URL,anchor) { // var anc = anchor?anchor:""; window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc; return false; } function jumpSelf(URL) { // window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); return false; } function setHighlight(id) { // top.fsMod.recentIds["web"]=id; top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } } ' . $this->doc->redirectUrls($listUrl) . ' ' . $dblist->CBfunctions() . ' function editRecords(table,idList,addParams,CBflag) { // window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams; } function editList(table,idList) { // var list=""; // Checking how many is checked, how many is not var pointer=0; var pos = idList.indexOf(","); while (pos!=-1) { if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) { list+=idList.substr(pointer,pos-pointer)+","; } pointer=pos+1; pos = idList.indexOf(",",pointer); } if (cbValue(table+"|"+idList.substr(pointer))) { list+=idList.substr(pointer)+","; } return list ? list : idList; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); } // access // Begin to compile the whole page, starting out with page header: $this->body = $this->doc->header($this->pageinfo['title']); $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">'; $this->body .= $dblist->HTMLcode; $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>'; // If a listing was produced, create the page footer with search form etc: if ($dblist->HTMLcode) { // Making field select box (when extended view for a single table is enabled): if ($dblist->table) { $this->body .= $dblist->fieldSelectBox($dblist->table); } // Adding checkbox options for extended listing and clipboard display: $this->body .= ' <!-- Listing options for extended view, clipboard and localization view --> <div id="typo3-listOptions"> <form action="" method="post">'; // Add "display bigControlPanel" checkbox: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') { $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"'); $this->body .= '<label for="checkLargeControl">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />'; } // Add "clipboard" checkbox: if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') { if ($dblist->showClipboard) { $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"'); $this->body .= '<label for="checkShowClipBoard">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />'; } } // Add "localization view" checkbox: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') { $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"'); $this->body .= '<label for="checkLocalization">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />'; } $this->body .= ' </form> </div>'; } // Printing clipboard if enabled if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) { $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>'; } // Search box: if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dblist->HTMLcode || $dblist->searchString !== '')) { $sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE)); $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>'; } // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $this->body .= GeneralUtility::callUserFunction($hook, $params, $this); } } // Setting up the buttons and markers for docheader $docHeaderButtons = $dblist->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body, 'EXTRACONTAINERCLASS' => $this->table ? 'singletable' : ''); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render('DB list', $this->content); }
/** * Initializes the Page * * @return void */ public function initPage() { /** * Document template * * @var \TYPO3\CMS\Backend\Template\DocumentTemplate $doc */ $doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc = $doc; $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:commerce/Resources/Private/Backend/mod_navigation.html'); $this->doc->showFlashMessages = FALSE; $subScript = $this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : ''; $highlight = $this->doHighlight ? 'hilight_row("txcommerceM1",highLightID);' : ''; $formstyle = !$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) { linkObj.blur(); }'; // Setting JavaScript for menu. $this->doc->JScode = $this->doc->wrapScriptTags($subScript . ' // Function, loading the list frame from navigation tree: function jumpTo(id, linkObj, highLightID) { var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "&id=" + id; if (top.condensedMode) { top.content.document.location = theUrl; } else { parent.list_frame.document.location = theUrl; } ' . $highlight . ' ' . $formstyle . ' return false; } // Call this function, refresh_nav(), from another script in the backend if you // want to refresh the navigation frame (eg. after having changed a page title or moved pages etc.) // See BackendUtility::getSetUpdateSignal() function refresh_nav() { window.setTimeout("_refresh_nav();", 0); } function _refresh_nav() { document.location="' . $this->pagetree->thisScript . '?unique=' . time() . '"; } // Highlighting rows in the page tree: function hilight_row(frameSetModule, highLightID) { // Remove old: theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule] + "_0"); if (theObj) { theObj.style.backgroundColor = ""; } // Set new: top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID; theObj = document.getElementById(highLightID + "_0"); if (theObj) { theObj.style.backgroundColor = "' . GeneralUtility::modifyHTMLColorAll($this->doc->bgColor, -20) . '"; } } ' . ($this->cMR ? "jumpTo(top.fsMod.recentIds['web'], '');" : '') . '; '); $this->doc->bodyTagId = 'typo3-pagetree'; }
/** * Main function, creating the listing * * @return void */ public function main() { // Initialize the template object $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:filelist/Resources/Private/Templates/file_list.html'); /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $this->doc->getPageRenderer(); $pageRenderer->loadJQuery(); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation'); // There there was access to this file path, continue, make the list if ($this->folderObject) { // Create filelisting object $this->filelist = GeneralUtility::makeInstance(FileList::class); $this->filelist->backPath = $GLOBALS['BACK_PATH']; // Apply predefined values for hidden checkboxes // Set predefined value for DisplayBigControlPanel: $backendUser = $this->getBackendUser(); if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') { $this->MOD_SETTINGS['bigControlPanel'] = TRUE; } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') { $this->MOD_SETTINGS['bigControlPanel'] = FALSE; } // Set predefined value for DisplayThumbnails: if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') { $this->MOD_SETTINGS['displayThumbs'] = TRUE; } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') { $this->MOD_SETTINGS['displayThumbs'] = FALSE; } // Set predefined value for Clipboard: if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') { $this->MOD_SETTINGS['clipBoard'] = TRUE; } elseif ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') { $this->MOD_SETTINGS['clipBoard'] = FALSE; } // If user never opened the list module, set the value for displayThumbs if (!isset($this->MOD_SETTINGS['displayThumbs'])) { $this->MOD_SETTINGS['displayThumbs'] = $backendUser->uc['thumbnailsByDefault']; } $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs']; // Create clipboard object and initialize that $this->filelist->clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class); $this->filelist->clipObj->fileMode = 1; $this->filelist->clipObj->initializeClipboard(); $CB = GeneralUtility::_GET('CB'); if ($this->cmd == 'setCB') { $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), '_FILE'); } if (!$this->MOD_SETTINGS['clipBoard']) { $CB['setP'] = 'normal'; } $this->filelist->clipObj->setCmd($CB); $this->filelist->clipObj->cleanCurrent(); // Saves $this->filelist->clipObj->endClipboard(); // If the "cmd" was to delete files from the list (clipboard thing), do that: if ($this->cmd == 'delete') { $items = $this->filelist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), '_FILE', 1); if (!empty($items)) { // Make command array: $FILE = array(); foreach ($items as $v) { $FILE['delete'][] = array('data' => $v); } // Init file processing object for deleting and pass the cmd array. $fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class); $fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']); $fileProcessor->setActionPermissions(); $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0; $fileProcessor->start($FILE); $fileProcessor->processData(); $fileProcessor->pushErrorMessagesToFlashMessageQueue(); } } if (!isset($this->MOD_SETTINGS['sort'])) { // Set default sorting $this->MOD_SETTINGS['sort'] = 'file'; $this->MOD_SETTINGS['reverse'] = 0; } // Start up filelisting object, include settings. $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000); $this->filelist->start($this->folderObject, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']); // Generate the list $this->filelist->generateList(); // Set top JavaScript: $this->doc->JScode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";' . $this->filelist->CBfunctions()); // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers. $this->doc->getContextMenuCode(); // Setting up the buttons and markers for docheader list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->folderObject); // add the folder info to the marker array $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo(); $docHeaderButtons = array_merge($this->getButtons(), $buttons); // Include DragUploader only if we have write access if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) { $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader'); $pageRenderer->addInlineLanguagelabelFile(ExtensionManagementUtility::extPath('lang') . 'locallang_core.xlf', 'file_upload'); } // Build the <body> for the module $moduleHeadline = $this->getModuleHeadline(); // Create output $pageContent = $moduleHeadline !== '' ? '<h1>' . $moduleHeadline . '</h1>' : ''; $pageContent .= '<form action="' . htmlspecialchars($this->filelist->listURL()) . '" method="post" name="dblistForm">'; $pageContent .= $this->filelist->HTMLcode; $pageContent .= '<input type="hidden" name="cmd" /></form>'; // Making listing options: if ($this->filelist->HTMLcode) { $pageContent .= ' <!-- Listing options for extended view, clipboard and thumbnails --> <div id="typo3-listOptions"> '; // Add "display bigControlPanel" checkbox: if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') { $pageContent .= '<div class="checkbox">' . '<label for="bigControlPanel">' . BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', '', 'id="bigControlPanel"') . $this->getLanguageService()->getLL('bigControlPanel', TRUE) . '</label>' . '</div>'; } // Add "display thumbnails" checkbox: if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') { $pageContent .= '<div class="checkbox">' . '<label for="checkDisplayThumbs">' . BackendUtility::getFuncCheck($this->id, 'SET[displayThumbs]', $this->MOD_SETTINGS['displayThumbs'], '', '', 'id="checkDisplayThumbs"') . $this->getLanguageService()->getLL('displayThumbs', TRUE) . '</label>' . '</div>'; } // Add "clipboard" checkbox: if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') { $pageContent .= '<div class="checkbox">' . '<label for="checkClipBoard">' . BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', '', 'id="checkClipBoard"') . $this->getLanguageService()->getLL('clipBoard', TRUE) . '</label>' . '</div>'; } $pageContent .= ' </div> '; // Set clipboard: if ($this->MOD_SETTINGS['clipBoard']) { $pageContent .= $this->filelist->clipObj->printClipboard(); $pageContent .= BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_clipboard'); } } $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => ($this->errorMessage ? $this->errorMessage->render() : '') . $pageContent, 'FOLDER_IDENTIFIER' => $this->folderObject->getCombinedIdentifier(), 'FILEDENYPATERN' => $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'], 'MAXFILESIZE' => GeneralUtility::getMaxUploadFileSize() * 1024); $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers)); // Renders the module page $this->content = $this->doc->render($this->getLanguageService()->getLL('files'), $this->content); } else { $content = ''; if ($this->errorMessage) { $this->errorMessage->setSeverity(FlashMessage::ERROR); $content = $this->doc->moduleBody(array(), array_merge(array('REFRESH' => '', 'PASTE' => '', 'LEVEL_UP' => ''), $this->getButtons()), array('CSH' => '', 'TITLE' => '', 'FOLDER_INFO' => '', 'PAGE_ICON' => '', 'FUNC_MENU' => '', 'CONTENT' => $this->errorMessage->render())); } // Create output - no access (no warning though) $this->content = $this->doc->render($this->getLanguageService()->getLL('files'), $content); } }
/** * 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); } }
/** * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for files. * * @return string HTML content for the module */ public function main_file() { // include JS files and set prefs for foldertree $this->doc->getDragDropCode('folders', 'Tree.ajaxID = "SC_alt_file_navframe::expandCollapse"'); // Starting content: $content = $this->doc->startPage('TBE file selector'); // Add the FlashMessages if any $content .= $this->doc->getFlashMessages(); // Init variable: $pArr = explode('|', $this->bparams); // The key number 3 of the pArr contains the "allowed" string. Disallowed is not passed to // the element browser at all but only filtered out in TCEMain afterwards $allowed = $pArr[3]; if ($allowed !== 'sys_file' && $allowed !== '*' && !empty($allowed)) { $allowedFileExtensions = $allowed; } $backendUser = $this->getBackendUserAuthentication(); if (isset($allowedFileExtensions)) { // Create new filter object $filterObject = GeneralUtility::makeInstance(FileExtensionFilter::class); $filterObject->setAllowedFileExtensions($allowedFileExtensions); // Set file extension filters on all storages $storages = $backendUser->getFileStorages(); /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */ foreach ($storages as $storage) { $storage->addFileAndFolderNameFilter(array($filterObject, 'filterFileList')); } } // Create upload/create folder forms, if a path is given $this->selectedFolder = FALSE; if ($this->expandFolder) { $fileOrFolderObject = NULL; // Try to fetch the folder the user had open the last time he browsed files // Fallback to the default folder in case the last used folder is not existing try { $fileOrFolderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->expandFolder); } catch (Exception $accessException) { // We're just catching the exception here, nothing to be done if folder does not exist or is not accessible. } if ($fileOrFolderObject instanceof Folder) { // It's a folder $this->selectedFolder = $fileOrFolderObject; } elseif ($fileOrFolderObject instanceof FileInterface) { // It's a file $this->selectedFolder = $fileOrFolderObject->getParentFolder(); } } // Or get the user's default upload folder if (!$this->selectedFolder) { try { $this->selectedFolder = $backendUser->getDefaultUploadFolder(); } catch (\Exception $e) { // The configured default user folder does not exist } } // Build the file upload and folder creation form $uploadForm = ''; $createFolder = ''; if ($this->selectedFolder) { $uploadForm = $this->uploadForm($this->selectedFolder); $createFolder = $this->createFolder($this->selectedFolder); } // Insert the upload form on top, if so configured if ($backendUser->getTSConfigVal('options.uploadFieldsInTopOfEB')) { $content .= $uploadForm; } // Getting flag for showing/not showing thumbnails: $noThumbs = $backendUser->getTSConfigVal('options.noThumbsInEB'); $_MOD_SETTINGS = array(); if (!$noThumbs) { // MENU-ITEMS, fetching the setting for thumbnails from File>List module: $_MOD_MENU = array('displayThumbs' => ''); $_MCONF['name'] = 'file_list'; $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']); } $noThumbs = $noThumbs ?: !$_MOD_SETTINGS['displayThumbs']; // Create folder tree: /** @var \TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView $folderTree */ $folderTree = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView::class); $folderTree->thisScript = $this->thisScript; $folderTree->ext_noTempRecyclerDirs = $this->mode == 'filedrag'; $tree = $folderTree->getBrowsableTree(); if ($this->selectedFolder) { if ($this->mode == 'filedrag') { $files = $this->TBE_dragNDrop($this->selectedFolder, $pArr[3]); } else { $files = $this->TBE_expandFolder($this->selectedFolder, $pArr[3], $noThumbs); } } else { $files = ''; } // Putting the parts together, side by side: $content .= ' <!-- Wrapper table for folder tree / file list: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles"> <tr> <td class="c-wCell" valign="top">' . $this->barheader($this->getLanguageService()->getLL('folderTree') . ':') . $tree . '</td> <td class="c-wCell" valign="top">' . $files . '</td> </tr> </table> '; // Adding create folder + upload forms if applicable: if (!$backendUser->getTSConfigVal('options.uploadFieldsInTopOfEB')) { $content .= $uploadForm; } $content .= $createFolder; // Add some space $content .= '<br /><br />'; // Setup indexed elements: $this->doc->JScode .= $this->doc->wrapScriptTags(' require(["TYPO3/CMS/Backend/BrowseLinks"], function(BrowseLinks) { BrowseLinks.addElements(' . json_encode($this->elements) . '); });'); // Ending page, returning content: $content .= $this->doc->endPage(); $content = $this->doc->insertStylesAndJS($content); return $content; }
/** * Main function of the module. Write the content to $this->content * * @return void * @todo Define visibility */ public function main() { // Template markers $markers = array('CSH' => '', 'FUNC_MENU' => '', 'WS_MENU' => '', 'CONTENT' => ''); // Setting module configuration: $this->MCONF = $GLOBALS['MCONF']; $this->REQUEST_URI = str_replace('&sendToReview=1', '', GeneralUtility::getIndpEnv('REQUEST_URI')); // Draw the header. $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:version/Resources/Private/Templates/version.html'); // Add styles $this->doc->inDocStylesArray[$GLOBALS['MCONF']['name']] = ' .version-diff-1 { background-color: green; } .version-diff-2 { background-color: red; } '; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Getting input data: $this->id = (int) GeneralUtility::_GP('id'); // Record uid. Goes with table name to indicate specific record $this->uid = (int) GeneralUtility::_GP('uid'); // // Record table. Goes with uid to indicate specific record $this->table = GeneralUtility::_GP('table'); $this->details = GeneralUtility::_GP('details'); // Page id. If set, indicates activation from Web>Versioning module $this->diffOnly = GeneralUtility::_GP('diffOnly'); // Flag. If set, shows only the offline version and with diff-view // Force this setting: $this->MOD_SETTINGS['expandSubElements'] = TRUE; $this->MOD_SETTINGS['diff'] = $this->details || $this->MOD_SETTINGS['diff'] ? 1 : 0; // Reading the record: $record = BackendUtility::getRecord($this->table, $this->uid); if ($record['pid'] == -1) { $record = BackendUtility::getRecord($this->table, $record['t3ver_oid']); } $this->recordFound = is_array($record); $pidValue = $this->table === 'pages' ? $this->uid : $record['pid']; // Checking access etc. if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS'] && !$this->id) { $this->doc->form = '<form action="" method="post">'; $this->uid = $record['uid']; // Might have changed if new live record was found! // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = BackendUtility::readPageAccess($pidValue, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($pidValue && $access || $GLOBALS['BE_USER']->user['admin'] && !$pidValue) { // JavaScript $this->doc->JScode .= $this->doc->wrapScriptTags(' function hlSubelements(origId, verId, over, diffLayer) { // if (over) { document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\'; document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver-hl\'; if (diffLayer) { document.getElementById(\'diff_\'+verId).style.visibility = \'visible\'; } } else { document.getElementById(\'orig_\'+origId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\'; document.getElementById(\'ver_\'+verId).attributes.getNamedItem("class").nodeValue = \'typo3-ver\'; if (diffLayer) { document.getElementById(\'diff_\'+verId).style.visibility = \'hidden\'; } } } '); // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $this->pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; // Setting publish access permission for workspace: $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace); $this->versioningMgm(); } $this->content .= $this->doc->spacer(10); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); $markers['CONTENT'] = $this->content; } else { // If no access or id value, create empty document $this->content = $this->doc->section($GLOBALS['LANG']->getLL('clickAPage_header'), $GLOBALS['LANG']->getLL('clickAPage_content'), 0, 1); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CONTENT'] = $this->content; } // Build the <body> for the module $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function, rendering the document with the iFrame with the RTE in. * * @return void */ public function main() { // Translate id to the workspace version: if ($versionedRecord = BackendUtility::getWorkspaceVersionOfRecord($this->getBackendUserAuthentication()->workspace, $this->P['table'], $this->P['uid'], 'uid')) { $this->P['uid'] = $versionedRecord['uid']; } // If all parameters are available: if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) { // Getting the raw record (we need only the pid-value from here...) $rawRecord = BackendUtility::getRecord($this->P['table'], $this->P['uid']); BackendUtility::fixVersioningPid($this->P['table'], $rawRecord); // override the default jumpToUrl $this->doc->JScodeArray['jumpToUrl'] = ' function jumpToUrl(URL,formEl) { if (document.editform) { if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else { window.location.href = URL; } } '; // Setting JavaScript of the pid value for viewing: if ($this->popView) { $this->doc->JScode = $this->doc->wrapScriptTags(BackendUtility::viewOnClick($rawRecord['pid'], '', BackendUtility::BEgetRootLine($rawRecord['pid']))); } // Initialize FormEngine - for rendering the field: /** @var FormEngine $formEngine */ $formEngine = GeneralUtility::makeInstance(FormEngine::class); // SPECIAL: Disables all wizards - we are NOT going to need them. $formEngine->disableWizards = 1; // Fetching content of record: /** @var DataPreprocessor $dataPreprocessor */ $dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class); $dataPreprocessor->lockRecords = 1; $dataPreprocessor->fetchRecord($this->P['table'], $this->P['uid'], ''); // Getting the processed record content out: $processedRecord = reset($dataPreprocessor->regTableItems_data); $processedRecord['uid'] = $this->P['uid']; $processedRecord['pid'] = $rawRecord['pid']; // TSconfig, setting width: $fieldTSConfig = FormEngineUtility::getTSconfigForTableRow($this->P['table'], $processedRecord, $this->P['field']); if ((string) $fieldTSConfig['RTEfullScreenWidth'] !== '') { $width = $fieldTSConfig['RTEfullScreenWidth']; } else { $width = '100%'; } // Get the form field and wrap it in the table with the buttons: $formContent = $formEngine->getSoloField($this->P['table'], $processedRecord, $this->P['field']); $formContent = ' <!-- RTE wizard: --> <table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard"> <tr> <td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td> <td></td> </tr> </table>'; // Adding hidden fields: $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" /> <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . FormEngine::getHiddenTokenField('tceAction'); // Finally, add the whole setup: $this->content .= $formEngine->printNeededJSFunctions_top() . $formContent . $formEngine->printNeededJSFunctions(); } else { // ERROR: $this->content .= $this->doc->section($this->getLanguageService()->getLL('forms_title'), '<span class="text-danger">' . $this->getLanguageService()->getLL('table_noData', TRUE) . '</span>', 0, 1); } // Setting up the buttons and markers for docHeader $docHeaderButtons = $this->getButtons(); $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage(''); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Initialize the normal module operation * * @return void */ public function init() { $beUser = $this->getBackendUser(); // Setting more GPvars: $this->popViewId = GeneralUtility::_GP('popViewId'); $this->popViewId_addParams = GeneralUtility::_GP('popViewId_addParams'); $this->viewUrl = GeneralUtility::_GP('viewUrl'); $this->editRegularContentFromId = GeneralUtility::_GP('editRegularContentFromId'); $this->recTitle = GeneralUtility::_GP('recTitle'); $this->noView = GeneralUtility::_GP('noView'); $this->perms_clause = $beUser->getPagePermsClause(1); // Set other internal variables: $this->R_URL_getvars['returnUrl'] = $this->retUrl; $this->R_URI = $this->R_URL_parts['path'] . '?' . ltrim(GeneralUtility::implodeArrayForUrl('', $this->R_URL_getvars), '&'); // Setting virtual document name $this->MCONF['name'] = 'xMOD_alt_doc.php'; // Create an instance of the document template object $this->doc = $GLOBALS['TBE_TEMPLATE']; $this->doc->getPageRenderer()->addInlineLanguageLabelFile('EXT:lang/locallang_alt_doc.xlf'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_doc.html'); $this->doc->form = '<form action="' . htmlspecialchars($this->R_URI) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">'; $this->doc->getPageRenderer()->loadPrototype(); // override the default jumpToUrl $this->doc->JScodeArray['jumpToUrl'] = ' function jumpToUrl(URL,formEl) { if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl && formEl.type=="checkbox") { formEl.checked = formEl.checked ? 0 : 1; } } '; // define the window size of the element browser $popupWindowWidth = 700; $popupWindowHeight = 750; $popupWindowSize = trim($beUser->getTSConfigVal('options.popupWindowSize')); if (!empty($popupWindowSize)) { list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize); } $t3Configuration = array('PopupWindow' => array('width' => $popupWindowWidth, 'height' => $popupWindowHeight)); $javascript = ' TYPO3.configuration = ' . json_encode($t3Configuration) . '; // Object: TS: // passwordDummy and decimalSign are used by tbe_editor.js and have to be declared here as // TS object overwrites the object declared in tbe_editor.js function typoSetup() { // this.uniqueID = ""; this.passwordDummy = "********"; this.PATH_typo3 = ""; this.decimalSign = "."; } var TS = new typoSetup(); // Info view: function launchView(table,uid,bP) { // var backPath= bP ? bP : ""; var thePreviewWindow=""; thePreviewWindow = window.open(backPath+' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item', array(), '') . '&table=') . '+encodeURIComponent(table)+"&uid="+encodeURIComponent(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0"); if (thePreviewWindow && thePreviewWindow.focus) { thePreviewWindow.focus(); } } function deleteRecord(table,id,url) { // if ( ' . ($beUser->jsConfirmation(JsConfirmation::DELETE) ? 'confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('deleteWarning')) . ')' : '1==1') . ' ) { window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1' . BackendUtility::getUrlToken('tceAction') . '&redirect="+escape(url)+"&vC=' . $beUser->veriCode() . '&prErr=1&uPT=1"; } return false; } '; $previewCode = isset($_POST['_savedokview_x']) && $this->popViewId ? $this->generatePreviewCode() : ''; $this->doc->JScode = $this->doc->wrapScriptTags($javascript . $previewCode); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->bodyTagAdditions = 'onload="window.scrollTo(0,' . MathUtility::forceIntegerInRange(GeneralUtility::_GP('_scrollPosition'), 0, 10000) . ');"'; $this->emitFunctionAfterSignal(__FUNCTION__); }