예제 #1
0
    /**
     * Main function, redering the actual content of the editing page
     *
     * @return void
     */
    public function main()
    {
        $docHeaderButtons = $this->getButtons();
        $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle'));
        // Hook	before compiling the output
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) {
            $preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'];
            if (is_array($preOutputProcessingHook)) {
                $hookParameters = array('content' => &$this->content, 'target' => &$this->target);
                foreach ($preOutputProcessingHook as $hookFunction) {
                    GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName()));
        $pageContent .= $this->doc->spacer(2);
        $code = '';
        $extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'];
        try {
            if (!$extList || !GeneralUtility::inList($extList, $this->fileObject->getExtension())) {
                throw new \Exception('Files with that extension are not editable.');
            }
            // Read file content to edit:
            $fileContent = $this->fileObject->getContents();
            // Making the formfields
            $hValue = BackendUtility::getModuleUrl('file_edit', array('target' => $this->origTarget, 'returnUrl' => $this->returnUrl));
            // Edit textarea:
            $code .= '
				<div id="c-edit">
					<textarea rows="30" name="file[editfile][0][data]" wrap="off" ' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="text-monospace t3js-enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea>
					<input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				<br />';
            // Make shortcut:
            if ($this->getBackendUser()->mayMakeShortcut()) {
                $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', 'file_edit', 1);
            } else {
                $docHeaderButtons['shortcut'] = '';
            }
        } catch (\Exception $e) {
            $code .= sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'), $extList);
        }
        // Ending of section and outputting editing form:
        $pageContent .= $this->doc->sectionEnd();
        $pageContent .= $code;
        // Hook	after compiling the output
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) {
            $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'];
            if (is_array($postOutputProcessingHook)) {
                $hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target);
                foreach ($postOutputProcessingHook as $hookFunction) {
                    GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
예제 #2
0
 /**
  * Rendering all other listings than QuickEdit
  *
  * @return string
  */
 public function renderListContent()
 {
     /** @var $dbList \TYPO3\CMS\Backend\View\PageLayoutView */
     $dbList = GeneralUtility::makeInstance(PageLayoutView::class);
     $dbList->backPath = $GLOBALS['BACK_PATH'];
     $dbList->thumbs = $this->imagemode;
     $dbList->no_noWrap = 1;
     $dbList->descrTable = $this->descrTable;
     $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
     $dbList->script = BackendUtility::getModuleUrl('web_layout');
     $dbList->showIcon = 0;
     $dbList->setLMargin = 0;
     $dbList->doEdit = $this->EDIT_CONTENT;
     $dbList->ext_CALC_PERMS = $this->CALC_PERMS;
     $dbList->agePrefixes = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
     $dbList->id = $this->id;
     $dbList->nextThree = MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
     $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!)
     // also fills $dbList->activeTables
     $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) {
         $h_func_b = '';
         if (!isset($dbList->externalTables[$table])) {
             $q_count = $this->getNumberOfHiddenElements();
             if ($q_count > 0) {
                 $h_func_b = '<div class="checkbox">' . '<label for="checkTt_content_showHidden">' . '<input type="checkbox" id="checkTt_content_showHidden" class="checkbox" name="SET[tt_content_showHidden]" value="1" ' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? 'checked="checked"' : '') . ' />' . $this->getLanguageService()->getLL('hiddenCE', TRUE) . ' (<span class="t3js-hidden-counter">' . $q_count . '</span>)' . '</label>' . '</div>';
             }
             // 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;
             // Setting up the tt_content columns to show:
             if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
                 $colList = array();
                 $tcaItems = GeneralUtility::callUserFunction(BackendLayoutView::class . '->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 ($this->colPosList !== '') {
                 $colList = array_intersect(GeneralUtility::intExplode(',', $this->colPosList), $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['activeCols'] = $this->activeColPosList;
             $dbList->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
             $dbList->tt_contentConfig['sys_language_uid'] = (int) $this->current_sys_language;
             // If the function menu is set to "Language":
             if ($this->MOD_SETTINGS['function'] == 2) {
                 $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 = BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], '', '');
             } 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 = '';
     }
     // END: traverse tables
     // For Context Sensitive Menus:
     $this->doc->getContextMenuCode();
     // Init the content
     $content = '';
     // Additional header content
     $headerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'];
     if (is_array($headerContentHook)) {
         foreach ($headerContentHook as $hook) {
             $params = array();
             $content .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     // 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'] && !empty($tableOutput)) {
         $this->markers['BUTTONLIST_ADDITIONAL'] = '<a href="#" onclick="toggleSearchToolbox(); return false;" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', TRUE) . '">' . IconUtility::getSpriteIcon('apps-toolbar-menu-search') . '</a>';
         $this->markers['SEARCHBOX'] = $dbList->getSearchBox(0);
     }
     // 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 .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     return $content;
 }
    /**
     * Creating the module output.
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        if ($this->id && $this->access) {
            // Init position map object:
            $posMap = GeneralUtility::makeInstance('ext_posMap');
            $posMap->cur_sys_language = $this->sys_language;
            $posMap->backPath = $GLOBALS['BACK_PATH'];
            // If a column is pre-set:
            if (isset($this->colPos)) {
                if ($this->uid_pid < 0) {
                    $row = array();
                    $row['uid'] = abs($this->uid_pid);
                } else {
                    $row = '';
                }
                $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
            } else {
                $this->onClickEvent = '';
            }
            // ***************************
            // Creating content
            // ***************************
            // use a wrapper div
            $this->content .= '<div id="user-setup-wrapper">';
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
            // Wizard
            $code = '';
            $wizardItems = $this->getWizardItems();
            // Wrapper for wizards
            $this->elementWrapper['section'] = array('<ul class="contentelement-wizard list-unstyled">', '</ul>');
            // Copy wrapper for tabs
            $this->elementWrapperForTabs = $this->elementWrapper;
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = GeneralUtility::getUserObj($classData);
                    if (!$hookObject instanceof \TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface) {
                        throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Wizard\\NewContentElementWizardHookInterface', 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
                // Restore wrapper for tabs if they are overwritten in hook
                $this->elementWrapper = $this->elementWrapperForTabs;
            }
            // Add document inline javascript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function goToalt_doc() {	//
					' . $this->onClickEvent . '
				}

				if(top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a radio button and title/description and icon:
            $cc = $key = 0;
            $menuItems = array();
            foreach ($wizardItems as $k => $wInfo) {
                if ($wInfo['header']) {
                    $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]);
                    $key = count($menuItems) - 1;
                } else {
                    $content = '';
                    if (!$this->onClickEvent) {
                        // Radio button:
                        $oC = 'document.editForm.defValues.value=unescape(\'' . rawurlencode($wInfo['params']) . '\');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : '');
                        $content .= '<div class="contentelement-wizard-item-input"><input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" /></div>';
                        // Onclick action for icon/title:
                        $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $oC . 'return false;';
                    } else {
                        $aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : '');
                    }
                    $menuItems[$key]['content'] .= '<li>
							<div class="contentelement-wizard-item">
								' . $content . '
								<div class="contentelement-wizard-item-icon">
									<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
										<img' . IconUtility::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" />
									</a>
								</div>
								<div class="contentelement-wizard-item-text">
									<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
										<strong>' . htmlspecialchars($wInfo['title']) . '</strong>
										<br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>
								</div>
							</div>
						</li>';
                    $cc++;
                }
            }
            // Add closing section-tag
            foreach ($menuItems as $key => $val) {
                $menuItems[$key]['content'] .= $this->elementWrapper['section'][1];
            }
            // Add the wizard table to the content, wrapped in tabs:
            if ($this->config['renderMode'] == 'tabs') {
                $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', FALSE, FALSE);
            } else {
                $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />';
                foreach ($menuItems as $section) {
                    $code .= '<h3 class="divider">' . $section['label'] . '</h3>' . $section['content'];
                }
            }
            $this->content .= $this->doc->section(!$this->onClickEvent ? $GLOBALS['LANG']->getLL('1_selectType') : '', $code, 0, 1);
            // If the user must also select a column:
            if (!$this->onClickEvent) {
                // Add anchor "sel2"
                $this->content .= $this->doc->section('', '<a name="sel2"></a>');
                $this->content .= $this->doc->spacer(20);
                // Select position
                $code = $GLOBALS['LANG']->getLL('sel2', 1) . '<br /><br />';
                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->id, 'mod.SHARED');
                $colPosList = trim($modTSconfig_SHARED['properties']['colPos_list']) !== '' ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                $colPosList = implode(',', array_unique(GeneralUtility::intExplode(',', $colPosList)));
                // Removing duplicates, if any
                // Finally, add the content of the column selector to the content:
                $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI);
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('2_selectPosition'), $code, 0, 1);
            }
            // Close wrapper div
            $this->content .= '</div>';
        } else {
            // In case of no access:
            $this->content = '';
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CSH'] = $docHeaderButtons['csh'];
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('newContentElement'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->sectionEnd();
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
예제 #4
0
    /**
     * Main function, rendering the main module content
     *
     * @return void
     */
    public function main()
    {
        $lang = $this->getLanguageService();
        // Start content compilation
        $this->content .= $this->doc->startPage($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
        // Make page header:
        $pageContent = $this->doc->header($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
        if ($this->folderObject->checkActionPermission('add')) {
            $code = '<form role="form" action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">';
            // Making the selector box for the number of concurrent folder-creations
            $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10);
            $code .= '
				<div class="form-group">
					<div class="form-section">
						<div class="form-group">
							<label for="number-of-new-folders">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . '</label>
							<div class="form-control-wrap">
								<div class="input-group">
									<select class="form-control form-control-adapt" name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
            for ($a = 1; $a <= $this->folderNumber; $a++) {
                $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>';
            }
            $code .= '
									</select>
								</div>
							</div>
						</div>
					</div>
				';
            // Making the number of new-folder boxes needed:
            for ($a = 0; $a < $this->number; $a++) {
                $code .= '
					<div class="form-section">
						<div class="form-group">
							<label for="folder_new_' . $a . '">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfolder') . ' ' . ($a + 1) . ':</label>
							<div class="form-control-wrap">
								<input type="text" class="form-control" id="folder_new_' . $a . '" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
								<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" />
							</div>
						</div>
					</div>';
            }
            // Making submit button for folder creation:
            $code .= '
				</div><div class="form-group">
					<input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				';
            // Switching form tags:
            $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfolders'), $code);
            $pageContent .= $this->doc->sectionEnd() . '</form>';
        }
        if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) {
            $pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform2">';
            // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc.
            $fileExtList = array();
            $textFileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
            foreach ($textFileExt as $fileExt) {
                if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) {
                    $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>';
                }
            }
            // Add form fields for creation of a new, blank text file:
            $code = '
				<div class="form-group">
					<div class="form-section">
						<div class="form-group">
							<label for="newfile">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfile') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . '</label>
							<div class="form-control-wrap">
								<input class="form-control" type="text" id="newfile" name="file[newfile][0][data]" onchange="changed=true;" />
								<input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" />
							</div>
							<div class="help-block">
								' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:cm.allowedFileExtensions') . '<br>
								' . implode(' ', $fileExtList) . '
							</div>
						</div>
					</div>
				</div>
				';
            // Submit button for creation of a new file:
            $code .= '
				<div class="form-group">
					<input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				';
            $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code);
            $pageContent .= $this->doc->sectionEnd();
            $pageContent .= '</form>';
        }
        $docHeaderButtons = array('back' => '');
        // Back
        if ($this->returnUrl) {
            $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
예제 #5
0
 /**
  * Rendering all other listings than QuickEdit
  *
  * @return void
  * @todo Define visibility
  */
 public function renderListContent()
 {
     // Initialize list object (see "class.db_layout.inc"):
     /** @var $dblist \TYPO3\CMS\Backend\View\PageLayoutView */
     $dblist = 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 = 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.xlf:labels.minutesHoursDaysYears');
     $dblist->id = $this->id;
     $dblist->nextThree = 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) {
         if (!isset($dblist->externalTables[$table])) {
             $q_count = $this->getNumberOfHiddenElements();
             $h_func_b = 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 = GeneralUtility::callUserFunction('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 ($this->colPosList !== '') {
                 $colList = array_intersect(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['activeCols'] = $this->activeColPosList;
             $dblist->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
             $dblist->tt_contentConfig['sys_language_uid'] = (int) $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 = 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();
     // Init the content
     $content = '';
     // Additional header content
     $headerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'];
     if (is_array($headerContentHook)) {
         foreach ($headerContentHook as $hook) {
             $params = array();
             $content .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     // 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 = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf: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 .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     return $content;
 }
    /**
     * [Describe function...]
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        $arrayBrowser = GeneralUtility::makeInstance('TYPO3\\CMS\\Lowlevel\\Utility\\ArrayBrowser');
        $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
        $search_field = GeneralUtility::_GP('search_field');
        $this->content = $this->doc->header($GLOBALS['LANG']->getLL('configuration', TRUE));
        $this->content .= '<h2>' . $label . '</h2>';
        $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 .= BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"') . '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', TRUE) . '</label>';
        $this->content .= 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'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_CONF_VARS';
                break;
            case 1:
                $theVar = $GLOBALS['TCA'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TCA';
                break;
            case 2:
                $theVar = $GLOBALS['TCA_DESCR'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TCA_DESCR';
                break;
            case 3:
                $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
                break;
            case 4:
                $theVar = $GLOBALS['T3_SERVICES'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$T3_SERVICES';
                break;
            case 5:
                $theVar = $GLOBALS['TBE_MODULES'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_MODULES';
                break;
            case 6:
                $theVar = $GLOBALS['TBE_MODULES_EXT'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_MODULES_EXT';
                break;
            case 7:
                $theVar = $GLOBALS['TBE_STYLES'];
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_STYLES';
                break;
            case 8:
                $theVar = $GLOBALS['BE_USER']->uc;
                GeneralUtility::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$BE_USER->uc';
                break;
            case 9:
                $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
                GeneralUtility::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 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;
        // 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 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, '', '');
        $this->content .= $this->doc->sectionEnd();
        // Variable name:
        if (GeneralUtility::_GP('varname')) {
            $line = GeneralUtility::_GP('_') ? GeneralUtility::_GP('_') : GeneralUtility::_GP('varname');
            // Write the line to extTables.php
            if (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 = GeneralUtility::getUrl(PATH_typo3conf . TYPO3_extTableDef_script);
                if ($var === '$TCA') {
                    // check if we are editing the TCA
                    preg_match_all('/\\[\'([^\']+)\'\\]/', $line, $parts);
                }
                // insert line in extTables.php
                $extTables = preg_replace('/<\\?php|\\?>/is', '', $extTables);
                $extTables = '<?php' . (empty($extTables) ? LF : '') . $extTables . $changedLine . LF . '?>';
                $success = GeneralUtility::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
                if ($success) {
                    // show flash message
                    $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . nl2br(htmlspecialchars($changedLine)) . '</strong>'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
                } else {
                    // Error: show flash message
                    $flashMessage = 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 .= '<div class="nowrap">' . $tree . '</div>';
        // 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);
    }
    /**
     * Main function, redering the actual content of the editing page
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        //TODO: change locallang*.php to locallang*.xml
        $docHeaderButtons = $this->getButtons();
        $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
        // Hook	before compiling the output
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) {
            $preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'];
            if (is_array($preOutputProcessingHook)) {
                $hookParameters = array('content' => &$this->content, 'target' => &$this->target);
                foreach ($preOutputProcessingHook as $hookFunction) {
                    \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName()));
        $pageContent .= $this->doc->spacer(2);
        $code = '';
        $extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'];
        if ($extList && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($extList, $this->fileObject->getExtension())) {
            // Read file content to edit:
            $fileContent = $this->fileObject->getContents();
            // Making the formfields
            $hValue = 'file_edit.php?target=' . rawurlencode($this->origTarget) . '&returnUrl=' . rawurlencode($this->returnUrl);
            // Edit textarea:
            $code .= '
				<div id="c-edit">
					<textarea rows="30" name="file[editfile][0][data]" wrap="off"' . $this->doc->formWidthText(48, 'width:98%;height:80%', 'off') . ' class="fixed-font enable-tab">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($fileContent) . '</textarea>
					<input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" />
				</div>
				<br />';
            // Make shortcut:
            if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
                $this->MCONF['name'] = 'xMOD_file_edit.php';
                $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', $this->MCONF['name'], 1);
            } else {
                $docHeaderButtons['shortcut'] = '';
            }
        } else {
            $code .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.coundNot'), $extList);
        }
        // Ending of section and outputting editing form:
        $pageContent .= $this->doc->sectionEnd();
        $pageContent .= $code;
        // Hook	after compiling the output
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) {
            $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'];
            if (is_array($postOutputProcessingHook)) {
                $hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target);
                foreach ($postOutputProcessingHook as $hookFunction) {
                    \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
예제 #8
-1
    /**
     * Main function, rendering the main module content
     *
     * @return void
     */
    public function main()
    {
        // Start content compilation
        $this->content .= $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
        // Make page header:
        $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
        $pageContent .= $this->doc->spacer(5);
        $pageContent .= $this->doc->divider(5);
        if ($this->folderObject->checkActionPermission('add')) {
            $code = '<form action="tce_file.php" method="post" name="editform">';
            // Making the selector box for the number of concurrent folder-creations
            $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10);
            $code .= '
				<div id="c-select">
					<label for="number-of-new-folders">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . '</label>
					<select name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
            for ($a = 1; $a <= $this->folderNumber; $a++) {
                $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>';
            }
            $code .= '
					</select>
				</div>
				';
            // Making the number of new-folder boxes needed:
            $code .= '
				<div id="c-createFolders">
			';
            for ($a = 0; $a < $this->number; $a++) {
                $code .= '
						<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
						<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" /><br />
					';
            }
            $code .= '
				</div>
			';
            // Making submit button for folder creation:
            $code .= '
				<div id="c-submitFolders">
					<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />
					<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				';
            // CSH:
            $code .= BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'], '<br />');
            $pageContent .= $code;
            // Add spacer:
            $pageContent .= $this->doc->spacer(10);
            // Switching form tags:
            $pageContent .= $this->doc->sectionEnd() . '</form>';
        }
        if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) {
            $pageContent .= '<form action="tce_file.php" method="post" name="editform2">';
            // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc.
            $fileExtList = array();
            $textfileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
            foreach ($textfileExt as $fileExt) {
                if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) {
                    $fileExtList[] = '*.' . $fileExt;
                }
            }
            // Add form fields for creation of a new, blank text file:
            $code = '
				<div id="c-newFile">
					<p>[' . htmlspecialchars(implode(', ', $fileExtList)) . ']</p>
					<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfile][0][data]" onchange="changed=true;" />
					<input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" />
				</div>
				';
            // Submit button for creation of a new file:
            $code .= '
				<div id="c-submitFiles">
					<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" />
					<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				';
            // CSH:
            $code .= BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'], '<br />');
            $pageContent .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code);
            $pageContent .= $this->doc->sectionEnd();
            $pageContent .= '</form>';
        }
        $docHeaderButtons = array('back' => '');
        // Back
        if ($this->returnUrl) {
            $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }