/**
  * Calls showStats to generate output.
  *
  * @return 	string		html table with results from showStats()
  * @todo Define visibility
  */
 public function main()
 {
     // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
     $theOutput = $this->pObj->doc->header($GLOBALS['LANG']->getLL('title'));
     $theOutput .= $this->pObj->doc->section('', $this->showStats(), 0, 1);
     $menu = array();
     $functionMenu = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[tx_indexedsearch_modfunc2_check]', $this->pObj->MOD_SETTINGS['tx_indexedsearch_modfunc2_check'], '', '', 'id="checkTx_indexedsearch_modfunc2_check"');
     $menu[] = $functionMenu . '<label for="checkTx_indexedsearch_modfunc2_check"' . $GLOBALS['LANG']->getLL('checklabel') . '</label>';
     $theOutput .= $this->pObj->doc->spacer(5);
     return $theOutput;
 }
예제 #2
0
    /**
     * MAIN function for cache information
     *
     * @return	string		Output HTML for the module.
     */
    public function main()
    {
        $content = '';
        // specific language selection from form
        $depth = $this->pObj->MOD_SETTINGS['depth'];
        $langOnly = $this->pObj->MOD_SETTINGS['lang'];
        if ($langOnly != '' && $langOnly != '-1') {
            $this->langOnly = (int) $langOnly;
        }
        $id = (int) $this->pObj->id;
        if ($id) {
            // Add CSS
            $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', '
				TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
				TABLE#tx-seobasics TD { vertical-align: top; }
			', $this->pObj->content);
            // Add Javascript
            $this->pObj->doc->getPageRenderer()->loadJquery();
            $this->pObj->doc->getPageRenderer()->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('seo_basics') . 'Resources/Public/JavaScript/SeoModule.js');
            // render depth selector
            $content = BackendUtility::getFuncMenu($id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']);
            // if there are multiple languages, show dropdown to narrow it down.
            if ($this->hasAvailableLanguages) {
                $content .= 'Display only language:&nbsp;';
                $content .= BackendUtility::getFuncMenu($id, 'SET[lang]', $this->pObj->MOD_SETTINGS['lang'], $this->pObj->MOD_MENU['lang'], 'index.php') . '<br/>';
            }
            $content .= BackendUtility::getFuncCheck($id, 'SET[hideShortcuts]', $this->pObj->MOD_SETTINGS['hideShortcuts'], '', '', 'id="SET[hideShortcuts]"');
            $content .= '<label for="SET[hideShortcuts]">Hide Shortcuts</label>&nbsp;&nbsp;';
            $content .= BackendUtility::getFuncCheck($id, 'SET[hideDisabled]', $this->pObj->MOD_SETTINGS['hideDisabled'], '', '', 'id="SET[hideDisabled]"');
            $content .= '<label for="SET[hideDisabled]">Hide Disabled Pages</label>&nbsp;&nbsp;<br/>';
            $content .= BackendUtility::getFuncCheck($id, 'SET[hideSysFolders]', $this->pObj->MOD_SETTINGS['hideSysFolders'], '', '', 'id="SET[hideSysFolders]"');
            $content .= '<label for="SET[hideSysfolders]">Hide System Folders</label>&nbsp;&nbsp;<br/>';
            $content .= BackendUtility::getFuncCheck($id, 'SET[hideNotInMenu]', $this->pObj->MOD_SETTINGS['hideNotInMenu'], '', '', 'id="SET[hideNotInMenu]"');
            $content .= '<label for="SET[hideNotInMenu]">Hide Not in menu</label>&nbsp;&nbsp;<br/>';
            // Save previous editing when submit was hit
            $this->saveChanges();
            // == Showing the tree ==
            // Initialize starting point (= $id) of page tree
            $treeStartingRecord = BackendUtility::getRecord('pages', $id);
            BackendUtility::workspaceOL('pages', $treeStartingRecord);
            // Initialize tree object
            $tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
            $tree->addField('tx_seo_titletag', 1);
            $tree->addField('keywords', 1);
            $tree->addField('description', 1);
            $tree->addField('tx_realurl_pathsegment', 1);
            $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1));
            // Creating top icon; the current page
            $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $treeStartingRecord);
            $tree->tree[] = array('row' => $treeStartingRecord, 'HTML' => $HTML);
            // Create the tree from starting point
            if ($depth > 0) {
                $tree->getTree($id, $depth, '');
            }
            // get all page IDs that will be displayed
            $pages = array();
            foreach ($tree->tree as $row) {
                $pages[] = $row['row']['uid'];
            }
            // load language overlays and path cache for all pages shown
            $uidList = $GLOBALS['TYPO3_DB']->cleanIntList(implode(',', $pages));
            $this->loadLanguageOverlays($uidList);
            $this->loadPathCache($uidList);
            // Render information table
            $content .= $this->renderSaveButtons();
            $content .= $this->renderSEOTable($tree);
            $content .= $this->renderSaveButtons();
        }
        return $content;
    }
예제 #3
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param int $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  */
 protected function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $lang = $this->getLanguageService();
     $out = '';
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $this->getBackendUser()->getTSConfigVal('options.noThumbsInEB');
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = GeneralUtility::implodeArrayForUrl('', $this->getUrlParameters(['identifier' => $this->selectedFolder->getCombinedIdentifier()]));
         $thumbNailCheck = '<div class="checkbox" style="padding:5px 0 15px 0"><label for="checkDisplayThumbs">' . BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', true) . '</label></div>';
         $out .= $thumbNailCheck;
     } else {
         $out .= '<div style="padding-top: 15px;"></div>';
     }
     return $out;
 }
    /**
     * Main
     *
     * @return string
     * @todo Define visibility
     */
    public function main()
    {
        $theOutput = '';
        // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
        // Checking for more than one template an if, set a menu...
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
        }
        // BUGBUG: Should we check if the uset may at all read and write template-records???
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        if ($existTemplate) {
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('currentTemplate', TRUE), \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('sys_template', $GLOBALS['tplRow']) . '<strong>' . $this->pObj->linkWrapTemplateTitle($GLOBALS['tplRow']['title']) . '</strong>' . htmlspecialchars(trim($GLOBALS['tplRow']['sitetitle']) ? ' (' . $GLOBALS['tplRow']['sitetitle'] . ')' : ''));
        }
        if ($manyTemplatesMenu) {
            $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
        }
        $GLOBALS['tmpl']->clearList_const_temp = array_flip($GLOBALS['tmpl']->clearList_const);
        $GLOBALS['tmpl']->clearList_setup_temp = array_flip($GLOBALS['tmpl']->clearList_setup);
        $pointer = count($GLOBALS['tmpl']->hierarchyInfo);
        $hierarchyInfo = $GLOBALS['tmpl']->ext_process_hierarchyInfo(array(), $pointer);
        $head = '<thead><tr>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('title', TRUE) . '</th>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('rootlevel', TRUE) . '</th>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('clearSetup', TRUE) . '</th>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('clearConstants', TRUE) . '</th>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('pid', TRUE) . '</th>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('rootline', TRUE) . '</th>';
        $head .= '<th>' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '</th>';
        $head .= '</tr></thead>';
        $hierar = implode(array_reverse($GLOBALS['tmpl']->ext_getTemplateHierarchyArr($hierarchyInfo, '', array(), 1)), '');
        $hierar = '<table class="t3-table" id="ts-analyzer">' . $head . $hierar . '</table>';
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateHierarchy', TRUE), $hierar, 0, 1);
        $urlParameters = array('id' => $GLOBALS['SOBE']->id, 'template' => 'all');
        $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
        $completeLink = '<p><a href="' . htmlspecialchars($aHref) . '" class="t3-button">' . $GLOBALS['LANG']->getLL('viewCompleteTS', TRUE) . '</a></p>';
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('completeTS', TRUE), $completeLink, 0, 1);
        $theOutput .= $this->pObj->doc->spacer(15);
        // Output options
        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions', TRUE), '', FALSE, TRUE);
        $addParams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') ? '&template=' . \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') : '';
        $theOutput .= '<div class="tst-analyzer-options">' . '<div class="checkbox"><label for="checkTs_analyzer_checkLinenum">' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkLinenum]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], '', $addParams, 'id="checkTs_analyzer_checkLinenum"') . $GLOBALS['LANG']->getLL('lineNumbers', TRUE) . '</label></div>' . '<div class="checkbox"><label for="checkTs_analyzer_checkSyntax">' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkSyntax]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], '', $addParams, 'id="checkTs_analyzer_checkSyntax"') . $GLOBALS['LANG']->getLL('syntaxHighlight', TRUE) . '</label> ' . '</label></div>';
        if (!$this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax']) {
            $theOutput .= '<div class="checkbox"><label for="checkTs_analyzer_checkComments">' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkComments]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], '', $addParams, 'id="checkTs_analyzer_checkComments"') . $GLOBALS['LANG']->getLL('comments', TRUE) . '</label></div>' . '<div class="checkbox"><label for="checkTs_analyzer_checkCrop">' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkCrop]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], '', $addParams, 'id="checkTs_analyzer_checkCrop"') . $GLOBALS['LANG']->getLL('cropLines', TRUE) . '</label></div>';
        }
        $theOutput .= '</div>';
        $theOutput .= $this->pObj->doc->spacer(25);
        // Output Constants
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template')) {
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants', TRUE), '', 0, 1);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $theOutput .= '
				<table class="t3-table ts-typoscript">
			';
            // Don't know why -2 and not 0... :-) But works.
            $GLOBALS['tmpl']->ext_lineNumberOffset = 0;
            $GLOBALS['tmpl']->ext_lineNumberOffset_mode = 'const';
            foreach ($GLOBALS['tmpl']->constants as $key => $val) {
                $currentTemplateId = $GLOBALS['tmpl']->hierarchyInfo[$key]['templateID'];
                if ($currentTemplateId == \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') || \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') == 'all') {
                    $theOutput .= '
						<tr>
							<td><strong>' . htmlspecialchars($GLOBALS['tmpl']->hierarchyInfo[$key]['title']) . '</strong></td>
						</tr>
						<tr>
							<td>
								<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td nowrap="nowrap">' . $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</td></tr></table>
							</td>
						</tr>
					';
                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') != 'all') {
                        break;
                    }
                }
                $GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
            }
            $theOutput .= '
				</table>
			';
        }
        // Output setup
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template')) {
            $theOutput .= $this->pObj->doc->spacer(15);
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup', TRUE), '', 0, 1);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $theOutput .= '
				<table class="t3-table ts-typoscript">
			';
            $GLOBALS['tmpl']->ext_lineNumberOffset = 0;
            $GLOBALS['tmpl']->ext_lineNumberOffset_mode = 'setup';
            foreach ($GLOBALS['tmpl']->config as $key => $val) {
                $currentTemplateId = $GLOBALS['tmpl']->hierarchyInfo[$key]['templateID'];
                if ($currentTemplateId == \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') || \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') == 'all') {
                    $theOutput .= '
						<tr>
							<td><strong>' . htmlspecialchars($GLOBALS['tmpl']->hierarchyInfo[$key]['title']) . '</strong></td></tr>
						<tr>
							<td><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td nowrap="nowrap">' . $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</td></tr></table>
							</td>
						</tr>
					';
                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') != 'all') {
                        break;
                    }
                }
                $GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
            }
            $theOutput .= '
				</table>
			';
        }
        return $theOutput;
    }
