Example #1
0
 /**
  * Main function to generate the content
  *
  * @return 	void
  * @todo Define visibility
  */
 public function main()
 {
     $this->content = $this->doc->header('Indexing Engine Statistics');
     $this->content .= $this->doc->spacer(5);
     switch ($this->MOD_SETTINGS['function']) {
         case 'stat':
             $this->content .= $this->doc->section('Records', $this->doc->table($this->getRecordsNumbers()), 0, 1);
             $this->content .= $this->doc->spacer(15);
             $this->content .= $this->doc->section('index_phash TYPES', $this->doc->table($this->getPhashTypes()), 1);
             $this->content .= $this->doc->spacer(15);
             break;
         case 'externalDocs':
             $this->content .= $this->doc->section('External documents', $this->doc->table($this->getPhashExternalDocs()), 0, 1);
             $this->content .= $this->doc->spacer(15);
             break;
         case 'typo3pages':
             $this->content .= $this->doc->section('TYPO3 Pages', $this->doc->table($this->getPhashT3pages()), 0, 1);
             $this->content .= $this->doc->spacer(15);
             break;
     }
     $docHeaderButtons = $this->getButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
     $this->content = $this->doc->startPage('Indexing Engine Statistics');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 protected function renderReferences()
 {
     $content = '';
     switch ($this->type) {
         case 'db':
             $references = $this->makeRef($this->table, $this->row['uid']);
             if (!empty($references)) {
                 $content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem'), $references);
             }
             $referencesFrom = $this->makeRefFrom($this->table, $this->row['uid']);
             if (!empty($referencesFrom)) {
                 $content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesFromThisItem'), $referencesFrom);
             }
             break;
         case 'file':
             if ($this->fileObject && $this->fileObject->isIndexed()) {
                 $references = $this->makeRef('_FILE', $this->fileObject);
                 if (!empty($references)) {
                     $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem');
                     $content .= $this->doc->section($header, $references);
                 }
             }
             break;
     }
     return $content;
 }
 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $access = is_array($this->pageinfo);
     // Template markers
     $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setModuleTemplate('EXT:func/Resources/Private/Templates/func.html');
     // Main
     if ($this->id && $access) {
         // JavaScript
         $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->doc->getContextMenuCode();
         $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
         $vContent = $this->doc->getVersionSelector($this->id, TRUE);
         if ($vContent) {
             $this->content .= $this->doc->section('', $vContent);
         }
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
         $markers['CONTENT'] = $this->content;
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html'));
         $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
         $this->content = $view->render();
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         $markers['CONTENT'] = $this->content;
     }
     // Build the <body> for the module
     $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     // Renders the module page
     $this->content = $this->doc->render($this->getLanguageService()->getLL('title'), $this->content);
 }
    /**
     * 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() . '&nbsp;&nbsp;' . '<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));
        }
    }
 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $access = is_array($this->pageinfo);
     if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
         $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
         if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) {
             $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
         }
         $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
         $this->doc->backPath = $GLOBALS['BACK_PATH'];
         $this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html');
         $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), 'defRow' => array('0' => array('<td valign="top">', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
         // JavaScript
         $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->doc->getContextMenuCode();
         $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">';
         $vContent = $this->doc->getVersionSelector($this->id, 1);
         if ($vContent) {
             $this->content .= $this->doc->section('', $vContent);
         }
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
         // Build the <body> for the module
         $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     } else {
         // If no access or if ID == zero
         $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
         $this->doc->backPath = $GLOBALS['BACK_PATH'];
         $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title'));
         $this->content .= $this->doc->spacer(5);
         $this->content .= $this->doc->spacer(10);
     }
     // Renders the module page
     $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
 }
 /**
  * Renders the content of the module.
  *
  * @return 	void
  */
 public function render()
 {
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
     $this->content .= $this->doc->section('', $GLOBALS['LANG']->getLL('description'));
     if ($this->isAccessibleForCurrentUser) {
         $this->loadHeaderData();
         // div container for renderTo
         $this->content .= '<div id="recyclerContent"></div>';
     } else {
         // If no access or if ID == zero
         $this->content .= $this->doc->spacer(10);
     }
 }
 /**
  * Generates the module content.
  *
  * @return void
  */
 protected function moduleContent()
 {
     switch ((string) $this->MOD_SETTINGS['function']) {
         case '2':
             $content = $this->getManufacturerListing();
             break;
         case '3':
             $content = $this->getSupplierListing();
             break;
         case '1':
         default:
             $this->modPid = $this->attributePid;
             $content = $this->getAttributeListing();
     }
     $this->content .= $this->doc->section('', $content, 0, 1);
 }
 /**
  * Main function, rendering the upload file form fields
  *
  * @return void
  */
 public function main()
 {
     // Make page header:
     $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle'));
     $form = $this->renderUploadForm();
     $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')) . $this->doc->section('', $form);
     // Header Buttons
     $docHeaderButtons = array('csh' => BackendUtility::cshItem('xMOD_csh_corebe', 'file_upload', $GLOBALS['BACK_PATH']), 'back' => '');
     $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);
     // 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>';
     }
     $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #9
0
 /**
  * Main function, rendering the upload file form fields
  *
  * @return void
  */
 public function main()
 {
     // Make page header:
     $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle'));
     $form = $this->renderUploadForm();
     $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle')) . $this->doc->section('', $form);
     // Header Buttons
     $docHeaderButtons = array('csh' => BackendUtility::cshItem('xMOD_csh_corebe', 'file_upload'), 'back' => '');
     $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title);
     // Back
     if ($this->returnUrl) {
         $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL)->render() . '</a>';
     }
     $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #10
