/** * Main function. Will generate the information to display for the item * set internally. * * @param string $returnLinkTag <a> tag closing/returning. * @return void * @todo Define visibility */ public function renderFileInfo($returnLinkTag) { $fileExtension = $this->fileObject->getExtension(); $code = '<div class="fileInfoContainer">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($fileExtension) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.file', TRUE) . ':</strong> ' . $this->fileObject->getName() . ' ' . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.filesize') . ':</strong> ' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($this->fileObject->getSize()) . '</div> '; $this->content .= $this->doc->section('', $code); $this->content .= $this->doc->divider(2); // If the file was an image... // @todo: add this check in the domain model, or in the processing folder if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) { // @todo: find a way to make getimagesize part of the t3lib_file object $imgInfo = @getimagesize($this->fileObject->getForLocalProcessing(FALSE)); $thumbUrl = $this->fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '150m', 'height' => '150m'))->getPublicUrl(TRUE); $code = '<div class="fileInfoContainer fileDimensions">' . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.dimensions') . ':</strong> ' . $imgInfo[0] . 'x' . $imgInfo[1] . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.pixels') . '</div>'; $code .= '<br /> <div align="center">' . $returnLinkTag . '<img src="' . $thumbUrl . '" alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" /></a></div>'; $this->content .= $this->doc->section('', $code); } elseif ($fileExtension == 'ttf') { $thumbUrl = $this->fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => '530m', 'height' => '600m'))->getPublicUrl(TRUE); $thumb = '<br /> <div align="center">' . $returnLinkTag . '<img src="' . $thumbUrl . '" border="0" title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" alt="" /></a></div>'; $this->content .= $this->doc->section('', $thumb); } // Traverse the list of fields to display for the record: $tableRows = array(); $showRecordFieldList = $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList']; $fieldList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $showRecordFieldList, TRUE); foreach ($fieldList as $name) { $name = trim($name); if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) { continue; } $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)); if ($isExcluded) { continue; } $uid = $this->row['uid']; $itemValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid); $itemLabel = $GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($this->table, $name), 1); $tableRows[] = ' <tr> <td class="t3-col-header">' . $itemLabel . '</td> <td>' . htmlspecialchars($itemValue) . '</td> </tr>'; } // Create table from the information: $tableCode = ' <table border="0" cellpadding="0" cellspacing="0" id="typo3-showitem" class="t3-table-info"> ' . implode('', $tableRows) . ' </table>'; $this->content .= $this->doc->section('', $tableCode); // References: if ($this->fileObject->isIndexed()) { $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'); $this->content .= $this->doc->section($header, $this->makeRef('_FILE', $this->fileObject)); } }
/** * Main function, rendering the content of the rename form * * @return void */ public function main() { // Make page header: $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle')); $pageContent .= $this->doc->spacer(5); $pageContent .= $this->doc->divider(5); if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $fileIdentifier = $this->fileOrFolderObject->getCombinedIdentifier(); } else { $fileIdentifier = $this->fileOrFolderObject->getUid(); } $code = '<form action="tce_file.php" method="post" name="editform">'; // Making the formfields for renaming: $code .= ' <div id="c-rename"> <input type="text" name="file[rename][0][target]" value="' . htmlspecialchars($this->fileOrFolderObject->getName()) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' /> <input type="hidden" name="file[rename][0][data]" value="' . htmlspecialchars($fileIdentifier) . '" /> </div> '; // Making submit button: $code .= ' <div id="c-submit"> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.submit', TRUE) . '" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . ' </div> '; $code .= '</form>'; // Add the HTML as a section: $pageContent .= $code; $docHeaderButtons = array('back' => ''); $docHeaderButtons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']); // Back if ($this->returnUrl) { $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>'; } // Add the HTML as a section: $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title); $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * @return [type] ... */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { $full_script_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/'; $this->relative_site_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // first get the http-path to typo3: $this->httpTypo3Path = substr(substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'))), 0, -1); if (strlen($this->httpTypo3Path) == 1) { $this->httpTypo3Path = '/'; } else { $this->httpTypo3Path .= '/'; } // Get the vhost full path (example: /var/www/html/domain.com/public_html/my_cms/) $this->DOCUMENT_ROOT = PATH_site; // Get the vhost full path to multishop (example: /var/www/html/domain.com/public_html/my_cms/typo3conf/ext/multishop/) $this->DOCUMENT_ROOT_MS = PATH_site . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // Get the site full URL (example: http://domain.com/my_cms/) $this->FULL_HTTP_URL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); // Get the multishop full URL (example: http://domain.com/my_cms/typo3/ext/multishop or http://domain.com/my_cms/typo3conf/ext/multishop) $this->FULL_HTTP_URL_MS = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // Get the host URL (example: http://domain.com) // dont use hostURL cause its not supporting subdirectory hosting $this->hostURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); // Draw the header. $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); //$this->doc->setModuleTemplate(ExtensionManagementUtility::extPath($this->extKey) . 'mod1/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; //$this->doc= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('bigDoc'); //$this->doc->backPath=$BACK_PATH; // JavaScript $this->doc->JScode = ' <style type="text/css"> /*<![CDATA[*/ <!-- /*inDocStyles*/ /*###POSTCSSMARKER###*/ --> /*]]>*/ .shadow_bottom { overflow:hidden; width:100%; background:url(' . $this->FULL_HTTP_URL_MS . 'mod1/images/shadow_bottom.png) left bottom no-repeat; padding:0 0 35px; } fieldset { display:block; border:1px solid #999; background:#fff; margin:10px 0 0; padding:10px 10px 10px; } fieldset legend { background:#585858; color:#fff; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; padding:2px 4px; } fieldset legend a { color:#fff; } fieldset legend a:hover { color:#fff; text-decoration:underline; } ul { list-style:none; margin:0; padding:0; } a.buttons, a.buttons_db { -moz-border-radius:1px 1px 1px 1px; BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button.png); background-color:#F6F6F6; background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #D5D5D5 90%); background-position:center bottom; background-repeat:repeat-x; border:1px solid #7C7C7C; color:#434343; display:block; padding:2px 4px; text-align:center; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; line-height:16px; } a.buttons:hover, a.buttons_db:hover { BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button-hover.png); background-color:#C8C8C8; background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #BDBCBC 90%); background-position:center bottom; background-repeat:repeat-x; border:1px solid #737F91; color:#1E1E1E; } a.buttons { width:142px; } a.buttons_db { width:126px; } fieldset.mod1MultishopFieldset ul { overflow:hidden; width:100%; } fieldset.mod1MultishopFieldset ul li { float:left; margin:0 10px 0 0; } </style> <!--[if IE]> <style> fieldset { position: relative; padding-top:15px; margin:20px 0 0; } legend { position: absolute; top: -10px; left: 10px; } </style> <![endif]--> <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } function CONFIRM(label) { if (confirm(label)) { return true; } else { return false; } } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50); $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); $this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } $this->content .= $this->doc->spacer(10); } else { // If no access or if ID == zero $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Creating form for editing the permissions ($this->edit = TRUE) * (Adding content to internal content variable) * * @return void */ public function doEdit() { if ($GLOBALS['BE_USER']->workspace != 0) { // Adding section with the permission setting matrix: $lockedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('WorkspaceWarningText'), $GLOBALS['LANG']->getLL('WorkspaceWarning'), \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($lockedMessage); } // Get usernames and groupnames $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getListGroupNames('title,uid'); $beGroupKeys = array_keys($beGroupArray); $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 1); } $beGroupArray_o = $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindGroupNames($beGroupArray_o, $beGroupKeys, 1); } // data of the first group, the user is member of $firstGroup = $beGroupKeys[0] ? $beGroupArray[$beGroupKeys[0]] : ''; // Owner selector: $options = ''; // flag: is set if the page-userid equals one from the user-list $userset = 0; foreach ($beUserArray as $uid => $row) { if ($uid == $this->pageinfo['perms_userid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>'; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_userid]"> ' . $options . ' </select>'; $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Owner') . ':', $selector); // Group selector: $options = ''; $userset = 0; foreach ($beGroupArray as $uid => $row) { if ($uid == $this->pageinfo['perms_groupid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; } // If the group was not set AND there is a group for the page if (!$userset && $this->pageinfo['perms_groupid']) { $options = ' <option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_groupid]"> ' . $options . ' </select>'; $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Group') . ':', $selector); // Permissions checkbox matrix: $code = ' <table border="0" cellspacing="2" cellpadding="0" id="typo3-permissionMatrix"> <tr> <td></td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('1', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('16', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('2', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('4', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $GLOBALS['LANG']->getLL('8', 1)) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $GLOBALS['LANG']->getLL('Owner', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 4) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $GLOBALS['LANG']->getLL('Group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 4) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $GLOBALS['LANG']->getLL('Everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 4) . '</td> </tr> </table> <br /> <input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" /> ' . $this->getRecursiveSelect($this->id, $this->perms_clause) . ' <input type="submit" name="submit" value="' . $GLOBALS['LANG']->getLL('Save', 1) . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('Abort', 1) . '" onclick="' . htmlspecialchars('jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_perm') . '&id=' . $this->id, TRUE) . '); return false;') . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . intval($this->return_id) . '&lastEdited=' . $this->id) . '" /> ' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction'); // Adding section with the permission setting matrix: $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('permissions') . ':', $code); // CSH for permissions setting $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />'); // Adding help text: if ($GLOBALS['BE_USER']->uc['helpText']) { $this->content .= $this->doc->divider(20); $legendText = '<strong>' . $GLOBALS['LANG']->getLL('1', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('16', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('2', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('4', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', 1); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('8', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', 1); $code = $legendText . '<br /><br />' . $GLOBALS['LANG']->getLL('def', 1); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend', 1) . ':', $code); } }
/** * 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); }