예제 #5
0
 /**
  * Main function
  *
  * @return void
  */
 public function main()
 {
     /** @var ArrayBrowser $arrayBrowser */
     $arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
     $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
     $search_field = GeneralUtility::_GP('search_field');
     $templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
     $this->view->setTemplatePathAndFilename($templatePathAndFilename);
     $this->view->assign('label', $label);
     $this->view->assign('search_field', $search_field);
     $this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
     switch ($this->MOD_SETTINGS['function']) {
         case 0:
             $theVar = $GLOBALS['TYPO3_CONF_VARS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_CONF_VARS';
             break;
         case 1:
             $theVar = $GLOBALS['TCA'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA';
             break;
         case 2:
             $theVar = $GLOBALS['TCA_DESCR'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA_DESCR';
             break;
         case 3:
             $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
             break;
         case 4:
             $theVar = $GLOBALS['T3_SERVICES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$T3_SERVICES';
             break;
         case 5:
             $theVar = $GLOBALS['TBE_MODULES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES';
             break;
         case 6:
             $theVar = $GLOBALS['TBE_MODULES_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES_EXT';
             break;
         case 7:
             $theVar = $GLOBALS['TBE_STYLES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_STYLES';
             break;
         case 8:
             $theVar = $GLOBALS['BE_USER']->uc;
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$BE_USER->uc';
             break;
         case 9:
             $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
             break;
         default:
             $theVar = array();
     }
     // Update node:
     $update = 0;
     $node = GeneralUtility::_GET('node');
     // If any plus-signs were clicked, it's registered.
     if (is_array($node)) {
         $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
         $update = 1;
     }
     if ($update) {
         $this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
     }
     $arrayBrowser->dontLinkVar = true;
     $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
     $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
     $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
     $arrayBrowser->searchKeysToo = true;
     // If any POST-vars are send, update the condition array
     if (GeneralUtility::_POST('search') && trim($search_field)) {
         $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
     }
     // mask sensitive information
     $varName = trim($arrayBrowser->varName, '$');
     if (isset($this->blindedConfigurationOptions[$varName])) {
         ArrayUtility::mergeRecursiveWithOverrule($theVar, $this->blindedConfigurationOptions[$varName]);
     }
     $tree = $arrayBrowser->tree($theVar, '', '');
     $this->view->assign('tree', $tree);
     // Setting up the shortcut button for docheader
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // Shortcut
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setSetVariables(['function']);
     $buttonBar->addButton($shortcutButton);
     $this->getModuleMenu();
     $this->content = '<form action="" id="ConfigurationView" method="post">';
     $this->content .= $this->view->render();
     $this->content .= '</form>';
 }
예제 #6
0
 /**
  * Rendering the quick-edit view.
  *
  * @return string
  */
 public function renderQuickEdit()
 {
     $databaseConnection = $this->getDatabaseConnection();
     $beUser = $this->getBackendUser();
     $lang = $this->getLanguageService();
     // 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'];
         }
     }
     $edit_record = $this->makeQuickEditMenu($edit_record);
     // Splitting the edit-record cmd value into table/uid:
     $this->eRParts = explode(':', $edit_record);
     $tableName = $this->eRParts[0];
     // Delete-button flag?
     $this->deleteButton = MathUtility::canBeInterpretedAsInteger($this->eRParts[1]) && $edit_record && ($tableName !== 'pages' && $this->EDIT_CONTENT || $tableName === '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($tableName, '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);
     // Creating editing form:
     if ($edit_record) {
         // Splitting uid parts for special features, if new:
         list($uidVal, $neighborRecordUid, $ex_colPos) = explode('/', $this->eRParts[1]);
         if ($uidVal === 'new') {
             $command = 'new';
             // Page id of this new record
             $theUid = $this->id;
             if ($neighborRecordUid) {
                 $theUid = $neighborRecordUid;
             }
         } else {
             $command = 'edit';
             $theUid = $uidVal;
             // Convert $uidVal to workspace version if any:
             $draftRecord = BackendUtility::getWorkspaceVersionOfRecord($beUser->workspace, $tableName, $theUid, 'uid');
             if ($draftRecord) {
                 $theUid = $draftRecord['uid'];
             }
         }
         // @todo: Hack because DatabaseInitializeNewRow reads from _GP directly
         $GLOBALS['_GET']['defVals'][$tableName] = array('colPos' => (int) $ex_colPos, 'sys_language_uid' => (int) $this->current_sys_language);
         /** @var TcaDatabaseRecord $formDataGroup */
         $formDataGroup = GeneralUtility::makeInstance(TcaDatabaseRecord::class);
         /** @var FormDataCompiler $formDataCompiler */
         $formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
         /** @var NodeFactory $nodeFactory */
         $nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
         try {
             $formDataCompilerInput = ['tableName' => $tableName, 'vanillaUid' => (int) $theUid, 'command' => $command];
             $formData = $formDataCompiler->compile($formDataCompilerInput);
             if ($command !== 'new') {
                 BackendUtility::lockRecords($tableName, $formData['databaseRow']['uid'], $tableName === 'tt_content' ? $formData['databaseRow']['pid'] : 0);
             }
             $formData['renderType'] = 'outerWrapContainer';
             $formResult = $nodeFactory->create($formData)->render();
             $panel = $formResult['html'];
             $formResult['html'] = '';
             /** @var FormResultCompiler $formResultCompiler */
             $formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class);
             $formResultCompiler->mergeResult($formResult);
             $row = $formData['databaseRow'];
             $new_unique_uid = '';
             if ($command === 'new') {
                 $new_unique_uid = $row['uid'];
             }
             // Add hidden fields:
             if ($uidVal == 'new') {
                 $panel .= '<input type="hidden" name="data[' . $tableName . '][' . $row['uid'] . '][pid]" value="' . $row['pid'] . '" />';
             }
             $redirect = $uidVal == 'new' ? BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->id, 'new_unique_uid' => $new_unique_uid, 'returnUrl' => $this->returnUrl]) : $this->R_URI;
             $panel .= '
                 <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />
                 <input type="hidden" name="edit_record" value="' . $edit_record . '" />
                 <input type="hidden" name="redirect" value="' . htmlspecialchars($redirect) . '" />
                 ';
             // Add JavaScript as needed around the form:
             $content = $formResultCompiler->JStop() . $panel . $formResultCompiler->printNeededJSFunctions();
             // Display "is-locked" message:
             if ($command === 'edit') {
                 $lockInfo = BackendUtility::isRecordLocked($tableName, $formData['databaseRow']['uid']);
                 if ($lockInfo) {
                     /** @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);
                 }
             }
         } catch (AccessDeniedException $e) {
             // If no edit access, print error message:
             $content = '<h2>' . $lang->getLL('noAccess', true) . '</h2>';
             $content .= '<div>' . $lang->getLL('noAccess_msg') . '<br /><br />' . ($beUser->errorMsg ? 'Reason: ' . $beUser->errorMsg . '<br /><br />' : '') . '</div>';
         }
     } else {
         // If no edit access, print error message:
         $content = '<h2>' . $lang->getLL('noAccess') . '</h2>';
         $content .= '<div>' . $lang->getLL('noAccess_msg') . '</div>';
     }
     // Element selection matrix:
     if ($tableName === 'tt_content' && MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
         $content .= '<h2>' . $lang->getLL('CEonThisPage') . '</h2>';
         // PositionMap
         $posMap = GeneralUtility::makeInstance(ContentLayoutPagePositionMap::class);
         $posMap->cur_sys_language = $this->current_sys_language;
         $content .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI);
         // Toggle hidden ContentElements
         $numberOfHiddenElements = $this->getNumberOfHiddenElements();
         if ($numberOfHiddenElements) {
             $content .= '<div class="checkbox">';
             $content .= '<label for="checkTt_content_showHidden">';
             $content .= BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], '', '', 'id="checkTt_content_showHidden"');
             $content .= !$numberOfHiddenElements ? '<span class="text-muted">' . $lang->getLL('hiddenCE', true) . '</span>' : $lang->getLL('hiddenCE', true) . ' (' . $numberOfHiddenElements . ')';
             $content .= '</label>';
             $content .= '</div>';
         }
         // CSH
         $content .= BackendUtility::cshItem($this->descrTable, 'quickEdit_selElement');
     }
     return $content;
 }
    /**
     * Main
     *
     * @return string
     */
    public function main()
    {
        $lang = $this->getLanguageService();
        $POST = GeneralUtility::_POST();
        $documentTemplate = $this->getDocumentTemplate();
        // Checking for more than one template an if, set a menu...
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
        }
        $bType = $this->pObj->MOD_SETTINGS['ts_browser_type'];
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        $tplRow = $this->getTemplateRow();
        // initialize
        $theOutput = '';
        if ($existTemplate) {
            $content = ' ' . IconUtility::getSpriteIconForRecord('sys_template', $tplRow) . ' <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow['title'], $bType == 'setup' ? 'config' : 'constants') . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : '');
            $theOutput .= $this->pObj->doc->section($lang->getLL('currentTemplate'), $content);
            if ($manyTemplatesMenu) {
                $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
            }
            $theOutput .= $this->pObj->doc->spacer(10);
            if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) {
                // add property
                $line = '';
                if (is_array($POST['data'])) {
                    $name = key($POST['data']);
                    if ($POST['data'][$name]['name'] !== '') {
                        // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
                        unset($POST['update_value']);
                        $POST['add_property'] = 'Add';
                    }
                    if ($POST['add_property']) {
                        $property = trim($POST['data'][$name]['name']);
                        if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
                            $badPropertyMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noSpaces') . '<br />' . $lang->getLL('nothingUpdated'), $lang->getLL('badProperty'), FlashMessage::ERROR);
                            $this->addFlashMessage($badPropertyMessage);
                        } else {
                            $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
                            $propertyAddedMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($pline), $lang->getLL('propertyAdded'));
                            $this->addFlashMessage($propertyAddedMessage);
                            $line .= LF . $pline;
                        }
                    } elseif ($POST['update_value']) {
                        $pline = $name . ' = ' . trim($POST['data'][$name]['value']);
                        $updatedMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($pline), $lang->getLL('valueUpdated'));
                        $this->addFlashMessage($updatedMessage);
                        $line .= LF . $pline;
                    } elseif ($POST['clear_object']) {
                        if ($POST['data'][$name]['clearValue']) {
                            $pline = $name . ' >';
                            $objectClearedMessage = GeneralUtility::makeInstance(FlashMessage::class, htmlspecialchars($pline), $lang->getLL('objectCleared'));
                            $this->addFlashMessage($objectClearedMessage);
                            $line .= LF . $pline;
                        }
                    }
                }
                if ($line) {
                    $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
                    // Set the data to be saved
                    $recData = array();
                    $field = $bType == 'setup' ? 'config' : 'constants';
                    $recData['sys_template'][$saveId][$field] = $tplRow[$field] . $line;
                    // Create new  tce-object
                    $tce = GeneralUtility::makeInstance(DataHandler::class);
                    $tce->stripslashes_values = FALSE;
                    // Initialize
                    $tce->start($recData, array());
                    // Saved the stuff
                    $tce->process_datamap();
                    // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                    $tce->clear_cacheCmd('all');
                    // re-read the template ...
                    $this->initialize_editor($this->pObj->id, $template_uid);
                }
            }
        }
        $tsbr = GeneralUtility::_GET('tsbr');
        $templateService = $this->getExtendedTemplateService();
        $update = 0;
        if (is_array($tsbr)) {
            // If any plus-signs were clicked, it's registred.
            $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $templateService->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]);
            $update = 1;
        }
        if ($POST['Submit']) {
            // If any POST-vars are send, update the condition array
            $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions'];
            $update = 1;
        }
        if ($update) {
            $this->getBackendUserAuthentication()->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
        }
        $templateService->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
        $templateService->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
        // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
        $templateService->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const'];
        if ($this->pObj->sObj && $templateService->constantMode) {
            $templateService->constantMode = 'untouched';
        }
        $templateService->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'];
        $templateService->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
        $templateService->linkObjects = TRUE;
        $templateService->ext_regLinenumbers = TRUE;
        $templateService->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
        $templateService->bType = $bType;
        if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') {
            $templateService->ext_constants_BRP = (int) GeneralUtility::_GP('breakPointLN');
        } else {
            $templateService->ext_config_BRP = (int) GeneralUtility::_GP('breakPointLN');
        }
        $templateService->generateConfig();
        if ($bType == 'setup') {
            $theSetup = $templateService->setup;
        } else {
            $theSetup = $templateService->setup_constants;
        }
        // EDIT A VALUE:
        if ($this->pObj->sObj) {
            list($theSetup, $theSetupValue) = $templateService->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : '');
            if ($existTemplate) {
                // Value
                $out = '';
                $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />';
                $out .= '<input type="text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $documentTemplate->formWidth(40) . ' />';
                $out .= '<input class="btn btn-default" type="submit" name="update_value" value="' . $lang->getLL('updateButton') . '" />';
                $theOutput .= $this->pObj->doc->section($lang->getLL('editProperty'), $out, 0, 0);
                // Property
                $out = '<span class="text-nowrap">' . htmlspecialchars($this->pObj->sObj) . '.';
                $out .= '<input type="text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $documentTemplate->formWidth(20) . ' /> = </span><br />';
                $out .= '<input type="text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $documentTemplate->formWidth(40) . ' />';
                $out .= '<input class="btn btn-default" type="submit" name="add_property" value="' . $lang->getLL('addButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($lang->getLL('addProperty'), $out, 0, 0);
                // clear
                $out = htmlspecialchars($this->pObj->sObj) . ' <strong>' . $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('clear'), 'toUpper') . '</strong> &nbsp;&nbsp;';
                $out .= '<input type="checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
                $out .= '<input class="btn btn-default" type="submit" name="clear_object" value="' . $lang->getLL('clearButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($lang->getLL('clearObject'), $out, 0, 0);
                $theOutput .= $this->pObj->doc->spacer(10);
            } else {
                $noTemplateMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noCurrentTemplate'), $lang->getLL('edit'), FlashMessage::ERROR);
                $this->addFlashMessage($noTemplateMessage);
                $theOutput .= htmlspecialchars($this->pObj->sObj) . ' = <strong>' . htmlspecialchars($theSetupValue) . '</strong>';
                $theOutput .= $this->pObj->doc->spacer(10);
            }
            // Links:
            $out = '';
            $urlParameters = array('id' => $this->pObj->id);
            $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
            if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) {
                if (!empty($theSetup)) {
                    $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj)) . '">';
                    $out .= sprintf($lang->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
                }
            } else {
                $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">';
                $out .= sprintf($lang->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
            }
            if ($out) {
                $theOutput .= $this->pObj->doc->divider(5);
                $theOutput .= $this->pObj->doc->section('', $out);
            }
            // back
            $out = $lang->getLL('back');
            $out = '<a href="' . htmlspecialchars($aHref) . '"><strong>' . $out . '</strong></a>';
            $theOutput .= $this->pObj->doc->divider(5);
            $theOutput .= $this->pObj->doc->section('', $out);
        } else {
            $templateService->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType];
            if (GeneralUtility::_POST('search') && GeneralUtility::_POST('search_field')) {
                // If any POST-vars are send, update the condition array
                $templateService->tsbrowser_depthKeys = $templateService->ext_getSearchKeys($theSetup, '', GeneralUtility::_POST('search_field'), array());
            }
            $theOutput .= '
				<div class="tsob-menu">
					<div class="form-inline">';
            if (is_array($this->pObj->MOD_MENU['ts_browser_type']) && count($this->pObj->MOD_MENU['ts_browser_type']) > 1) {
                $theOutput .= '
						<div class="form-group">
							<label class="control-label">' . $lang->getLL('browse') . '</label>' . BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']) . '
						</div>';
            }
            if (is_array($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) && count($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) > 1) {
                $theOutput .= '
						<div class="form-group">
							<label class="control-label" for="ts_browser_toplevel_' . $bType . '">' . $lang->getLL('objectList') . '</label> ' . BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) . '
						</div>';
            }
            $theOutput .= '
						<div class="form-group">
							<label class="control-label" for="search_field">' . $lang->getLL('search') . '</label>
							<input class="form-control" type="search" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $documentTemplate->formWidth(20) . '/>
						</div>
						<input class="btn btn-default tsob-search-submit" type="submit" name="search" value="' . $lang->sL('LLL:EXT:lang/locallang_common.xlf:search') . '" />
					</div>
					<div class="checkbox">
						<label for="checkTs_browser_regexsearch">
							' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"') . $lang->getLL('regExp') . '
						</label>
					</div>
				</div>';
            $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType];
            if (!$theKey || !str_replace('-', '', $theKey)) {
                $theKey = '';
            }
            list($theSetup, $theSetupValue) = $templateService->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
            $tree = $templateService->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
            $tree = $templateService->substituteCMarkers($tree);
            $urlParameters = array('id' => $this->pObj->id);
            $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
            // Parser Errors:
            $pEkey = $bType == 'setup' ? 'config' : 'constants';
            if (!empty($templateService->parserErrors[$pEkey])) {
                $errMsg = array();
                foreach ($templateService->parserErrors[$pEkey] as $inf) {
                    $errorLink = ' <a href="' . htmlspecialchars($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2]) . '">' . $lang->getLL('errorShowDetails') . '</a>';
                    $errMsg[] = $inf[1] . ': &nbsp; &nbsp;' . $inf[0] . $errorLink;
                }
                $theOutput .= $this->pObj->doc->spacer(10);
                $title = $lang->getLL('errorsWarnings');
                $message = '<p>' . implode($errMsg, '<br />') . '</p>';
                $view = GeneralUtility::makeInstance(StandaloneView::class);
                $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
                $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_WARNING));
                $theOutput .= $view->render();
            }
            if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
                $remove = '<a href="' . htmlspecialchars($aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">' . $lang->getLL('removeKey') . '</a>';
            } else {
                $remove = '';
            }
            $label = $theKey ? $theKey : ($bType == 'setup' ? $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('setupRoot'), 'toUpper') : $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('constantRoot'), 'toUpper'));
            $theOutput .= $this->pObj->doc->sectionEnd();
            $theOutput .= '<div class="panel panel-space panel-default">';
            $theOutput .= '<div class="panel-heading">';
            $theOutput .= '<strong>' . $label . ' ' . $remove . '</strong>';
            $theOutput .= '</div>';
            $theOutput .= '<div class="panel-body">' . $tree . '</div>';
            $theOutput .= '</div>';
            // second row options
            $menu = '<div class="tsob-menu-row2">';
            $menu .= '<div class="checkbox"><label for="checkTs_browser_showComments">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
            $menu .= $lang->getLL('displayComments') . '</label></div>';
            $menu .= '<div class="checkbox"><label for="checkTs_browser_alphaSort">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
            $menu .= $lang->getLL('sortAlphabetically') . '</label></div>';
            $menu .= '<div class="checkbox"><label for="checkTs_browser_fixedLgd">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"');
            $menu .= $lang->getLL('cropLines') . '</label></div>';
            if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
                $menu .= '<br /><br /><label>' . $lang->getLL('displayConstants') . '</label>';
                $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
            }
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section($lang->getLL('displayOptions'), '<span class="text-nowrap">' . $menu . '</span>', 0, 1);
            // Conditions:
            if (is_array($templateService->sections) && !empty($templateService->sections)) {
                $theOutput .= $this->pObj->doc->section($lang->getLL('conditions'), '', 0, 1);
                $out = '';
                foreach ($templateService->sections as $key => $val) {
                    $out .= '<div class="checkbox"><label for="check' . $key . '">';
                    $out .= '<input class="checkbox" type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? ' checked' : '') . ' />' . $templateService->substituteCMarkers(htmlspecialchars($val));
                    $out .= '</label></div>';
                }
                $theOutput .= '<div class="tsob-menu-row2">' . $out . '</div><input class="btn btn-default" type="submit" name="Submit" value="' . $lang->getLL('setConditions') . '" />';
            }
            // Ending section:
            $theOutput .= $this->pObj->doc->sectionEnd();
        }
        return $theOutput;
    }
