/** * Initialize module header etc and call extObjContent function * * @return void * @todo Define visibility */ public function main() { global $LANG, $BACK_PATH; // 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) ? 1 : 0; // Template markers $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => ''); $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/func.html'); // Main if ($this->id && $access) { // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } '); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->form = '<form action="index.php" method="post"><input type="hidden" name="id" value="' . $this->id . '" />'; $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['CSH'] = $docHeaderButtons['csh']; $markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\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 $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('clickAPage_content'), $LANG->getLL('title'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $this->content = $flashMessage->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($LANG->getLL('title'), $this->content); }
/** * Initialize module header etc and call extObjContent function * * @return void * @todo Define visibility */ public function main() { // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; 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('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->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } '); $this->doc->postCode = $this->doc->wrapScriptTags(' script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->form = '<form action="index.php" 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' => \TYPO3\CMS\Backend\Utility\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\\MediumDocumentTemplate'); $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); }
/** * Constructor, initializing internal variables. * * @return void * @todo Define visibility */ public function init() { // Setting class files to include: if (is_array($GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses'])) { $this->include_once = array_merge($this->include_once, $GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses']); } // Setting internal vars: $this->id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id')); $this->sys_language = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('sys_language_uid')); $this->R_URI = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); $this->colPos = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('colPos'); $this->uid_pid = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('uid_pid')); $this->MCONF['name'] = 'xMOD_db_new_content_el'; $this->modTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement'); $config = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($this->id); $this->config = $config['mod.']['wizards.']['newContentElement.']; // Starting the document template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_new_content_el.html'); $this->doc->JScode = ''; $this->doc->form = '<form action="" name="editForm"><input type="hidden" name="defValues" value="" />'; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Getting the current page and receiving access information (used in main()) $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $perms_clause); $this->access = is_array($this->pageinfo) ? 1 : 0; }
/** * Rendering all other listings than QuickEdit * * @return void * @todo Define visibility */ public function renderListContent() { // Initialize list object (see "class.db_layout.inc"): /** @var $dblist \TYPO3\CMS\Backend\View\PageLayoutView */ $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView'); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->thumbs = $this->imagemode; $dblist->no_noWrap = 1; $dblist->descrTable = $this->descrTable; $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000); $dblist->script = 'db_layout.php'; $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->doEdit = $this->EDIT_CONTENT; $dblist->ext_CALC_PERMS = $this->CALC_PERMS; $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'); $dblist->id = $this->id; $dblist->nextThree = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10); $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0'; $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1; $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0; if (!$dblist->nextThree) { $dblist->nextThree = 1; } $dblist->externalTables = $this->externalTables; // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!) $h_menu = $dblist->getTableMenu($this->id); // Initialize other variables: $h_func = ''; $tableOutput = array(); $tableJSOutput = array(); $CMcounter = 0; // Traverse the list of table names which has records on this page (that array is populated // by the $dblist object during the function getTableMenu()): foreach ($dblist->activeTables as $table => $value) { // Load full table definitions: \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table); if (!isset($dblist->externalTables[$table])) { $q_count = $this->getNumberOfHiddenElements(); $h_func_b = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE')) : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>'; // Boolean: Display up/down arrows and edit icons for tt_content records $dblist->tt_contentConfig['showCommands'] = 1; // Boolean: Display info-marks or not $dblist->tt_contentConfig['showInfo'] = 1; // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown // in the total width of the page $dblist->tt_contentConfig['single'] = 0; if ($this->MOD_SETTINGS['function'] == 4) { // Grid view $dblist->tt_contentConfig['showAsGrid'] = 1; } // Setting up the tt_content columns to show: if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) { $colList = array(); $tcaItems = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->id, $this); foreach ($tcaItems as $temp) { $colList[] = $temp[1]; } } else { // ... should be impossible that colPos has no array. But this is the fallback should it make any sense: $colList = array('1', '0', '2', '3'); } if (strcmp($this->colPosList, '')) { $colList = array_intersect(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->colPosList), $colList); } // If only one column found, display the single-column view. if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) { // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] // is shown in the total width of the page $dblist->tt_contentConfig['single'] = 1; // The column(s) to show if single mode (under each other) $dblist->tt_contentConfig['showSingleCol'] = current($colList); } // The order of the rows: Default is left(1), Normal(0), right(2), margin(3) $dblist->tt_contentConfig['cols'] = implode(',', $colList); $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden']; $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language); // If the function menu is set to "Language": if ($this->MOD_SETTINGS['function'] == 2) { $dblist->tt_contentConfig['single'] = 0; $dblist->tt_contentConfig['languageMode'] = 1; $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language']; $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language; } } else { if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) { $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', ''); } else { $h_func = ''; } } // Start the dblist object: $dblist->itemsLimitSingleTable = 1000; $dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit); $dblist->counter = $CMcounter; $dblist->ext_function = $this->MOD_SETTINGS['function']; // Render versioning selector: $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id); // Generate the list of elements here: $dblist->generateList(); // Adding the list content to the tableOutput variable: $tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : ''); // ... and any accumulated JavaScript goes the same way! $tableJSOutput[$table] = $dblist->JScode; // Increase global counter: $CMcounter += $dblist->counter; // Reset variables after operation: $dblist->HTMLcode = ''; $dblist->JScode = ''; $h_func = ''; $h_func_b = ''; } // END: traverse tables // For Context Sensitive Menus: $this->doc->getContextMenuCode(); // Add the content for each table we have rendered (traversing $tableOutput variable) foreach ($tableOutput as $table => $output) { $content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE); $content .= $this->doc->spacer(15); $content .= $this->doc->sectionEnd(); } // Making search form: if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) { $sectionTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE)); $content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE); } // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this); } } return $content; }
/** * Constructor function for the class * * @return void * @todo Define visibility */ public function init() { // Page-selection permission clause (reading) $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); // This will hide records from display - it has nothing to do with user rights!! if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) { if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) { $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')'; } } // Setting GPvars: // The page id to operate from $this->id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id')); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); $this->pagesOnly = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pagesOnly'); // Create instance of template class for output $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_new.html'); $this->doc->JScode = ''; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Creating content $this->content = ''; $this->content .= $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle')); // Id a positive id is supplied, ask for the page record with permission information contained: if ($this->id > 0) { $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); } // If a page-record was returned, the user had read-access to the page. if ($this->pageinfo['uid']) { // Get record of parent page $this->pidInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $this->pageinfo['pid']); // Checking the permissions for the user with regard to the parent page: Can he create new pages, new content record, new page after? if ($GLOBALS['BE_USER']->doesUserHaveAccess($this->pageinfo, 8)) { $this->newPagesInto = 1; } if ($GLOBALS['BE_USER']->doesUserHaveAccess($this->pageinfo, 16)) { $this->newContentInto = 1; } if (($GLOBALS['BE_USER']->isAdmin() || is_array($this->pidInfo)) && $GLOBALS['BE_USER']->doesUserHaveAccess($this->pidInfo, 8)) { $this->newPagesAfter = 1; } } elseif ($GLOBALS['BE_USER']->isAdmin()) { // Admins can do it all $this->newPagesInto = 1; $this->newContentInto = 1; $this->newPagesAfter = 0; } else { // People with no permission can do nothing $this->newPagesInto = 0; $this->newContentInto = 0; $this->newPagesAfter = 0; } }
/** * Initialize the normal module operation * * @return void * @todo Define visibility */ public function init() { // Setting more GPvars: $this->popViewId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('popViewId'); $this->popViewId_addParams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('popViewId_addParams'); $this->viewUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('viewUrl'); $this->editRegularContentFromId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('editRegularContentFromId'); $this->recTitle = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('recTitle'); $this->disHelp = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('disHelp'); $this->noView = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('noView'); $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); // Set other internal variables: $this->R_URL_getvars['returnUrl'] = $this->retUrl; $this->R_URI = $this->R_URL_parts['path'] . '?' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $this->R_URL_getvars); // MENU-ITEMS: // If array, then it's a selector box menu // If empty string it's just a variable, that'll be saved. // Values NOT in this array will not be saved in the settings-array for the module. $this->MOD_MENU = array('showPalettes' => ''); // Setting virtual document name $this->MCONF['name'] = 'xMOD_alt_doc.php'; // CLEANSE SETTINGS $this->MOD_SETTINGS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleData($this->MOD_MENU, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET'), $this->MCONF['name']); // Create an instance of the document template object $this->doc = $GLOBALS['TBE_TEMPLATE']; $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('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(); $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL,formEl) { // if (!TBE_EDITOR.isFormChanged()) { window.location.href = URL; } else if (formEl && formEl.type=="checkbox") { formEl.checked = formEl.checked ? 0 : 1; } } // 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+"show_item.php?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 ( ' . ($GLOBALS['BE_USER']->jsConfirmation(4) ? 'confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')) . ')' : '1==1') . ' ) { window.location.href = "tce_db.php?cmd["+table+"]["+id+"][delete]=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1"; } return false; } ' . (isset($_POST['_savedokview_x']) && $this->popViewId ? 'if (window.opener) { ' . \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->popViewId, '', \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->popViewId), '', $this->viewUrl, $this->popViewId_addParams, FALSE) . ' } else { ' . \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->popViewId, '', \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->popViewId), '', $this->viewUrl, $this->popViewId_addParams) . ' } ' : '')); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->bodyTagAdditions = 'onload="window.scrollTo(0,' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_scrollPosition'), 0, 10000) . ');"'; }