0
 /**
  * Main function, rendering the table wizard
  *
  * @return void
  */
 public function main()
 {
     if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
         $this->content .= $this->doc->section($this->getLanguageService()->getLL('table_title'), $this->tableWizard(), 0, 1);
     } else {
         $this->content .= $this->doc->section($this->getLanguageService()->getLL('table_title'), '<span class="typo3-red">' . $this->getLanguageService()->getLL('table_noData', TRUE) . '</span>', 0, 1);
     }
     // 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('Table');
     $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
    /**
     * Main Method, rendering either colorpicker or frameset depending on ->showPicker
     *
     * @return 	void
     */
    public function main()
    {
        // Show frameset by default:
        if (!GeneralUtility::_GP('showPicker')) {
            $this->frameSet();
        } else {
            // Putting together the items into a form:
            $content = '
				<form name="colorform" method="post" action="' . htmlspecialchars(BackendUtility::getModuleUrl('wizard_colorpicker')) . '">
					' . $this->colorMatrix() . '
					' . $this->colorList() . '
					' . $this->colorImage() . '

						<!-- Value box: -->
					<p class="c-head">' . $GLOBALS['LANG']->getLL('colorpicker_colorValue', TRUE) . '</p>
					<table border="0" cellpadding="0" cellspacing="3">
						<tr>
							<td><input type="text" ' . $this->doc->formWidth(7) . ' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) . '" /></td>
							<td style="background-color:' . htmlspecialchars($this->colorValue) . '; border: 1px solid black;">&nbsp;<span style="color: black;">' . $GLOBALS['LANG']->getLL('colorpicker_black', TRUE) . '</span>&nbsp;<span style="color: white;">' . $GLOBALS['LANG']->getLL('colorpicker_white', TRUE) . '</span>&nbsp;</td>
							<td><input type="submit" name="save_close" value="' . $GLOBALS['LANG']->getLL('colorpicker_setClose', TRUE) . '" /></td>
						</tr>
					</table>

						<!-- Hidden fields with values that has to be kept constant -->
					<input type="hidden" name="showPicker" value="1" />
					<input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) . '" />
					<input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) . '" />
					<input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) . '" />
					<input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) . '" />
					<input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) . '" />
					<input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) . '" />
				</form>';
            // If the save/close button is clicked, then close:
            if (GeneralUtility::_GP('save_close')) {
                $content .= $this->doc->wrapScriptTags('
					setValue(' . GeneralUtility::quoteJSvalue($this->colorValue) . ');
					parent.close();
				');
            }
            // Output:
            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('colorpicker_title'), $content, 0, 1);
        }
    }
 /**
  * Generate the module's content
  *
  * @return string HTML of the module's main content
  */
 protected function getModuleContent()
 {
     $content = '';
     $sectionTitle = '';
     // Handle chosen action
     switch ((string) $this->MOD_SETTINGS['function']) {
         case 'create':
             $content = $this->kickstarter->mgm_wizard();
             break;
         case 'edit':
             if (!$this->kickstarter->modData['wizArray_ser']) {
                 $this->kickstarter->modData['wizArray_ser'] = base64_encode($this->getWizardFormDat());
             }
             $content .= $this->getEditableExtensionsMenu();
             $content .= $this->kickstarter->mgm_wizard();
             break;
     }
     // Wrap the content in a section
     return $this->doc->section($sectionTitle, '<div class="tx_kickstarter_modfunc1">' . $content . '</div>', 0, 1);
 }
 /**
  * Rendering the content.
  *
  * @return void
  */
 public function main()
 {
     $msg = array();
     // Add a message, telling that no documents were open...
     $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg', TRUE) . '</p><br />';
     // If another page module was specified, replace the default Page module with the new one
     $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
     $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
     // Perform some access checks:
     $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
     $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
     // Finding module images: PAGE
     $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_layout_tab'];
     $imgInfo = @getimagesize($imgFile);
     $img_web_layout = is_array($imgInfo) ? '<img src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($imgFile) . '" ' . $imgInfo[3] . ' alt="" />' : '';
     // Finding module images: LIST
     $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_list_tab'];
     $imgInfo = @getimagesize($imgFile);
     $img_web_list = is_array($imgInfo) ? '<img src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($imgFile) . '" ' . $imgInfo[3] . ' alt="" />' : '';
     // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
     if ($a_wl || $a_wp) {
         $msg_2 = array();
         // Web>Page:
         if ($a_wp) {
             $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'' . $pageModule . '\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_pagemodule', TRUE) . $img_web_layout . '</a></strong>';
             if ($a_wl) {
                 $msg_2[] = $GLOBALS['LANG']->getLL('noDocuments_OR');
             }
         }
         // Web>List
         if ($a_wl) {
             $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_listmodule', TRUE) . $img_web_list . '</a></strong>';
         }
         $msg[] = '<p>' . sprintf($GLOBALS['LANG']->getLL('noDocuments_msg2', 1), implode(' ', $msg_2)) . '</p><br />';
     }
     // Display the list of the most recently edited documents:
     $modObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController');
     $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE) . '</p><br />' . $modObj->renderMenu();
     // Adding the content:
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('noDocuments'), implode(' ', $msg), 0, 1);
 }
 /**
  * Show list references
  *
  * @return void
  * @todo Define visibility
  */
 public function func_relations()
 {
     global $LANG, $BACK_PATH;
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('relations'));
     $admin = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck');
     $admin->genTree_makeHTML = 0;
     $admin->backPath = $BACK_PATH;
     $fkey_arrays = $admin->getGroupFields('');
     $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays);
     $fileTest = $admin->testFileRefs();
     $code = '';
     if (is_array($fileTest['noReferences'])) {
         foreach ($fileTest['noReferences'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong></nobr><br>';
         }
     } else {
         $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>';
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_ref'), $code, TRUE, TRUE);
     $code = '';
     if (is_array($fileTest['moreReferences'])) {
         foreach ($fileTest['moreReferences'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong>: ' . $val[2] . ' ' . $GLOBALS['LANG']->getLL('references') . '</nobr><br>' . $val[3] . '<br><br>';
         }
     } else {
         $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>';
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_many_ref'), $code, TRUE, TRUE);
     $code = '';
     if (is_array($fileTest['noFile'])) {
         ksort($fileTest['noFile']);
         foreach ($fileTest['noFile'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong> ' . $GLOBALS['LANG']->getLL('isMissing') . ' </nobr><br>' . $GLOBALS['LANG']->getLL('referencedFrom') . $val[2] . '<br><br>';
         }
     } else {
         $code = '<p>' . $GLOBALS['LANG']->getLL('no_files_found') . '</p>';
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_file'), $code, TRUE, TRUE);
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('select_db'), $admin->testDBRefs($admin->checkSelectDBRefs), TRUE, TRUE);
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('group_db'), $admin->testDBRefs($admin->checkGroupDBRefs), TRUE, TRUE);
 }
    /**
     * Generate the main settings formular:
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        global $LANG;
        if ($this->languageUpdate) {
            $this->doc->JScodeArray['languageUpdate'] .= '
				if (top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			';
        }
        if ($this->pagetreeNeedsRefresh) {
            BackendUtility::setUpdateSignal('updatePageTree');
        }
        // Start page:
        $this->doc->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
        // Use a wrapper div
        $this->content .= '<div id="user-setup-wrapper">';
        // Load available backend modules
        $this->loadModules = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
        $this->loadModules->observeWorkspaces = TRUE;
        $this->loadModules->load($GLOBALS['TBE_MODULES']);
        $this->content .= $this->doc->header($LANG->getLL('UserSettings'));
        // Show if setup was saved
        if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) {
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('setupWasUpdated'), $LANG->getLL('UserSettings'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->tempDataIsCleared) {
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('tempDataClearedFlashMessage'), $LANG->getLL('tempDataCleared'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->settingsAreResetToDefault) {
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('settingsAreReset'), $LANG->getLL('resetConfiguration'));
            $this->content .= $flashMessage->render();
        }
        // Notice
        if ($this->setupIsUpdated || $this->settingsAreResetToDefault) {
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('activateChanges'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
            $this->content .= $flashMessage->render();
        }
        // If password is updated, output whether it failed or was OK.
        if ($this->passwordIsSubmitted) {
            if ($this->passwordIsUpdated) {
                $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('newPassword_ok'), $LANG->getLL('newPassword'));
            } else {
                $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('newPassword_failed'), $LANG->getLL('newPassword'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
            }
            $this->content .= $flashMessage->render();
        }
        // Render the menu items
        $menuItems = $this->renderUserSetup();
        $this->content .= $this->doc->getDynTabMenu($menuItems, 'user-setup', FALSE, FALSE, 1, FALSE, 1, $this->dividers2tabs);
        $formToken = $this->formProtection->generateToken('BE user setup', 'edit');
        $this->content .= $this->doc->section('', '<input type="hidden" name="simUser" value="' . $this->simUser . '" />
			<input type="hidden" name="formToken" value="' . $formToken . '" />
			<input type="hidden" value="1" name="data[save]" />
			<input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" />
			<input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />');
        // End of wrapper div
        $this->content .= '</div>';
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CSH'] = $docHeaderButtons['csh'];
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render($LANG->getLL('UserSettings'), $this->content);
    }
 /**
  * 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;
 }
Example #17
0
    /**
     * 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);
        }
    }
    /**
     * Management of versions for record
     *
     * @return void
     * @todo Define visibility
     */
    public function versioningMgm()
    {
        // Diffing:
        $diff_1 = GeneralUtility::_POST('diff_1');
        $diff_2 = GeneralUtility::_POST('diff_2');
        if (GeneralUtility::_POST('do_diff')) {
            $content = '';
            $content .= '<h3>' . $GLOBALS['LANG']->getLL('diffing') . ':</h3>';
            if ($diff_1 && $diff_2) {
                $diff_1_record = BackendUtility::getRecord($this->table, $diff_1);
                $diff_2_record = BackendUtility::getRecord($this->table, $diff_2);
                if (is_array($diff_1_record) && is_array($diff_2_record)) {
                    $t3lib_diff_Obj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\DiffUtility');
                    $tRows = array();
                    $tRows[] = '
									<tr class="bgColor5 tableheader">
										<td>' . $GLOBALS['LANG']->getLL('fieldname') . '</td>
										<td width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</td>
									</tr>
								';
                    foreach ($diff_1_record as $fN => $fV) {
                        if ($GLOBALS['TCA'][$this->table]['columns'][$fN] && $GLOBALS['TCA'][$this->table]['columns'][$fN]['config']['type'] !== 'passthrough' && !GeneralUtility::inList('t3ver_label', $fN)) {
                            if ((string) $diff_1_record[$fN] !== (string) $diff_2_record[$fN]) {
                                $diffres = $t3lib_diff_Obj->makeDiffDisplay(BackendUtility::getProcessedValue($this->table, $fN, $diff_2_record[$fN], 0, 1), BackendUtility::getProcessedValue($this->table, $fN, $diff_1_record[$fN], 0, 1));
                                $tRows[] = '
									<tr class="bgColor4">
										<td>' . $fN . '</td>
										<td width="98%">' . $diffres . '</td>
									</tr>
								';
                            }
                        }
                    }
                    if (count($tRows) > 1) {
                        $content .= '<table border="0" cellpadding="1" cellspacing="1" width="100%">' . implode('', $tRows) . '</table><br /><br />';
                    } else {
                        $content .= $GLOBALS['LANG']->getLL('recordsMatchesCompletely');
                    }
                } else {
                    $content .= $GLOBALS['LANG']->getLL('errorRecordsNotFound');
                }
            } else {
                $content .= $GLOBALS['LANG']->getLL('errorDiffSources');
            }
        }
        // Element:
        $record = BackendUtility::getRecord($this->table, $this->uid);
        $recordIcon = IconUtility::getSpriteIconForRecord($this->table, $record);
        $recTitle = BackendUtility::getRecordTitle($this->table, $record, TRUE);
        // Display versions:
        $content .= '
			' . $recordIcon . $recTitle . '
			<form name="theform" action="' . str_replace('&sendToReview=1', '', $this->REQUEST_URI) . '" method="post">
			<table border="0" cellspacing="1" cellpadding="1">';
        $content .= '
				<tr class="bgColor5 tableheader">
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '">' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</td>
					<td title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</td>
					<td colspan="2"><input type="submit" name="do_diff" value="' . $GLOBALS['LANG']->getLL('diff') . '" /></td>
				</tr>';
        $versions = BackendUtility::selectVersionsOfRecord($this->table, $this->uid, '*', $GLOBALS['BE_USER']->workspace);
        foreach ($versions as $row) {
            $adminLinks = $this->adminLinks($this->table, $row);
            $content .= '
				<tr class="' . ($row['uid'] != $this->uid ? 'bgColor4' : 'bgColor2 tableheader') . '">
					<td>' . ($row['uid'] != $this->uid ? '<a href="' . $this->doc->issueCommand('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent', TRUE) . '">' . IconUtility::getSpriteIcon('actions-version-swap-version') . '</a>' : IconUtility::getSpriteIcon('status-status-current', array('title' => $GLOBALS['LANG']->getLL('currentOnlineVersion', TRUE)))) . '</td>
					<td nowrap="nowrap">' . $adminLinks . '</td>
					<td nowrap="nowrap">' . BackendUtility::getRecordTitle($this->table, $row, TRUE) . '</td>
					<td>' . $row['uid'] . '</td>
					<td>' . $row['t3ver_oid'] . '</td>
					<td>' . $row['t3ver_id'] . '</td>
					<td>' . $row['t3ver_wsid'] . '</td>
					<td>' . $row['t3ver_state'] . '</td>
					<td>' . $row['t3ver_stage'] . '</td>
					<td>' . $row['t3ver_count'] . '</td>
					<td>' . $row['pid'] . '</td>
					<td nowrap="nowrap"><a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $this->table . '][' . $row['uid'] . ']=edit&columnsOnly=t3ver_label', $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>' . htmlspecialchars($row['t3ver_label']) . '</td>
					<td class="version-diff-1"><input type="radio" name="diff_1" value="' . $row['uid'] . '"' . ($diff_1 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
					<td class="version-diff-2"><input type="radio" name="diff_2" value="' . $row['uid'] . '"' . ($diff_2 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
				</tr>';
            // Show sub-content if the table is pages AND it is not the online branch (because that will mostly render the WHOLE tree below - not smart;)
            if ($this->table == 'pages' && $row['uid'] != $this->uid) {
                $sub = $this->pageSubContent($row['uid']);
                if ($sub) {
                    $content .= '
						<tr>
							<td></td>
							<td></td>
							<td colspan="10">' . $sub . '</td>
							<td colspan="2"></td>
						</tr>';
                }
            }
        }
        $content .= '</table></form>';
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $content, 0, 1);
        // Create new:
        $content = '

			<form action="' . $this->doc->backPath . 'tce_db.php" method="post">
			' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . ': <input type="text" name="cmd[' . $this->table . '][' . $this->uid . '][version][label]" /><br />
			<br /><input type="hidden" name="cmd[' . $this->table . '][' . $this->uid . '][version][action]" value="new" />
			<input type="hidden" name="prErr" value="1" />
			<input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) . '" />
			<input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" />
			' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
			</form>

		';
        $this->content .= $this->doc->spacer(15);
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('createNewVersion'), $content, 0, 1);
    }
    /**
     * Management of versions for record
     *
     * @return void
     */
    public function versioningMgm()
    {
        // Diffing:
        $diff_1 = GeneralUtility::_POST('diff_1');
        $diff_2 = GeneralUtility::_POST('diff_2');
        if (GeneralUtility::_POST('do_diff')) {
            $content = '';
            $content .= '<div class="panel panel-space panel-default">';
            $content .= '<div class="panel-heading">' . $GLOBALS['LANG']->getLL('diffing') . '</div>';
            if ($diff_1 && $diff_2) {
                $diff_1_record = BackendUtility::getRecord($this->table, $diff_1);
                $diff_2_record = BackendUtility::getRecord($this->table, $diff_2);
                if (is_array($diff_1_record) && is_array($diff_2_record)) {
                    $diffUtility = GeneralUtility::makeInstance(DiffUtility::class);
                    $rows = array();
                    $rows[] = '
									<tr>
										<th>' . $GLOBALS['LANG']->getLL('fieldname') . '</th>
										<th width="98%">' . $GLOBALS['LANG']->getLL('coloredDiffView') . ':</th>
									</tr>
								';
                    foreach ($diff_1_record as $fN => $fV) {
                        if ($GLOBALS['TCA'][$this->table]['columns'][$fN] && $GLOBALS['TCA'][$this->table]['columns'][$fN]['config']['type'] !== 'passthrough' && !GeneralUtility::inList('t3ver_label', $fN)) {
                            if ((string) $diff_1_record[$fN] !== (string) $diff_2_record[$fN]) {
                                $diffres = $diffUtility->makeDiffDisplay(BackendUtility::getProcessedValue($this->table, $fN, $diff_2_record[$fN], 0, 1), BackendUtility::getProcessedValue($this->table, $fN, $diff_1_record[$fN], 0, 1));
                                $rows[] = '
									<tr>
										<td>' . $fN . '</td>
										<td width="98%">' . $diffres . '</td>
									</tr>
								';
                            }
                        }
                    }
                    if (count($rows) > 1) {
                        $content .= '<div class="table-fit"><table class="table">' . implode('', $rows) . '</table></div>';
                    } else {
                        $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('recordsMatchesCompletely') . '</div>';
                    }
                } else {
                    $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('errorRecordsNotFound') . '</div>';
                }
            } else {
                $content .= '<div class="panel-body">' . $GLOBALS['LANG']->getLL('errorDiffSources') . '</div>';
            }
            $content .= '</div>';
        }
        // Element:
        $record = BackendUtility::getRecord($this->table, $this->uid);
        $recTitle = BackendUtility::getRecordTitle($this->table, $record, true);
        // Display versions:
        $content .= '
			<form name="theform" action="' . str_replace('&sendToReview=1', '', $this->REQUEST_URI) . '" method="post">
				<div class="panel panel-space panel-default">
				<div class="panel-heading">' . $recTitle . '</div>
					<div class="table-fit">
						<table class="table">
							<thead>
								<tr>
									<th colspan="2" class="col-icon"></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_title') . '">' . $GLOBALS['LANG']->getLL('tblHeader_title') . '</th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_uid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_uid') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_oid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_oid') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_id') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_id') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_wsid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_wsid') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_state', true) . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_state') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_stage') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_stage') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_count') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_count') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_pid') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_pid') . '</i></th>
									<th title="' . $GLOBALS['LANG']->getLL('tblHeaderDesc_t3ver_label') . '"><i>' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</i></th>
									<th></th>
									<th colspan="2">
										<button class="btn btn-default btn-sm" type="submit"  name="do_diff" value="true">
											' . $GLOBALS['LANG']->getLL('diff') . '
										</button>
									</th>
								</tr>
							</thead>
							<tbody>
			';
        $versions = BackendUtility::selectVersionsOfRecord($this->table, $this->uid, '*', $GLOBALS['BE_USER']->workspace);
        foreach ($versions as $row) {
            $adminLinks = $this->adminLinks($this->table, $row);
            $editUrl = BackendUtility::getModuleUrl('record_edit', ['edit' => [$this->table => [$row['uid'] => 'edit']], 'columnsOnly' => 't3ver_label', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
            $content .= '
				<tr' . ($row['uid'] != $this->uid ? '' : ' class="active"') . '>
					<td class="col-icon">' . ($row['uid'] != $this->uid ? '<a href="' . BackendUtility::getLinkToDataHandlerAction('&cmd[' . $this->table . '][' . $this->uid . '][version][swapWith]=' . $row['uid'] . '&cmd[' . $this->table . '][' . $this->uid . '][version][action]=swap') . '" title="' . $GLOBALS['LANG']->getLL('swapWithCurrent', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-version-swap-version', Icon::SIZE_SMALL)->render() . '</a>' : '<span title="' . $GLOBALS['LANG']->getLL('currentOnlineVersion', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('status-status-current', Icon::SIZE_SMALL)->render() . '</span>') . '
					</td>
					<td class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($this->table, $row, Icon::SIZE_SMALL)->render() . '</td>
					<td>' . htmlspecialchars(BackendUtility::getRecordTitle($this->table, $row, true)) . '</td>
					<td>' . $row['uid'] . '</td>
					<td>' . $row['t3ver_oid'] . '</td>
					<td>' . $row['t3ver_id'] . '</td>
					<td>' . $row['t3ver_wsid'] . '</td>
					<td>' . $row['t3ver_state'] . '</td>
					<td>' . $row['t3ver_stage'] . '</td>
					<td>' . $row['t3ver_count'] . '</td>
					<td>' . $row['pid'] . '</td>
					<td>
						<a href="' . htmlspecialchars($editUrl) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', true) . '">
							' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '
						</a>' . htmlspecialchars($row['t3ver_label']) . '
					</td>
					<td class="col-control">' . $adminLinks . '</td>
					<td class="text-center success"><input type="radio" name="diff_1" value="' . $row['uid'] . '"' . ($diff_1 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
					<td class="text-center danger"><input type="radio" name="diff_2" value="' . $row['uid'] . '"' . ($diff_2 == $row['uid'] ? ' checked="checked"' : '') . '/></td>
				</tr>';
            // Show sub-content if the table is pages AND it is not the online branch (because that will mostly render the WHOLE tree below - not smart;)
            if ($this->table === 'pages' && $row['uid'] != $this->uid) {
                $sub = $this->pageSubContent($row['uid']);
                if ($sub) {
                    $content .= '
						<tr>
							<td colspan="2"></td>
							<td colspan="11">' . $sub . '</td>
							<td class="success"></td>
							<td class="danger"></td>
						</tr>';
                }
            }
        }
        $content .= '
							</tbody>
						</table>
					</div>
				</div>
			</form>';
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('title'), $content, 0, 1);
        // Create new:
        $content = '
			<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post">
				<div class="row">
					<div class="col-sm-6 col-md-4 col-lg-3">
						<div class="form-group">
							<label for="typo3-new-version-label">' . $GLOBALS['LANG']->getLL('tblHeader_t3ver_label') . '</label>
							<input id="typo3-new-version-label" class="form-control" type="text" name="cmd[' . $this->table . '][' . $this->uid . '][version][label]" />
						</div>
						<div class="form-group">
							<input type="hidden" name="cmd[' . $this->table . '][' . $this->uid . '][version][action]" value="new" />
							<input type="hidden" name="prErr" value="1" />
							<input type="hidden" name="redirect" value="' . htmlspecialchars($this->REQUEST_URI) . '" />
							<input class="btn btn-default" type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('createNewVersion') . '" />
						</div>
					</div>
				</div>
			</form>

		';
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('createNewVersion'), $content, 0, 1);
    }
    /**
     * Main function, rendering the main module content
     *
     * @return void
     */
    public function main()
    {
        $lang = $this->getLanguageService();
        // Start content compilation
        $this->content .= $this->doc->startPage($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
        // Make page header:
        $pageContent = $this->doc->header($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
        if ($this->folderObject->checkActionPermission('add')) {
            $code = '<form role="form" action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">';
            // Making the selector box for the number of concurrent folder-creations
            $this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10);
            $code .= '
				<div class="form-group">
					<div class="form-section">
						<div class="form-group">
							<label for="number-of-new-folders">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.number_of_folders') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfolder') . '</label>
							<div class="form-control-wrap">
								<div class="input-group">
									<select class="form-control form-control-adapt" name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
            for ($a = 1; $a <= $this->folderNumber; $a++) {
                $code .= '<option value="' . $a . '"' . ($this->number == $a ? ' selected="selected"' : '') . '>' . $a . '</option>';
            }
            $code .= '
									</select>
								</div>
							</div>
						</div>
					</div>
				';
            // Making the number of new-folder boxes needed:
            for ($a = 0; $a < $this->number; $a++) {
                $code .= '
					<div class="form-section">
						<div class="form-group">
							<label for="folder_new_' . $a . '">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfolder') . ' ' . ($a + 1) . ':</label>
							<div class="form-control-wrap">
								<input type="text" class="form-control" id="folder_new_' . $a . '" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
								<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->target) . '" />
							</div>
						</div>
					</div>';
            }
            // Making submit button for folder creation:
            $code .= '
				</div><div class="form-group">
					<input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				';
            // Switching form tags:
            $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfolders'), $code);
            $pageContent .= $this->doc->sectionEnd() . '</form>';
        }
        if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) {
            $pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform2">';
            // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc.
            $fileExtList = array();
            $textFileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
            foreach ($textFileExt as $fileExt) {
                if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) {
                    $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>';
                }
            }
            // Add form fields for creation of a new, blank text file:
            $code = '
				<div class="form-group">
					<div class="form-section">
						<div class="form-group">
							<label for="newfile">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.label_newfile') . ' ' . BackendUtility::cshItem('xMOD_csh_corebe', 'file_newfile') . '</label>
							<div class="form-control-wrap">
								<input class="form-control" type="text" id="newfile" name="file[newfile][0][data]" onchange="changed=true;" />
								<input type="hidden" name="file[newfile][0][target]" value="' . htmlspecialchars($this->target) . '" />
							</div>
							<div class="help-block">
								' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:cm.allowedFileExtensions') . '<br>
								' . implode(' ', $fileExtList) . '
							</div>
						</div>
					</div>
				</div>
				';
            // Submit button for creation of a new file:
            $code .= '
				<div class="form-group">
					<input class="btn btn-default" type="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile_submit', TRUE) . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				';
            $pageContent .= $this->doc->section($lang->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.newfile'), $code);
            $pageContent .= $this->doc->sectionEnd();
            $pageContent .= '</form>';
        }
        $docHeaderButtons = array('back' => '');
        // Back
        if ($this->returnUrl) {
            $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'CONTENT' => $pageContent, 'PATH' => $this->title);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Example #21