예제 #8
0
 /**
  * Search (Full / Advanced)
  *
  * @return void
  */
 public function func_search()
 {
     $lang = $this->getLanguageService();
     $searchMode = $this->MOD_SETTINGS['search'];
     $fullsearch = GeneralUtility::makeInstance(QueryView::class);
     $fullsearch->setFormName($this->formName);
     $submenu = '<div class="form-inline form-inline-spaced">';
     $submenu .= BackendUtility::getDropdownMenu(0, 'SET[search]', $searchMode, $this->MOD_MENU['search']);
     if ($this->MOD_SETTINGS['search'] == 'query') {
         $submenu .= BackendUtility::getDropdownMenu(0, 'SET[search_query_makeQuery]', $this->MOD_SETTINGS['search_query_makeQuery'], $this->MOD_MENU['search_query_makeQuery']) . '<br />';
     }
     $submenu .= '</div>';
     if ($this->MOD_SETTINGS['search'] == 'query') {
         $submenu .= '<div class="checkbox"><label for="checkSearch_query_smallparts">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_query_smallparts]', $this->MOD_SETTINGS['search_query_smallparts'], '', '', 'id="checkSearch_query_smallparts"') . $lang->getLL('showSQL') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkSearch_result_labels">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_result_labels]', $this->MOD_SETTINGS['search_result_labels'], '', '', 'id="checkSearch_result_labels"') . $lang->getLL('useFormattedStrings') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkLabels_noprefix">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[labels_noprefix]', $this->MOD_SETTINGS['labels_noprefix'], '', '', 'id="checkLabels_noprefix"') . $lang->getLL('dontUseOrigValues') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkOptions_sortlabel">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[options_sortlabel]', $this->MOD_SETTINGS['options_sortlabel'], '', '', 'id="checkOptions_sortlabel"') . $lang->getLL('sortOptions') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkShow_deleted">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[show_deleted]', $this->MOD_SETTINGS['show_deleted'], '', '', 'id="checkShow_deleted"') . $lang->getLL('showDeleted') . '</label></div>';
     }
     $this->view->assign('submenu', $submenu);
     $this->view->assign('searchMode', $searchMode);
     switch ($searchMode) {
         case 'query':
             $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Lowlevel/QueryGenerator');
             $this->view->assign('queryMaker', $fullsearch->queryMaker());
             break;
         case 'raw':
         default:
             $this->view->assign('searchOptions', $fullsearch->form());
             $this->view->assign('results', $fullsearch->search());
     }
 }
 /**
  * The main processing method if this class
  *
  * @return string Information of the template status or the taken actions as HTML string
  * @todo Define visibility
  */
 public function main()
 {
     global $BACK_PATH;
     global $tmpl, $tplRow, $theConstants;
     $this->pObj->MOD_MENU['includeTypoScriptFileContent'] = TRUE;
     $edit = $this->pObj->edit;
     $e = $this->pObj->e;
     \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_template');
     // Checking for more than one template an if, set a menu...
     $manyTemplatesMenu = $this->pObj->templateMenu();
     $template_uid = 0;
     if ($manyTemplatesMenu) {
         $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
     }
     // Initialize
     $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
     if ($existTemplate) {
         $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
     }
     // Create extension template
     $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
     if ($newId) {
         // Switch to new template
         $urlParameters = array('id' => $this->pObj->id, 'SET[templatesOnPage]' => $newId);
         $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
         \TYPO3\CMS\Core\Utility\HttpUtility::redirect($aHref);
     }
     if ($existTemplate) {
         // Update template ?
         $POST = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
         if ($POST['submit'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) {
             // Set the data to be saved
             $recData = array();
             $alternativeFileName = array();
             $tmp_upload_name = '';
             // Set this to blank
             $tmp_newresource_name = '';
             if (is_array($POST['data'])) {
                 foreach ($POST['data'] as $field => $val) {
                     switch ($field) {
                         case 'constants':
                         case 'config':
                         case 'title':
                         case 'sitetitle':
                         case 'description':
                             $recData['sys_template'][$saveId][$field] = $val;
                             break;
                     }
                 }
             }
             if (count($recData)) {
                 $recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]);
                 // Create new  tce-object
                 $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                 $tce->stripslashes_values = 0;
                 $tce->alternativeFileName = $alternativeFileName;
                 // Initialize
                 $tce->start($recData, array());
                 // Saved the stuff
                 $tce->process_datamap();
                 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                 $tce->clear_cacheCmd('all');
                 // tce were processed successfully
                 $this->tce_processed = TRUE;
                 // re-read the template ...
                 $this->initialize_editor($this->pObj->id, $template_uid);
             }
             // If files has been edited:
             if (is_array($edit)) {
                 if ($edit['filename'] && $tplRow['resources'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($tplRow['resources'], $edit['filename'])) {
                     // Check if there are resources, and that the file is in the resourcelist.
                     $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $edit['filename'];
                     $fI = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($edit['filename']);
                     if (@is_file($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
                         // checks that have already been done.. Just to make sure
                         // @TODO: Check if the hardcorded value already has a config member, otherwise create one
                         // Checks that have already been done.. Just to make sure
                         if (filesize($path) < 30720) {
                             \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($path, $edit['file']);
                             $theOutput .= $this->pObj->doc->spacer(10);
                             $theOutput .= $this->pObj->doc->section('<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>', sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']), 0, 0, 0, 1);
                             // Clear cache - the file has probably affected the template setup
                             // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
                             /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
                             $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                             $tce->stripslashes_values = 0;
                             $tce->start(array(), array());
                             $tce->clear_cacheCmd('all');
                         }
                     }
                 }
             }
         }
         // Hook	post updating template/TCE processing
         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) {
             $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'];
             if (is_array($postTCEProcessingHook)) {
                 $hookParameters = array('POST' => $POST, 'tce' => $tce);
                 foreach ($postTCEProcessingHook as $hookFunction) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                 }
             }
         }
         $content = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('sys_template', $tplRow) . '<strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : '');
         $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), $content, 0, 1);
         if ($manyTemplatesMenu) {
             $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
         }
         $theOutput .= $this->pObj->doc->spacer(10);
         $numberOfRows = 35;
         // If abort pressed, nothing should be edited:
         if ($POST['abort'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) {
             unset($e);
         }
         if ($e['title']) {
             $outCode = '<input type="Text" name="data[title]" value="' . htmlspecialchars($tplRow['title']) . '"' . $this->pObj->doc->formWidth() . '>';
             $outCode .= '<input type="Hidden" name="e[title]" value="1">';
             $theOutput .= $this->pObj->doc->spacer(15);
             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode, TRUE);
         }
         if ($e['sitetitle']) {
             $outCode = '<input type="Text" name="data[sitetitle]" value="' . htmlspecialchars($tplRow['sitetitle']) . '"' . $this->pObj->doc->formWidth() . '>';
             $outCode .= '<input type="Hidden" name="e[sitetitle]" value="1">';
             $theOutput .= $this->pObj->doc->spacer(15);
             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode, TRUE);
         }
         if ($e['description']) {
             $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, '', '') . '>' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['description']) . '</textarea>';
             $outCode .= '<input type="Hidden" name="e[description]" value="1">';
             $theOutput .= $this->pObj->doc->spacer(15);
             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode, TRUE);
         }
         if ($e['constants']) {
             $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['constants']) . '</textarea>';
             $outCode .= '<input type="Hidden" name="e[constants]" value="1">';
             // Display "Include TypoScript file content?" checkbox
             $outCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[constants]=1', 'id="checkIncludeTypoScriptFileContent"');
             $outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />';
             $theOutput .= $this->pObj->doc->spacer(15);
             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '', TRUE);
             $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
         }
         if ($e['file']) {
             $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $e[file];
             $fI = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($e[file]);
             if (@is_file($path) && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
                 if (filesize($path) < $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size'] * 1024) {
                     $fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($path);
                     $outCode = $GLOBALS['LANG']->getLL('file') . ' <strong>' . $e[file] . '</strong><BR>';
                     $outCode .= '<textarea name="edit[file]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($fileContent) . '</textarea>';
                     $outCode .= '<input type="Hidden" name="edit[filename]" value="' . $e[file] . '">';
                     $outCode .= '<input type="Hidden" name="e[file]" value="' . htmlspecialchars($e[file]) . '">';
                     $theOutput .= $this->pObj->doc->spacer(15);
                     $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), '');
                     $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
                 } else {
                     $theOutput .= $this->pObj->doc->spacer(15);
                     $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']);
                     $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']);
                     $theOutput .= $this->pObj->doc->section('<font color=red>' . $fileToBig . '</font>', $filesizeNotAllowed, 0, 0, 0, 1);
                 }
             }
         }
         if ($e['config']) {
             $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($tplRow['config']) . '</textarea>';
             $outCode .= '<input type="Hidden" name="e[config]" value="1">';
             // Display "Include TypoScript file content?" checkbox
             $outCode .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[config]=1', 'id="checkIncludeTypoScriptFileContent"');
             $outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />';
             if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tsconfig_help')) {
                 $url = $BACK_PATH . 'wizard_tsconfig.php?mode=tsref';
                 $params = array('formName' => 'editForm', 'itemName' => 'data[config]');
                 $outCode .= '<a href="#" onClick="vHWin=window.open(\'' . $url . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', array('P' => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-typoscript-documentation-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef', TRUE))) . '</a>';
             }
             $theOutput .= $this->pObj->doc->spacer(15);
             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '', TRUE);
             $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
         }
         // Processing:
         $outCode = '';
         $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('title'), htmlspecialchars($tplRow['title']), 'title');
         $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle');
         $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description');
         $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('constants'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0), 'constants');
         $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('setup'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0), 'config');
         $outCode = '<table class="t3-table-info">' . $outCode . '</table>';
         // Edit all icon:
         $outCode .= '<br /><a href="#" onClick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick(rawurlencode('&createExtension=0') . '&amp;edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editTemplateRecord'))) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>';
         $theOutput .= $this->pObj->doc->section('', $outCode);
         // hook	after compiling the output
         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) {
             $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
             if (is_array($postOutputProcessingHook)) {
                 $hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows);
                 foreach ($postOutputProcessingHook as $hookFunction) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                 }
             }
         }
     } else {
         $theOutput .= $this->pObj->noTemplate(1);
     }
     return $theOutput;
 }
 /**
  * Rendering all other listings than QuickEdit
  *
  * @return void
  * @todo Define visibility
  */
 public function renderListContent()
 {
     // Initialize list object (see "class.db_layout.inc"):
     /** @var $dblist \TYPO3\CMS\Backend\View\PageLayoutView */
     $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView');
     $dblist->backPath = $GLOBALS['BACK_PATH'];
     $dblist->thumbs = $this->imagemode;
     $dblist->no_noWrap = 1;
     $dblist->descrTable = $this->descrTable;
     $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
     $dblist->script = 'db_layout.php';
     $dblist->showIcon = 0;
     $dblist->setLMargin = 0;
     $dblist->doEdit = $this->EDIT_CONTENT;
     $dblist->ext_CALC_PERMS = $this->CALC_PERMS;
     $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
     $dblist->id = $this->id;
     $dblist->nextThree = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
     $dblist->option_showBigButtons = $this->modTSconfig['properties']['disableBigButtons'] === '0';
     $dblist->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
     $dblist->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
     if (!$dblist->nextThree) {
         $dblist->nextThree = 1;
     }
     $dblist->externalTables = $this->externalTables;
     // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
     $h_menu = $dblist->getTableMenu($this->id);
     // Initialize other variables:
     $h_func = '';
     $tableOutput = array();
     $tableJSOutput = array();
     $CMcounter = 0;
     // Traverse the list of table names which has records on this page (that array is populated
     // by the $dblist object during the function getTableMenu()):
     foreach ($dblist->activeTables as $table => $value) {
         // Load full table definitions:
         \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
         if (!isset($dblist->externalTables[$table])) {
             $q_count = $this->getNumberOfHiddenElements();
             $h_func_b = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('hiddenCE')) : $GLOBALS['LANG']->getLL('hiddenCE') . ' (' . $q_count . ')') . '</label>';
             // Boolean: Display up/down arrows and edit icons for tt_content records
             $dblist->tt_contentConfig['showCommands'] = 1;
             // Boolean: Display info-marks or not
             $dblist->tt_contentConfig['showInfo'] = 1;
             // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown
             // in the total width of the page
             $dblist->tt_contentConfig['single'] = 0;
             if ($this->MOD_SETTINGS['function'] == 4) {
                 // Grid view
                 $dblist->tt_contentConfig['showAsGrid'] = 1;
             }
             // Setting up the tt_content columns to show:
             if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
                 $colList = array();
                 $tcaItems = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->id, $this);
                 foreach ($tcaItems as $temp) {
                     $colList[] = $temp[1];
                 }
             } else {
                 // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
                 $colList = array('1', '0', '2', '3');
             }
             if (strcmp($this->colPosList, '')) {
                 $colList = array_intersect(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->colPosList), $colList);
             }
             // If only one column found, display the single-column view.
             if (count($colList) === 1 && !$this->MOD_SETTINGS['function'] === 4) {
                 // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol']
                 // is shown in the total width of the page
                 $dblist->tt_contentConfig['single'] = 1;
                 // The column(s) to show if single mode (under each other)
                 $dblist->tt_contentConfig['showSingleCol'] = current($colList);
             }
             // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
             $dblist->tt_contentConfig['cols'] = implode(',', $colList);
             $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
             $dblist->tt_contentConfig['sys_language_uid'] = intval($this->current_sys_language);
             // If the function menu is set to "Language":
             if ($this->MOD_SETTINGS['function'] == 2) {
                 $dblist->tt_contentConfig['single'] = 0;
                 $dblist->tt_contentConfig['languageMode'] = 1;
                 $dblist->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
                 $dblist->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
             }
         } else {
             if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
                 $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], 'db_layout.php', '');
             } else {
                 $h_func = '';
             }
         }
         // Start the dblist object:
         $dblist->itemsLimitSingleTable = 1000;
         $dblist->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
         $dblist->counter = $CMcounter;
         $dblist->ext_function = $this->MOD_SETTINGS['function'];
         // Render versioning selector:
         $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
         // Generate the list of elements here:
         $dblist->generateList();
         // Adding the list content to the tableOutput variable:
         $tableOutput[$table] = ($h_func ? $h_func . '<br /><img src="clear.gif" width="1" height="4" alt="" /><br />' : '') . $dblist->HTMLcode . ($h_func_b ? '<img src="clear.gif" width="1" height="10" alt="" /><br />' . $h_func_b : '');
         // ... and any accumulated JavaScript goes the same way!
         $tableJSOutput[$table] = $dblist->JScode;
         // Increase global counter:
         $CMcounter += $dblist->counter;
         // Reset variables after operation:
         $dblist->HTMLcode = '';
         $dblist->JScode = '';
         $h_func = '';
         $h_func_b = '';
     }
     // END: traverse tables
     // For Context Sensitive Menus:
     $this->doc->getContextMenuCode();
     // Add the content for each table we have rendered (traversing $tableOutput variable)
     foreach ($tableOutput as $table => $output) {
         $content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE);
         $content .= $this->doc->spacer(15);
         $content .= $this->doc->sectionEnd();
     }
     // Making search form:
     if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
         $sectionTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE));
         $content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
     }
     // Additional footer content
     $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
     if (is_array($footerContentHook)) {
         foreach ($footerContentHook as $hook) {
             $params = array();
             $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     return $content;
 }
    /**
     * Main function of class
     *
     * @return string HTML output
     */
    public function main()
    {
        $menu = BackendUtility::getFuncMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']);
        $menu .= '<div class="checkbox"><label for="checkTsconf_alphaSort">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"') . $GLOBALS['LANG']->getLL('sort_alphabetic', TRUE) . '</label></div>';
        $menu .= '<br /><br />';
        $theOutput = $this->pObj->doc->header($GLOBALS['LANG']->getLL('tsconf_title'));
        if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
            $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, NULL, TRUE);
            $lines = array();
            $pUids = array();
            foreach ($TSparts as $k => $v) {
                if ($k != 'uid_0') {
                    if ($k == 'defaultPageTSconfig') {
                        $pTitle = '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_default', TRUE) . '</strong>';
                        $editIcon = '';
                    } else {
                        $pUids[] = substr($k, 4);
                        $row = BackendUtility::getRecordWSOL('pages', substr($k, 4));
                        $pTitle = $this->pObj->doc->getHeader('pages', $row, '', FALSE);
                        $editIdList = substr($k, 4);
                        $params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=TSconfig';
                        $onclickUrl = BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], '');
                        $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
                    }
                    $TScontent = nl2br(htmlspecialchars(trim($v) . chr(10)));
                    $tsparser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
                    $tsparser->lineNumberOffset = 0;
                    $TScontent = $tsparser->doSyntaxHighlight(trim($v) . LF);
                    $lines[] = '
						<tr><td nowrap="nowrap" class="bgColor5">' . $pTitle . '</td></tr>
						<tr><td nowrap="nowrap" class="bgColor4">' . $TScontent . $editIcon . '</td></tr>
						<tr><td>&nbsp;</td></tr>
					';
                }
            }
            if (count($pUids)) {
                $params = '&edit[pages][' . implode(',', $pUids) . ']=edit&columnsOnly=TSconfig';
                $onclickUrl = BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], '');
                $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig_all', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_all', TRUE) . '</strong>' . '</a>';
            } else {
                $editIcon = '';
            }
            $theOutput .= $this->pObj->doc->section('', BackendUtility::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_edit', $GLOBALS['BACK_PATH'], '|<br />') . $menu . '
					<br /><br />

					<!-- Edit fields: -->
					<table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table><br />' . $editIcon, 0, 1);
        } else {
            // Defined global here!
            $tmpl = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
            // Do not log time-performance information
            $tmpl->tt_track = 0;
            $tmpl->fixedLgd = 0;
            $tmpl->linkObjects = 0;
            $tmpl->bType = '';
            $tmpl->ext_expandAllNotes = 1;
            $tmpl->ext_noPMicons = 1;
            switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                case '1':
                    $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod');
                    break;
                case '1a':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '1b':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '1c':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '1d':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '1e':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '1f':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '1g':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '2':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '5':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '6':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '3':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                case '4':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id));
                    break;
                default:
                    $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id);
            }
            $modTSconfig = $modTSconfig['properties'];
            if (!is_array($modTSconfig)) {
                $modTSconfig = array();
            }
            $csh = BackendUtility::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_hierarchy', $GLOBALS['BACK_PATH'], '|<br />');
            $tree = $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']);
            $theOutput .= $this->pObj->doc->section('', $csh . $menu . '<div class="nowrap">' . $tree . '</div>', 0, 1);
        }
        return $theOutput;
    }
 /**
  * Search (Full / Advanced)
  *
  * @return void
  * @todo Define visibility
  */
 public function func_search()
 {
     global $LANG;
     $fullsearch = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryView');
     $fullsearch->setFormName($this->formName);
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('search'));
     $this->content .= $this->doc->spacer(5);
     $menu2 = '';
     if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
         $menu2 = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(0, 'SET[search]', $this->MOD_SETTINGS['search'], $this->MOD_MENU['search']);
     }
     if ($this->MOD_SETTINGS['search'] == 'query' && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopMenu']) {
         $menu2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(0, 'SET[search_query_makeQuery]', $this->MOD_SETTINGS['search_query_makeQuery'], $this->MOD_MENU['search_query_makeQuery']) . '<br />';
     }
     if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableTopCheckboxes'] && $this->MOD_SETTINGS['search'] == 'query') {
         $menu2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_query_smallparts]', $this->MOD_SETTINGS['search_query_smallparts'], '', '', 'id="checkSearch_query_smallparts"') . '&nbsp;<label for="checkSearch_query_smallparts">' . $GLOBALS['LANG']->getLL('showSQL') . '</label><br />';
         $menu2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_result_labels]', $this->MOD_SETTINGS['search_result_labels'], '', '', 'id="checkSearch_result_labels"') . '&nbsp;<label for="checkSearch_result_labels">' . $GLOBALS['LANG']->getLL('useFormattedStrings') . '</label><br />';
         $menu2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[labels_noprefix]', $this->MOD_SETTINGS['labels_noprefix'], '', '', 'id="checkLabels_noprefix"') . '&nbsp;<label for="checkLabels_noprefix">' . $GLOBALS['LANG']->getLL('dontUseOrigValues') . '</label><br />';
         $menu2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[options_sortlabel]', $this->MOD_SETTINGS['options_sortlabel'], '', '', 'id="checkOptions_sortlabel"') . '&nbsp;<label for="checkOptions_sortlabel">' . $GLOBALS['LANG']->getLL('sortOptions') . '</label><br />';
         $menu2 .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[show_deleted]', $this->MOD_SETTINGS['show_deleted'], '', '', 'id="checkShow_deleted"') . '&nbsp;<label for="checkShow_deleted">' . $GLOBALS['LANG']->getLL('showDeleted') . '</label>';
     }
     $this->content .= $this->doc->section('', $menu2) . $this->doc->spacer(10);
     switch ($this->MOD_SETTINGS['search']) {
         case 'query':
             $this->content .= $fullsearch->queryMaker();
             break;
         case 'raw':
         default:
             $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('searchOptions'), $fullsearch->form(), FALSE, TRUE);
             $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('result'), $fullsearch->search(), FALSE, TRUE);
             break;
     }
 }
    /**
     * Main
     *
     * @return string
     */
    public function main()
    {
        $theOutput = '';
        // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
        // Checking for more than one template an if, set a menu...
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
        }
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        $lang = $this->getLanguageService();
        if ($existTemplate) {
            $siteTitle = trim($GLOBALS['tplRow']['sitetitle']);
            $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
            $theOutput .= $this->pObj->doc->section($lang->getLL('currentTemplate', true), $iconFactory->getIconForRecord('sys_template', $GLOBALS['tplRow'], Icon::SIZE_SMALL)->render() . '<strong>' . $this->pObj->linkWrapTemplateTitle($GLOBALS['tplRow']['title']) . '</strong>' . htmlspecialchars($siteTitle ? ' (' . $siteTitle . ')' : ''));
        }
        if ($manyTemplatesMenu) {
            $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
        }
        $templateService = $this->getExtendedTemplateService();
        $templateService->clearList_const_temp = array_flip($templateService->clearList_const);
        $templateService->clearList_setup_temp = array_flip($templateService->clearList_setup);
        $pointer = count($templateService->hierarchyInfo);
        $hierarchyInfo = $templateService->ext_process_hierarchyInfo(array(), $pointer);
        $head = '<thead><tr>';
        $head .= '<th>' . $lang->getLL('title', true) . '</th>';
        $head .= '<th>' . $lang->getLL('rootlevel', true) . '</th>';
        $head .= '<th>' . $lang->getLL('clearSetup', true) . '</th>';
        $head .= '<th>' . $lang->getLL('clearConstants', true) . '</th>';
        $head .= '<th>' . $lang->getLL('pid', true) . '</th>';
        $head .= '<th>' . $lang->getLL('rootline', true) . '</th>';
        $head .= '<th>' . $lang->getLL('nextLevel', true) . '</th>';
        $head .= '</tr></thead>';
        $hierar = implode(array_reverse($templateService->ext_getTemplateHierarchyArr($hierarchyInfo, '', array(), 1)), '');
        $hierar = '<div class="table-fit"><table class="table table-striped table-hover" id="ts-analyzer">' . $head . $hierar . '</table></div>';
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section($lang->getLL('templateHierarchy', true), $hierar, 0, 1);
        $urlParameters = array('id' => $GLOBALS['SOBE']->id, 'template' => 'all');
        $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
        $completeLink = '<p><a href="' . htmlspecialchars($aHref) . '" class="btn btn-default">' . $lang->getLL('viewCompleteTS', true) . '</a></p>';
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section($lang->getLL('completeTS', true), $completeLink, 0, 1);
        $theOutput .= $this->pObj->doc->spacer(15);
        // Output options
        $theOutput .= $this->pObj->doc->section($lang->getLL('displayOptions', true), '', false, true);
        $template = GeneralUtility::_GET('template');
        $addParams = $template ? '&template=' . $template : '';
        $theOutput .= '<div class="tst-analyzer-options">' . '<div class="checkbox"><label for="checkTs_analyzer_checkLinenum">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkLinenum]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], '', $addParams, 'id="checkTs_analyzer_checkLinenum"') . $lang->getLL('lineNumbers', true) . '</label></div>' . '<div class="checkbox"><label for="checkTs_analyzer_checkSyntax">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkSyntax]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], '', $addParams, 'id="checkTs_analyzer_checkSyntax"') . $lang->getLL('syntaxHighlight', true) . '</label> ' . '</label></div>';
        if (!$this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax']) {
            $theOutput .= '<div class="checkbox"><label for="checkTs_analyzer_checkComments">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkComments]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], '', $addParams, 'id="checkTs_analyzer_checkComments"') . $lang->getLL('comments', true) . '</label></div>' . '<div class="checkbox"><label for="checkTs_analyzer_checkCrop">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkCrop]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], '', $addParams, 'id="checkTs_analyzer_checkCrop"') . $lang->getLL('cropLines', true) . '</label></div>';
        }
        $theOutput .= '</div>';
        $theOutput .= $this->pObj->doc->spacer(25);
        if ($template) {
            // Output Constants
            $theOutput .= $this->pObj->doc->section($lang->getLL('constants', true), '', 0, 1);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $templateService->ext_lineNumberOffset = 0;
            $templateService->ext_lineNumberOffset_mode = 'const';
            foreach ($templateService->constants as $key => $val) {
                $currentTemplateId = $templateService->hierarchyInfo[$key]['templateID'];
                if ($currentTemplateId == $template || $template === 'all') {
                    $theOutput .= '
						<h3>' . htmlspecialchars($templateService->hierarchyInfo[$key]['title']) . '</h3>
						<div class="nowrap">' . $templateService->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</div>
					';
                    if ($template !== 'all') {
                        break;
                    }
                }
                $templateService->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
            }
            // Output Setup
            $theOutput .= $this->pObj->doc->spacer(15);
            $theOutput .= $this->pObj->doc->section($lang->getLL('setup', true), '', 0, 1);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $templateService->ext_lineNumberOffset = 0;
            $templateService->ext_lineNumberOffset_mode = 'setup';
            foreach ($templateService->config as $key => $val) {
                $currentTemplateId = $templateService->hierarchyInfo[$key]['templateID'];
                if ($currentTemplateId == $template || $template == 'all') {
                    $theOutput .= '
						<h3>' . htmlspecialchars($templateService->hierarchyInfo[$key]['title']) . '</h3>
						<div class="nowrap">' . $templateService->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</div>
					';
                    if ($template !== 'all') {
                        break;
                    }
                }
                $templateService->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
            }
        }
        return $theOutput;
    }
    /**
     * Main function of class
     *
     * @return string HTML output
     */
    public function main()
    {
        if ((int) GeneralUtility::_GP('id') === 0) {
            $lang = $this->getLanguageService();
            return '<div class="nowrap"><div class="table-fit"><table class="table table-striped table-hover" id="tsconfig-overview">' . '<thead>' . '<tr>' . '<th>' . $lang->getLL('pagetitle') . '</th>' . '<th>' . $lang->getLL('included_tsconfig_files') . '</th>' . '<th>' . $lang->getLL('written_tsconfig_lines') . '</th>' . '</tr>' . '</thead>' . '<tbody>' . implode('', $this->getOverviewOfPagesUsingTSConfig()) . '</tbody>' . '</table></div>';
        } else {
            $menu = '<div class="form-inline form-inline-spaced">';
            $menu .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']);
            $menu .= '<div class="checkbox"><label for="checkTsconf_alphaSort">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"') . ' ' . $this->getLanguageService()->getLL('sort_alphabetic', true) . '</label></div>';
            $menu .= '</div>';
            $theOutput = '<h1>' . htmlspecialchars($this->getLanguageService()->getLL('tsconf_title')) . '</h1>';
            if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
                $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true);
                $lines = array();
                $pUids = array();
                foreach ($TSparts as $k => $v) {
                    if ($k != 'uid_0') {
                        if ($k == 'defaultPageTSconfig') {
                            $pTitle = '<strong>' . $this->getLanguageService()->getLL('editTSconfig_default', true) . '</strong>';
                            $editIcon = '';
                        } else {
                            $pUids[] = substr($k, 4);
                            $row = BackendUtility::getRecordWSOL('pages', substr($k, 4));
                            $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL);
                            $pTitle = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']) . ' ' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $row));
                            $editIdList = substr($k, 4);
                            $urlParameters = ['edit' => ['pages' => [$editIdList => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                            $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                            $editIcon = '<a href="' . htmlspecialchars($url) . '" title="' . $this->getLanguageService()->getLL('editTSconfig', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
                        }
                        $TScontent = nl2br(htmlspecialchars(trim($v) . LF));
                        $tsparser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
                        $tsparser->lineNumberOffset = 0;
                        $TScontent = $tsparser->doSyntaxHighlight(trim($v) . LF);
                        $lines[] = '
							<tr><td nowrap="nowrap" class="bgColor5">' . $pTitle . '</td></tr>
							<tr><td nowrap="nowrap" class="bgColor4">' . $TScontent . $editIcon . '</td></tr>
							<tr><td>&nbsp;</td></tr>
						';
                    }
                }
                if (!empty($pUids)) {
                    $urlParameters = ['edit' => ['pages' => [implode(',', $pUids) => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                    $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                    $editIcon = '<a href="' . htmlspecialchars($url) . '" title="' . $this->getLanguageService()->getLL('editTSconfig_all', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '<strong>' . $this->getLanguageService()->getLL('editTSconfig_all', true) . '</strong>' . '</a>';
                } else {
                    $editIcon = '';
                }
                $theOutput .= '<div>';
                $theOutput .= BackendUtility::cshItem('_MOD_web_info', 'tsconfig_edit', null, '<span class="btn btn-default btn-sm">|</span>') . $menu . '
						<!-- Edit fields: -->
						<table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table><br />' . $editIcon;
                $theOutput .= '</div>';
            } else {
                // Defined global here!
                $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
                // Do not log time-performance information
                $tmpl->tt_track = 0;
                $tmpl->fixedLgd = 0;
                $tmpl->linkObjects = 0;
                $tmpl->bType = '';
                $tmpl->ext_expandAllNotes = 1;
                $tmpl->ext_noPMicons = 1;
                $beUser = $this->getBackendUser();
                switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                    case '1':
                        $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod');
                        break;
                    case '1a':
                        $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '1b':
                        $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '1c':
                        $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '1d':
                        $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '1e':
                        $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '1f':
                        $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '1g':
                        $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '2':
                        $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '5':
                        $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '6':
                        $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '3':
                        $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    case '4':
                        $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id));
                        break;
                    default:
                        $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id);
                }
                $modTSconfig = $modTSconfig['properties'];
                if (!is_array($modTSconfig)) {
                    $modTSconfig = array();
                }
                $csh = BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '<span class="btn btn-default btn-sm">|</span>');
                $tree = $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']);
                $theOutput .= '<div>';
                $theOutput .= $csh . $menu . '<div class="nowrap">' . $tree . '</div>';
                $theOutput .= '</div>';
            }
        }
        return $theOutput;
    }
