/** * @param array $PA * @param \TYPO3\CMS\Backend\Form\FormEngine $fObj * * @return mixed */ public function getFieldTxWmdbBaseEwhListType($PA, $fObj) { $itemsToShow = array(); $cType = $PA['row']['CType']; $items = $PA['fieldConf']['config']['items']; foreach ($items as $key => $item) { if (stristr($item[1], '--div--') === FALSE && stristr($cType, 'wmdb_base_ewh') !== false) { // reset icon unset($item[2]); $itemsToShow[] = $item; } /** * <rupert.germann>, 18.07.2012 * wenn man für optgroups nur das keyword '--div--' verwendet, werden die optgroups von extmgm::addPlugin wieder ausgefiltert. * um das zu vermeiden, schreiben wir optgroups in der Form '--div--[zahl]'. Diese werden hier erkannt und wieder in die korrekte * Schreibweise umgewandelt. Die folgende Funktion getSingleField_typeSelect() kann die wieder interpretieren. */ if (stristr($item[1], '--div--') !== FALSE) { $item[1] = '--div--'; // reset icon unset($item[2]); $itemsToShow[] = $item; } } // add empty item to the beginning of the list if ($itemsToShow[0][0] != '') { array_unshift($itemsToShow, $PA['fieldConf']['config']['items'][0]); } $PA['fieldConf']['config']['items'] = $itemsToShow; return $fObj->getSingleField_typeSelect('tt_content', 'tx_wmdbbaseewh_list_type', $PA['row'], $PA); }
/** * @param array $config * @param string $itemValue * @param string $expectedResult * @dataProvider formatValueDataProvider * @test */ public function formatValueWithGivenConfiguration($config, $itemValue, $expectedResult) { $timezoneBackup = date_default_timezone_get(); date_default_timezone_set('UTC'); $result = $this->subject->formatValue($config, $itemValue); date_default_timezone_set($timezoneBackup); $this->assertEquals($expectedResult, $result); }
/** * @param ViewInterface $view * @return void */ public function initializeView(ViewInterface $view) { parent::initializeView($view); $name = $this->getCurrentConfigurationName(); $pageUid = $this->getCurrentPageUid(); $this->configuration = $this->configurationRepository->findOrCreateOneByNameInPid($name, $pageUid); $this->formHandler = $this->objectManager->get('TYPO3\\CMS\\Backend\\Form\\FormEngine'); $this->formHandler->initDefaultBEmode(); $this->formHandler->enableClickMenu = TRUE; $this->formHandler->enableTabMenu = TRUE; $this->view->assign('formHandler', $this->formHandler); $this->view->assign('configurationName', $name); $this->view->setControllerContext($this->controllerContext); }
/** * If the select field is build by a foreign_table the related UIDs * will be returned. * * Otherwise the label of the currently selected value will be written * to the alternativeFieldValue class property. * * @param array $fieldConfig The "config" section of the TCA for the current select field. * @param string $fieldName The name of the select field. * @param string $value The current value in the local record, usually a comma separated list of selected values. * @return array Array of related UIDs. */ protected function getRelatedSelectFieldUids(array $fieldConfig, $fieldName, $value) { $relatedUids = array(); $isTraversable = FALSE; if (isset($fieldConfig['foreign_table'])) { $isTraversable = TRUE; // if a foreign_table is used we pre-filter the records for performance $fieldConfig['foreign_table_where'] .= ' AND ' . $fieldConfig['foreign_table'] . '.uid IN (' . $value . ')'; } $PA = array(); $PA['fieldConf']['config'] = $fieldConfig; $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type']; $PA['fieldTSConfig'] = $this->formEngine->setTSconfig($this->currentTable, $this->currentRow, $fieldName); $PA['fieldConf']['config'] = $this->formEngine->overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']); $selectItemArray = $this->formEngine->getSelectItems($this->currentTable, $fieldName, $this->currentRow, $PA); if ($isTraversable && count($selectItemArray)) { $this->currentTable = $fieldConfig['foreign_table']; $relatedUids = $this->getSelectedValuesFromSelectItemArray($selectItemArray, $value); } else { $selectedLabels = $this->getSelectedValuesFromSelectItemArray($selectItemArray, $value, 1, TRUE); if (count($selectedLabels) === 1) { $this->alternativeFieldValue = $selectedLabels[0]; $this->forceAlternativeFieldValueUse = TRUE; } } return $relatedUids; }
/** * Add additional JavaScript to use the tceform select box * * @return void */ protected function JScode() { $this->t3lib_TCEforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); $this->t3lib_TCEforms->backPath = $GLOBALS['BACK_PATH']; $js = $this->t3lib_TCEforms->dbFileCon(); $this->taskObject->doc->JScodeArray[] = $js; return $js; }
/** * @param string $table * @param array|string $data * @return string */ public function render($table = NULL, $data = NULL) { if (!$data) { $data = array(); } if ($table) { if (!$data['uid']) { $data['uid'] = "none"; } if (!$data['pid']) { $data['pid'] = "0"; } $this->pageRenderer->loadPrototype(); $this->pageRenderer->loadExtJS(); $this->tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); $this->tceforms->initDefaultBEMode(); // EXTBASE FORMS $this->tceforms->prependFormFieldNames = $this->getFieldNamePrefix(); $this->tceforms->formName = $table; $this->tceforms->totalWrap = '<div class="typo3-TCEforms"> | </div>'; $this->tceforms->doSaveFieldName = 'doSave'; $this->tceforms->localizationMode = GeneralUtility::inList('text,media', $this->localizationMode) ? $this->localizationMode : ''; $this->tceforms->returnUrl = $this->R_URI; $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes']; $this->tceforms->disableRTE = !$GLOBALS['BE_USER']->isRTE(); $this->tceforms->enableClickMenu = TRUE; $this->tceforms->enableTabMenu = TRUE; $panel = $this->tceforms->getMainFields($table, $data); $body = $this->tceforms->printNeededJSFunctions_top(); $body .= $this->tceforms->wrapTotal($panel, $data, $table); $body .= $this->tceforms->printNeededJSFunctions(); if (count($this->tceforms->commentMessages)) { $body .= ' <!-- TCEFORM messages ' . htmlspecialchars(implode(LF, $this->tceforms->commentMessages)) . ' --> '; } } else { return "Tabelle wurde nicht angegeben."; } return $body; }
/** * JavaScript code used for input-field evaluation. * * @param string $formname The identification of the form on the page. * @param boolean $update Just extend/update existing settings, e.g. for AJAX call * @return string A section with JavaScript - if $update is FALSE, embedded in <script></script> */ public function JSbottom($formname = 'forms[0]', $update = FALSE) { $result = parent::JSbottom($formname, $update); $enableMediaFilePicker = (bool) $this->getBackendUser()->getTSConfigVal('options.vidi.enableMediaFilePicker'); if (!$update && $enableMediaFilePicker) { /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer(); // Override JS. $pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/FormEngine'); } return $result; }
/** * Initializes <code>\TYPO3\CMS\Backend\Form\FormEngine</code> class for use in this module. * * @return void */ protected function initTCEForms() { $this->tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); if (version_compare(TYPO3_version, '7.2.99', '<=')) { $this->tceforms->initDefaultBEMode(); } $this->tceforms->doSaveFieldName = 'doSave'; $this->tceforms->localizationMode = ''; $this->tceforms->palettesCollapsed = 0; if (version_compare(TYPO3_version, '6.99.99', '<=')) { $this->tceforms->enableTabMenu = true; } }
/** * Shows warning message about ENABLE_INSTALL_TOOL file and a button to create this file * * @return void */ protected function showInstallToolEnableRequest() { // Create instance of object for output of data $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('install') . 'mod/mod_template.html'); $this->doc->form = '<form method="post" id="t3-install-form-unlock" action="">'; $this->doc->addStyleSheet('install', 'stylesheets/install/install.css'); $this->doc->addStyleSheet('mod-install', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('install') . 'mod/mod_styles.css'); $markers = $buttons = array(); $markers['CONTENT'] = $this->renderMessage(); $content = $this->doc->moduleBody('', $buttons, $markers); $this->doc->postCode = '<input type="hidden" name="enableInstallTool" value="1" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('installToolEnableToken'); echo $this->doc->render('', $content); }
/** * Parses the HTML tags that would have been inserted to the <head> of a HTML document and returns the found tags as multidimensional array. * * @return array The parsed tags with their attributes and innerHTML parts */ protected function getHeadTags() { $headTags = array(); $headDataRaw = $this->fObj->JStop() . $this->getJavaScriptAndStyleSheetsOfPageRenderer(); if ($headDataRaw) { // Create instance of the HTML parser: $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\HtmlParser'); // Removes script wraps: $headDataRaw = str_replace(array('/*<![CDATA[*/', '/*]]>*/'), '', $headDataRaw); // Removes leading spaces of a multiline string: $headDataRaw = trim(preg_replace('/(^|\\r|\\n)( |\\t)+/', '$1', $headDataRaw)); // Get script and link tags: $tags = array_merge($parseObj->getAllParts($parseObj->splitTags('link', $headDataRaw)), $parseObj->getAllParts($parseObj->splitIntoBlock('script', $headDataRaw))); foreach ($tags as $tagData) { $tagAttributes = $parseObj->get_tag_attributes($parseObj->getFirstTag($tagData), TRUE); $headTags[] = array('name' => $parseObj->getFirstTagName($tagData), 'attributes' => $tagAttributes[0], 'innerHTML' => $parseObj->removeFirstAndLastTag($tagData)); } } return $headTags; }
/** * 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); }
/** * Constructs this object. */ public function __construct() { $this->initializeTemplateContainer(); parent::__construct(); }
/** * Rendering the quick-edit view. * * @return string */ public function renderQuickEdit() { $databaseConnection = $this->getDatabaseConnection(); $beUser = $this->getBackendUser(); $lang = $this->getLanguageService(); // Alternative template $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout_quickedit.html'); // Alternative form tag; Quick Edit submits its content to tce_db.php. $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db', ['prErr' => 1, 'uPT' => 1])) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Set the edit_record value for internal use in this function: $edit_record = $this->edit_record; // If a command to edit all records in a column is issue, then select all those elements, and redirect to FormEngine if (substr($edit_record, 0, 9) == '_EDIT_COL') { $res = $databaseConnection->exec_SELECTquery('*', 'tt_content', 'pid=' . (int) $this->id . ' AND colPos=' . (int) substr($edit_record, 10) . ' AND sys_language_uid=' . (int) $this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting'); $idListA = array(); while ($cRow = $databaseConnection->sql_fetch_assoc($res)) { $idListA[] = $cRow['uid']; } $url = BackendUtility::getModuleUrl('record_edit', array('edit[tt_content][' . implode(',', $idListA) . ']' => 'edit', 'returnUrl' => $this->local_linkThisScript(array('edit_record' => '')))); HttpUtility::redirect($url); } // If the former record edited was the creation of a NEW record, this will look up the created records uid: if ($this->new_unique_uid) { $res = $databaseConnection->exec_SELECTquery('*', 'sys_log', 'userid=' . (int) $beUser->user['uid'] . ' AND NEWid=' . $databaseConnection->fullQuoteStr($this->new_unique_uid, 'sys_log')); $sys_log_row = $databaseConnection->sql_fetch_assoc($res); if (is_array($sys_log_row)) { $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid']; } } // Creating the selector box, allowing the user to select which element to edit: $opt = array(); $is_selected = 0; $languageOverlayRecord = ''; if ($this->current_sys_language) { list($languageOverlayRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . (int) $this->current_sys_language); } if (is_array($languageOverlayRecord)) { $inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid']; $is_selected += (int) $edit_record == $inValue; $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $lang->getLL('editLanguageHeader', TRUE) . ' ]</option>'; } else { $inValue = 'pages:' . $this->id; $is_selected += (int) $edit_record == $inValue; $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $lang->getLL('editPageProperties', TRUE) . ' ]</option>'; } // Selecting all content elements from this language and allowed colPos: $res = $databaseConnection->exec_SELECTquery('*', 'tt_content', 'pid=' . (int) $this->id . ' AND sys_language_uid=' . (int) $this->current_sys_language . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting'); $colPos = NULL; $first = 1; // Page is the pid if no record to put this after. $prev = $this->id; while ($cRow = $databaseConnection->sql_fetch_assoc($res)) { BackendUtility::workspaceOL('tt_content', $cRow); if (is_array($cRow)) { if ($first) { if (!$edit_record) { $edit_record = 'tt_content:' . $cRow['uid']; } $first = 0; } if (!isset($colPos) || $cRow['colPos'] !== $colPos) { $colPos = $cRow['colPos']; $opt[] = '<option value=""></option>'; $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $lang->sL(BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $colPos), TRUE) . ':__</option>'; } $inValue = 'tt_content:' . $cRow['uid']; $is_selected += (int) $edit_record == $inValue; $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $beUser->uc['titleLen'])) . '</option>'; $prev = -$cRow['uid']; } } // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element: if (!$edit_record) { $edit_record = 'tt_content:new/' . $prev . '/' . $colPos; $inValue = 'tt_content:new/' . $prev . '/' . $colPos; $is_selected += (int) $edit_record == $inValue; $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $lang->getLL('newLabel', 1) . ' ]</option>'; } // If none is yet selected... if (!$is_selected) { $opt[] = '<option value=""></option>'; $opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $lang->getLL('newLabel', TRUE) . ' ]</option>'; } // Splitting the edit-record cmd value into table/uid: $this->eRParts = explode(':', $edit_record); // Delete-button flag? $this->deleteButton = MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & Permission::PAGE_DELETE); // If undo-button should be rendered (depends on available items in sys_history) $this->undoButton = FALSE; $undoRes = $databaseConnection->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $databaseConnection->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . (int) $this->eRParts[1], '', 'tstamp DESC', '1'); if ($this->undoButtonR = $databaseConnection->sql_fetch_assoc($undoRes)) { $this->undoButton = TRUE; } // Setting up the Return URL for coming back to THIS script (if links take the user to another script) $R_URL_parts = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI')); $R_URL_getvars = GeneralUtility::_GET(); unset($R_URL_getvars['popView']); unset($R_URL_getvars['new_unique_uid']); $R_URL_getvars['edit_record'] = $edit_record; $this->R_URI = $R_URL_parts['path'] . '?' . GeneralUtility::implodeArrayForUrl('', $R_URL_getvars); // Setting close url/return url for exiting this script: // Goes to 'Columns' view if close is pressed (default) $this->closeUrl = $this->local_linkThisScript(array('SET' => array('function' => 1))); if ($this->returnUrl) { $this->closeUrl = $this->returnUrl; } // Return-url for JavaScript: $retUrlStr = $this->returnUrl ? '+\'&returnUrl=\'+' . GeneralUtility::quoteJSvalue(rawurlencode($this->returnUrl)) : ''; // Drawing the edit record selectbox $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('web_layout') . '&id=' . $this->id . '&edit_record=') . '+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>'; $content = ''; // Creating editing form: if ($beUser->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] !== 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] === 'pages' && $this->CALC_PERMS & Permission::PAGE_SHOW)) { // Splitting uid parts for special features, if new: list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]); // Convert $uidVal to workspace version if any: if ($uidVal != 'new') { if ($draftRecord = BackendUtility::getWorkspaceVersionOfRecord($beUser->workspace, $this->eRParts[0], $uidVal, 'uid')) { $uidVal = $draftRecord['uid']; } } // Initializing transfer-data object: $trData = GeneralUtility::makeInstance(DataPreprocessor::class); $trData->addRawData = TRUE; $trData->defVals[$this->eRParts[0]] = array('colPos' => (int) $ex_colPos, 'sys_language_uid' => (int) $this->current_sys_language); $trData->lockRecords = 1; // 'new' $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal); $new_unique_uid = ''; // Getting/Making the record: reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); if ($uidVal == 'new') { $new_unique_uid = uniqid('NEW', TRUE); $rec['uid'] = $new_unique_uid; $rec['pid'] = (int) $ex_pid ?: $this->id; $recordAccess = TRUE; } else { $rec['uid'] = $uidVal; // Checking internals access: $recordAccess = $beUser->recordEditAccessInternals($this->eRParts[0], $uidVal); } if (!$recordAccess) { // If no edit access, print error message: $content = $this->doc->section($lang->getLL('noAccess'), $lang->getLL('noAccess_msg') . '<br /><br />' . ($beUser->errorMsg ? 'Reason: ' . $beUser->errorMsg . '<br /><br />' : ''), 0, 1); } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-) // Create instance of TCEforms, setting defaults: $tceForms = GeneralUtility::makeInstance(FormEngine::class); // Render form, wrap it: $panel = ''; $panel .= $tceForms->getMainFields($this->eRParts[0], $rec); $panel = $tceForms->wrapTotal($panel, $rec, $this->eRParts[0]); // Add hidden fields: $theCode = $panel; if ($uidVal == 'new') { $theCode .= '<input type="hidden" name="data[' . $this->eRParts[0] . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; } $theCode .= ' <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="edit_record" value="' . $edit_record . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($uidVal == 'new' ? BackendUtility::getModuleUrl('web_layout', array('id' => $this->id, 'new_unique_uid' => $new_unique_uid, 'returnUrl' => $this->returnUrl)) : $this->R_URI) . '" /> ' . FormEngine::getHiddenTokenField('tceAction'); // Add JavaScript as needed around the form: $theCode = $tceForms->printNeededJSFunctions_top() . $theCode . $tceForms->printNeededJSFunctions(); // Add warning sign if record was "locked": if ($lockInfo = BackendUtility::isRecordLocked($this->eRParts[0], $rec['uid'])) { /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($lockInfo['msg']), '', FlashMessage::WARNING); /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } // Add whole form as a document section: $content = $this->doc->section('', $theCode); } } else { // If no edit access, print error message: $content = $this->doc->section($lang->getLL('noAccess'), $lang->getLL('noAccess_msg') . '<br /><br />', 0, 1); } // Bottom controls (function menus): $q_count = $this->getNumberOfHiddenElements(); if ($q_count) { $h_func_b = '<div class="checkbox">' . '<label for="checkTt_content_showHidden">' . BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"') . (!$q_count ? '<span class="text-muted">' . $lang->getLL('hiddenCE', TRUE) . '</span>' : $lang->getLL('hiddenCE', TRUE) . ' (' . $q_count . ')') . '</label>' . '</div>'; $content .= $this->doc->section('', $h_func_b, 0, 0); $content .= $this->doc->spacer(10); } // Select element matrix: if ($this->eRParts[0] == 'tt_content' && MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) { $posMap = GeneralUtility::makeInstance(ContentLayoutPagePositionMap::class); $posMap->backPath = $GLOBALS['BACK_PATH']; $posMap->cur_sys_language = $this->current_sys_language; $HTMLcode = ''; // CSH: $HTMLcode .= BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement', NULL, '|<br />'); $HTMLcode .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI); $content .= $this->doc->spacer(20); $content .= $this->doc->section($lang->getLL('CEonThisPage'), $HTMLcode, 0, 1); $content .= $this->doc->spacer(20); } return $content; }
/** * Creating form for editing the permissions ($this->edit = true) * (Adding content to internal content variable). * * @return void */ public function doEdit() { $backendUser = $this->getBackendUser(); $language = $this->getLanguageService(); if ($backendUser->workspace != 0) { // Adding section with the permission setting matrix: /** * FlashMessage. * * @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $language->getLL('WorkspaceWarningText'), $language->getLL('WorkspaceWarning'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); /** * Flash message service. * * @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */ $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); /** * Flash message queue. * * @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue $defaultFlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } // Get usernames and groupnames $beGroupArray = BackendUtility::getListGroupNames('title,uid'); $beGroupKeys = array_keys($beGroupArray); $beUserArray = BackendUtility::getUserNames(); if (!$backendUser->isAdmin()) { $beUserArray = BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 1); } $beGroupArrayO = $beGroupArray = BackendUtility::getGroupNames(); if (!$backendUser->isAdmin()) { $beGroupArray = BackendUtility::blindGroupNames($beGroupArrayO, $beGroupKeys, 1); } // Owner selector: $options = ''; // flag: is set if the page-userid equals one from the user-list foreach ($beUserArray as $uid => $row) { if ($uid == $this->pageinfo['perms_userid']) { $selected = ' selected="selected"'; } else { $selected = ''; } $options .= LF . '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>'; } $options = '<option value="0"></option>' . $options; $selector = '<select name="data[tx_commerce_categories][' . $this->categoryUid . '][perms_userid]">' . $options . '</select>'; $this->content .= $this->doc->section($language->getLL('Owner'), $selector, true); // Group selector: $options = ''; $userset = 0; foreach ($beGroupArray as $uid => $row) { if ($uid == $this->pageinfo['perms_groupid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; } // If the group was not set AND there is a group for the page if (!$userset && $this->pageinfo['perms_groupid']) { $options = ' <option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArrayO[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options; } $options = '<option value="0"></option>' . $options; $selector = '<select name="data[tx_commerce_categories][' . $this->categoryUid . '][perms_groupid]"> ' . $options . '</select>'; $this->content .= $this->doc->section($language->getLL('Group'), $selector, true); $onClickAction = 'onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('commerce_permission') . '&id=' . $this->id) . '); return false;') . '"'; // Permissions checkbox matrix: $code = ' <table class="t3-table" id="typo3-permissionMatrix"> <thead> <tr> <th></th> <th>' . $language->getLL('1', true) . '</th> <th>' . $language->getLL('16', true) . '</th> <th>' . $language->getLL('2', true) . '</th> <th>' . $language->getLL('4', true) . '</th> <th>' . $language->getLL('8', true) . '</th> </tr> </thead> <tbody> <tr> <td><strong>' . $language->getLL('Owner', true) . '</strong></td> <td>' . $this->printCheckBox('perms_user', 1) . '</td> <td>' . $this->printCheckBox('perms_user', 5) . '</td> <td>' . $this->printCheckBox('perms_user', 2) . '</td> <td>' . $this->printCheckBox('perms_user', 3) . '</td> <td>' . $this->printCheckBox('perms_user', 4) . '</td> </tr> <tr> <td><strong>' . $language->getLL('Group', true) . '</strong></td> <td>' . $this->printCheckBox('perms_group', 1) . '</td> <td>' . $this->printCheckBox('perms_group', 5) . '</td> <td>' . $this->printCheckBox('perms_group', 2) . '</td> <td>' . $this->printCheckBox('perms_group', 3) . '</td> <td>' . $this->printCheckBox('perms_group', 4) . '</td> </tr> <tr> <td><strong>' . $language->getLL('Everybody', true) . '</strong></td> <td>' . $this->printCheckBox('perms_everybody', 1) . '</td> <td>' . $this->printCheckBox('perms_everybody', 5) . '</td> <td>' . $this->printCheckBox('perms_everybody', 2) . '</td> <td>' . $this->printCheckBox('perms_everybody', 3) . '</td> <td>' . $this->printCheckBox('perms_everybody', 4) . '</td> </tr> </tbody> </table> <input type="hidden" name="data[tx_commerce_categories][' . $this->categoryUid . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" /> <input type="hidden" name="data[tx_commerce_categories][' . $this->categoryUid . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" /> <input type="hidden" name="data[tx_commerce_categories][' . $this->categoryUid . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" /> ' . $this->getRecursiveSelect($this->id) . ' <input type="submit" name="submit" value="' . $language->getLL('Save', true) . '" /><input type="submit" value="' . $language->getLL('Abort', true) . '" ' . $onClickAction . ' /> <input type="hidden" name="redirect" value="' . htmlspecialchars(BackendUtility::getModuleUrl('commerce_permission') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . (int) $this->return_id . '&lastEdited=' . $this->id) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Adding section with the permission setting matrix: $this->content .= $this->doc->section($language->getLL('permissions'), $code, true); // CSH for permissions setting $this->content .= BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module_setting', $this->getBackPath(), '<br /><br />'); // Adding help text: if (true || $backendUser->uc['helpText']) { $legendText = '<p><strong>' . $language->getLL('1', true) . '</strong>: ' . $language->getLL('1_t', true) . '<br /><strong>' . $language->getLL('16', true) . '</strong>: ' . $language->getLL('16_t', true) . '<br /><strong>' . $language->getLL('2', true) . '</strong>: ' . $language->getLL('2_t', true) . '<br /><strong>' . $language->getLL('4', true) . '</strong>: ' . $language->getLL('4_t', true) . '<br /><strong>' . $language->getLL('8', true) . '</strong>: ' . $language->getLL('8_t', true) . '</p>'; $code = $legendText . '<p>' . $language->getLL('def', true) . '</p>'; $this->content .= $this->doc->section($language->getLL('Legend', true), $code, true); } }
/** * 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); }
/** * Main function, rendering the content of the rename form * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent .= $this->doc->spacer(5); $pageContent .= $this->doc->divider(5); if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $fileIdentifier = $this->fileOrFolderObject->getCombinedIdentifier(); } else { $fileIdentifier = $this->fileOrFolderObject->getUid(); } $code = '<form action="tce_file.php" method="post" name="editform">'; // Making the formfields for renaming: $code .= ' <div id="c-rename"> <input type="text" name="file[rename][0][target]" value="' . htmlspecialchars($this->fileOrFolderObject->getName()) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' /> <input type="hidden" name="file[rename][0][data]" value="' . htmlspecialchars($fileIdentifier) . '" /> </div> '; // Making submit button: $code .= ' <div id="c-submit"> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.submit', TRUE) . '" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; $code .= '</form>'; // Add the HTML as a section: $pageContent .= $code; $docHeaderButtons = array('back' => ''); $docHeaderButtons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Creating form for editing the permissions ($this->edit = TRUE) * (Adding content to internal content variable) * * @return void */ public function doEdit() { if ($GLOBALS['BE_USER']->workspace != 0) { // Adding section with the permission setting matrix: $lockedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('WorkspaceWarningText'), $GLOBALS['LANG']->getLL('WorkspaceWarning'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($lockedMessage); } // Get usernames and groupnames $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getListGroupNames('title,uid'); $beGroupKeys = array_keys($beGroupArray); $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 1); } $beGroupArray_o = $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindGroupNames($beGroupArray_o, $beGroupKeys, 1); } // data of the first group, the user is member of $firstGroup = $beGroupKeys[0] ? $beGroupArray[$beGroupKeys[0]] : ''; // Owner selector: $options = ''; // flag: is set if the page-userid equals one from the user-list $userset = 0; foreach ($beUserArray as $uid => $row) { if ($uid == $this->pageinfo['perms_userid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>'; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_userid]"> ' . $options . ' </select>'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Owner') . ':', $selector); // Group selector: $options = ''; $userset = 0; foreach ($beGroupArray as $uid => $row) { if ($uid == $this->pageinfo['perms_groupid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; } // If the group was not set AND there is a group for the page if (!$userset && $this->pageinfo['perms_groupid']) { $options = ' <option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_groupid]"> ' . $options . ' </select>'; $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Group') . ':', $selector); // Permissions checkbox matrix: $code = ' <table border="0" cellspacing="2" cellpadding="0" id="typo3-permissionMatrix"> <tr> <td></td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('1', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('16', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('2', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('4', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('8', 1)) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $GLOBALS['LANG']->getLL('Owner', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 4) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $GLOBALS['LANG']->getLL('Group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 4) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $GLOBALS['LANG']->getLL('Everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 4) . '</td> </tr> </table> <br /> <input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" /> ' . $this->getRecursiveSelect($this->id, $this->perms_clause) . ' <input type="submit" name="submit" value="' . $GLOBALS['LANG']->getLL('Save', 1) . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('Abort', 1) . '" onclick="' . htmlspecialchars('jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_perm') . '&id=' . $this->id, TRUE) . '); return false;') . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . intval($this->return_id) . '&lastEdited=' . $this->id) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Adding section with the permission setting matrix: $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('permissions') . ':', $code); // CSH for permissions setting $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />'); // Adding help text: if ($GLOBALS['BE_USER']->uc['helpText']) { $this->content .= $this->doc->divider(20); $legendText = '<strong>' . $GLOBALS['LANG']->getLL('1', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('16', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('2', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('4', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('8', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', 1); $code = $legendText . '<br /><br />' . $GLOBALS['LANG']->getLL('def', 1); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend', 1) . ':', $code); } }
/** * This will render a selector box element for selecting elements * of (category) trees. * Depending on the tree it display full trees or root elements only. * * @param array $parameter An array with additional configuration options. * @param FormEngine $fObj TCEForms object reference * * @return string The HTML code for the TCEform field */ public function getSingleField_selectCategories(array $parameter, FormEngine &$fObj) { $this->tceForms =& $parameter['pObj']; $table = $parameter['table']; $field = $parameter['field']; $row = $parameter['row']; $config = $parameter['fieldConf']['config']; $disabled = ''; if ($this->tceForms->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } // @todo it seems TCE has a bug and do not work correctly with '1' $config['maxitems'] = $config['maxitems'] == 2 ? 1 : $config['maxitems']; // read the permissions we are restricting the tree to, depending on the table $perms = 'show'; switch ($table) { case 'tx_commerce_categories': $perms = 'new'; break; case 'tx_commerce_products': $perms = 'editcontent'; break; case 'tt_content': // fall through // fall through case 'be_groups': // fall through // fall through case 'be_users': $perms = 'show'; break; default: } /** * Category tree. * * @var \CommerceTeam\Commerce\Tree\CategoryTree $categoryTree */ $categoryTree = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\CategoryTree'); // disabled clickmenu $categoryTree->noClickmenu(); // set the minimum permissions $categoryTree->setMinCategoryPerms($perms); if ($config['allowProducts']) { $categoryTree->setBare(false); } if ($config['substituteRealValues']) { // @todo fix me $categoryTree->substituteRealValues(); } /* * Disallows clicks on certain leafs * Values is a comma-separated list of leaf names * (e.g. \CommerceTeam\Commerce\Tree\Leaf\Category) */ $categoryTree->disallowClick($config['disallowClick']); $categoryTree->init(); /** * Browse tree. * * @var \CommerceTeam\Commerce\ViewHelpers\TreelibTceforms $renderBrowseTrees */ $renderBrowseTrees = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\ViewHelpers\\TreelibTceforms'); $renderBrowseTrees->init($parameter); // Render the tree $renderBrowseTrees->renderBrowsableMountTrees($categoryTree); $thumbnails = ''; if (!$disabled) { // tree frame <div> $thumbnails = $renderBrowseTrees->renderDivBox(); } // get selected processed items - depending on the table we want to insert // into (tx_commerce_products, tx_commerce_categories, be_users) // if row['uid'] is defined and is an int we do display an existing record // otherwise it's a new record, so get default values $itemArray = array(); if ((int) $row['uid']) { // existing Record switch ($table) { case 'tx_commerce_categories': $itemArray = $renderBrowseTrees->processItemArrayForBrowseableTreePCategory($categoryTree, $row['uid']); break; case 'tx_commerce_products': $itemArray = $renderBrowseTrees->processItemArrayForBrowseableTreeProduct($categoryTree, $row['uid']); break; case 'be_users': $itemArray = $renderBrowseTrees->processItemArrayForBrowseableTree($categoryTree, $row['uid']); break; case 'be_groups': $itemArray = $renderBrowseTrees->processItemArrayForBrowseableTreeGroups($categoryTree, $row['uid']); break; case 'tt_content': // Perform modification of the selected items array: $itemArray = GeneralUtility::trimExplode(',', $parameter['itemFormElValue'], 1); $itemArray = $renderBrowseTrees->processItemArrayForBrowseableTreeCategory($categoryTree, $itemArray[0]); break; default: $itemArray = $renderBrowseTrees->processItemArrayForBrowseableTreeDefault($parameter['itemFormElValue']); } } else { // New record $defVals = GeneralUtility::_GP('defVals'); switch ($table) { case 'tx_commerce_categories': /** * Category. * * @var \CommerceTeam\Commerce\Domain\Model\Category $category */ $category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $defVals['tx_commerce_categories']['parent_category']); $category->loadData(); $itemArray = array($category->getUid() . '|' . $category->getTitle()); break; case 'tx_commerce_products': /** * Category. * * @var \CommerceTeam\Commerce\Domain\Model\Category $category */ $category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $defVals['tx_commerce_products']['categories']); $category->loadData(); if ($category->getUid() > 0) { $itemArray = array($category->getUid() . '|' . $category->getTitle()); } break; default: } } // process selected values // Creating the label for the "No Matching Value" entry. $noMatchingValueLabel = isset($parameter['fieldTSConfig']['noMatchingValue_label']) ? $this->tceForms->sL($parameter['fieldTSConfig']['noMatchingValue_label']) : '[ ' . $this->tceForms->getLL('l_noMatchingValue') . ' ]'; $noMatchingValueLabel = @sprintf($noMatchingValueLabel, $parameter['itemFormElValue']); // Possibly remove some items: $removeItems = GeneralUtility::trimExplode(',', $parameter['fieldTSConfig']['removeItems'], true); foreach ($itemArray as $tk => $tv) { $tvP = explode('|', $tv, 2); if (in_array($tvP[0], $removeItems) && !$parameter['fieldTSConfig']['disableNoMatchingValueElement']) { $tvP[1] = rawurlencode($noMatchingValueLabel); } elseif (isset($parameter['fieldTSConfig']['altLabels.'][$tvP[0]])) { $tvP[1] = rawurlencode($this->tceForms->sL($parameter['fieldTSConfig']['altLabels.'][$tvP[0]])); } $itemArray[$tk] = implode('|', $tvP); } // Rendering and output $minitems = max($config['minitems'], 0); $maxitems = max($config['maxitems'], 0); if (!$maxitems) { $maxitems = 100000; } $this->tceForms->requiredElements[$parameter['itemFormElName']] = array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field); $item = '<input type="hidden" name="' . $parameter['itemFormElName'] . '_mul" value="' . ($config['multiple'] ? 1 : 0) . '"' . $disabled . ' />'; $params = array('size' => $config['size'], 'autoSizeMax' => \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($config['autoSizeMax'], 0), 'style' => ' style="width:200px;"', 'dontShowMoveIcons' => $maxitems <= 1, 'maxitems' => $maxitems, 'info' => '', 'headers' => array('selector' => $this->tceForms->getLL('l_selected') . ':<br />', 'items' => $disabled ? '' : $this->tceForms->getLL('l_items') . ':<br />'), 'noBrowser' => true, 'readOnly' => $disabled, 'thumbnails' => $thumbnails); $item .= ' <style type="text/css"> .x-tree-root-ct ul { padding: 0 0 0 19px; margin: 0; } .x-tree-root-ct { padding-left: 0; } tr:hover .x-tree-root-ct a { text-decoration: none; } .x-tree-root-ct li { list-style: none; margin: 0; padding: 0; } .x-tree-root-ct ul li.expanded ul { background: url("' . $this->tceForms->backPath . 'sysext/t3skin/icons/gfx/ol/line.gif") repeat-y scroll left top transparent; } .x-tree-root-ct ul li.expanded.last ul { background: none; } .x-tree-root-ct li { clear: left; margin-bottom: 0; } </style> '; $item .= $this->tceForms->dbFileIcons($parameter['itemFormElName'], $config['internal_type'], $config['allowed'], $itemArray, '', $params, $parameter['onFocus']); // Wizards: if (!$disabled) { $specConf = $this->tceForms->getSpecConfFromString($parameter['extra'], $parameter['fieldConf']['defaultExtras']); $altItem = '<input type="hidden" name="' . $parameter['itemFormElName'] . '" value="' . htmlspecialchars($parameter['itemFormElValue']) . '" />'; $item = $this->tceForms->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $parameter, $parameter['itemFormElName'], $specConf); } return $item; }
/** * Creating form for editing the permissions ($this->edit = true) * (Adding content to internal content variable) * * @return void */ public function doEdit() { if ($GLOBALS['BE_USER']->workspace != 0) { // Adding section with the permission setting matrix: $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('WorkspaceWarningText'), $GLOBALS['LANG']->getLL('WorkspaceWarning'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } // Get ACL configuration $disableOldPermissionSystem = 0; $beAclConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_acl']); if ($beAclConfig['disableOldPermissionSystem']) { $disableOldPermissionSystem = 1; } $GLOBALS['LANG']->includeLLFile('EXT:be_acl/res/locallang_perm.xml'); // Get usernames and groupnames $beGroupArray = BackendUtility::getListGroupNames('title,uid'); $beGroupKeys = array_keys($beGroupArray); $beUserArray = BackendUtility::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 1); } $beGroupArray_o = $beGroupArray = BackendUtility::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = BackendUtility::blindGroupNames($beGroupArray_o, $beGroupKeys, 1); } // Set JavaScript // Generate list if record is available on subpages, if yes, enter the id $this->content .= '<script src="../../../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('be_acl') . 'res/acl.js" type="text/javascript"></script>'; // Owner selector: $options = ''; // flag: is set if the page-userid equals one from the user-list $userset = 0; foreach ($beUserArray as $uid => $row) { if ($uid == $this->pageinfo['perms_userid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>'; } $options = '<option value="0"></option>' . $options; // Hide selector if not needed $hidden = ''; if ($disableOldPermissionSystem) { $hidden = ' style="display:none;" '; } $selector = '<select name="data[pages][' . $this->id . '][perms_userid]"' . $hidden . '>' . $options . '</select>'; if ($disableOldPermissionSystem) { $this->content .= $selector; } else { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Owner'), $selector, TRUE); } // Group selector: $options = ''; $userset = 0; foreach ($beGroupArray as $uid => $row) { if ($uid == $this->pageinfo['perms_groupid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; } // If the group was not set AND there is a group for the page if (!$userset && $this->pageinfo['perms_groupid']) { $options = '<option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options; } $options = '<option value="0"></option>' . $options; $selector = '<select name="data[pages][' . $this->id . '][perms_groupid]"' . $hidden . '>' . $options . '</select>'; if ($disableOldPermissionSystem) { $this->content .= $selector; } else { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Group'), $selector, TRUE); } // Permissions checkbox matrix: $code = ' <input type="hidden" name="pageID" value="' . (int) $this->id . '" /> <table class="t3-table" id="typo3-permissionMatrix"> <thead> <tr> <th></th> <th>' . $GLOBALS['LANG']->getLL('1', TRUE) . '</th> <th>' . $GLOBALS['LANG']->getLL('16', TRUE) . '</th> <th>' . $GLOBALS['LANG']->getLL('2', TRUE) . '</th> <th>' . $GLOBALS['LANG']->getLL('4', TRUE) . '</th> <th>' . $GLOBALS['LANG']->getLL('8', TRUE) . '</th> <th>' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('recursiveAcl', 1)) . '</th> <th></th> </tr> </thead> <tbody>'; if (!$disableOldPermissionSystem) { $code .= ' <tr> <td><strong>' . $GLOBALS['LANG']->getLL('Owner', TRUE) . '</strong></td> <td>' . $this->printCheckBox('perms_user', 1) . '</td> <td>' . $this->printCheckBox('perms_user', 5) . '</td> <td>' . $this->printCheckBox('perms_user', 2) . '</td> <td>' . $this->printCheckBox('perms_user', 3) . '</td> <td>' . $this->printCheckBox('perms_user', 4) . '</td> <td></td> <td></td> </tr> <tr> <td><strong>' . $GLOBALS['LANG']->getLL('Group', TRUE) . '</strong></td> <td>' . $this->printCheckBox('perms_group', 1) . '</td> <td>' . $this->printCheckBox('perms_group', 5) . '</td> <td>' . $this->printCheckBox('perms_group', 2) . '</td> <td>' . $this->printCheckBox('perms_group', 3) . '</td> <td>' . $this->printCheckBox('perms_group', 4) . '</td> <td></td> <td></td> </tr> <tr> <td><strong>' . $GLOBALS['LANG']->getLL('Everybody', TRUE) . '</strong></td> <td>' . $this->printCheckBox('perms_everybody', 1) . '</td> <td>' . $this->printCheckBox('perms_everybody', 5) . '</td> <td>' . $this->printCheckBox('perms_everybody', 2) . '</td> <td>' . $this->printCheckBox('perms_everybody', 3) . '</td> <td>' . $this->printCheckBox('perms_everybody', 4) . '</td> <td></td> <td></td> </tr>'; } // ACL CODE $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_beacl_acl', 'pid=' . (int) $this->id); while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $acl_prefix = 'data[tx_beacl_acl][' . $result['uid'] . ']'; $code .= ' <tr> <td align="right"><select name="' . $acl_prefix . '[type]" onChange="updateUserGroup(' . $result['uid'] . ')"><option value="0" ' . ($result['type'] ? '' : 'selected="selected"') . '>User</option><option value="1" ' . ($result['type'] ? 'selected="selected"' : '') . '>Group</option></select><select name="' . $acl_prefix . '[object_id]"></select></td> <td>' . $this->printCheckBox('perms_acl_' . $result['uid'], 1, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td>' . $this->printCheckBox('perms_acl_' . $result['uid'], 5, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td>' . $this->printCheckBox('perms_acl_' . $result['uid'], 2, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td>' . $this->printCheckBox('perms_acl_' . $result['uid'], 3, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td>' . $this->printCheckBox('perms_acl_' . $result['uid'], 4, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . ' <input type="hidden" name="' . $acl_prefix . '[permissions]" value="' . $result['permissions'] . '" /> <script type="text/javascript">updateUserGroup(' . $result['uid'] . ', ' . $result['object_id'] . '); setCheck("check[perms_acl_' . $result['uid'] . ']","data[tx_beacl_acl][' . $result['uid'] . '][permissions]"); global_currentACLs[global_currentACLs.length] = ' . $result['uid'] . ' ; </script> </td> <td> <input type="hidden" name="' . $acl_prefix . '[recursive]" value="0" /> <input type="checkbox" name="' . $acl_prefix . '[recursive]" value="1" ' . ($result['recursive'] ? 'checked="checked"' : '') . ' /> </td> <td><a href="#" onClick="deleteACL(' . $result['uid'] . ')"><img ' . IconUtility::skinImg('', 'gfx/garbage.gif') . ' alt="' . $GLOBALS['LANG']->getLL('delAcl', 1) . '" /></a></td> </tr>'; } $code .= ' </table> <br />'; if ($disableOldPermissionSystem) { $code .= '<span style="display:none;">'; for ($i = 1; $i <= 5; ++$i) { $code .= $this->printCheckBox('perms_user', $i) . $this->printCheckBox('perms_group', $i) . $this->printCheckBox('perms_everybody', $i); } $code .= '</span>'; } $code .= ' <span id="insertHiddenFields"></span> <img ' . IconUtility::skinImg('', 'gfx/garbage.gif') . ' alt="' . $GLOBALS['LANG']->getLL('delAcl', 1) . '" / id="templateDeleteImage" style="display:none"> <a href="javascript:addACL()"><img ' . IconUtility::skinImg('', 'gfx/new_el.gif') . ' alt="' . $GLOBALS['LANG']->getLL('addAcl', 1) . '" />' . $GLOBALS['LANG']->getLL('addAcl', 1) . '</a><br /> <input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" /> ' . ($disableOldPermissionSystem ? '' : $this->getRecursiveSelect($this->id, $this->perms_clause)) . ' <input type="submit" name="submit" value="' . $GLOBALS['LANG']->getLL('saveAndClose', TRUE) . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('Abort', TRUE) . '" onclick="' . htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('web_perm') . '&id=' . $this->id, TRUE) . '); return false;') . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars(BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . (int) $this->return_id . '&lastEdited=' . $this->id) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Adding section with the permission setting matrix: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('permissions'), $code, TRUE); // CSH for permissions setting $this->content .= BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />'); // Adding help text: if ($GLOBALS['BE_USER']->uc['helpText']) { $legendText = '<p><strong>' . $GLOBALS['LANG']->getLL('1', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', TRUE) . '<br />'; $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('16', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', TRUE) . '<br />'; $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('2', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', TRUE) . '<br />'; $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('4', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', TRUE) . '<br />'; $legendText .= '<strong>' . $GLOBALS['LANG']->getLL('8', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', TRUE) . '</p>'; $code = $legendText . '<p>' . $GLOBALS['LANG']->getLL('def', TRUE) . '</p>'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend', TRUE), $code, TRUE); } }
/** * Put together the various elements (buttons, selectors, form) into a table * * @param string $editForm HTML form. * @return string Composite HTML */ public function compileForm($editForm) { $formContent = ' <!-- EDITING FORM --> ' . $editForm . ' <input type="hidden" name="returnUrl" value="' . htmlspecialchars($this->retUrl) . '" /> <input type="hidden" name="viewUrl" value="' . htmlspecialchars($this->viewUrl) . '" />'; if ($this->returnNewPageId) { $formContent .= '<input type="hidden" name="returnNewPageId" value="1" />'; } $formContent .= '<input type="hidden" name="popViewId" value="' . htmlspecialchars($this->viewId) . '" />'; if ($this->viewId_addParams) { $formContent .= '<input type="hidden" name="popViewId_addParams" value="' . htmlspecialchars($this->viewId_addParams) . '" />'; } $formContent .= ' <input type="hidden" name="closeDoc" value="0" /> <input type="hidden" name="doSave" value="0" /> <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="_scrollPosition" value="" />' . FormEngine::getHiddenTokenField('editRecord'); return $formContent; }
/** * Render Form Field in typo3 backend * @param array $PA * @param \TYPO3\CMS\Backend\Form\FormEngine $fob */ public function renderInput(array $PA, \TYPO3\CMS\Backend\Form\FormEngine $fob) { $content = file_get_contents(dirname(__FILE__) . '/../Resources/Private/Templates/formField.php'); $content = str_replace('###UID###', $PA['row']['uid'], $content); $content = str_replace('###TABLE###', $PA['table'], $content); $content = str_replace('###ID###', uniqid(), $content); $result = $this->getOverwriteprotectionRepository()->findByProtectedUidAndTableName($PA['row']['uid'], $PA['table']); $value = ''; $overwriteMode = ''; $conflictMode = ''; foreach ($result as $overwriteprotection) { /* @var $overwriteprotection Tx_AoeDbsequenzer_Domain_Model_Overwriteprotection */ $value = $overwriteprotection->getProtectedTime(); $value = date('H:i d-m-Y', $value); if ($overwriteprotection->getProtectedMode() === 0) { $conflictMode = 'selected="selected"'; } else { $overwriteMode = 'selected="selected"'; } } $content = str_replace('###VALUE###', $value, $content); $content = str_replace('###OVERWIRTE_MODE###', $overwriteMode, $content); $content = str_replace('###CONFLICT_MODE###', $conflictMode, $content); $content = str_replace('###LABEL_MODE###', $fob->sL('LLL:EXT:aoe_dbsequenzer/Resources/Private/Language/locallang_db.xml:protected_mode'), $content); $content = str_replace('###LABEL_MODE_CONFLICT###', $fob->sL('LLL:EXT:aoe_dbsequenzer/Resources/Private/Language/locallang_db.xml:mode_conflict'), $content); $content = str_replace('###LABEL_MODE_OVERWIRTE###', $fob->sL('LLL:EXT:aoe_dbsequenzer/Resources/Private/Language/locallang_db.xml:mode_overwrite'), $content); return $content; }
/** * Return the Javascript code for configuring the RTE * * @param integer $RTEcounter: The index number of the current RTE editing area within the form. * @param string $table: The table that includes this RTE (optional, necessary for IRRE). * @param string $uid: The uid of that table that includes this RTE (optional, necessary for IRRE). * @param string $field: The field of that record that includes this RTE (optional). * @param string $textAreaId ID of the textarea, to have a unigue number for the editor * @return string the Javascript code for configuring the RTE * @todo Define visibility */ public function registerRTEinJS($RTEcounter, $table = '', $uid = '', $field = '', $textAreaId = '') { $configureRTEInJavascriptString = ' if (typeof(configureEditorInstance) == "undefined") { configureEditorInstance = new Object(); } configureEditorInstance["' . $textAreaId . '"] = function() { if (typeof(RTEarea) == "undefined" || typeof(HTMLArea) == "undefined") { window.setTimeout("configureEditorInstance[\'' . $textAreaId . '\']();", 40); } else { editornumber = "' . $textAreaId . '"; RTEarea[editornumber] = new Object(); RTEarea[editornumber].RTEtsConfigParams = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '"; RTEarea[editornumber].number = editornumber; RTEarea[editornumber].deleted = false; RTEarea[editornumber].textAreaId = "' . $textAreaId . '"; RTEarea[editornumber].id = "RTEarea" + editornumber; RTEarea[editornumber].RTEWidthOverride = "' . (is_object($GLOBALS['BE_USER']) && isset($GLOBALS['BE_USER']->uc['rteWidth']) && trim($GLOBALS['BE_USER']->uc['rteWidth']) ? trim($GLOBALS['BE_USER']->uc['rteWidth']) : trim($this->thisConfig['RTEWidthOverride'])) . '"; RTEarea[editornumber].RTEHeightOverride = "' . (is_object($GLOBALS['BE_USER']) && isset($GLOBALS['BE_USER']->uc['rteHeight']) && (int) $GLOBALS['BE_USER']->uc['rteHeight'] ? (int) $GLOBALS['BE_USER']->uc['rteHeight'] : (int) $this->thisConfig['RTEHeightOverride']) . '"; RTEarea[editornumber].resizable = ' . (is_object($GLOBALS['BE_USER']) && isset($GLOBALS['BE_USER']->uc['rteResize']) && $GLOBALS['BE_USER']->uc['rteResize'] ? 'true' : (trim($this->thisConfig['rteResize']) ? 'true' : 'false')) . '; RTEarea[editornumber].maxHeight = "' . (is_object($GLOBALS['BE_USER']) && isset($GLOBALS['BE_USER']->uc['rteMaxHeight']) && (int) $GLOBALS['BE_USER']->uc['rteMaxHeight'] ? trim($GLOBALS['BE_USER']->uc['rteMaxHeight']) : ((int) $this->thisConfig['rteMaxHeight'] ?: '2000')) . '"; RTEarea[editornumber].fullScreen = ' . ($this->fullScreen ? 'true' : 'false') . '; RTEarea[editornumber].showStatusBar = ' . (trim($this->thisConfig['showStatusBar']) ? 'true' : 'false') . '; RTEarea[editornumber].enableWordClean = ' . (trim($this->thisConfig['enableWordClean']) ? 'true' : 'false') . '; RTEarea[editornumber].htmlRemoveComments = ' . (trim($this->thisConfig['removeComments']) ? 'true' : 'false') . '; RTEarea[editornumber].disableEnterParagraphs = ' . (trim($this->thisConfig['disableEnterParagraphs']) ? 'true' : 'false') . '; RTEarea[editornumber].disableObjectResizing = ' . (trim($this->thisConfig['disableObjectResizing']) ? 'true' : 'false') . '; RTEarea[editornumber].removeTrailingBR = ' . (trim($this->thisConfig['removeTrailingBR']) ? 'true' : 'false') . '; RTEarea[editornumber].useCSS = ' . (trim($this->thisConfig['useCSS']) ? 'true' : 'false') . '; RTEarea[editornumber].keepButtonGroupTogether = ' . (trim($this->thisConfig['keepButtonGroupTogether']) ? 'true' : 'false') . '; RTEarea[editornumber].disablePCexamples = ' . (trim($this->thisConfig['disablePCexamples']) ? 'true' : 'false') . '; RTEarea[editornumber].showTagFreeClasses = ' . (trim($this->thisConfig['showTagFreeClasses']) ? 'true' : 'false') . '; RTEarea[editornumber].useHTTPS = ' . (trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'] ? 'true' : 'false') . '; RTEarea[editornumber].tceformsNested = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(TRUE) : '[]') . '; RTEarea[editornumber].dialogueWindows = new Object();'; if (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromTop'])) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].dialogueWindows.positionFromTop = ' . (int) $this->thisConfig['dialogueWindows.']['defaultPositionFromTop'] . ';'; } if (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromLeft'])) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].dialogueWindows.positionFromLeft = ' . (int) $this->thisConfig['dialogueWindows.']['defaultPositionFromLeft'] . ';'; } // The following properties apply only to the backend if (!$this->is_FE()) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].sys_language_content = "' . $this->contentLanguageUid . '"; RTEarea[editornumber].typo3ContentLanguage = "' . $this->contentTypo3Language . '"; RTEarea[editornumber].typo3ContentCharset = "' . $this->contentCharset . '"; RTEarea[editornumber].userUid = "' . $this->userUid . '";'; } // Setting the plugin flags $configureRTEInJavascriptString .= ' RTEarea[editornumber].plugin = new Object(); RTEarea[editornumber].pathToPluginDirectory = new Object();'; foreach ($this->pluginEnabledArray as $pluginId) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].plugin.' . $pluginId . ' = true;'; if (is_object($this->registeredPlugins[$pluginId])) { $pathToPluginDirectory = $this->registeredPlugins[$pluginId]->getPathToPluginDirectory(); if ($pathToPluginDirectory) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].pathToPluginDirectory.' . $pluginId . ' = "' . $pathToPluginDirectory . '";'; } } } // Setting the buttons configuration $configureRTEInJavascriptString .= ' RTEarea[editornumber].buttons = new Object();'; if (is_array($this->thisConfig['buttons.'])) { foreach ($this->thisConfig['buttons.'] as $buttonIndex => $conf) { $button = substr($buttonIndex, 0, -1); if (is_array($conf)) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].buttons.' . $button . ' = ' . $this->buildNestedJSArray($conf) . ';'; } } } // Setting the list of tags to be removed if specified in the RTE config if (trim($this->thisConfig['removeTags'])) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].htmlRemoveTags = /^(' . implode('|', GeneralUtility::trimExplode(',', $this->thisConfig['removeTags'], TRUE)) . ')$/i;'; } // Setting the list of tags to be removed with their contents if specified in the RTE config if (trim($this->thisConfig['removeTagsAndContents'])) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].htmlRemoveTagsAndContents = /^(' . implode('|', GeneralUtility::trimExplode(',', $this->thisConfig['removeTagsAndContents'], TRUE)) . ')$/i;'; } // Setting array of custom tags if specified in the RTE config if (!empty($this->thisConfig['customTags'])) { $customTags = GeneralUtility::trimExplode(',', $this->thisConfig['customTags'], TRUE); if (!empty($customTags)) { $configureRTEInJavascriptString .= ' RTEarea[editornumber].customTags= ' . json_encode($customTags) . ';'; } } // Setting the pageStyle $configureRTEInJavascriptString .= ' RTEarea[editornumber].pageStyle = "' . GeneralUtility::createVersionNumberedFilename($this->getContentCssFileName()) . '";'; // Process classes configuration $classesConfigurationRequired = FALSE; foreach ($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId)) { $classesConfigurationRequired = $classesConfigurationRequired || $plugin->requiresClassesConfiguration(); } } if ($classesConfigurationRequired) { $configureRTEInJavascriptString .= $this->buildJSClassesConfig($RTEcounter); } // Add Javascript configuration for registered plugins foreach ($this->registeredPlugins as $pluginId => $plugin) { if ($this->isPluginEnabled($pluginId)) { $configureRTEInJavascriptString .= $plugin->buildJavascriptConfiguration('editornumber'); } } // Avoid premature reference to HTMLArea when being initially loaded by IRRE Ajax call $configureRTEInJavascriptString .= ' RTEarea[editornumber].toolbar = ' . $this->getJSToolbarArray() . '; RTEarea[editornumber].convertButtonId = ' . json_encode(array_flip($this->convertToolbarForHtmlAreaArray)) . '; RTEarea.initEditor(editornumber); } }; configureEditorInstance["' . $textAreaId . '"]();'; return $configureRTEInJavascriptString; }
/** * Main function, redering the actual content of the editing page * * @return void */ public function main() { $docHeaderButtons = $this->getButtons(); $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle')); // Hook before compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) { $preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook']; if (is_array($preOutputProcessingHook)) { $hookParameters = array('content' => &$this->content, 'target' => &$this->target); foreach ($preOutputProcessingHook as $hookFunction) { GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName())); $pageContent .= $this->doc->spacer(2); $code = ''; $extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext']; try { if (!$extList || !GeneralUtility::inList($extList, $this->fileObject->getExtension())) { throw new \Exception('Files with that extension are not editable.'); } // Read file content to edit: $fileContent = $this->fileObject->getContents(); // Making the formfields $hValue = BackendUtility::getModuleUrl('file_edit', array('target' => $this->origTarget, 'returnUrl' => $this->returnUrl)); // Edit textarea: $code .= ' <div id="c-edit"> <textarea rows="30" name="file[editfile][0][data]" wrap="off" ' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="text-monospace t3js-enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea> <input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> <br />'; // Make shortcut: if ($this->getBackendUser()->mayMakeShortcut()) { $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', 'file_edit', 1); } else { $docHeaderButtons['shortcut'] = ''; } } catch (\Exception $e) { $code .= sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'), $extList); } // Ending of section and outputting editing form: $pageContent .= $this->doc->sectionEnd(); $pageContent .= $code; // Hook after compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) { $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook']; if (is_array($postOutputProcessingHook)) { $hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target); foreach ($postOutputProcessingHook as $hookFunction) { GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this); } } } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Rendering the quick-edit view. * * @return void * @todo Define visibility */ public function renderQuickEdit() { // Alternative template $this->doc->setModuleTemplate('templates/db_layout_quickedit.html'); // Alternative form tag; Quick Edit submits its content to tce_db.php. $this->doc->form = '<form action="' . htmlspecialchars($GLOBALS['BACK_PATH'] . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Set the edit_record value for internal use in this function: $edit_record = $this->edit_record; // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php: if (substr($edit_record, 0, 9) == '_EDIT_COL') { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_content')) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_content') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting'); $idListA = array(); while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $idListA[] = $cRow['uid']; } $url = $GLOBALS['BACK_PATH'] . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => ''))); \TYPO3\CMS\Core\Utility\HttpUtility::redirect($url); } // If the former record edited was the creation of a NEW record, this will look up the created records uid: if ($this->new_unique_uid) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log')); $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (is_array($sys_log_row)) { $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid']; } } // Creating the selector box, allowing the user to select which element to edit: $opt = array(); $is_selected = 0; $languageOverlayRecord = ''; if ($this->current_sys_language) { list($languageOverlayRecord) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language)); } if (is_array($languageOverlayRecord)) { $inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editLanguageHeader', 1) . ' ]</option>'; } else { $inValue = 'pages:' . $this->id; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('editPageProperties', 1) . ' ]</option>'; } // Selecting all content elements from this language and allowed colPos: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_content')) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_content') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting'); $colPos = ''; $first = 1; // Page is the pid if no record to put this after. $prev = $this->id; while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('tt_content', $cRow); if (is_array($cRow)) { if ($first) { if (!$edit_record) { $edit_record = 'tt_content:' . $cRow['uid']; } $first = 0; } if (strcmp($cRow['colPos'], $colPos)) { $colPos = $cRow['colPos']; $opt[] = '<option value=""></option>'; $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>'; } $inValue = 'tt_content:' . $cRow['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $GLOBALS['BE_USER']->uc['titleLen'])) . '</option>'; $prev = -$cRow['uid']; } } // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element: if (!$edit_record) { $edit_record = 'tt_content:new/' . $prev . '/' . $colPos; $inValue = 'tt_content:new/' . $prev . '/' . $colPos; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>'; } // If none is yet selected... if (!$is_selected) { $opt[] = '<option value=""></option>'; $opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $GLOBALS['LANG']->getLL('newLabel', 1) . ' ]</option>'; } // Splitting the edit-record cmd value into table/uid: $this->eRParts = explode(':', $edit_record); // Delete-button flag? $this->deleteButton = \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4); // If undo-button should be rendered (depends on available items in sys_history) $this->undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1'); if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $this->undoButton = 1; } // Setting up the Return URL for coming back to THIS script (if links take the user to another script) $R_URL_parts = parse_url(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); $R_URL_getvars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(); unset($R_URL_getvars['popView']); unset($R_URL_getvars['new_unique_uid']); $R_URL_getvars['edit_record'] = $edit_record; $this->R_URI = $R_URL_parts['path'] . '?' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $R_URL_getvars); // Setting close url/return url for exiting this script: // Goes to 'Columns' view if close is pressed (default) $this->closeUrl = $this->local_linkThisScript(array('SET' => array('function' => 1))); if ($GLOBALS['BE_USER']->uc['condensedMode']) { $this->closeUrl = $GLOBALS['BACK_PATH'] . 'alt_db_navframe.php'; } if ($this->returnUrl) { $this->closeUrl = $this->returnUrl; } // Return-url for JavaScript: $retUrlStr = $this->returnUrl ? '+\'&returnUrl=\'+\'' . rawurlencode($this->returnUrl) . '\'' : ''; // Drawing the edit record selectbox $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>'; // Creating editing form: if ($GLOBALS['BE_USER']->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] !== 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] === 'pages' && $this->CALC_PERMS & 1)) { // Splitting uid parts for special features, if new: list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]); // Convert $uidVal to workspace version if any: if ($uidVal != 'new') { if ($draftRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) { $uidVal = $draftRecord['uid']; } } // Initializing transfer-data object: $trData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor'); $trData->addRawData = TRUE; $trData->defVals[$this->eRParts[0]] = array('colPos' => intval($ex_colPos), 'sys_language_uid' => intval($this->current_sys_language)); $trData->disableRTE = $this->MOD_SETTINGS['disableRTE']; $trData->lockRecords = 1; // 'new' $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal); // Getting/Making the record: reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); if ($uidVal == 'new') { $new_unique_uid = uniqid('NEW'); $rec['uid'] = $new_unique_uid; $rec['pid'] = intval($ex_pid) ? intval($ex_pid) : $this->id; $recordAccess = TRUE; } else { $rec['uid'] = $uidVal; // Checking internals access: $recordAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($this->eRParts[0], $uidVal); } if (!$recordAccess) { // If no edit access, print error message: $content .= $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />' . ($GLOBALS['BE_USER']->errorMsg ? 'Reason: ' . $GLOBALS['BE_USER']->errorMsg . '<br /><br />' : ''), 0, 1); } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-) // Create instance of TCEforms, setting defaults: $tceforms = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine'); $tceforms->backPath = $GLOBALS['BACK_PATH']; $tceforms->initDefaultBEMode(); $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder']; $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes']; $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE']; $tceforms->enableClickMenu = TRUE; // Clipboard is initialized: // Start clipboard $tceforms->clipObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard'); // Initialize - reads the clipboard content from the user session $tceforms->clipObj->initializeClipboard(); // Render form, wrap it: $panel = ''; $panel .= $tceforms->getMainFields($this->eRParts[0], $rec); $panel = $tceforms->wrapTotal($panel, $rec, $this->eRParts[0]); // Add hidden fields: $theCode = $panel; if ($uidVal == 'new') { $theCode .= '<input type="hidden" name="data[' . $this->eRParts[0] . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; } $theCode .= ' <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="_disableRTE" value="' . $tceforms->disableRTE . '" /> <input type="hidden" name="edit_record" value="' . $edit_record . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($uidVal == 'new' ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cms') . 'layout/db_layout.php?id=' . $this->id . '&new_unique_uid=' . $new_unique_uid . '&returnUrl=' . rawurlencode($this->returnUrl) : $this->R_URI) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Add JavaScript as needed around the form: $theCode = $tceforms->printNeededJSFunctions_top() . $theCode . $tceforms->printNeededJSFunctions(); // Add warning sign if record was "locked": if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked($this->eRParts[0], $rec['uid'])) { $lockedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($lockInfo['msg']), '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($lockedMessage); } // Add whole form as a document section: $content .= $this->doc->section('', $theCode); } } else { // If no edit access, print error message: $content .= $this->doc->section($GLOBALS['LANG']->getLL('noAccess'), $GLOBALS['LANG']->getLL('noAccess_msg') . '<br /><br />', 0, 1); } // Bottom controls (function menus): $q_count = $this->getNumberOfHiddenElements(); $h_func_b = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE', 1)) : $GLOBALS['LANG']->getLL('hiddenCE', 1) . ' (' . $q_count . ')') . '</label>'; $h_func_b .= '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], 'db_layout.php', '', 'id="checkShowPalettes"') . '<label for="checkShowPalettes">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes', 1) . '</label>'; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('context_help')) { $h_func_b .= '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[showDescriptions]', $this->MOD_SETTINGS['showDescriptions'], 'db_layout.php', '', 'id="checkShowDescriptions"') . '<label for="checkShowDescriptions">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions', 1) . '</label>'; } if ($GLOBALS['BE_USER']->isRTE()) { $h_func_b .= '<br />' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[disableRTE]', $this->MOD_SETTINGS['disableRTE'], 'db_layout.php', '', 'id="checkDisableRTE"') . '<label for="checkDisableRTE">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE', 1) . '</label>'; } // Add the function menus to bottom: $content .= $this->doc->section('', $h_func_b, 0, 0); $content .= $this->doc->spacer(10); // Select element matrix: if ($this->eRParts[0] == 'tt_content' && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) { $posMap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('ext_posMap'); $posMap->backPath = $GLOBALS['BACK_PATH']; $posMap->cur_sys_language = $this->current_sys_language; $HTMLcode = ''; // CSH: $HTMLcode .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement', $GLOBALS['BACK_PATH'], '|<br />'); $HTMLcode .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI); $content .= $this->doc->spacer(20); $content .= $this->doc->section($GLOBALS['LANG']->getLL('CEonThisPage'), $HTMLcode, 0, 1); $content .= $this->doc->spacer(20); } // Finally, if comments were generated in TCEforms object, print these as a HTML comment: if (count($tceforms->commentMessages)) { $content .= ' <!-- TCEFORM messages ' . htmlspecialchars(implode(LF, $tceforms->commentMessages)) . ' --> '; } return $content; }
/** * For TBE: Makes a form for creating new folders in the filemount the user is browsing. * The folder creation request is sent to the tce_file.php script in the core which will handle the creation. * * @param Folder $folderObject Absolute filepath on server in which to create the new folder. * @return string HTML for the create folder form. * @todo Define visibility */ public function createFolder(Folder $folderObject) { if (!$folderObject->checkActionPermission('write')) { return ''; } if (!($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB'))) { return ''; } // Don't show Folder-create form if it's denied if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) { return ''; } // Create header, showing upload path: $header = $folderObject->getIdentifier(); $code = ' <!-- Form, for creating new folders: --> <form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform2" id="typo3-crFolderForm"> <table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder"> <tr> <td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle') . ':') . '</td> </tr> <tr> <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', TRUE) . ':</strong> ' . htmlspecialchars($header) . '</td> </tr> <tr> <td class="c-wCell c-hCell">'; // Create the new-folder name field: $a = 1; $code .= '<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" />' . '<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />'; // Make footer of upload form, including the submit button: $redirectValue = $this->getThisScript() . 'act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams); $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />'; $code .= '</td> </tr> </table> </form>'; return $code; }
/** * This function renders the upload form * * @return string The HTML form as a string, ready for outputting */ public function renderUploadForm() { // Make checkbox for "overwrite" $content = ' <div id="c-override"> <p><label for="overwriteExistingFiles"><input type="checkbox" class="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> ' . $this->getLanguageService()->getLL('overwriteExistingFiles', 1) . '</label></p> <p> </p> <p>' . $this->getLanguageService()->getLL('uploadMultipleFilesInfo', TRUE) . '</p> </div> '; // Produce the number of upload-fields needed: $content .= ' <div id="c-upload"> '; // Adding 'size="50" ' for the sake of Mozilla! $content .= ' <input type="file" multiple="true" name="upload_1[]" /> <input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($this->folderObject->getCombinedIdentifier()) . '" /> <input type="hidden" name="file[upload][1][data]" value="1" /><br /> '; $content .= ' </div> '; // Submit button: $content .= ' <div id="c-submit"> <input type="hidden" name="redirect" value="' . $this->returnUrl . '" /><br /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' <input class="btn btn-default" type="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.submit', TRUE) . '" /> </div> '; return $content; }
/** * Renders the slider value wizard * * @param array $params * @param \TYPO3\CMS\Backend\Form\FormEngine $pObj * @return string * @todo Define visibility */ public function renderWizard(&$params, &$pObj) { $jsPath = '../t3lib/js/extjs/components/slider/'; $pObj->loadJavascriptLib($jsPath . 'ValueSlider.js'); $field = $params['field']; $value = $params['row'][$field]; // If Slider is used in a flexform if (!empty($params['flexFormPath'])) { $flexFormTools = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools'); $flexFormValue = $flexFormTools->getArrayValueByPath($params['flexFormPath'], \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($value)); if ($flexFormValue !== NULL) { $value = $flexFormValue; } } $itemName = $params['itemName']; // Set default values (which correspond to those of the JS component) $min = 0; $max = 10000; // Use the range property, if defined, to set min and max values if (isset($params['fieldConfig']['range'])) { $min = isset($params['fieldConfig']['range']['lower']) ? intval($params['fieldConfig']['range']['lower']) : 0; $max = isset($params['fieldConfig']['range']['upper']) ? intval($params['fieldConfig']['range']['upper']) : 10000; } $elementType = $params['fieldConfig']['type']; $step = $params['wConf']['step'] ? $params['wConf']['step'] : 1; $width = intval($params['wConf']['width']) ? intval($params['wConf']['width']) : 400; $type = 'null'; if (isset($params['fieldConfig']['eval'])) { $eval = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $params['fieldConfig']['eval'], TRUE); if (in_array('time', $eval)) { $type = 'time'; $value = (int) $value; } elseif (in_array('int', $eval)) { $type = 'int'; $value = (int) $value; } elseif (in_array('double2', $eval)) { $type = 'double'; $value = (double) $value; } } if (isset($params['fieldConfig']['items'])) { $type = 'array'; $value = (int) $value; } $callback = $params['fieldChangeFunc']['TBE_EDITOR_fieldChanged']; $getField = $params['fieldChangeFunc']['typo3form.fieldGet']; $id = 'slider-' . $params['md5ID']; $contents = '<div id="' . $id . '"></div>'; $js = ' new TYPO3.Components.TcaValueSlider({ minValue: ' . $min . ', maxValue: ' . $max . ', value: ' . $value . ', increment: ' . $step . ', renderTo: "' . $id . '", itemName: "' . $itemName . '", changeCallback: "' . $callback . '", getField: "' . $getField . '", width: "' . $width . '", type: "' . $type . '", elementType: "' . $elementType . '" }); '; /** @var $pageRenderer t3lib_pageRenderer */ $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer(); $pageRenderer->addExtOnReadyCode($js); return $contents; }
/** * Management of versions for record * * @return void * @todo Define visibility */ public function versioningMgm() { // Diffing: $diff_1 = GeneralUtility::_POST('diff_1'); $diff_2 = GeneralUtility::_POST('diff_2'); if (GeneralUtility::_POST('do_diff')) { $content = ''; $content .= '<h3>' . $GLOBALS['LANG']->getLL('diffing') . ':</h3>'; if ($diff_1 && $diff_2) { $diff_1_record = BackendUtility::getRecord($this->table, $diff_1); $diff_2_record = BackendUtility::getRecord($this->table, $diff_2); if (is_array($diff_1_record) && is_array($diff_2_record)) { $t3lib_diff_Obj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility'); $tRows = array(); $tRows[] = ' <tr class="bgColor5 tableheader"> <td>' . $GLOBALS['LANG']->getLL('fieldname') . '</td> <td width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</td> </tr> '; foreach ($diff_1_record as $fN => $fV) { if ($GLOBALS['TCA'][$this->table]['columns'][$fN] && $GLOBALS['TCA'][$this->table]['columns'][$fN]['config']['type'] !== 'passthrough' && !GeneralUtility::inList('t3ver_label', $fN)) { if ((string) $diff_1_record[$fN] !== (string) $diff_2_record[$fN]) { $diffres = $t3lib_diff_Obj->makeDiffDisplay(BackendUtility::getProcessedValue($this->table, $fN, $diff_2_record[$fN], 0, 1), BackendUtility::getProcessedValue($this->table, $fN, $diff_1_record[$fN], 0, 1)); $tRows[] = ' <tr class="bgColor4"> <td>' . $fN . '</td> <td width="98%">' . $diffres . '</td> </tr> '; } } } if (count($tRows) > 1) { $content .= '<table border="0" cellpadding="1" cellspacing="1" width="100%">' . implode('', $tRows) . '</table><br /><br />'; } else { $content .= $GLOBALS['LANG']->getLL('recordsMatchesCompletely'); } } else { $content .= $GLOBALS['LANG']->getLL('errorRecordsNotFound'); } } else { $content .= $GLOBALS['LANG']->getLL('errorDiffSources'); } } // Element: $record = BackendUtility::getRecord($this->table, $this->uid); $recordIcon = IconUtility::getSpriteIconForRecord($this->table, $record); $recTitle = BackendUtility::getRecordTitle($this->table, $record, TRUE); // Display versions: $content .= ' ' . $recordIcon . $recTitle . ' <form name="theform" action="' . str_replace('&sendToReview=1', '', $this->REQUEST_URI) . '" method="post"> <table border="0" cellspacing="1" cellpadding="1">'; $content .= ' <tr class="bgColor5 tableheader"> <td> </td> <td> </td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</td> <td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</td> <td colspan="2"><input type="submit" name="do_diff" value="' . $GLOBALS['LANG']->getLL('diff') . '" /></td> </tr>'; $versions = BackendUtility::selectVersionsOfRecord($this->table, $this->uid, '*', $GLOBALS['BE_USER']->workspace); foreach ($versions as $row) { $adminLinks = $this->adminLinks($this->table, $row); $content .= ' <tr class="' . ($row['uid'] != $this->uid ? 'bgColor4' : 'bgColor2 tableheader') . '"> <td>' . ($row['uid'] != $this->uid ? '<a href="' . $this->doc->issueCommand('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent', TRUE) . '">' . IconUtility::getSpriteIcon('actions-version-swap-version') . '</a>' : IconUtility::getSpriteIcon('status-status-current', array('title' => $GLOBALS['LANG']->getLL('currentOnlineVersion', TRUE)))) . '</td> <td nowrap="nowrap">' . $adminLinks . '</td> <td nowrap="nowrap">' . BackendUtility::getRecordTitle($this->table, $row, TRUE) . '</td> <td>' . $row['uid'] . '</td> <td>' . $row['t3ver_oid'] . '</td> <td>' . $row['t3ver_id'] . '</td> <td>' . $row['t3ver_wsid'] . '</td> <td>' . $row['t3ver_state'] . '</td> <td>' . $row['t3ver_stage'] . '</td> <td>' . $row['t3ver_count'] . '</td> <td>' . $row['pid'] . '</td> <td nowrap="nowrap"><a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $this->table . '][' . $row['uid'] . ']=edit&columnsOnly=t3ver_label', $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>' . htmlspecialchars($row['t3ver_label']) . '</td> <td class="version-diff-1"><input type="radio" name="diff_1" value="' . $row['uid'] . '"' . ($diff_1 == $row['uid'] ? ' checked="checked"' : '') . '/></td> <td class="version-diff-2"><input type="radio" name="diff_2" value="' . $row['uid'] . '"' . ($diff_2 == $row['uid'] ? ' checked="checked"' : '') . '/></td> </tr>'; // Show sub-content if the table is pages AND it is not the online branch (because that will mostly render the WHOLE tree below - not smart;) if ($this->table == 'pages' && $row['uid'] != $this->uid) { $sub = $this->pageSubContent($row['uid']); if ($sub) { $content .= ' <tr> <td></td> <td></td> <td colspan="10">' . $sub . '</td> <td colspan="2"></td> </tr>'; } } } $content .= '</table></form>'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $content, 0, 1); // Create new: $content = ' <form action="' . $this->doc->backPath . 'tce_db.php" method="post"> ' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . ': <input type="text" name="cmd[' . $this->table . '][' . $this->uid . '][version][label]" /><br /> <br /><input type="hidden" name="cmd[' . $this->table . '][' . $this->uid . '][version][action]" value="new" /> <input type="hidden" name="prErr" value="1" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) . '" /> <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </form> '; $this->content .= $this->doc->spacer(15); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('createNewVersion'), $content, 0, 1); }
/** * Main function, rendering the main module content * * @return void */ public function main() { $lang = $this->getLanguageService(); // Start content compilation $this->content .= $this->doc->startPage($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle')); // Make page header: $pageContent = $this->doc->header($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle')); if ($this->folderObject->checkActionPermission('add')) { $code = '<form role="form" action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">'; // Making the selector box for the number of concurrent folder-creations $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10); $code .= ' <div class="form-group"> <div class="form-section"> <div class="form-group"> <label for="number-of-new-folders">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . '</label> <div class="form-control-wrap"> <div class="input-group"> <select class="form-control form-control-adapt" name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">'; for ($a = 1; $a <= $this->folderNumber; $a++) { $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>'; } $code .= ' </select> </div> </div> </div> </div> '; // Making the number of new-folder boxes needed: for ($a = 0; $a < $this->number; $a++) { $code .= ' <div class="form-section"> <div class="form-group"> <label for="folder_new_' . $a . '">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfolder') . ' ' . ($a + 1) . ':</label> <div class="form-control-wrap"> <input type="text" class="form-control" id="folder_new_' . $a . '" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" /> <input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" /> </div> </div> </div>'; } // Making submit button for folder creation: $code .= ' </div><div class="form-group"> <input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; // Switching form tags: $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfolders'), $code); $pageContent .= $this->doc->sectionEnd() . '</form>'; } if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) { $pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform2">'; // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc. $fileExtList = array(); $textFileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE); foreach ($textFileExt as $fileExt) { if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) { $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>'; } } // Add form fields for creation of a new, blank text file: $code = ' <div class="form-group"> <div class="form-section"> <div class="form-group"> <label for="newfile">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfile') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . '</label> <div class="form-control-wrap"> <input class="form-control" type="text" id="newfile" name="file[newfile][0][data]" onchange="changed=true;" /> <input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" /> </div> <div class="help-block"> ' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:cm.allowedFileExtensions') . '<br> ' . implode(' ', $fileExtList) . ' </div> </div> </div> </div> '; // Submit button for creation of a new file: $code .= ' <div class="form-group"> <input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code); $pageContent .= $this->doc->sectionEnd(); $pageContent .= '</form>'; } $docHeaderButtons = array('back' => ''); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Make sure that the exclude field configuration is still valid after * the rendering of an inline element. * * @test */ public function excludeElementsAreNotOverwrittenByInlineField() { $rows = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'tx_inlinetest_record', 'uid=1'); $mainFields = $this->subject->getMainFields('tx_inlinetest_record', $rows[0]); $this->assertNotContains('afterinline', $mainFields); }