0
 /**
  * Main function for rendering the form wizard HTML
  *
  * @return void
  */
 public function main()
 {
     if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('forms_title'), $this->formsWizard(), 0, 1);
     } else {
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('forms_title'), '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('table_noData', 1) . '</span>', 0, 1);
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage('Form Wizard');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #22
0
    /**
     * Main function, rendering the document with the iFrame with the RTE in.
     *
     * @return void
     */
    public function main()
    {
        // Translate id to the workspace version:
        if ($versionedRecord = BackendUtility::getWorkspaceVersionOfRecord($this->getBackendUserAuthentication()->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
            $this->P['uid'] = $versionedRecord['uid'];
        }
        // If all parameters are available:
        if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
            // Getting the raw record (we need only the pid-value from here...)
            $rawRecord = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
            BackendUtility::fixVersioningPid($this->P['table'], $rawRecord);
            // override the default jumpToUrl
            $this->doc->JScodeArray['jumpToUrl'] = '
		function jumpToUrl(URL,formEl) {
			if (document.editform) {
				if (!TBE_EDITOR.isFormChanged()) {
					window.location.href = URL;
				} else if (formEl) {
					if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
				}
			} else {
				window.location.href = URL;
			}
		}
';
            // Setting JavaScript of the pid value for viewing:
            if ($this->popView) {
                $this->doc->JScode = $this->doc->wrapScriptTags(BackendUtility::viewOnClick($rawRecord['pid'], '', BackendUtility::BEgetRootLine($rawRecord['pid'])));
            }
            // Initialize FormEngine - for rendering the field:
            /** @var FormEngine $formEngine */
            $formEngine = GeneralUtility::makeInstance(FormEngine::class);
            // SPECIAL: Disables all wizards - we are NOT going to need them.
            $formEngine->disableWizards = 1;
            // Fetching content of record:
            /** @var DataPreprocessor $dataPreprocessor */
            $dataPreprocessor = GeneralUtility::makeInstance(DataPreprocessor::class);
            $dataPreprocessor->lockRecords = 1;
            $dataPreprocessor->fetchRecord($this->P['table'], $this->P['uid'], '');
            // Getting the processed record content out:
            $processedRecord = reset($dataPreprocessor->regTableItems_data);
            $processedRecord['uid'] = $this->P['uid'];
            $processedRecord['pid'] = $rawRecord['pid'];
            // TSconfig, setting width:
            $fieldTSConfig = FormEngineUtility::getTSconfigForTableRow($this->P['table'], $processedRecord, $this->P['field']);
            if ((string) $fieldTSConfig['RTEfullScreenWidth'] !== '') {
                $width = $fieldTSConfig['RTEfullScreenWidth'];
            } else {
                $width = '100%';
            }
            // Get the form field and wrap it in the table with the buttons:
            $formContent = $formEngine->getSoloField($this->P['table'], $processedRecord, $this->P['field']);
            $formContent = '

			<!-- RTE wizard: -->
				<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
					<tr>
						<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
						<td></td>
					</tr>
				</table>';
            // Adding hidden fields:
            $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
						<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . FormEngine::getHiddenTokenField('tceAction');
            // Finally, add the whole setup:
            $this->content .= $formEngine->printNeededJSFunctions_top() . $formContent . $formEngine->printNeededJSFunctions();
        } else {
            // ERROR:
            $this->content .= $this->doc->section($this->getLanguageService()->getLL('forms_title'), '<span class="text-danger">' . $this->getLanguageService()->getLL('table_noData', TRUE) . '</span>', 0, 1);
        }
        // Setting up the buttons and markers for docHeader
        $docHeaderButtons = $this->getButtons();
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage('');
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
 /**
  * Creating the module output.
  *
  * @return void
  */
 public function main()
 {
     $lang = $this->getLanguageService();
     if ($this->page_id) {
         $backendUser = $this->getBackendUser();
         // Get record for element:
         $elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid);
         // Headerline: Icon, record title:
         $headerLine = IconUtility::getSpriteIconForRecord($this->table, $elRow, array('id' => 'c-recIcon', 'title' => htmlspecialchars(BackendUtility::getRecordIconAltText($elRow, $this->table))));
         $headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, TRUE);
         // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
         $headerLine .= $this->doc->spacer(5);
         $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript(array('makeCopy' => !$this->makeCopy))) . ';';
         $headerLine .= $this->doc->spacer(5);
         $headerLine .= '<input type="hidden" name="makeCopy" value="0" />' . '<input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy" class="t3-label-valign-top">' . $lang->getLL('makeCopy', 1) . '</label>';
         // Add the header-content to the module content:
         $this->content .= $this->doc->section('', $headerLine, FALSE, TRUE);
         $this->content .= $this->doc->spacer(20);
         // Reset variable to pick up the module content in:
         $code = '';
         // IF the table is "pages":
         if ((string) $this->table == 'pages') {
             // Get page record (if accessible):
             $pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\PageMovingPagePositionMap::class);
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 if ($pageInfo['pid']) {
                     $pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . IconUtility::getSpriteIcon('actions-view-go-up') . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree:
                 $code .= $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI);
             }
         }
         // IF the table is "tt_content":
         if ((string) $this->table == 'tt_content') {
             // First, get the record:
             $tt_content_rec = BackendUtility::getRecord('tt_content', $this->moveUid);
             // ?
             if (!$this->input_moveUid) {
                 $this->page_id = $tt_content_rec['pid'];
             }
             // Checking if the parent page is readable:
             $pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ContentMovingPagePositionMap::class);
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 $posMap->cur_sys_language = $this->sys_language;
                 // Headerline for the parent page: Icon, record title:
                 $headerLine = IconUtility::getSpriteIconForRecord('pages', $pageInfo, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($pageInfo, 'pages'))));
                 $headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, TRUE);
                 // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                 // SHARED page-TSconfig settings.
                 // $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->pageId, 'mod.SHARED');
                 $colPosArray = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this);
                 $colPosIds = array();
                 foreach ($colPosArray as $colPos) {
                     $colPosIds[] = $colPos[1];
                 }
                 // Removing duplicates, if any
                 $colPosList = implode(',', array_unique($colPosIds));
                 // Adding parent page-header and the content element columns from position-map:
                 $code = $headerLine . '<br />';
                 $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI);
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 $code .= '<br /><br />';
                 if ($pageInfo['pid']) {
                     $pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . IconUtility::getSpriteIcon('actions-view-go-up') . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree (for pages):
                 $code .= $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI);
             }
         }
         // Add the $code content as a new section to the module:
         $this->content .= $this->doc->section($lang->getLL('selectPositionOfElement'), $code, FALSE, TRUE);
     }
     // 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($lang->getLL('movingElement'));
     $this->content .= $this->doc->moduleBody($pageInfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #24
0
    /**
     * Main Method, rendering either colorpicker or frameset depending on ->showPicker
     *
     * @return void
     */
    public function main()
    {
        // Show frameset by default:
        if (!GeneralUtility::_GP('showPicker')) {
            $this->frameSet();
        } else {
            // Putting together the items into a form:
            $content = '
				<form name="colorform" method="post" action="' . htmlspecialchars(BackendUtility::getModuleUrl('wizard_colorpicker')) . '">
					' . $this->colorMatrix() . '
					' . $this->colorList() . '
					' . $this->colorImage() . '

					<!-- Value box: -->
					<p class="c-head">' . $this->getLanguageService()->getLL('colorpicker_colorValue', true) . '</p>
					<table border="0" cellpadding="0" cellspacing="3">
						<tr>
							<td>
								<input id="colorValue" type="text" ' . $this->doc->formWidth(7) . ' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) . '" />
							</td>
							<td style="background-color:' . htmlspecialchars($this->colorValue) . '; border: 1px solid black;">
								<span style="color: black;">' . $this->getLanguageService()->getLL('colorpicker_black', true) . '</span>&nbsp;<span style="color: white;">' . $this->getLanguageService()->getLL('colorpicker_white', true) . '</span>
							</td>
							<td>
								<input class="btn btn-default" type="submit" id="colorpicker-saveclose" value="' . $this->getLanguageService()->getLL('colorpicker_setClose', true) . '" />
							</td>
						</tr>
					</table>

					<!-- Hidden fields with values that has to be kept constant -->
					<input type="hidden" name="showPicker" value="1" />
					<input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) . '" />
					<input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) . '" />
					<input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) . '" />
					<input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) . '" />
					<input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) . '" />
					<input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) . '" />
				</form>';
            $this->content .= $this->doc->section($this->getLanguageService()->getLL('colorpicker_title'), $content, false, true);
        }
    }
Example #25
0
    /**
     * Main function, rendering the document with the iframe with the RTE in.
     *
     * @return void
     */
    public function main()
    {
        // Translate id to the workspace version:
        if ($versionRec = BackendUtility::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
            $this->P['uid'] = $versionRec['uid'];
        }
        // If all parameters are available:
        if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
            // Getting the raw record (we need only the pid-value from here...)
            $rawRec = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
            BackendUtility::fixVersioningPid($this->P['table'], $rawRec);
            // override the default jumpToUrl
            $this->doc->JScodeArray['jumpToUrl'] = '
		function jumpToUrl(URL,formEl) {
			if (document.editform) {
				if (!TBE_EDITOR.isFormChanged()) {
					window.location.href = URL;
				} else if (formEl) {
					if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
				}
			} else {
				window.location.href = URL;
			}
		}
';
            // Setting JavaScript of the pid value for viewing:
            if ($this->popView) {
                $this->doc->JScode = $this->doc->wrapScriptTags(BackendUtility::viewOnClick($rawRec['pid'], '', BackendUtility::BEgetRootLine($rawRec['pid'])));
            }
            // Initialize TCeforms - for rendering the field:
            $tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
            // Init...
            $tceforms->initDefaultBEMode();
            // SPECIAL: Disables all wizards - we are NOT going to need them.
            $tceforms->disableWizards = 1;
            // SPECIAL: Setting background color of the RTE to ordinary background
            $tceforms->colorScheme[0] = $this->doc->bgColor;
            // Initialize style for RTE object:
            // Getting reference to the RTE object used to render the field!
            $RTEobj = BackendUtility::RTEgetObj();
            if ($RTEobj->ID == 'rte') {
                $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
            }
            // Fetching content of record:
            $trData = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor');
            $trData->lockRecords = 1;
            $trData->fetchRecord($this->P['table'], $this->P['uid'], '');
            // Getting the processed record content out:
            $rec = reset($trData->regTableItems_data);
            $rec['uid'] = $this->P['uid'];
            $rec['pid'] = $rawRec['pid'];
            // TSconfig, setting width:
            $fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
            if ((string) $fieldTSConfig['RTEfullScreenWidth'] !== '') {
                $width = $fieldTSConfig['RTEfullScreenWidth'];
            } else {
                $width = '100%';
            }
            // Get the form field and wrap it in the table with the buttons:
            $formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']);
            $formContent = '


			<!--
				RTE wizard:
			-->
				<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
					<tr>
						<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
						<td></td>
					</tr>
				</table>';
            // Adding hidden fields:
            $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
						<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction');
            // Finally, add the whole setup:
            $this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions();
        } else {
            // ERROR:
            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('forms_title'), '<span class="typo3-red">' . $GLOBALS['LANG']->getLL('table_noData', TRUE) . '</span>', 0, 1);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage('');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
    /**
     * Showing the permissions in a tree ($this->edit = FALSE)
     * (Adding content to internal content variable)
     *
     * @return void
     */
    public function notEdit()
    {
        // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of
        $beGroupKeys = $GLOBALS['BE_USER']->userGroupsUID;
        $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 0);
        }
        $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindGroupNames($beGroupArray, $beGroupKeys, 0);
        }
        // Length of strings:
        $tLen = $this->MOD_SETTINGS['mode'] == 'perms' ? 20 : 30;
        // Selector for depth:
        $code = $GLOBALS['LANG']->getLL('Depth') . ': ';
        $code .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']);
        $this->content .= $this->doc->section('', $code);
        $this->content .= $this->doc->spacer(5);
        // Initialize tree object:
        $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
        $tree->init('AND ' . $this->perms_clause);
        $tree->addField('perms_user', 1);
        $tree->addField('perms_group', 1);
        $tree->addField('perms_everybody', 1);
        $tree->addField('perms_userid', 1);
        $tree->addField('perms_groupid', 1);
        $tree->addField('hidden');
        $tree->addField('fe_group');
        $tree->addField('starttime');
        $tree->addField('endtime');
        $tree->addField('editlock');
        // Creating top icon; the current page
        $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pageinfo);
        $tree->tree[] = array('row' => $this->pageinfo, 'HTML' => $HTML);
        // Create the tree from $this->id:
        $tree->getTree($this->id, $this->MOD_SETTINGS['depth'], '');
        // Make header of table:
        $code = '';
        if ($this->MOD_SETTINGS['mode'] == 'perms') {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td>' . $GLOBALS['LANG']->getLL('Owner', TRUE) . '</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('Group', TRUE) . '</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('Everybody', TRUE) . '</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('EditLock', TRUE) . '</td>
				</tr>
			';
        } else {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center" nowrap="nowrap">' . $GLOBALS['LANG']->getLL('User', TRUE) . ': ' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</td>
					' . (!$GLOBALS['BE_USER']->isAdmin() ? '<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('EditLock', TRUE) . '</td>' : '') . '
				</tr>';
        }
        // Traverse tree:
        foreach ($tree->tree as $data) {
            $cells = array();
            $pageId = $data['row']['uid'];
            // Background colors:
            $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : '';
            $lE_bgCol = $bgCol;
            // User/Group names:
            $userName = $beUserArray[$data['row']['perms_userid']] ? $beUserArray[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : '');
            if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) {
                $userName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($userName, 20)), FALSE);
            } else {
                $userName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($userName, 20)));
            }
            $groupName = $beGroupArray[$data['row']['perms_groupid']] ? $beGroupArray[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : '');
            if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) {
                $groupName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupName, 20)), FALSE);
            } else {
                $groupName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupName, 20)));
            }
            // Seeing if editing of permissions are allowed for that page:
            $editPermsAllowed = $data['row']['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin();
            // First column:
            $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '';
            $cells[] = '
					<td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . '>' . $data['HTML'] . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($data['row']['title'], $tLen)) . '&nbsp;</td>';
            // "Edit permissions" -icon
            if ($editPermsAllowed && $pageId) {
                $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1';
                $cells[] = '
					<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $GLOBALS['LANG']->getLL('ch_permissions', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a></td>';
            } else {
                $cells[] = '
					<td' . $bgCol . '></td>';
            }
            // Rest of columns (depending on mode)
            if ($this->MOD_SETTINGS['mode'] == 'perms') {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $GLOBALS['LANG']->getLL('EditLock_descr', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the &raquo;Admin-only&laquo; edit lock for this page">[+]</a></span>')) . '</td>
				';
            } else {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>';
                $bgCol = $GLOBALS['BE_USER']->user['uid'] == $data['row']['perms_userid'] ? ' class="bgColor-20"' : $lE_bgCol;
                // FIXME $owner undefined
                $cells[] = '
					<td' . $bgCol . ' nowrap="nowrap" align="center">' . ($pageId ? $owner . \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($GLOBALS['BE_USER']->calcPerms($data['row']), $pageId, 'user') : '') . '</td>
					' . (!$GLOBALS['BE_USER']->isAdmin() ? '
					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-lock', array('title' => $GLOBALS['LANG']->getLL('EditLock_descr', TRUE))) : '') . '</td>
					' : '');
                $bgCol = $lE_bgCol;
            }
            // Compile table row:
            $code .= '
				<tr>
					' . implode('
					', $cells) . '
				</tr>';
        }
        // Wrap rows in table tags:
        $code = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-permissionList">' . $code . '</table>';
        // Adding the content as a section:
        $this->content .= $this->doc->section('', $code);
        // CSH for permissions setting
        $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|');
        // Creating legend table:
        $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 = '<table border="0" id="typo3-legendTable">
			<tr>
				<td valign="top">
					<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" />
				</td>
				<td valign="top" nowrap="nowrap">' . $legendText . '</td>
			</tr>
		</table>';
        $code .= '<div id="perm-legend">' . $GLOBALS['LANG']->getLL('def', 1);
        $code .= '<br /><br />' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-permission-granted') . ': ' . $GLOBALS['LANG']->getLL('A_Granted', 1);
        $code .= '<br />' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-permission-denied') . ': ' . $GLOBALS['LANG']->getLL('A_Denied', 1);
        $code .= '</div>';
        // Adding section with legend code:
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend') . ':', $code, 0, 1);
    }