예제 #15
0
파일: index.php 프로젝트: danilovq/l10nmgr
    /**
     * Main function of the module. Write the content to
     *
     * @return  void
     */
    public function main()
    {
        // Get language to export/import
        $this->sysLanguage = $this->MOD_SETTINGS["lang"];
        // Draw the header.
        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('EXT:l10nmgr/Resources/Private/Templates/Cm1Template.html');
        $this->doc->form = '<form action="" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        // JavaScript
        $this->doc->JScode = '
			<script language="javascript" type="text/javascript">
				script_ended = 0;
				function jumpToUrl(URL)	{
					document.location = URL;
				}
			</script>
			<script language="javascript" type="text/javascript" src="' . GeneralUtility::resolveBackPath($GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('l10nmgr') . 'Resources/Public/Contrib/tabs.js') . '"></script>
			<link rel="stylesheet" type="text/css" href="' . GeneralUtility::resolveBackPath($GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('l10nmgr') . 'Resources/Public/Contrib/tabs.css') . '" />';
        // Find l10n configuration record
        /** @var $l10ncfgObj L10nConfiguration */
        $l10ncfgObj = GeneralUtility::makeInstance(L10nConfiguration::class);
        $l10ncfgObj->load($this->id);
        if ($l10ncfgObj->isLoaded()) {
            // Setting page id
            $this->id = $l10ncfgObj->getData('pid');
            $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
            $access = is_array($this->pageinfo) ? 1 : 0;
            if ($this->id && $access) {
                // Header:
                //				$this->content.=$this->doc->startPage($GLOBALS['LANG']->getLL('general.title'));
                //				$this->content.=$this->doc->header($GLOBALS['LANG']->getLL('general.title'));
                // Create and render view to show details for the current l10nmgrcfg
                /** @var $l10nmgrconfigurationView L10nConfigurationDetailView */
                $l10nmgrconfigurationView = GeneralUtility::makeInstance(L10nConfigurationDetailView::class, $l10ncfgObj, $this->doc);
                $this->content .= $this->doc->section('', $l10nmgrconfigurationView->render());
                $this->content .= $this->doc->divider(15);
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('general.export.choose.action.title'), BackendUtility::getFuncMenu($l10ncfgObj->getId(), "SET[lang]", $this->sysLanguage, $this->MOD_MENU["lang"], '', '&srcPID=' . rawurlencode(GeneralUtility::_GET('srcPID'))) . BackendUtility::getFuncMenu($l10ncfgObj->getId(), "SET[action]", $this->MOD_SETTINGS["action"], $this->MOD_MENU["action"], '', '&srcPID=' . rawurlencode(GeneralUtility::_GET('srcPID'))) . BackendUtility::getFuncCheck($l10ncfgObj->getId(), "SET[onlyChangedContent]", $this->MOD_SETTINGS["onlyChangedContent"], '', '&srcPID=' . rawurlencode(GeneralUtility::_GET('srcPID'))) . ' ' . $GLOBALS['LANG']->getLL('export.xml.new.title') . BackendUtility::getFuncCheck($l10ncfgObj->getId(), "SET[noHidden]", $this->MOD_SETTINGS["noHidden"], '', '&srcPID=' . rawurlencode(GeneralUtility::_GET('srcPID'))) . ' ' . $GLOBALS['LANG']->getLL('export.xml.noHidden.title') . '</br>');
                // Render content:
                if (!count($this->MOD_MENU['lang'])) {
                    $this->content .= $this->doc->section('ERROR', $GLOBALS['LANG']->getLL('general.access.error.title'));
                } else {
                    $this->moduleContent($l10ncfgObj);
                }
            }
        }
        $this->content .= $this->doc->spacer(10);
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $docHeaderButtons = $this->getButtons();
        $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('general.title'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
예제 #16
0
 /**
  * Make selector table
  *
  * @param array $modSettings
  * @param string $enableList
  * @return string
  */
 public function makeSelectorTable($modSettings, $enableList = 'table,fields,query,group,order,limit')
 {
     $out = array();
     $enableArr = explode(',', $enableList);
     $backendUserAuthentication = $this->getBackendUserAuthentication();
     // Make output
     if (in_array('table', $enableArr) && !$backendUserAuthentication->userTS['mod.']['dbint.']['disableSelectATable']) {
         $out[] = '<div class="form-group">';
         $out[] = '	<label for="SET[queryTable]">Select a table:</label>';
         $out[] = $this->mkTableSelect('SET[queryTable]', $this->table);
         $out[] = '</div>';
     }
     if ($this->table) {
         // Init fields:
         $this->setAndCleanUpExternalLists('queryFields', $modSettings['queryFields'], 'uid,' . $this->getLabelCol());
         $this->setAndCleanUpExternalLists('queryGroup', $modSettings['queryGroup']);
         $this->setAndCleanUpExternalLists('queryOrder', $modSettings['queryOrder'] . ',' . $modSettings['queryOrder2']);
         // Limit:
         $this->extFieldLists['queryLimit'] = $modSettings['queryLimit'];
         if (!$this->extFieldLists['queryLimit']) {
             $this->extFieldLists['queryLimit'] = 100;
         }
         $parts = GeneralUtility::intExplode(',', $this->extFieldLists['queryLimit']);
         if ($parts[1]) {
             $this->limitBegin = $parts[0];
             $this->limitLength = $parts[1];
         } else {
             $this->limitLength = $this->extFieldLists['queryLimit'];
         }
         $this->extFieldLists['queryLimit'] = implode(',', array_slice($parts, 0, 2));
         // Insert Descending parts
         if ($this->extFieldLists['queryOrder']) {
             $descParts = explode(',', $modSettings['queryOrderDesc'] . ',' . $modSettings['queryOrder2Desc']);
             $orderParts = explode(',', $this->extFieldLists['queryOrder']);
             $reList = array();
             foreach ($orderParts as $kk => $vv) {
                 $reList[] = $vv . ($descParts[$kk] ? ' DESC' : '');
             }
             $this->extFieldLists['queryOrder_SQL'] = implode(',', $reList);
         }
         // Query Generator:
         $this->procesData($modSettings['queryConfig'] ? unserialize($modSettings['queryConfig']) : '');
         $this->queryConfig = $this->cleanUpQueryConfig($this->queryConfig);
         $this->enableQueryParts = (bool) $modSettings['search_query_smallparts'];
         $codeArr = $this->getFormElements();
         $queryCode = $this->printCodeArray($codeArr);
         if (in_array('fields', $enableArr) && !$backendUserAuthentication->userTS['mod.']['dbint.']['disableSelectFields']) {
             $out[] = '<div class="form-group form-group-with-button-addon">';
             $out[] = '	<label for="SET[queryFields]">Select fields:</label>';
             $out[] = $this->mkFieldToInputSelect('SET[queryFields]', $this->extFieldLists['queryFields']);
             $out[] = '</div>';
         }
         if (in_array('query', $enableArr) && !$backendUserAuthentication->userTS['mod.']['dbint.']['disableMakeQuery']) {
             $out[] = '<div class="form-group">';
             $out[] = '	<label>Make Query:</label>';
             $out[] = $queryCode;
             $out[] = '</div>';
         }
         if (in_array('group', $enableArr) && !$backendUserAuthentication->userTS['mod.']['dbint.']['disableGroupBy']) {
             $out[] = '<div class="form-group form-inline">';
             $out[] = '	<label for="SET[queryGroup]">Group By:</label>';
             $out[] = $this->mkTypeSelect('SET[queryGroup]', $this->extFieldLists['queryGroup'], '');
             $out[] = '</div>';
         }
         if (in_array('order', $enableArr) && !$backendUserAuthentication->userTS['mod.']['dbint.']['disableOrderBy']) {
             $module = $this->getModule();
             $orderByArr = explode(',', $this->extFieldLists['queryOrder']);
             $orderBy = array();
             $orderBy[] = $this->mkTypeSelect('SET[queryOrder]', $orderByArr[0], '');
             $orderBy[] = '<div class="checkbox">';
             $orderBy[] = '	<label for="checkQueryOrderDesc">';
             $orderBy[] = BackendUtility::getFuncCheck($module->id, 'SET[queryOrderDesc]', $modSettings['queryOrderDesc'], '', '', 'id="checkQueryOrderDesc"') . ' Descending';
             $orderBy[] = '	</label>';
             $orderBy[] = '</div>';
             if ($orderByArr[0]) {
                 $orderBy[] = $this->mkTypeSelect('SET[queryOrder2]', $orderByArr[1], '');
                 $orderBy[] = '<div class="checkbox">';
                 $orderBy[] = '	<label for="checkQueryOrder2Desc">';
                 $orderBy[] = BackendUtility::getFuncCheck($module->id, 'SET[queryOrder2Desc]', $modSettings['queryOrder2Desc'], '', '', 'id="checkQueryOrder2Desc"') . ' Descending';
                 $orderBy[] = '	</label>';
                 $orderBy[] = '</div>';
             }
             $out[] = '<div class="form-group form-inline">';
             $out[] = '	<label>Order By:</label>';
             $out[] = implode(LF, $orderBy);
             $out[] = '</div>';
         }
         if (in_array('limit', $enableArr) && !$backendUserAuthentication->userTS['mod.']['dbint.']['disableLimit']) {
             $limit = array();
             $limit[] = '<div class="input-group">';
             $limit[] = '	<div class="input-group-addon">';
             $limit[] = '		<span class="input-group-btn">';
             $limit[] = $this->updateIcon();
             $limit[] = '		</span>';
             $limit[] = '	</div>';
             $limit[] = '	<input type="text" class="form-control" value="' . htmlspecialchars($this->extFieldLists['queryLimit']) . '" name="SET[queryLimit]" id="queryLimit">';
             $limit[] = '</div>';
             $prevLimit = $this->limitBegin - $this->limitLength < 0 ? 0 : $this->limitBegin - $this->limitLength;
             $prevButton = '';
             $nextButton = '';
             if ($this->limitBegin) {
                 $prevButton = '<input type="button" class="btn btn-default" value="previous ' . htmlspecialchars($this->limitLength) . '" data-value="' . htmlspecialchars($prevLimit . ',' . $this->limitLength) . '">';
             }
             if (!$this->limitLength) {
                 $this->limitLength = 100;
             }
             $nextLimit = $this->limitBegin + $this->limitLength;
             if ($nextLimit < 0) {
                 $nextLimit = 0;
             }
             if ($nextLimit) {
                 $nextButton = '<input type="button" class="btn btn-default" value="next ' . htmlspecialchars($this->limitLength) . '" data-value="' . htmlspecialchars($nextLimit . ',' . $this->limitLength) . '">';
             }
             $out[] = '<div class="form-group form-group-with-button-addon">';
             $out[] = '	<label>Limit:</label>';
             $out[] = '	<div class="form-inline">';
             $out[] = implode(LF, $limit);
             $out[] = '		<div class="input-group">';
             $out[] = '			<div class="btn-group t3js-limit-submit">';
             $out[] = $prevButton;
             $out[] = $nextButton;
             $out[] = '			</div>';
             $out[] = '			<div class="btn-group t3js-limit-submit">';
             $out[] = '				<input type="button" class="btn btn-default" data-value="10" value="10">';
             $out[] = '				<input type="button" class="btn btn-default" data-value="20" value="20">';
             $out[] = '				<input type="button" class="btn btn-default" data-value="50" value="50">';
             $out[] = '				<input type="button" class="btn btn-default" data-value="100" value="100">';
             $out[] = '			</div>';
             $out[] = '		</div>';
             $out[] = '	</div>';
             $out[] = '</div>';
         }
     }
     $out[] = $this->JSbottom($this->formName);
     return implode(LF, $out);
 }
예제 #17
0
 /**
  * Main
  *
  * @return string
  */
 public function main()
 {
     $lang = $this->getLanguageService();
     $POST = GeneralUtility::_POST();
     // Checking for more than one template an if, set a menu...
     $manyTemplatesMenu = $this->pObj->templateMenu();
     $template_uid = 0;
     if ($manyTemplatesMenu) {
         $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
     }
     $bType = $this->pObj->MOD_SETTINGS['ts_browser_type'];
     $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
     // initialize
     $assigns = [];
     $assigns['LLPrefix'] = 'LLL:' . $this->localLanguageFilePath . ':';
     $assigns['existTemplate'] = $existTemplate;
     $assigns['tsBrowserType'] = $this->pObj->MOD_SETTINGS['ts_browser_type'];
     if ($existTemplate) {
         $assigns['templateRecord'] = $this->templateRow;
         $assigns['linkWrapTemplateTitle'] = $this->pObj->linkWrapTemplateTitle($this->templateRow['title'], $bType == 'setup' ? 'config' : 'constants');
         $assigns['manyTemplatesMenu'] = $manyTemplatesMenu;
         if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) {
             // add property
             $line = '';
             if (is_array($POST['data'])) {
                 $name = key($POST['data']);
                 if ($POST['data'][$name]['name'] !== '') {
                     // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
                     unset($POST['update_value']);
                     $POST['add_property'] = 'Add';
                 }
                 if ($POST['add_property']) {
                     $property = trim($POST['data'][$name]['name']);
                     if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
                         $badPropertyMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noSpaces') . $lang->getLL('nothingUpdated'), $lang->getLL('badProperty'), FlashMessage::ERROR);
                         $this->addFlashMessage($badPropertyMessage);
                     } else {
                         $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
                         $propertyAddedMessage = GeneralUtility::makeInstance(FlashMessage::class, $pline, $lang->getLL('propertyAdded'));
                         $this->addFlashMessage($propertyAddedMessage);
                         $line .= LF . $pline;
                     }
                 } elseif ($POST['update_value']) {
                     $pline = $name . ' = ' . trim($POST['data'][$name]['value']);
                     $updatedMessage = GeneralUtility::makeInstance(FlashMessage::class, $pline, $lang->getLL('valueUpdated'));
                     $this->addFlashMessage($updatedMessage);
                     $line .= LF . $pline;
                 } elseif ($POST['clear_object']) {
                     if ($POST['data'][$name]['clearValue']) {
                         $pline = $name . ' >';
                         $objectClearedMessage = GeneralUtility::makeInstance(FlashMessage::class, $pline, $lang->getLL('objectCleared'));
                         $this->addFlashMessage($objectClearedMessage);
                         $line .= LF . $pline;
                     }
                 }
             }
             if ($line) {
                 $saveId = $this->templateRow['_ORIG_uid'] ?: $this->templateRow['uid'];
                 // Set the data to be saved
                 $recData = [];
                 $field = $bType == 'setup' ? 'config' : 'constants';
                 $recData['sys_template'][$saveId][$field] = $this->templateRow[$field] . $line;
                 // Create new  tce-object
                 $tce = GeneralUtility::makeInstance(DataHandler::class);
                 // Initialize
                 $tce->start($recData, []);
                 // Saved the stuff
                 $tce->process_datamap();
                 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                 $tce->clear_cacheCmd('all');
                 // re-read the template ...
                 $this->initialize_editor($this->pObj->id, $template_uid);
             }
         }
     }
     $tsbr = GeneralUtility::_GET('tsbr');
     $update = 0;
     if (is_array($tsbr)) {
         // If any plus-signs were clicked, it's registred.
         $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $this->templateService->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]);
         $update = 1;
     }
     if ($POST['Submit']) {
         // If any POST-vars are send, update the condition array
         $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions'];
         $update = 1;
     }
     if ($update) {
         $this->getBackendUserAuthentication()->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
     }
     $this->templateService->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
     $this->templateService->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
     // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
     $this->templateService->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const'];
     if ($this->pObj->sObj && $this->templateService->constantMode) {
         $this->templateService->constantMode = 'untouched';
     }
     $this->templateService->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'];
     $this->templateService->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
     $this->templateService->linkObjects = true;
     $this->templateService->ext_regLinenumbers = true;
     $this->templateService->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
     $this->templateService->bType = $bType;
     if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') {
         $this->templateService->ext_constants_BRP = (int) GeneralUtility::_GP('breakPointLN');
     } else {
         $this->templateService->ext_config_BRP = (int) GeneralUtility::_GP('breakPointLN');
     }
     $this->templateService->generateConfig();
     if ($bType == 'setup') {
         $theSetup = $this->templateService->setup;
     } else {
         $theSetup = $this->templateService->setup_constants;
     }
     // EDIT A VALUE:
     $assigns['typoScriptPath'] = $this->pObj->sObj;
     if ($this->pObj->sObj) {
         list($theSetup, $theSetupValue) = $this->templateService->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : '');
         $assigns['theSetupValue'] = $theSetupValue;
         if ($existTemplate === false) {
             $noTemplateMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noCurrentTemplate'), $lang->getLL('edit'), FlashMessage::ERROR);
             $this->addFlashMessage($noTemplateMessage);
         }
         // Links:
         $urlParameters = ['id' => $this->pObj->id];
         $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         $assigns['moduleUrl'] = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         $assigns['isNotInTopLevelKeyList'] = !isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]);
         $assigns['hasProperties'] = !empty($theSetup);
         if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) {
             if (!empty($theSetup)) {
                 $assigns['moduleUrlObjectListAction'] = $aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj);
             }
         } else {
             $assigns['moduleUrlObjectListAction'] = $aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0';
         }
     } else {
         $this->templateService->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType];
         if (GeneralUtility::_POST('search') && GeneralUtility::_POST('search_field')) {
             // If any POST-vars are send, update the condition array
             $searchString = GeneralUtility::_POST('search_field');
             try {
                 $this->templateService->tsbrowser_depthKeys = $this->templateService->ext_getSearchKeys($theSetup, '', $searchString, []);
             } catch (Exception $e) {
                 $this->addFlashMessage(GeneralUtility::makeInstance(FlashMessage::class, sprintf($lang->getLL('error.' . $e->getCode()), $searchString), '', FlashMessage::ERROR));
             }
         }
         $assigns['hasTsBrowserTypes'] = is_array($this->pObj->MOD_MENU['ts_browser_type']) && count($this->pObj->MOD_MENU['ts_browser_type']) > 1;
         if (is_array($this->pObj->MOD_MENU['ts_browser_type']) && count($this->pObj->MOD_MENU['ts_browser_type']) > 1) {
             $assigns['browserTypeDropdownMenu'] = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
         }
         $assigns['hasTopLevelInObjectList'] = is_array($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) && count($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) > 1;
         if (is_array($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) && count($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) > 1) {
             $assigns['objectListDropdownMenu'] = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]);
         }
         $assigns['regexSearchCheckbox'] = BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
         $assigns['postSearchField'] = $POST['search_field'];
         $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType];
         if (!$theKey || !str_replace('-', '', $theKey)) {
             $theKey = '';
         }
         list($theSetup, $theSetupValue) = $this->templateService->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
         $tree = $this->templateService->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
         $tree = $this->templateService->substituteCMarkers($tree);
         $urlParameters = ['id' => $this->pObj->id];
         $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         // Parser Errors:
         $pEkey = $bType == 'setup' ? 'config' : 'constants';
         $assigns['hasParseErrors'] = !empty($this->templateService->parserErrors[$pEkey]);
         if (!empty($this->templateService->parserErrors[$pEkey])) {
             $assigns['showErrorDetailsUri'] = $aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-';
             $assigns['parseErrors'] = $this->templateService->parserErrors[$pEkey];
         }
         if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
             $assigns['moduleUrlRemoveFromObjectList'] = $aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0';
         }
         $assigns['hasKeySelected'] = $theKey !== '';
         if ($theKey) {
             $assigns['treeLabel'] = $theKey;
         } else {
             $assigns['rootLLKey'] = $bType === 'setup' ? 'setupRoot' : 'constantRoot';
         }
         $assigns['tsTree'] = $tree;
         // second row options
         $assigns['isSetupAndCropLinesDisabled'] = $bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
         $assigns['checkBoxShowComments'] = BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
         $assigns['checkBoxAlphaSort'] = BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
         $assigns['checkBoxCropLines'] = BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"');
         if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
             $assigns['dropdownDisplayConstants'] = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
         }
         // Conditions:
         $assigns['hasConditions'] = is_array($this->templateService->sections) && !empty($this->templateService->sections);
         if (is_array($this->templateService->sections) && !empty($this->templateService->sections)) {
             $tsConditions = [];
             foreach ($this->templateService->sections as $key => $val) {
                 $tsConditions[] = ['key' => $key, 'value' => $val, 'label' => $this->templateService->substituteCMarkers(htmlspecialchars($val)), 'isSet' => $this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? true : false];
             }
             $assigns['tsConditions'] = $tsConditions;
         }
         // Ending section displayoptions
     }
     $view = GeneralUtility::makeInstance(StandaloneView::class);
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/TemplateObjectBrowserModuleFunction.html'));
     $view->assignMultiple($assigns);
     return $view->render();
 }
 /**
  * @test
  */
 public function getFuncCheckReturnsInputTagWithValueAttribute()
 {
     $this->assertStringMatchesFormat('<input %Svalue="1"%S/>', BackendUtility::getFuncCheck('params', 'test', true));
 }
 /**
  * The main processing method if this class
  *
  * @return string Information of the template status or the taken actions as HTML string
  */
 public function main()
 {
     $lang = $this->getLanguageService();
     $lang->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_info.xlf');
     $this->pObj->MOD_MENU['includeTypoScriptFileContent'] = true;
     $e = $this->pObj->e;
     // Checking for more than one template an if, set a menu...
     $manyTemplatesMenu = $this->pObj->templateMenu();
     $template_uid = 0;
     if ($manyTemplatesMenu) {
         $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
     }
     // Initialize
     $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
     $tplRow = $GLOBALS['tplRow'];
     $saveId = 0;
     if ($existTemplate) {
         $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
     }
     // Create extension template
     $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
     if ($newId) {
         // Switch to new template
         $urlParameters = ['id' => $this->pObj->id, 'SET[templatesOnPage]' => $newId];
         $url = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         HttpUtility::redirect($url);
     }
     $tce = null;
     $theOutput = '';
     if ($existTemplate) {
         // Update template ?
         $POST = GeneralUtility::_POST();
         if (isset($POST['_savedok']) || isset($POST['_saveandclosedok'])) {
             // Set the data to be saved
             $recData = array();
             $alternativeFileName = array();
             if (is_array($POST['data'])) {
                 foreach ($POST['data'] as $field => $val) {
                     switch ($field) {
                         case 'constants':
                         case 'config':
                             $recData['sys_template'][$saveId][$field] = $val;
                             break;
                     }
                 }
             }
             if (!empty($recData)) {
                 $recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]);
                 // Create new  tce-object
                 $tce = GeneralUtility::makeInstance(DataHandler::class);
                 $tce->alternativeFileName = $alternativeFileName;
                 // Initialize
                 $tce->start($recData, array());
                 // Saved the stuff
                 $tce->process_datamap();
                 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                 $tce->clear_cacheCmd('all');
                 // tce were processed successfully
                 $this->tce_processed = true;
                 // re-read the template ...
                 $this->initialize_editor($this->pObj->id, $template_uid);
                 $tplRow = $GLOBALS['tplRow'];
                 // reload template menu
                 $manyTemplatesMenu = $this->pObj->templateMenu();
             }
         }
         // Hook post updating template/TCE processing
         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) {
             $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'];
             if (is_array($postTCEProcessingHook)) {
                 $hookParameters = array('POST' => $POST, 'tce' => $tce);
                 foreach ($postTCEProcessingHook as $hookFunction) {
                     GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                 }
             }
         }
         $content = '<a href="#" class="t3-js-clickmenutrigger" data-table="sys_template" data-uid="' . $tplRow['uid'] . '" data-listframe="1">' . $this->iconFactory->getIconForRecord('sys_template', $tplRow, Icon::SIZE_SMALL)->render() . '</a><strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . (trim($tplRow['sitetitle']) ? htmlspecialchars(' (' . $tplRow['sitetitle'] . ')') : '');
         $theOutput .= '<h2>' . $lang->getLL('templateInformation', true) . '</h2><div>' . $content . '</div>';
         if ($manyTemplatesMenu) {
             $theOutput .= '<div>' . $manyTemplatesMenu . '</div>';
         }
         $theOutput .= '<div style="padding-top: 10px;"></div>';
         $numberOfRows = 35;
         // If abort pressed, nothing should be edited:
         if (isset($POST['_saveandclosedok'])) {
             unset($e);
         }
         if (isset($e['constants'])) {
             $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="text-monospace enable-tab" style="width:98%;height:70%" class="text-monospace">' . htmlspecialchars($tplRow['constants']) . '</textarea>';
             $outCode .= '<input type="hidden" name="e[constants]" value="1">';
             // Display "Include TypoScript file content?" checkbox
             $outCode .= '<div class="checkbox"><label for="checkIncludeTypoScriptFileContent">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[constants]=1', 'id="checkIncludeTypoScriptFileContent"');
             $outCode .= $lang->getLL('includeTypoScriptFileContent') . '</label></div><br />';
             $theOutput .= '<div style="padding-top: 15px;"></div>';
             $theOutput .= '<h3>' . $lang->getLL('constants', true) . '</h3>';
             $theOutput .= $outCode;
         }
         if (isset($e['config'])) {
             $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="text-monospace enable-tab" style="width:98%;height:70%" class="text-monospace">' . htmlspecialchars($tplRow['config']) . '</textarea>';
             $outCode .= '<input type="hidden" name="e[config]" value="1">';
             // Display "Include TypoScript file content?" checkbox
             $outCode .= '<div class="checkbox"><label for="checkIncludeTypoScriptFileContent">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[config]=1', 'id="checkIncludeTypoScriptFileContent"');
             $outCode .= $lang->getLL('includeTypoScriptFileContent') . '</label></div><br />';
             $theOutput .= '<div style="padding-top: 15px;"></div>';
             $theOutput .= '<h3>' . $lang->getLL('setup', true) . '</h3>';
             $theOutput .= $outCode;
         }
         // Processing:
         $outCode = '';
         $outCode .= $this->tableRow($lang->getLL('title'), htmlspecialchars($tplRow['title']), 'title', $tplRow['uid']);
         $outCode .= $this->tableRow($lang->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle', $tplRow['uid']);
         $outCode .= $this->tableRow($lang->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description', $tplRow['uid']);
         $outCode .= $this->tableRow($lang->getLL('constants'), sprintf($lang->getLL('editToView'), trim($tplRow['constants']) ? count(explode(LF, $tplRow['constants'])) : 0), 'constants', $tplRow['uid']);
         $outCode .= $this->tableRow($lang->getLL('setup'), sprintf($lang->getLL('editToView'), trim($tplRow['config']) ? count(explode(LF, $tplRow['config'])) : 0), 'config', $tplRow['uid']);
         $outCode = '<div class="table-fit"><table class="table table-striped table-hover">' . $outCode . '</table></div>';
         // Edit all icon:
         $urlParameters = ['edit' => ['sys_template' => [$tplRow['uid'] => 'edit']], 'createExtension' => 0, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
         $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
         $title = $lang->getLL('editTemplateRecord', true);
         $icon = $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render();
         $outCode .= '<br /><a class="btn btn-default" href="' . htmlspecialchars($url) . '"><strong>' . $icon . '&nbsp;' . $title . '</strong></a>';
         $theOutput .= '<div>' . $outCode . '</div>';
         // hook	after compiling the output
         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) {
             $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
             if (is_array($postOutputProcessingHook)) {
                 $hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows);
                 foreach ($postOutputProcessingHook as $hookFunction) {
                     GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                 }
             }
         }
     } else {
         $theOutput .= $this->pObj->noTemplate(1);
     }
     return $theOutput;
 }
