/** * Constructor, initialize. * * @return void * @todo Define visibility */ public function init() { // Start the template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate'); $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 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader'); $this->loadModules->load($GLOBALS['TBE_MODULES']); }
/** * 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); }
/** * Initialization of the class * * @return void * @todo Define visibility */ public function init() { // GPvars: $this->P = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'); $this->TABLECFG = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('TABLE'); // Setting options: $this->xmlStorage = $this->P['params']['xmlOutput']; $this->numNewRows = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->P['params']['numNewRows'], 1, 50, 5); // Textareas or input fields: $this->inputStyle = isset($this->TABLECFG['textFields']) ? $this->TABLECFG['textFields'] : 1; // 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/wizard_table.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL,formEl) { // window.location.href = URL; } '); // Setting form tag: list($rUri) = explode('#', \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $this->doc->form = '<form action="' . htmlspecialchars($rUri) . '" method="post" name="wizardForm">'; $this->tableParsing_delimiter = '|'; $this->tableParsing_quote = ''; }
/** * 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 = \TYPO3\CMS\Backend\Utility\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) . ';'); }
/** * Main function, rendering the document with the iframe with the RTE in. * * @return void * @todo Define visibility */ public function main() { // Translate id to the workspace version: if ($versionRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) { $this->P['uid'] = $versionRec['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...) $rawRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']); \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($this->P['table'], $rawRec); // Setting JavaScript, including the pid value for viewing: $this->doc->JScode = $this->doc->wrapScriptTags(' 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; } ' . ($this->popView ? \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($rawRec['pid'], '', \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($rawRec['pid'])) : '') . ' '); // Initialize TCeforms - for rendering the field: $tceforms = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); // Init... $tceforms->initDefaultBEMode(); // SPECIAL: Disables all wizards - we are NOT going to need them. $tceforms->disableWizards = 1; // SPECIAL: Setting background color of the RTE to ordinary background $tceforms->colorScheme[0] = $this->doc->bgColor; // Initialize style for RTE object: // Getting reference to the RTE object used to render the field! $RTEobj = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEgetObj(); if ($RTEobj->ID == 'rte') { $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;'; } // Fetching content of record: $trData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor'); $trData->lockRecords = 1; $trData->fetchRecord($this->P['table'], $this->P['uid'], ''); // Getting the processed record content out: $rec = reset($trData->regTableItems_data); $rec['uid'] = $this->P['uid']; $rec['pid'] = $rawRec['pid']; // TSconfig, setting width: $fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']); if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) { $width = $fieldTSConfig['RTEfullScreenWidth']; } else { $width = '100%'; } // Get the form field and wrap it in the table with the buttons: $formContent = $tceforms->getSoloField($this->P['table'], $rec, $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()) . '" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Finally, add the whole setup: $this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions(); } else { // ERROR: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('forms_title'), '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('table_noData', 1) . '</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($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Initialization the class * * @return void * @todo Define visibility */ public function init() { // GPvars: $this->P = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'); $this->special = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('special'); $this->FORMCFG = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('FORMCFG'); // Setting options: $this->xmlStorage = $this->P['params']['xmlOutput']; // 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/wizard_forms.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL,formEl) { // window.location.href = URL; } '); // Setting form tag: list($rUri) = explode('#', \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $this->doc->form = '<form action="' . htmlspecialchars($rUri) . '" method="post" name="wizardForm">'; }
/** * Creating the module output. * * @return void * @todo Define visibility */ public function main() { if ($this->id && $this->access) { // Init position map object: $posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap'); $posMap->cur_sys_language = $this->sys_language; $posMap->backPath = $GLOBALS['BACK_PATH']; // If a column is pre-set: if ((string) $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['sectionHeader'] = array('<h3 class="divider">', '</h3>'); $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>'); $this->elementWrapper['wizard'] = array('<tr>', '</tr>'); $this->elementWrapper['wizardPart'] = array('<td>', '</td>'); // 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 = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classData); if (!$hookObject instanceof \TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 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 = ''; // Radio button: $oC = 'document.editForm.defValues.value=unescape(\'' . rawurlencode($wInfo['params']) . '\');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : ''); $content .= $this->elementWrapper['wizardPart'][0] . '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" />' . $this->elementWrapper['wizardPart'][1]; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $oC . 'return false;'; // Icon: $iInfo = @getimagesize($wInfo['icon']); $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1]; // Title + description: $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1]; // Finally, put it together in a container: $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1]; $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') { $this->doc->inDocStylesArray[] = ' .typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #adadad; width: 680px; } .typo3-dyntabmenu-divs table { margin: 15px; } .typo3-dyntabmenu-divs table td { padding: 3px; } '; $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 .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $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 = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->id, 'mod.SHARED'); $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3'; $colPosList = implode(',', array_unique(\TYPO3\CMS\Core\Utility\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. * Creates some general objects and calls other functions for the main rendering of module content. * * @return void * @todo Define visibility */ public function main() { // Access check... // The page will show only if there is a valid page and if this page may be viewed by the user $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access) { // Initialize permission settings: $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); $this->EDIT_CONTENT = $this->CALC_PERMS & 16 ? 1 : 0; // Start document template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_layout.html'); // JavaScript: $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.updateform.js') . '">' . '</script>'; $this->doc->JScode .= $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . intval($this->id) . '_"+top.fsMod.currentBank; ' . intval($this->id) . '; function jumpToUrl(URL,formEl) { // if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?) if (!TBE_EDITOR.isFormChanged()) { // window.location.href = URL; } else if (formEl) { if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1; } } else window.location.href = URL; } ' . ($this->popView ? \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->id)) : '') . ' function deleteRecord(table,id,url) { // if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')) . ')) { window.location.href = "' . $GLOBALS['BACK_PATH'] . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1"; } return false; } '); $this->doc->JScode .= $this->doc->wrapScriptTags(' var DTM_array = new Array(); var DTM_origClass = new String(); // if tabs are used in a popup window the array might not exists if(!top.DTM_currentTabs) { top.DTM_currentTabs = new Array(); } function DTM_activate(idBase,index,doToogle) { // // Hiding all: if (DTM_array[idBase]) { for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { if (DTM_array[idBase][cnt] != idBase+"-"+index) { document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none"; document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } } } // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase] = -1; } else { document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; if(DTM_origClass=="") { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; } else { DTM_origClass = "tabact"; } top.DTM_currentTabs[idBase] = index; } } } function DTM_toggle(idBase,index,isInit) { // // Showing one: if (document.getElementById(idBase+"-"+index+"-DIV")) { if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") { document.getElementById(idBase+"-"+index+"-DIV").style.display = "none"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab"; } else { DTM_origClass = "tab"; } top.DTM_currentTabs[idBase+"-"+index] = 0; } else { document.getElementById(idBase+"-"+index+"-DIV").style.display = "block"; if(isInit) { document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact"; } else { DTM_origClass = "tabact"; } top.DTM_currentTabs[idBase+"-"+index] = 1; } } } function DTM_mouseOver(obj) { // DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue; obj.attributes.getNamedItem(\'class\').nodeValue += "_over"; } function DTM_mouseOut(obj) { // obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass; DTM_origClass = ""; } '); // Setting doc-header $this->doc->form = '<form action="' . htmlspecialchars('db_layout.php?id=' . $this->id . '&imagemode=' . $this->imagemode) . '" method="post">'; // Creating the top function menu: $this->topFuncMenu = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'], 'db_layout.php', ''); $this->languageMenu = count($this->MOD_MENU['language']) > 1 ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language', 1) . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[language]', $this->current_sys_language, $this->MOD_MENU['language'], 'db_layout.php', '') : ''; // Find backend layout / coumns $backendLayout = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', $this->id, $this); if (count($backendLayout['__colPosList'])) { $this->colPosList = implode(',', $backendLayout['__colPosList']); } // Removing duplicates, if any $this->colPosList = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->colPosList))); // Page title $body = $this->doc->header($this->pageinfo['title']); $body .= $this->getHeaderFlashMessagesForCurrentPid(); // Render the primary module content: if ($this->MOD_SETTINGS['function'] == 0) { // QuickEdit $body .= $this->renderQuickEdit(); } else { // All other listings $body .= $this->renderListContent(); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons($this->MOD_SETTINGS['function'] == 0 ? 'quickEdit' : ''); $markers = array('CSH' => $docHeaderButtons['csh'], 'TOP_FUNCTION_MENU' => $this->topFuncMenu . $this->editSelect, 'LANGSELECTOR' => $this->languageMenu, 'CONTENT' => $body); // Build the <body> for the module $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); } else { // If no access or id value, create empty document: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_layout.html'); $this->doc->JScode = $this->doc->wrapScriptTags(' if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('clickAPage_content'), $GLOBALS['LANG']->getLL('clickAPage_header'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $body = $flashMessage->render(); // Setting up the buttons and markers for docheader $docHeaderButtons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => ''); $markers = array('CSH' => \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($this->descrTable, '', $GLOBALS['BACK_PATH'], '', TRUE), 'TOP_FUNCTION_MENU' => '', 'LANGSELECTOR' => '', 'CONTENT' => $body); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content); } }
/** * 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) . ');"'; }
/** * Initialization of the class * * @return void * @todo Define visibility */ public function init() { // Check if the tsconfig_help extension is loaded - which is mandatory for this wizard to work. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tsconfig_help', 1); // Init GPvars: $this->P = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'); $this->mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode'); $this->show = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('show'); $this->objString = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('objString'); $this->onlyProperty = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('onlyProperty'); // Preparing some JavaScript code: if (!$this->areFieldChangeFunctionsValid()) { $this->P['fieldChangeFunc'] = array(); } unset($this->P['fieldChangeFunc']['alert']); $update = ''; foreach ($this->P['fieldChangeFunc'] as $k => $v) { $update .= ' window.opener.' . $v; } // Init the document table object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="" name="editform">'; // Adding Styles (should go into stylesheet?) $this->doc->inDocStylesArray[] = ' A:link {text-decoration: bold; color: ' . $this->doc->hoverColor . ';} A:visited {text-decoration: bold; color: ' . $this->doc->hoverColor . ';} A:active {text-decoration: bold; color: ' . $this->doc->hoverColor . ';} A:hover {color: ' . $this->doc->bgColor2 . '} '; $this->doc->JScode .= $this->doc->wrapScriptTags(' function checkReference_name() { // Checks if the input field containing the name exists in the document if (window.opener && window.opener.document && window.opener.document.' . $this->P['formName'] . ' && window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"] ) { return window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"]; } } function checkReference_value() { // Checks if the input field containing the value exists in the document if (window.opener && window.opener.document && window.opener.document.' . $this->P['formName'] . ' && window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemValue'] . '"] ) { return window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemValue'] . '"]; } } /** * [Describe function...] * * @param [type] $field,value: ... * @return [type] ... */ function setValue(field,value) { var nameField = checkReference_name(); var valueField = checkReference_value(); if (nameField) { if (valueField) { // This applies to the TS Object Browser module nameField.value=field; valueField.value=value; } else { // This applies to the Info/Modify module and the Page TSconfig field if (value) { nameField.value=field+"="+value+"\\n"+nameField.value; } else { nameField.value=field+"\\n"+nameField.value; } } ' . $update . ' window.opener.focus(); } close(); } function getValue() { // This is never used. Remove it? var field = checkReference_name(); if (field) { return field.value; } else { close(); } } /** * [Describe function...] * * @param [type] $cmd,objString: ... * @return [type] ... */ function mixerField(cmd,objString) { var temp; switch(cmd) { case "Indent": temp = str_replace("\\n","\\n ","\\n"+document.editform.mixer.value); document.editform.mixer.value = temp.substr(1); break; case "Outdent": temp = str_replace("\\n ","\\n","\\n"+document.editform.mixer.value); document.editform.mixer.value = temp.substr(1); break; case "Transfer": setValue(document.editform.mixer.value); break; case "Wrap": document.editform.mixer.value=objString+" {\\n"+document.editform.mixer.value+"\\n}"; break; } } /** * [Describe function...] * * @param [type] $match,replace,string: ... * @return [type] ... */ function str_replace(match,replace,string) { var input = ""+string; var matchStr = ""+match; if (!matchStr) {return string;} var output = ""; var pointer=0; var pos = input.indexOf(matchStr); while (pos!=-1) { output+=""+input.substr(pointer, pos-pointer)+replace; pointer=pos+matchStr.length; pos = input.indexOf(match, pos+1); } output+=""+input.substr(pointer); return output; } /** * [Describe function...] * * @param [type] $show,objString: ... * @return [type] ... */ function jump(show, objString) { window.location.href = "' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('show' => '', 'objString' => '')) . '&show="+show+"&objString="+objString; } '); // Start the page: $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('tsprop')); }