Example #27
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);
    }
 /**
  * Main processing, creating the list of new record tables to select from
  *
  * @return void
  */
 public function main()
 {
     // If there was a page - or if the user is admin (admins has access to the root) we proceed:
     if ($this->pageinfo['uid'] || $GLOBALS['BE_USER']->isAdmin()) {
         // Acquiring TSconfig for this module/current page:
         $this->web_list_modTSconfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
         $this->allowedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['properties']['allowedNewTables'], TRUE);
         $this->deniedNewTables = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['properties']['deniedNewTables'], TRUE);
         // Acquiring TSconfig for this module/parent page:
         $this->web_list_modTSconfig_pid = BackendUtility::getModTSconfig($this->pageinfo['pid'], 'mod.web_list');
         $this->allowedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], TRUE);
         $this->deniedNewTables_pid = GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['deniedNewTables'], TRUE);
         // More init:
         if (!$this->showNewRecLink('pages')) {
             $this->newPagesInto = 0;
         }
         if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) {
             $this->newPagesAfter = 0;
         }
         // Set header-HTML and return_url
         if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
             $iconImgTag = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
         } else {
             $iconImgTag = IconUtility::getSpriteIcon('apps-pagetree-root', array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
             $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
         }
         $this->code = '<span class="typo3-moduleHeader">' . $this->doc->wrapClickMenuOnIcon($iconImgTag, 'pages', $this->pageinfo['uid']) . htmlspecialchars(GeneralUtility::fixed_lgd_cs($title, 45)) . '</span><br />';
         $this->R_URI = $this->returnUrl;
         // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard)
         // Regular new element:
         if (!$this->pagesOnly) {
             $this->regularNew();
         } elseif ($this->showNewRecLink('pages')) {
             // Pages only wizard
             $this->pagesOnly();
         }
         // Add all the content to an output section
         $this->content .= $this->doc->section('', $this->code);
         // 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']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle'));
         $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
         $this->content .= $this->doc->endPage();
         $this->content = $this->doc->insertStylesAndJS($this->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);
    }
 /**
  * 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;
 }