예제 #20
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param int $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  */
 public function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $lang = $this->getLanguageService();
     $labelToggleSelection = $lang->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', TRUE);
     $labelImportSelection = $lang->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', TRUE);
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $this->getBackendUserAuthentication()->getTSConfigVal('options.noThumbsInEB');
     $out = $this->doc->spacer(10) . '<div>' . '<a href="#" onclick="BrowseLinks.Selector.handle()">' . IconUtility::getSpriteIcon('actions-document-import-t3d', array('title' => $labelImportSelection)) . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" onclick="BrowseLinks.Selector.toggle()">' . IconUtility::getSpriteIcon('actions-document-select', array('title' => $labelToggleSelection)) . $labelToggleSelection . '</a>' . '</div>';
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
         $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], GeneralUtility::_GP('M') ? '' : $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
         $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
     } else {
         $out .= $this->doc->spacer(15);
     }
     return $out;
 }
예제 #21
0
 /**
  * @return void
  */
 public function indexAction()
 {
     $pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
     $pageRenderer->setTitle($this->getLanguageService()->getLL('files'));
     // There there was access to this file path, continue, make the list
     if ($this->folderObject) {
         // Create fileListing object
         $this->filelist = GeneralUtility::makeInstance(FileList::class, $this);
         $this->filelist->thumbs = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs'];
         // Create clipboard object and initialize that
         $this->filelist->clipObj = GeneralUtility::makeInstance(Clipboard::class);
         $this->filelist->clipObj->fileMode = 1;
         $this->filelist->clipObj->initializeClipboard();
         $CB = GeneralUtility::_GET('CB');
         if ($this->cmd == 'setCB') {
             $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), '_FILE');
         }
         if (!$this->MOD_SETTINGS['clipBoard']) {
             $CB['setP'] = 'normal';
         }
         $this->filelist->clipObj->setCmd($CB);
         $this->filelist->clipObj->cleanCurrent();
         // Saves
         $this->filelist->clipObj->endClipboard();
         // If the "cmd" was to delete files from the list (clipboard thing), do that:
         if ($this->cmd == 'delete') {
             $items = $this->filelist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), '_FILE', 1);
             if (!empty($items)) {
                 // Make command array:
                 $FILE = [];
                 foreach ($items as $v) {
                     $FILE['delete'][] = ['data' => $v];
                 }
                 // Init file processing object for deleting and pass the cmd array.
                 /** @var ExtendedFileUtility $fileProcessor */
                 $fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
                 $fileProcessor->setActionPermissions();
                 $fileProcessor->setExistingFilesConflictMode($this->overwriteExistingFiles);
                 $fileProcessor->start($FILE);
                 $fileProcessor->processData();
             }
         }
         // Start up filelisting object, include settings.
         $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
         $this->filelist->start($this->folderObject, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']);
         // Generate the list
         $this->filelist->generateList();
         // Set top JavaScript:
         $this->view->getModuleTemplate()->addJavaScriptCode('FileListIndex', 'if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";' . $this->filelist->CBfunctions() . '
             function jumpToUrl(URL) {
                 window.location.href = URL;
                 return false;
             }
             ');
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete');
         $pageRenderer->addInlineLanguageLabelFile('EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons');
         // Include DragUploader only if we have write access
         if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) {
             $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
             $pageRenderer->addInlineLanguageLabelFile('EXT:lang/Resources/Private/Language/locallang_core.xlf', 'file_upload');
             $pageRenderer->addInlineLanguageLabelArray(['permissions.read' => $this->getLanguageService()->getLL('read'), 'permissions.write' => $this->getLanguageService()->getLL('write')]);
         }
         // Setting up the buttons
         $this->registerButtons();
         $pageRecord = ['_additional_info' => $this->filelist->getFolderInfo(), 'combined_identifier' => $this->folderObject->getCombinedIdentifier()];
         $this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
         $this->view->assign('headline', $this->getModuleHeadline());
         $this->view->assign('listHtml', $this->filelist->HTMLcode);
         $this->view->assign('checkboxes', ['bigControlPanel' => ['enabled' => $this->getBackendUser()->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable', 'label' => htmlspecialchars($this->getLanguageService()->getLL('bigControlPanel')), 'html' => BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', '', 'id="bigControlPanel"')], 'displayThumbs' => ['enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->getBackendUser()->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable', 'label' => htmlspecialchars($this->getLanguageService()->getLL('displayThumbs')), 'html' => BackendUtility::getFuncCheck($this->id, 'SET[displayThumbs]', $this->MOD_SETTINGS['displayThumbs'], '', '', 'id="checkDisplayThumbs"')], 'enableClipBoard' => ['enabled' => $this->getBackendUser()->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable', 'label' => htmlspecialchars($this->getLanguageService()->getLL('clipBoard')), 'html' => BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', '', 'id="checkClipBoard"')]]);
         $this->view->assign('showClipBoard', (bool) $this->MOD_SETTINGS['clipBoard']);
         $this->view->assign('clipBoardHtml', $this->filelist->clipObj->printClipboard());
         $this->view->assign('folderIdentifier', $this->folderObject->getCombinedIdentifier());
         $this->view->assign('fileDenyPattern', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern']);
         $this->view->assign('maxFileSize', GeneralUtility::getMaxUploadFileSize() * 1024);
     } else {
         $this->forward('missingFolder');
     }
 }
예제 #22
0
    /**
     * [Describe function...]
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        $arrayBrowser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lowlevel\\Utility\\ArrayBrowser');
        $this->content = $this->doc->header($GLOBALS['LANG']->getLL('configuration', TRUE));
        $this->content .= '<div id="lowlevel-config">
						<label for="search_field">' . $GLOBALS['LANG']->getLL('enterSearchPhrase', TRUE) . '</label>
						<input type="text" id="search_field" name="search_field" value="' . htmlspecialchars($search_field) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />
						<input type="submit" name="search" id="search" value="' . $GLOBALS['LANG']->getLL('search', TRUE) . '" />';
        $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"') . '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', TRUE) . '</label>';
        $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck(0, 'SET[fixedLgd]', $this->MOD_SETTINGS['fixedLgd'], '', '', 'id="checkFixedLgd"') . '<label for="checkFixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', TRUE) . '</label>
						</div>';
        $this->content .= $this->doc->spacer(5);
        switch ($this->MOD_SETTINGS['function']) {
            case 0:
                $theVar = $GLOBALS['TYPO3_CONF_VARS'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_CONF_VARS';
                break;
            case 1:
                foreach ($GLOBALS['TCA'] as $table => $config) {
                    \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
                }
                $theVar = $GLOBALS['TCA'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TCA';
                break;
            case 2:
                $theVar = $GLOBALS['TCA_DESCR'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TCA_DESCR';
                break;
            case 3:
                $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
                break;
            case 4:
                $theVar = $GLOBALS['T3_SERVICES'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$T3_SERVICES';
                break;
            case 5:
                $theVar = $GLOBALS['TBE_MODULES'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_MODULES';
                break;
            case 6:
                $theVar = $GLOBALS['TBE_MODULES_EXT'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_MODULES_EXT';
                break;
            case 7:
                $theVar = $GLOBALS['TBE_STYLES'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_STYLES';
                break;
            case 8:
                $theVar = $GLOBALS['BE_USER']->uc;
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$BE_USER->uc';
                break;
            case 9:
                $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
                \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
                break;
            default:
                $theVar = array();
                break;
        }
        // Update node:
        $update = 0;
        $node = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('node');
        // If any plus-signs were clicked, it's registred.
        if (is_array($node)) {
            $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
            $update = 1;
        }
        if ($update) {
            $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $this->MOD_SETTINGS);
        }
        $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
        $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
        $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
        $arrayBrowser->searchKeysToo = TRUE;
        $search_field = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('search_field');
        // If any POST-vars are send, update the condition array
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('search') && trim($search_field)) {
            $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
        }
        // mask the encryption key to not show it as plaintext in the configuration module
        if ($theVar == $GLOBALS['TYPO3_CONF_VARS']) {
            $theVar['SYS']['encryptionKey'] = '***** (length: ' . strlen($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . ' characters)';
        }
        $tree = $arrayBrowser->tree($theVar, '', '');
        $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
        $this->content .= $this->doc->sectionEnd();
        // Variable name:
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('varname')) {
            $line = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_') : \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('varname');
            // Write the line to extTables.php
            if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('writetoexttables')) {
                // change value to $GLOBALS
                $length = strpos($line, '[');
                $var = substr($line, 0, $length);
                $changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length);
                // load current extTables.php
                $extTables = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(PATH_typo3conf . TYPO3_extTableDef_script);
                if ($var === '$TCA') {
                    // check if we are editing the TCA
                    preg_match_all('/\\[\'([^\']+)\'\\]/', $line, $parts);
                    if ($parts[1][1] !== 'ctrl') {
                        // anything else than ctrl section requires to load TCA
                        $loadTCA = 'TYPO3\\CMS\\Core\\Utility\\GeneralUtility::loadTCA(\'' . $parts[1][0] . '\');';
                        if (strpos($extTables, $loadTCA) === FALSE) {
                            // check if the loadTCA statement is not already present in the file
                            $changedLine = $loadTCA . LF . $changedLine;
                        }
                    }
                }
                // insert line in extTables.php
                $extTables = preg_replace('/<\\?php|\\?>/is', '', $extTables);
                $extTables = '<?php' . (empty($extTables) ? LF : '') . $extTables . $changedLine . LF . '?>';
                $success = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
                if ($success) {
                    // show flash message
                    $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . nl2br($changedLine) . '</strong>'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
                } else {
                    // Error: show flash message
                    $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessageFailed', TRUE), TYPO3_extTableDef_script), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                }
                $this->content .= $flashMessage->render();
            }
            $this->content .= '<div id="lowlevel-config-var">
				<strong>' . $GLOBALS['LANG']->getLL('variable', TRUE) . '</strong><br />
				<input type="text" name="_" value="' . trim(htmlspecialchars($line)) . '" size="120" /><br/>';
            if (TYPO3_extTableDef_script !== '' && ($this->MOD_SETTINGS['function'] === '1' || $this->MOD_SETTINGS['function'] === '4')) {
                // write only for $TCA and TBE_STYLES if  TYPO3_extTableDef_script is defined
                $this->content .= '<br /><input type="submit" name="writetoexttables" value="' . $GLOBALS['LANG']->getLL('writeValue', TRUE) . '" /></div>';
            } else {
                $this->content .= $GLOBALS['LANG']->getLL('copyPaste', TRUE) . LF . '</div>';
            }
        }
        $this->content .= '<br /><table border="0" cellpadding="0" cellspacing="0" class="t3-tree t3-tree-config">';
        $this->content .= '<tr>
					<th class="t3-row-header t3-tree-config-header">' . $label . '</th>
				</tr>
				<tr>
					<td>' . $tree . '</td>
				</tr>
			</table>
		';
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->content);
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render('Configuration', $this->content);
    }
예제 #23
0
    /**
     * Main function, starting the rendering of the list.
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        // Start document template object:
        $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('EXT:recordlist/Resources/Private/Templates/db_list.html');
        // Loading current page record and checking access:
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        // Apply predefined values for hidden checkboxes
        // Set predefined value for DisplayBigControlPanel:
        if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') {
            $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
        } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') {
            $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
        }
        // Set predefined value for Clipboard:
        if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') {
            $this->MOD_SETTINGS['clipBoard'] = TRUE;
        } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') {
            $this->MOD_SETTINGS['clipBoard'] = FALSE;
        }
        // Set predefined value for LocalizationView:
        if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') {
            $this->MOD_SETTINGS['localization'] = TRUE;
        } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') {
            $this->MOD_SETTINGS['localization'] = FALSE;
        }
        // Initialize the dblist object:
        /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */
        $dblist = GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\RecordList\\DatabaseRecordList');
        $dblist->backPath = $GLOBALS['BACK_PATH'];
        $dblist->script = BackendUtility::getModuleUrl('web_list', array(), '');
        $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
        $dblist->thumbs = $GLOBALS['BE_USER']->uc['thumbnailsByDefault'];
        $dblist->returnUrl = $this->returnUrl;
        $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0;
        $dblist->localizationView = $this->MOD_SETTINGS['localization'];
        $dblist->showClipboard = 1;
        $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
        $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
        $dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
        $dblist->hideTranslations = $this->modTSconfig['properties']['hideTranslations'];
        $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
        $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0;
        $dblist->allowedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], TRUE);
        $dblist->deniedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], TRUE);
        $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
        $dblist->pageRow = $this->pageinfo;
        $dblist->counter++;
        $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
        $dblist->modTSconfig = $this->modTSconfig;
        $clickTitleMode = trim($this->modTSconfig['properties']['clickTitleMode']);
        $dblist->clickTitleMode = $clickTitleMode === '' ? 'edit' : $clickTitleMode;
        // Clipboard is initialized:
        // Start clipboard
        $dblist->clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
        // Initialize - reads the clipboard content from the user session
        $dblist->clipObj->initializeClipboard();
        // Clipboard actions are handled:
        // CB is the clipboard command array
        $CB = GeneralUtility::_GET('CB');
        if ($this->cmd == 'setCB') {
            // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked.
            // By merging we get a full array of checked/unchecked elements
            // This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
            $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), $this->cmd_table);
        }
        if (!$this->MOD_SETTINGS['clipBoard']) {
            // If the clipboard is NOT shown, set the pad to 'normal'.
            $CB['setP'] = 'normal';
        }
        // Execute commands.
        $dblist->clipObj->setCmd($CB);
        // Clean up pad
        $dblist->clipObj->cleanCurrent();
        // Save the clipboard content
        $dblist->clipObj->endClipboard();
        // This flag will prevent the clipboard panel in being shown.
        // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
        $dblist->dontShowClipControlPanels = !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
        // If there is access to the page or root page is used for searching, then render the list contents and set up the document template object:
        if ($access || $this->id === 0 && $this->search_levels > 0 && strlen($this->search_field) > 0) {
            // Deleting records...:
            // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
            if ($this->cmd == 'delete') {
                $items = $dblist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), $this->cmd_table, 1);
                if (count($items)) {
                    $cmd = array();
                    foreach ($items as $iK => $value) {
                        $iKParts = explode('|', $iK);
                        $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1;
                    }
                    $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                    $tce->stripslashes_values = 0;
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    if (isset($cmd['pages'])) {
                        BackendUtility::setUpdateSignal('updatePageTree');
                    }
                    $tce->printLogErrorMessages(GeneralUtility::getIndpEnv('REQUEST_URI'));
                }
            }
            // Initialize the listing object, dblist, for rendering the list:
            $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
            $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
            $dblist->setDispFields();
            // Render versioning selector:
            if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('version')) {
                $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
            }
            // Render the list of tables:
            $dblist->generateList();
            $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH']));
            // Add JavaScript functions to the page:
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function jumpExt(URL,anchor) {	//
					var anc = anchor?anchor:"";
					window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
					return false;
				}
				function jumpSelf(URL) {	//
					window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
					return false;
				}

				function setHighlight(id) {	//
					top.fsMod.recentIds["web"]=id;
					top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

					if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
						top.content.nav_frame.refresh_nav();
					}
				}
				' . $this->doc->redirectUrls($listUrl) . '
				' . $dblist->CBfunctions() . '
				function editRecords(table,idList,addParams,CBflag) {	//
					window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
				}
				function editList(table,idList) {	//
					var list="";

						// Checking how many is checked, how many is not
					var pointer=0;
					var pos = idList.indexOf(",");
					while (pos!=-1) {
						if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
							list+=idList.substr(pointer,pos-pointer)+",";
						}
						pointer=pos+1;
						pos = idList.indexOf(",",pointer);
					}
					if (cbValue(table+"|"+idList.substr(pointer))) {
						list+=idList.substr(pointer)+",";
					}

					return list ? list : idList;
				}

				if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
        }
        // access
        // Begin to compile the whole page, starting out with page header:
        $this->body = $this->doc->header($this->pageinfo['title']);
        $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
        $this->body .= $dblist->HTMLcode;
        $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
        // If a listing was produced, create the page footer with search form etc:
        if ($dblist->HTMLcode) {
            // Making field select box (when extended view for a single table is enabled):
            if ($dblist->table) {
                $this->body .= $dblist->fieldSelectBox($dblist->table);
            }
            // Adding checkbox options for extended listing and clipboard display:
            $this->body .= '

					<!--
						Listing options for extended view, clipboard and localization view
					-->
					<div id="typo3-listOptions">
						<form action="" method="post">';
            // Add "display bigControlPanel" checkbox:
            if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') {
                $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"');
                $this->body .= '<label for="checkLargeControl">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />';
            }
            // Add "clipboard" checkbox:
            if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') {
                if ($dblist->showClipboard) {
                    $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"');
                    $this->body .= '<label for="checkShowClipBoard">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />';
                }
            }
            // Add "localization view" checkbox:
            if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') {
                $this->body .= BackendUtility::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"');
                $this->body .= '<label for="checkLocalization">' . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />';
            }
            $this->body .= '
						</form>
					</div>';
        }
        // Printing clipboard if enabled
        if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) {
            $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>';
        }
        // Search box:
        if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dblist->HTMLcode || $dblist->searchString !== '')) {
            $sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
            $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>';
        }
        // Additional footer content
        $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook'];
        if (is_array($footerContentHook)) {
            foreach ($footerContentHook as $hook) {
                $params = array();
                $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
            }
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $dblist->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body, 'EXTRACONTAINERCLASS' => $this->table ? 'singletable' : '');
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render('DB list', $this->content);
    }
예제 #24
0
    /**
     * [Describe function...]
     *
     * @param 	[type]		$modSettings: ...
     * @param 	[type]		$enableList: ...
     * @return 	[type]		...
     * @todo Define visibility
     */
    public function makeSelectorTable($modSettings, $enableList = 'table,fields,query,group,order,limit')
    {
        $enableArr = explode(',', $enableList);
        // Make output
        $TDparams = ' class="bgColor5" nowrap';
        if (in_array('table', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectATable']) {
            $out = '
			<tr>
				<td' . $TDparams . '><strong>Select a table:</strong></td>
				<td' . $TDparams . '>' . $this->mkTableSelect('SET[queryTable]', $this->table) . '</td>
			</tr>';
        }
        if ($this->table) {
            // Init fields:
            $this->setAndCleanUpExternalLists('queryFields', $modSettings['queryFields'], 'uid,' . $this->getLabelCol());
            $this->setAndCleanUpExternalLists('queryGroup', $modSettings['queryGroup']);
            $this->setAndCleanUpExternalLists('queryOrder', $modSettings['queryOrder'] . ',' . $modSettings['queryOrder2']);
            // Limit:
            $this->extFieldLists['queryLimit'] = $modSettings['queryLimit'];
            if (!$this->extFieldLists['queryLimit']) {
                $this->extFieldLists['queryLimit'] = 100;
            }
            $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->extFieldLists['queryLimit']);
            if ($parts[1]) {
                $this->limitBegin = $parts[0];
                $this->limitLength = $parts[1];
            } else {
                $this->limitLength = $this->extFieldLists['queryLimit'];
            }
            $this->extFieldLists['queryLimit'] = implode(',', array_slice($parts, 0, 2));
            // Insert Descending parts
            if ($this->extFieldLists['queryOrder']) {
                $descParts = explode(',', $modSettings['queryOrderDesc'] . ',' . $modSettings['queryOrder2Desc']);
                $orderParts = explode(',', $this->extFieldLists['queryOrder']);
                $reList = array();
                foreach ($orderParts as $kk => $vv) {
                    $reList[] = $vv . ($descParts[$kk] ? ' DESC' : '');
                }
                $this->extFieldLists['queryOrder_SQL'] = implode(',', $reList);
            }
            // Query Generator:
            $this->procesData($modSettings['queryConfig'] ? unserialize($modSettings['queryConfig']) : '');
            $this->queryConfig = $this->cleanUpQueryConfig($this->queryConfig);
            $this->enableQueryParts = $modSettings['search_query_smallparts'];
            $codeArr = $this->getFormElements();
            $queryCode = $this->printCodeArray($codeArr);
            if (in_array('fields', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectFields']) {
                $out .= '
				<tr>
					<td' . $TDparams . '><strong>Select fields:</strong></td>
					<td' . $TDparams . '>' . $this->mkFieldToInputSelect('SET[queryFields]', $this->extFieldLists['queryFields']) . '</td>
				</tr>';
            }
            if (in_array('query', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableMakeQuery']) {
                $out .= '<tr>
					<td colspan="2"' . $TDparams . '><strong>Make Query:</strong></td>
				</tr>
				<tr>
					<td colspan="2">' . $queryCode . '</td>
				</tr>
				';
            }
            if (in_array('group', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableGroupBy']) {
                $out .= '<tr>
					<td' . $TDparams . '><strong>Group By:</strong></td>
					<td' . $TDparams . '>' . $this->mkTypeSelect('SET[queryGroup]', $this->extFieldLists['queryGroup'], '') . '</td>
				</tr>';
            }
            if (in_array('order', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableOrderBy']) {
                $orderByArr = explode(',', $this->extFieldLists['queryOrder']);
                $orderBy = '';
                $orderBy .= $this->mkTypeSelect('SET[queryOrder]', $orderByArr[0], '') . '&nbsp;' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrderDesc]', $modSettings['queryOrderDesc'], '', '', 'id="checkQueryOrderDesc"') . '&nbsp;<label for="checkQueryOrderDesc">Descending</label>';
                if ($orderByArr[0]) {
                    $orderBy .= '<BR>' . $this->mkTypeSelect('SET[queryOrder2]', $orderByArr[1], '') . '&nbsp;' . \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrder2Desc]', $modSettings['queryOrder2Desc'], '', '', 'id="checkQueryOrder2Desc"') . '&nbsp;<label for="checkQueryOrder2Desc">Descending</label>';
                }
                $out .= '<tr>
					<td' . $TDparams . '><strong>Order By:</strong></td>
					<td' . $TDparams . '>' . $orderBy . '</td>
				</tr>';
            }
            if (in_array('limit', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableLimit']) {
                $limit = '<input type="Text" value="' . htmlspecialchars($this->extFieldLists['queryLimit']) . '" name="SET[queryLimit]" id="queryLimit"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>' . $this->updateIcon();
                $prevLimit = $this->limitBegin - $this->limitLength < 0 ? 0 : $this->limitBegin - $this->limitLength;
                if ($this->limitBegin) {
                    $prevButton = '<input type="button" value="previous ' . $this->limitLength . '" onclick=\'document.getElementById("queryLimit").value="' . $prevLimit . ',' . $this->limitLength . '";document.forms[0].submit();\'>';
                }
                if (!$this->limitLength) {
                    $this->limitLength = 100;
                }
                $nextLimit = $this->limitBegin + $this->limitLength;
                if ($nextLimit < 0) {
                    $nextLimit = 0;
                }
                if ($nextLimit) {
                    $nextButton = '<input type="button" value="next ' . $this->limitLength . '" onclick=\'document.getElementById("queryLimit").value="' . $nextLimit . ',' . $this->limitLength . '";document.forms[0].submit();\'>';
                }
                $numberButtons = '<input type="button" value="10" onclick=\'document.getElementById("queryLimit").value="10";document.forms[0].submit();\'>';
                $numberButtons .= '<input type="button" value="20" onclick=\'document.getElementById("queryLimit").value="20";document.forms[0].submit();\'>';
                $numberButtons .= '<input type="button" value="50" onclick=\'document.getElementById("queryLimit").value="50";document.forms[0].submit();\'>';
                $numberButtons .= '<input type="button" value="100" onclick=\'document.getElementById("queryLimit").value="100";document.forms[0].submit();\'>';
                $out .= '<tr>
					<td' . $TDparams . '><strong>Limit:</strong></td>
					<td' . $TDparams . '>' . $limit . $prevButton . $nextButton . '&nbsp;' . $numberButtons . '</td>
				</tr>
				';
            }
        }
        $out = '<table border="0" cellpadding="3" cellspacing="1" class="qg-make-query">' . $out . '</table>';
        $out .= $this->JSbottom($this->formName);
        return $out;
    }
 /**
  * Main function of class
  *
  * @return string HTML output
  */
 public function main()
 {
     $pageId = (int) GeneralUtility::_GP('id');
     if ($pageId === 0) {
         $this->view->assign('pageZero', 1);
         $this->view->assign('overviewOfPagesUsingTSConfig', $this->getOverviewOfPagesUsingTSConfig());
     } else {
         if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
             $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true);
             $lines = array();
             $pUids = array();
             foreach ($TSparts as $k => $v) {
                 if ($k != 'uid_0') {
                     $line = array();
                     if ($k == 'defaultPageTSconfig') {
                         $line['defaultPageTSconfig'] = 1;
                     } else {
                         $pUids[] = substr($k, 4);
                         $row = BackendUtility::getRecordWSOL('pages', substr($k, 4));
                         $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL);
                         $editIdList = substr($k, 4);
                         $urlParameters = ['edit' => ['pages' => [$editIdList => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                         $line['editIcon'] = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                         $line['editTitle'] = 'editTSconfig';
                         $line['title'] = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']) . ' ' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $row));
                     }
                     $tsparser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
                     $tsparser->lineNumberOffset = 0;
                     $line['content'] = $tsparser->doSyntaxHighlight(trim($v) . LF);
                     $lines[] = $line;
                 }
             }
             if (!empty($pUids)) {
                 $urlParameters = ['edit' => ['pages' => [implode(',', $pUids) => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                 $editIcon = htmlspecialchars($url);
                 $editTitle = 'editTSconfig_all';
             } else {
                 $editIcon = '';
                 $editTitle = '';
             }
             $this->view->assign('tsconfParts99', 1);
             $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_edit', null, '|'));
             $this->view->assign('lines', $lines);
             $this->view->assign('editIcon', $editIcon);
             $this->view->assign('editTitle', $editTitle);
         } else {
             $this->view->assign('tsconfParts99', 0);
             // Defined global here!
             $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
             // Do not log time-performance information
             $tmpl->tt_track = 0;
             $tmpl->fixedLgd = 0;
             $tmpl->linkObjects = 0;
             $tmpl->bType = '';
             $tmpl->ext_expandAllNotes = 1;
             $tmpl->ext_noPMicons = 1;
             $beUser = $this->getBackendUser();
             switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                 case '1':
                     $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod');
                     break;
                 case '1a':
                     $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1b':
                     $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1c':
                     $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1d':
                     $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1e':
                     $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1f':
                     $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1g':
                     $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '2':
                     $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '5':
                     $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '6':
                     $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '3':
                     $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '4':
                     $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 default:
                     $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id);
             }
             $modTSconfig = $modTSconfig['properties'];
             if (!is_array($modTSconfig)) {
                 $modTSconfig = array();
             }
             $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '|'));
             $this->view->assign('tree', $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']));
         }
         $this->view->assign('alphaSort', BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"'));
         $this->view->assign('dropdownMenu', BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']));
     }
     return $this->view->render();
 }
예제 #26
0
    /**
     * Main function, starting the rendering of the list.
     *
     * @return void
     */
    public function main()
    {
        $backendUser = $this->getBackendUserAuthentication();
        $lang = $this->getLanguageService();
        // Loading current page record and checking access:
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        // Start document template object:
        // We need to keep this due to deeply nested dependencies
        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler');
        $calcPerms = $backendUser->calcPerms($this->pageinfo);
        $userCanEditPage = $calcPerms & Permission::PAGE_EDIT && !empty($this->id) && ($backendUser->isAdmin() || (int) $this->pageinfo['editlock'] === 0);
        if ($userCanEditPage) {
            $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
                PageActions.setPageId(' . (int) $this->id . ');
                PageActions.initializePageTitleRenaming();
            }');
        }
        $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Recordlist/Tooltip');
        // Apply predefined values for hidden checkboxes
        // Set predefined value for DisplayBigControlPanel:
        if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') {
            $this->MOD_SETTINGS['bigControlPanel'] = true;
        } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') {
            $this->MOD_SETTINGS['bigControlPanel'] = false;
        }
        // Set predefined value for Clipboard:
        if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') {
            $this->MOD_SETTINGS['clipBoard'] = true;
        } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') {
            $this->MOD_SETTINGS['clipBoard'] = false;
        } else {
            if ($this->MOD_SETTINGS['clipBoard'] === null) {
                $this->MOD_SETTINGS['clipBoard'] = true;
            }
        }
        // Set predefined value for LocalizationView:
        if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') {
            $this->MOD_SETTINGS['localization'] = true;
        } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') {
            $this->MOD_SETTINGS['localization'] = false;
        }
        // Initialize the dblist object:
        /** @var $dblist RecordList\DatabaseRecordList */
        $dblist = GeneralUtility::makeInstance(RecordList\DatabaseRecordList::class);
        $dblist->script = BackendUtility::getModuleUrl('web_list');
        $dblist->calcPerms = $calcPerms;
        $dblist->thumbs = $backendUser->uc['thumbnailsByDefault'];
        $dblist->returnUrl = $this->returnUrl;
        $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0;
        $dblist->localizationView = $this->MOD_SETTINGS['localization'];
        $dblist->showClipboard = 1;
        $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
        $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
        $dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
        $dblist->hideTranslations = $this->modTSconfig['properties']['hideTranslations'];
        $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
        $dblist->allowedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], true);
        $dblist->deniedNewTables = GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], true);
        $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
        $dblist->pageRow = $this->pageinfo;
        $dblist->counter++;
        $dblist->MOD_MENU = ['bigControlPanel' => '', 'clipBoard' => '', 'localization' => ''];
        $dblist->modTSconfig = $this->modTSconfig;
        $clickTitleMode = trim($this->modTSconfig['properties']['clickTitleMode']);
        $dblist->clickTitleMode = $clickTitleMode === '' ? 'edit' : $clickTitleMode;
        if (isset($this->modTSconfig['properties']['tableDisplayOrder.'])) {
            $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
            $dblist->setTableDisplayOrder($typoScriptService->convertTypoScriptArrayToPlainArray($this->modTSconfig['properties']['tableDisplayOrder.']));
        }
        // Clipboard is initialized:
        // Start clipboard
        $dblist->clipObj = GeneralUtility::makeInstance(Clipboard::class);
        // Initialize - reads the clipboard content from the user session
        $dblist->clipObj->initializeClipboard();
        // Clipboard actions are handled:
        // CB is the clipboard command array
        $CB = GeneralUtility::_GET('CB');
        if ($this->cmd == 'setCB') {
            // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked.
            // By merging we get a full array of checked/unchecked elements
            // This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
            $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), $this->cmd_table);
        }
        if (!$this->MOD_SETTINGS['clipBoard']) {
            // If the clipboard is NOT shown, set the pad to 'normal'.
            $CB['setP'] = 'normal';
        }
        // Execute commands.
        $dblist->clipObj->setCmd($CB);
        // Clean up pad
        $dblist->clipObj->cleanCurrent();
        // Save the clipboard content
        $dblist->clipObj->endClipboard();
        // This flag will prevent the clipboard panel in being shown.
        // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
        $dblist->dontShowClipControlPanels = $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
        // If there is access to the page or root page is used for searching, then render the list contents and set up the document template object:
        if ($access || $this->id === 0 && $this->search_levels !== 0 && $this->search_field !== '') {
            // Deleting records...:
            // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
            if ($this->cmd == 'delete') {
                $items = $dblist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), $this->cmd_table, 1);
                if (!empty($items)) {
                    $cmd = [];
                    foreach ($items as $iK => $value) {
                        $iKParts = explode('|', $iK);
                        $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1;
                    }
                    $tce = GeneralUtility::makeInstance(DataHandler::class);
                    $tce->start([], $cmd);
                    $tce->process_cmdmap();
                    if (isset($cmd['pages'])) {
                        BackendUtility::setUpdateSignal('updatePageTree');
                    }
                    $tce->printLogErrorMessages(GeneralUtility::getIndpEnv('REQUEST_URI'));
                }
            }
            // Initialize the listing object, dblist, for rendering the list:
            $this->pointer = max(0, (int) $this->pointer);
            $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
            $dblist->setDispFields();
            // Render versioning selector:
            if (ExtensionManagementUtility::isLoaded('version')) {
                $dblist->HTMLcode .= $this->moduleTemplate->getVersionSelector($this->id);
            }
            // Render the list of tables:
            $dblist->generateList();
            $listUrl = $dblist->listURL();
            // Add JavaScript functions to the page:
            $this->moduleTemplate->addJavaScriptCode('RecordListInlineJS', '
				function jumpExt(URL,anchor) {	//
					var anc = anchor?anchor:"";
					window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
					return false;
				}
				function jumpSelf(URL) {	//
					window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
					return false;
				}
				function jumpToUrl(URL) {
					window.location.href = URL;
					return false;
				}

				function setHighlight(id) {	//
					top.fsMod.recentIds["web"]=id;
					top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

					if (top.nav_frame && top.nav_frame.refresh_nav) {
						top.nav_frame.refresh_nav();
					}
				}
				' . $this->moduleTemplate->redirectUrls($listUrl) . '
				' . $dblist->CBfunctions() . '
				function editRecords(table,idList,addParams,CBflag) {	//
					window.location.href="' . BackendUtility::getModuleUrl('record_edit', ['returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]) . '&edit["+table+"]["+idList+"]=edit"+addParams;
				}
				function editList(table,idList) {	//
					var list="";

						// Checking how many is checked, how many is not
					var pointer=0;
					var pos = idList.indexOf(",");
					while (pos!=-1) {
						if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
							list+=idList.substr(pointer,pos-pointer)+",";
						}
						pointer=pos+1;
						pos = idList.indexOf(",",pointer);
					}
					if (cbValue(table+"|"+idList.substr(pointer))) {
						list+=idList.substr(pointer)+",";
					}

					return list ? list : idList;
				}

				if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
			');
            // Setting up the context sensitive menu:
            $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
        }
        // access
        // Begin to compile the whole page, starting out with page header:
        if (!$this->id) {
            $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
        } else {
            $title = $this->pageinfo['title'];
        }
        $this->body = $this->moduleTemplate->header($title);
        $this->moduleTemplate->setTitle($title);
        if (!empty($dblist->HTMLcode)) {
            $output = $dblist->HTMLcode;
        } else {
            $output = '';
            $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noRecordsOnThisPage'), '', FlashMessage::INFO);
            /** @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);
        }
        $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
        $this->body .= $output;
        $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
        // If a listing was produced, create the page footer with search form etc:
        if ($dblist->HTMLcode) {
            // Making field select box (when extended view for a single table is enabled):
            if ($dblist->table) {
                $this->body .= $dblist->fieldSelectBox($dblist->table);
            }
            // Adding checkbox options for extended listing and clipboard display:
            $this->body .= '

					<!--
						Listing options for extended view, clipboard and localization view
					-->
					<div class="typo3-listOptions">
						<form action="" method="post">';
            // Add "display bigControlPanel" checkbox:
            if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') {
                $this->body .= '<div class="checkbox">' . '<label for="checkLargeControl">' . BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"') . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', htmlspecialchars($lang->getLL('largeControl'))) . '</label>' . '</div>';
            }
            // Add "clipboard" checkbox:
            if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') {
                if ($dblist->showClipboard) {
                    $this->body .= '<div class="checkbox">' . '<label for="checkShowClipBoard">' . BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"') . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', htmlspecialchars($lang->getLL('showClipBoard'))) . '</label>' . '</div>';
                }
            }
            // Add "localization view" checkbox:
            if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') {
                $this->body .= '<div class="checkbox">' . '<label for="checkLocalization">' . BackendUtility::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"') . BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', htmlspecialchars($lang->getLL('localization'))) . '</label>' . '</div>';
            }
            $this->body .= '
						</form>
					</div>';
        }
        // Printing clipboard if enabled
        if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) {
            $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>';
        }
        // Additional footer content
        $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook'];
        if (is_array($footerContentHook)) {
            foreach ($footerContentHook as $hook) {
                $params = [];
                $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
            }
        }
        // Setting up the buttons for docheader
        $dblist->getDocHeaderButtons($this->moduleTemplate);
        // searchbox toolbar
        if (!$this->modTSconfig['properties']['disableSearchBox'] && ($dblist->HTMLcode || !empty($dblist->searchString))) {
            $this->content = $dblist->getSearchBox();
            $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ToggleSearchToolbox');
            $searchButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->makeLinkButton();
            $searchButton->setHref('#')->setClasses('t3js-toggle-search-toolbox')->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.searchIcon'))->setIcon($this->iconFactory->getIcon('actions-search', Icon::SIZE_SMALL));
            $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($searchButton, ButtonBar::BUTTON_POSITION_LEFT, 90);
        }
        if ($this->pageinfo) {
            $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
        }
        // Build the <body> for the module
        $this->content .= $this->body;
    }
예제 #27
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param integer $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  * @todo Define visibility
  */
 public function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', TRUE);
     $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', TRUE);
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
     $out = $this->doc->spacer(10) . '<div>' . '<a href="#" onclick="BrowseLinks.Selector.handle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/import.gif', 'width="12" height="12"') . ' title="' . $labelImportSelection . '" alt="" /> ' . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" onclick="BrowseLinks.Selector.toggle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/clip_select.gif', 'width="12" height="12"') . ' title="' . $labelToggleSelection . '" alt="" /> ' . $labelToggleSelection . '</a>' . '</div>';
     $thumbNailCheck = '';
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
         $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], GeneralUtility::_GP('M') ? '' : $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
         $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
     } else {
         $out .= $this->doc->spacer(15);
     }
     return $out;
 }
예제 #28
0
    /**
     * 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;
    }
    /**
     * Main
     *
     * @return string
     * @todo Define visibility
     */
    public function main()
    {
        global $BACK_PATH;
        global $tmpl, $tplRow, $theConstants;
        $POST = GeneralUtility::_POST();
        // Checking for more than one template an if, set a menu...
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
        }
        // BUGBUG: Should we check if the user may at all read and write template-records???
        $bType = $this->pObj->MOD_SETTINGS['ts_browser_type'];
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        if ($existTemplate) {
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('currentTemplate'), ' <img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow['title'], $bType == 'setup' ? 'config' : 'constants') . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : ''));
            if ($manyTemplatesMenu) {
                $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
            }
            $theOutput .= $this->pObj->doc->spacer(10);
            if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) {
                // add property
                $line = '';
                if (is_array($POST['data'])) {
                    $name = key($POST['data']);
                    if ($POST['data'][$name]['name'] !== '') {
                        // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
                        unset($POST['update_value']);
                        $POST['add_property'] = 'Add';
                    }
                    if ($POST['add_property']) {
                        $property = trim($POST['data'][$name]['name']);
                        if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
                            $badPropertyMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noSpaces') . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated'), $GLOBALS['LANG']->getLL('badProperty'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                            $this->addFlashMessage($badPropertyMessage);
                        } else {
                            $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
                            $propertyAddedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('propertyAdded'));
                            $this->addFlashMessage($propertyAddedMessage);
                            $line .= LF . $pline;
                        }
                    } elseif ($POST['update_value']) {
                        $pline = $name . ' = ' . trim($POST['data'][$name]['value']);
                        $updatedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('valueUpdated'));
                        $this->addFlashMessage($updatedMessage);
                        $line .= LF . $pline;
                    } elseif ($POST['clear_object']) {
                        if ($POST['data'][$name]['clearValue']) {
                            $pline = $name . ' >';
                            $objectClearedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('objectCleared'));
                            $this->addFlashMessage($objectClearedMessage);
                            $line .= LF . $pline;
                        }
                    }
                }
                if ($line) {
                    $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
                    // Set the data to be saved
                    $recData = array();
                    $field = $bType == 'setup' ? 'config' : 'constants';
                    $recData['sys_template'][$saveId][$field] = $tplRow[$field] . $line;
                    // Create new  tce-object
                    $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                    $tce->stripslashes_values = 0;
                    // Initialize
                    $tce->start($recData, array());
                    // Saved the stuff
                    $tce->process_datamap();
                    // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                    $tce->clear_cacheCmd('all');
                    // re-read the template ...
                    $this->initialize_editor($this->pObj->id, $template_uid);
                }
            }
        }
        $tsbr = GeneralUtility::_GET('tsbr');
        $update = 0;
        if (is_array($tsbr)) {
            // If any plus-signs were clicked, it's registred.
            $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]);
            $update = 1;
        }
        if ($POST['Submit']) {
            // If any POST-vars are send, update the condition array
            $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions'];
            $update = 1;
        }
        if ($update) {
            $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
        }
        $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
        $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
        // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
        $tmpl->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const'];
        if ($this->pObj->sObj && $tmpl->constantMode) {
            $tmpl->constantMode = 'untouched';
        }
        $tmpl->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'];
        $tmpl->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
        $tmpl->linkObjects = TRUE;
        $tmpl->ext_regLinenumbers = TRUE;
        $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
        $tmpl->bType = $bType;
        $tmpl->resourceCheck = 1;
        $tmpl->removeFromGetFilePath = PATH_site;
        if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') {
            $tmpl->ext_constants_BRP = (int) GeneralUtility::_GP('breakPointLN');
        } else {
            $tmpl->ext_config_BRP = (int) GeneralUtility::_GP('breakPointLN');
        }
        $tmpl->generateConfig();
        if ($bType == 'setup') {
            $theSetup = $tmpl->setup;
        } else {
            $theSetup = $tmpl->setup_constants;
        }
        // EDIT A VALUE:
        if ($this->pObj->sObj) {
            list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : '');
            if ($existTemplate) {
                // Value
                $out = '';
                $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
                $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
                // Property
                $out = '';
                $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' /> = </nobr><br />';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
                $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
                // clear
                $out = '';
                $out = htmlspecialchars($this->pObj->sObj) . ' <strong>' . $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper') . '</strong> &nbsp;&nbsp;';
                $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
                $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
                $theOutput .= $this->pObj->doc->spacer(10);
            } else {
                $noTemplateMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noCurrentTemplate'), $GLOBALS['LANG']->getLL('edit'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                $this->addFlashMessage($noTemplateMessage);
                $theOutput .= htmlspecialchars($this->pObj->sObj) . ' = <strong>' . htmlspecialchars($theSetupValue) . '</strong>';
                $theOutput .= $this->pObj->doc->spacer(10);
            }
            // Links:
            $out = '';
            $urlParameters = array('id' => $this->pObj->id);
            $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
            if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) {
                if (count($theSetup)) {
                    $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj)) . '">';
                    $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
                }
            } else {
                $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">';
                $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
            }
            if ($out) {
                $theOutput .= $this->pObj->doc->divider(5);
                $theOutput .= $this->pObj->doc->section('', $out);
            }
            // back
            $out = $GLOBALS['LANG']->getLL('back');
            $out = '<a href="' . htmlspecialchars($aHref) . '"><strong>' . $out . '</strong></a>';
            $theOutput .= $this->pObj->doc->divider(5);
            $theOutput .= $this->pObj->doc->section('', $out);
        } else {
            $tmpl->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType];
            if (GeneralUtility::_POST('search') && GeneralUtility::_POST('search_field')) {
                // If any POST-vars are send, update the condition array
                $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', GeneralUtility::_POST('search_field'), array());
            }
            $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
            $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
            $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
            $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]);
            //search
            $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') . '</label>';
            $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
            $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:search') . '" />';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
            $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
            $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType];
            if (!$theKey || !str_replace('-', '', $theKey)) {
                $theKey = '';
            }
            list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
            $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
            $tree = $tmpl->substituteCMarkers($tree);
            $urlParameters = array('id' => $this->pObj->id);
            $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
            // Parser Errors:
            $pEkey = $bType == 'setup' ? 'config' : 'constants';
            if (count($tmpl->parserErrors[$pEkey])) {
                $errMsg = array();
                $templateAnalyzerInstalled = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tstemplate');
                foreach ($tmpl->parserErrors[$pEkey] as $inf) {
                    $errorLink = '';
                    if ($templateAnalyzerInstalled) {
                        $errorLink = ' <a href="' . htmlspecialchars($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2]) . '">' . $GLOBALS['LANG']->getLL('errorShowDetails') . '</a>';
                    }
                    $errMsg[] = $inf[1] . ': &nbsp; &nbsp;' . $inf[0] . $errorLink;
                }
                $theOutput .= $this->pObj->doc->spacer(10);
                $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', implode($errMsg, '<br />'), $GLOBALS['LANG']->getLL('errorsWarnings'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                $theOutput .= $flashMessage->render();
            }
            if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
                $remove = '<th><a href="' . htmlspecialchars($aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">' . $GLOBALS['LANG']->getLL('removeKey') . '</a></th>';
            } else {
                $remove = '';
            }
            $label = $theKey ? $theKey : ($bType == 'setup' ? $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') : $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper'));
            $theOutput .= $this->pObj->doc->spacer(15);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $theOutput .= '<table class="t3-table" id="typo3-objectBrowser">
	<thead>
		<tr>
			<th>' . $label . '</th>' . $remove . '</tr>
	</thead>
	<tbody>
		<tr>
			<td>' . $tree . '</td>' . ($remove ? '<td></td>' : '') . '
		</tr>
	</tbody>
</table>';
            // second row options
            $menu = '<div class="tsob-menu-row2">';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
            $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
            $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"');
            $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
            if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
                $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
                $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
            }
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
            // Conditions:
            if (is_array($tmpl->sections)) {
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
                $out = '';
                foreach ($tmpl->sections as $key => $val) {
                    $out .= '<div class="tsob-conditions"><input class="checkbox" type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? ' checked' : '') . ' />';
                    $out .= '<label for="check' . $key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></div>';
                }
                $theOutput .= '<div class="tsob-menu-row2">' . $out . '</div><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" />';
            }
            // Ending section:
            $theOutput .= $this->pObj->doc->sectionEnd();
        }
        return $theOutput;
    }
예제 #30
0
    /**
     * Main function, creating the listing
     *
     * @return void
     */
    public function main()
    {
        // Initialize the template object
        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('EXT:filelist/Resources/Private/Templates/file_list.html');
        /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
        $pageRenderer = $this->doc->getPageRenderer();
        $pageRenderer->loadJQuery();
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation');
        // There there was access to this file path, continue, make the list
        if ($this->folderObject) {
            // Create filelisting object
            $this->filelist = GeneralUtility::makeInstance(FileList::class);
            $this->filelist->backPath = $GLOBALS['BACK_PATH'];
            // Apply predefined values for hidden checkboxes
            // Set predefined value for DisplayBigControlPanel:
            $backendUser = $this->getBackendUser();
            if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
                $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
            } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
                $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
            }
            // Set predefined value for DisplayThumbnails:
            if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
                $this->MOD_SETTINGS['displayThumbs'] = TRUE;
            } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
                $this->MOD_SETTINGS['displayThumbs'] = FALSE;
            }
            // Set predefined value for Clipboard:
            if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
                $this->MOD_SETTINGS['clipBoard'] = TRUE;
            } elseif ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
                $this->MOD_SETTINGS['clipBoard'] = FALSE;
            }
            // If user never opened the list module, set the value for displayThumbs
            if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
                $this->MOD_SETTINGS['displayThumbs'] = $backendUser->uc['thumbnailsByDefault'];
            }
            $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs'];
            // Create clipboard object and initialize that
            $this->filelist->clipObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
            $this->filelist->clipObj->fileMode = 1;
            $this->filelist->clipObj->initializeClipboard();
            $CB = GeneralUtility::_GET('CB');
            if ($this->cmd == 'setCB') {
                $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(GeneralUtility::_POST('CBH'), (array) GeneralUtility::_POST('CBC')), '_FILE');
            }
            if (!$this->MOD_SETTINGS['clipBoard']) {
                $CB['setP'] = 'normal';
            }
            $this->filelist->clipObj->setCmd($CB);
            $this->filelist->clipObj->cleanCurrent();
            // Saves
            $this->filelist->clipObj->endClipboard();
            // If the "cmd" was to delete files from the list (clipboard thing), do that:
            if ($this->cmd == 'delete') {
                $items = $this->filelist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), '_FILE', 1);
                if (!empty($items)) {
                    // Make command array:
                    $FILE = array();
                    foreach ($items as $v) {
                        $FILE['delete'][] = array('data' => $v);
                    }
                    // Init file processing object for deleting and pass the cmd array.
                    $fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
                    $fileProcessor->init(array(), $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                    $fileProcessor->setActionPermissions();
                    $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
                    $fileProcessor->start($FILE);
                    $fileProcessor->processData();
                    $fileProcessor->pushErrorMessagesToFlashMessageQueue();
                }
            }
            if (!isset($this->MOD_SETTINGS['sort'])) {
                // Set default sorting
                $this->MOD_SETTINGS['sort'] = 'file';
                $this->MOD_SETTINGS['reverse'] = 0;
            }
            // Start up filelisting object, include settings.
            $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
            $this->filelist->start($this->folderObject, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']);
            // Generate the list
            $this->filelist->generateList();
            // Set top JavaScript:
            $this->doc->JScode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";' . $this->filelist->CBfunctions());
            // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
            $this->doc->getContextMenuCode();
            // Setting up the buttons and markers for docheader
            list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->folderObject);
            // add the folder info to the marker array
            $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo();
            $docHeaderButtons = array_merge($this->getButtons(), $buttons);
            // Include DragUploader only if we have write access
            if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) {
                $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
                $pageRenderer->addInlineLanguagelabelFile(ExtensionManagementUtility::extPath('lang') . 'locallang_core.xlf', 'file_upload');
            }
            // Build the <body> for the module
            $moduleHeadline = $this->getModuleHeadline();
            // Create output
            $pageContent = $moduleHeadline !== '' ? '<h1>' . $moduleHeadline . '</h1>' : '';
            $pageContent .= '<form action="' . htmlspecialchars($this->filelist->listURL()) . '" method="post" name="dblistForm">';
            $pageContent .= $this->filelist->HTMLcode;
            $pageContent .= '<input type="hidden" name="cmd" /></form>';
            // Making listing options:
            if ($this->filelist->HTMLcode) {
                $pageContent .= '

					<!--
						Listing options for extended view, clipboard and thumbnails
					-->
					<div id="typo3-listOptions">
				';
                // Add "display bigControlPanel" checkbox:
                if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') {
                    $pageContent .= '<div class="checkbox">' . '<label for="bigControlPanel">' . BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', '', 'id="bigControlPanel"') . $this->getLanguageService()->getLL('bigControlPanel', TRUE) . '</label>' . '</div>';
                }
                // Add "display thumbnails" checkbox:
                if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') {
                    $pageContent .= '<div class="checkbox">' . '<label for="checkDisplayThumbs">' . BackendUtility::getFuncCheck($this->id, 'SET[displayThumbs]', $this->MOD_SETTINGS['displayThumbs'], '', '', 'id="checkDisplayThumbs"') . $this->getLanguageService()->getLL('displayThumbs', TRUE) . '</label>' . '</div>';
                }
                // Add "clipboard" checkbox:
                if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') {
                    $pageContent .= '<div class="checkbox">' . '<label for="checkClipBoard">' . BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', '', 'id="checkClipBoard"') . $this->getLanguageService()->getLL('clipBoard', TRUE) . '</label>' . '</div>';
                }
                $pageContent .= '
					</div>
				';
                // Set clipboard:
                if ($this->MOD_SETTINGS['clipBoard']) {
                    $pageContent .= $this->filelist->clipObj->printClipboard();
                    $pageContent .= BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_clipboard');
                }
            }
            $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => ($this->errorMessage ? $this->errorMessage->render() : '') . $pageContent, 'FOLDER_IDENTIFIER' => $this->folderObject->getCombinedIdentifier(), 'FILEDENYPATERN' => $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'], 'MAXFILESIZE' => GeneralUtility::getMaxUploadFileSize() * 1024);
            $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
            // Renders the module page
            $this->content = $this->doc->render($this->getLanguageService()->getLL('files'), $this->content);
        } else {
            $content = '';
            if ($this->errorMessage) {
                $this->errorMessage->setSeverity(FlashMessage::ERROR);
                $content = $this->doc->moduleBody(array(), array_merge(array('REFRESH' => '', 'PASTE' => '', 'LEVEL_UP' => ''), $this->getButtons()), array('CSH' => '', 'TITLE' => '', 'FOLDER_INFO' => '', 'PAGE_ICON' => '', 'FUNC_MENU' => '', 'CONTENT' => $this->errorMessage->render()));
            }
            // Create output - no access (no warning though)
            $this->content = $this->doc->render($this->getLanguageService()->getLL('files'), $content);
        }
    }