/**
     * Initialize.
     *
     * @return void
     */
    protected function init()
    {
        // Start the template object:
        $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->bodyTagMargins['x'] = 5;
        $this->doc->bodyTagMargins['y'] = 5;
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        // Add JS
        $this->doc->JScode = $this->doc->wrapScriptTags('
		function jump(url, modName, mainModName) {
				// clear information about which entry in nav. tree that might have been highlighted.
			top.fsMod.navFrameHighlightedID = [];

			if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
				top.content.nav_frame.refresh_nav();
			}

			top.nextLoadModuleUrl = url;
			top.goToModule(modName);
		}
		');
        // Start the page:
        $this->content = '';
        $this->content .= $this->doc->startPage('TYPO3 Edit Document');
        // Loads the backend modules available for the logged in user.
        $this->loadModules = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
        $this->loadModules->load($GLOBALS['TBE_MODULES']);
    }
 /**
  * Generate module output
  *
  * @return void
  */
 public function main()
 {
     // Start history object
     $historyObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\History\\RecordHistory');
     // Get content:
     $this->content .= $historyObj->main();
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers['CONTENT'] = $this->content;
     $markers['CSH'] = $docHeaderButtons['csh'];
     // Build the <body> for the module
     $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
 }
Example #3
0
    /**
     * Main function, rendering the browsable page tree
     *
     * @return	void
     */
    public function main()
    {
        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'doktype = 254 AND module in (\'dmail\')' . BackendUtility::deleteClause('pages'), '', 'title');
        $out = '';
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            if (BackendUtility::readPageAccess($row['uid'], $GLOBALS['BE_USER']->getPagePermsClause(1))) {
                $icon = $iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL)->render();
                $out .= '<tr onmouseover="this.style.backgroundColor=\'' . GeneralUtility::modifyHTMLColorAll($this->doc->bgColor, -5) . '\'" onmouseout="this.style.backgroundColor=\'\'">' . '<td id="dmail_' . $row['uid'] . '" >
						<a href="#" onclick="top.fsMod.recentIds[\'txdirectmailM1\']=' . $row['uid'] . ';jumpTo(\'id=' . $row['uid'] . '\',this,\'dmail_' . $row['uid'] . '\');">' . $icon . '&nbsp;' . htmlspecialchars($row['title']) . '</a></td></tr>';
            }
        }
        $GLOBALS['TYPO3_DB']->sql_free_result($res);
        $content = '<table cellspacing="0" cellpadding="0" border="0" width="100%">' . $out . '</table>';
        // Adding highlight - JavaScript
        if ($this->doHighlight) {
            $content .= $this->doc->wrapScriptTags('
			hilight_row("",top.fsMod.navFrameHighlightedID["web"]);
		');
        }
        $docHeaderButtons = array('CSH' => BackendUtility::cshItem('_MOD_txdirectmailM1', 'folders', $GLOBALS['BACK_PATH'], TRUE), 'REFRESH' => '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('unique' => uniqid('directmail_navframe')))) . '">' . $iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL) . '</a>');
        $markers = array('HEADLINE' => '', 'CONTENT' => $this->getLanguageService()->getLL('dmail_folders') . $content);
        // Build the <body> for the module
        $this->content = $this->doc->startPage('TYPO3 Direct Mail Navigation');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
    }
 /**
  * Main function of the module. Write the content to $this->content.
  *
  * @return void
  */
 public function main()
 {
     $backendUser = $this->getBackendUser();
     $language = $this->getLanguageService();
     // 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);
     // Checking access:
     if ($this->id && $access || $backendUser->isAdmin()) {
         // Render content:
         $this->moduleContent();
     } else {
         // If no access or if ID == zero
         $this->content .= $this->doc->header($language->getLL('statistic'));
     }
     $docHeaderButtons = $this->getHeaderButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content);
     $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']));
     // put it all together
     $this->content = $this->doc->startPage($language->getLL('statistic'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #5
0
 /**
  * The main render method
  *
  * Gathers all content and returns it
  *
  * @return string
  */
 public function render()
 {
     $docHeaderButtons = array();
     // Check if the referenced record is available
     $this->recordIsAvailable = $this->repository->hasRecord();
     if ($this->recordIsAvailable) {
         // Load necessary JavaScript
         $this->loadJavascript();
         // Load necessary CSS
         $this->loadCss();
         // Load the settings
         $this->loadSettings();
         // Localization
         $this->loadLocalization();
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         // Hook
         $this->callRenderHook();
     }
     // Getting the body content
     $markers['CONTENT'] = $this->getBodyContent();
     // Build the HTML for the module
     $content = $this->doc->startPage($this->getLanguageService()->getLL('title', true));
     $content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
     $content .= $this->doc->endPage();
     return $this->doc->insertStylesAndJS($content);
 }
    /**
     * Injects the request object for the current request or subrequest
     * As this controller goes only through the main() method, it is rather simple for now
     *
     * @param ServerRequestInterface $request the current request
     * @param ResponseInterface $response the prepared response object
     * @return ResponseInterface the response with the content
     */
    public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
    {
        $this->determineScriptUrl($request);
        $this->initVariables($request);
        $this->loadLinkHandlers();
        $this->initCurrentUrl();
        $menuData = $this->buildMenuArray();
        $renderLinkAttributeFields = $this->renderLinkAttributeFields();
        $browserContent = $this->displayedLinkHandler->render($request);
        $this->initDocumentTemplate();
        $content = $this->doc->startPage('Link Browser');
        $content .= $this->doc->getFlashMessages();
        if ($this->currentLink) {
            $content .= '<!-- Print current URL -->
				<table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
					<tr>
						<td>' . $this->getLanguageService()->getLL('currentLink', true) . ': ' . htmlspecialchars($this->currentLinkHandler->formatCurrentUrl()) . '</td>
					</tr>
				</table>';
        }
        $content .= $this->doc->getTabMenuRaw($menuData);
        $content .= $renderLinkAttributeFields;
        $content .= '<div class="linkBrowser-tabContent">' . $browserContent . '</div>';
        $content .= $this->doc->endPage();
        $response->getBody()->write($this->doc->insertStylesAndJS($content));
        return $response;
    }
Example #7
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);
 }
    /**
     * Main function, rendering the browsable page tree
     *
     * @return 	void
     * @todo Define visibility
     */
    public function main()
    {
        // Produce browse-tree:
        $tree = $this->pagetree->getBrowsableTree();
        // Outputting Temporary DB mount notice:
        if ($this->active_tempMountPoint) {
            $flashText = '
				<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) . '</a>		<br />' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.path', 1) . ': <span title="' . htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->active_tempMountPoint['_thePath'], -50)) . '</span>
			';
            $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $flashText, '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
            $this->content .= $flashMessage->render();
        }
        // Outputting page tree:
        $this->content .= '<div id="PageTreeDiv">' . $tree . '</div>';
        // Adding javascript for drag & drop activation and highlighting
        $this->content .= $this->doc->wrapScriptTags('
			' . ($this->doHighlight ? 'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '') . '
			Tree.registerDragDropHandlers();');
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers = array('IMG_RESET' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array('id' => 'treeFilterReset', 'alt' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'), 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'))), 'WORKSPACEINFO' => $this->getWorkspaceInfo(), 'CONTENT' => $this->content);
        $subparts = array();
        if (!$this->hasFilterBox) {
            $subparts['###SECOND_ROW###'] = '';
        }
        // Build the <body> for the module
        $this->content = $this->doc->startPage('TYPO3 Page Tree');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
 /**
  * Injects the request object for the current request or subrequest
  * As this controller goes only through the main() method, it is rather simple for now
  *
  * @param ServerRequestInterface $request the current request
  * @param ResponseInterface $response
  * @return ResponseInterface the response with the content
  */
 public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $this->main();
     $content = $this->doc->startPage($this->titleTag);
     $content .= $this->doc->insertStylesAndJS($this->content);
     $content .= $this->doc->endPage();
     $response->getBody()->write($content);
     return $response;
 }
    /**
     * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for folders.
     *
     * @return string HTML content for the module
     * @todo Define visibility
     */
    public function main_folder()
    {
        // include JS files
        $this->doc->getDragDropCode('folders');
        // Setting prefs for foldertree
        $this->doc->JScode .= $this->doc->wrapScriptTags('
			Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
		');
        // Starting content:
        $content = $this->doc->startPage('TBE folder selector');
        // Add the FlashMessages if any
        $content .= $this->doc->getFlashMessages();
        // Init variable:
        $parameters = explode('|', $this->bparams);
        if ($this->expandFolder) {
            $this->selectedFolder = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($this->expandFolder);
        }
        if ($this->selectedFolder) {
            $createFolder = $this->createFolder($this->selectedFolder);
        } else {
            $createFolder = '';
        }
        // Create folder tree:
        $folderTree = GeneralUtility::makeInstance('TBE_FolderTree');
        $folderTree->thisScript = $this->thisScript;
        $folderTree->ext_noTempRecyclerDirs = $this->mode == 'filedrag';
        $tree = $folderTree->getBrowsableTree(FALSE);
        list(, , $specUid) = explode('_', $this->PM);
        if ($this->selectedFolder) {
            if ($this->mode == 'filedrag') {
                $folders = $this->TBE_dragNDrop($this->selectedFolder, $parameters[3]);
            } else {
                $folders = $this->TBE_expandSubFolders($this->selectedFolder);
            }
        }
        // Putting the parts together, side by side:
        $content .= '

			<!--
				Wrapper table for folder tree / folder list:
			-->
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
				<tr>
					<td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('folderTree') . ':') . $tree . '</td>
					<td class="c-wCell" valign="top">' . $folders . '</td>
				</tr>
			</table>
			';
        // Adding create folder if applicable:
        $content .= $createFolder;
        // Add some space
        $content .= '<br /><br />';
        // Ending page, returning content:
        $content .= $this->doc->endPage();
        $content = $this->doc->insertStylesAndJS($content);
        return $content;
    }
Example #11
0
 /**
  * Main function, rendering the browsable page tree
  *
  * @return void
  */
 public function main()
 {
     // Produce browse-tree:
     $tree = $this->pagetree->getBrowsableTree();
     $docHeaderButtons = $this->getButtons();
     $markers = array('IMG_RESET' => '', 'WORKSPACEINFO' => '', 'CONTENT' => $tree);
     // Build the <body> for the module
     $this->content = $this->doc->startPage($this->getLanguageService()->sl('LLL:EXT:commerce/Resources/Private/Language/locallang_be.xml:mod_orders.navigation_title'));
     $this->content .= $this->doc->moduleBody('', $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 /**
  * Main function, rendering the folder tree
  *
  * @return void
  */
 public function main()
 {
     // Produce browse-tree:
     $tree = $this->foldertree->getBrowsableTree();
     // Outputting page tree:
     $this->content .= $tree;
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('CONTENT' => $this->content);
     $subparts = array();
     // Build the <body> for the module
     $this->content = $this->doc->startPage('TYPO3 Folder Tree');
     $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers, $subparts);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 /**
  * 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 #14
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);
 }
Example #15
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);
 }
    /**
     * Main function, rendering the content of the rename form
     *
     * @return void
     */
    public function main()
    {
        // Make page header:
        $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle'));
        $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle'));
        $pageContent .= $this->doc->spacer(5);
        $pageContent .= $this->doc->divider(5);
        if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
            $fileIdentifier = $this->fileOrFolderObject->getCombinedIdentifier();
        } else {
            $fileIdentifier = $this->fileOrFolderObject->getUid();
        }
        $code = '<form action="tce_file.php" method="post" name="editform">';
        // Making the formfields for renaming:
        $code .= '

			<div id="c-rename">
				<input type="text" name="file[rename][0][target]" value="' . htmlspecialchars($this->fileOrFolderObject->getName()) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />
				<input type="hidden" name="file[rename][0][data]" value="' . htmlspecialchars($fileIdentifier) . '" />
			</div>
		';
        // Making submit button:
        $code .= '
			<div id="c-submit">
				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.submit', TRUE) . '" />
				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
				<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
				' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
			</div>
		';
        $code .= '</form>';
        // Add the HTML as a section:
        $pageContent .= $code;
        $docHeaderButtons = array('back' => '');
        $docHeaderButtons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']);
        // Back
        if ($this->returnUrl) {
            $docHeaderButtons['back'] = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
 /**
  * Main method.
  *
  * @return void
  */
 public function main()
 {
     $listUrl = GeneralUtility::getIndpEnv('REQUEST_URI');
     // Access check!
     // The page will show only if there is a valid page and if user may access it
     if ($this->id && (is_array($this->pageRow) ? 1 : 0)) {
         // JavaScript
         $this->doc->JScode = $this->doc->wrapScriptTags('
             script_ended = 0;
             function jumpToUrl(URL) {
                 document.location = URL;
             }
             function deleteRecord(table, id, url, warning) {
                 if (
                     confirm(eval(warning))
                 ) {
                     window.location.href = "' . $this->getBackPath() . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url);
                 }
                 return false;
             }
             ' . $this->doc->redirectUrls($listUrl) . '
         ');
         $this->doc->postCode = $this->doc->wrapScriptTags('
             script_ended = 1;
             if (top.fsMod) {
                 top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
             }
         ');
         $this->doc->inDocStylesArray['mod_systemdata'] = '';
         // Render content:
         $this->moduleContent();
     } else {
         $this->content = 'Access denied or commerce pages not created yet!';
     }
     $docHeaderButtons = $this->getHeaderButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content);
     $markers['FUNC_MENU'] = $this->doc->funcMenu('', BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']));
     // put it all together
     $this->content = $this->doc->startPage($this->getLanguageService()->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageRow, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
    /**
     * Main function, rendering the content of the rename form
     *
     * @return void
     */
    public function main()
    {
        // Make page header:
        $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle'));
        $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle'));
        if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
            $fileIdentifier = $this->fileOrFolderObject->getCombinedIdentifier();
        } else {
            $fileIdentifier = $this->fileOrFolderObject->getUid();
        }
        $pageContent .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform" role="form">';
        // Making the formfields for renaming:
        $pageContent .= '

			<div class="form-group">
				<input class="form-control" type="text" name="file[rename][0][target]" value="' . htmlspecialchars($this->fileOrFolderObject->getName()) . '" ' . $this->getDocumentTemplate()->formWidth(40) . ' />
				<input type="hidden" name="file[rename][0][data]" value="' . htmlspecialchars($fileIdentifier) . '" />
			</div>
		';
        // Making submit button:
        $pageContent .= '
			<div class="form-group">
				<input class="btn btn-primary" type="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.submit', TRUE) . '" />
				<input class="btn btn-danger" type="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.cancel', TRUE) . '" onclick="backToList(); return false;" />
				<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
				' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
			</div>
		';
        $pageContent .= '</form>';
        $docHeaderButtons = array('back' => '');
        $docHeaderButtons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'file_rename');
        // 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) . '">' . \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);
    }
    /**
     * Main function, rendering the folder tree
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        // Produce browse-tree:
        $tree = $this->foldertree->getBrowsableTree();
        // Outputting page tree:
        $this->content .= $tree;
        // Adding javascript for drag & drop activation and highlighting
        $this->content .= $this->doc->wrapScriptTags('
			' . ($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '') . '
			Tree.registerDragDropHandlers();');
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers = array('IMG_RESET' => '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"') . ' id="treeFilterReset" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" />', 'CONTENT' => $this->content);
        $subparts = array();
        // Possible filter/search like in page tree
        $subparts['###SECOND_ROW###'] = '';
        // Build the <body> for the module
        $this->content = $this->doc->startPage('TYPO3 Folder Tree');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Example #20
0
 /**
  * Injects the request object for the current request or subrequest
  * As this controller goes only through the main() method, it is rather simple for now
  *
  * @param ServerRequestInterface $request the current request
  * @param ResponseInterface $response the prepared response object
  * @return ResponseInterface the response with the content
  */
 public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $this->determineScriptUrl($request);
     $this->initVariables($request);
     $this->loadLinkHandlers();
     $this->initCurrentUrl();
     $menuData = $this->buildMenuArray();
     $renderLinkAttributeFields = $this->renderLinkAttributeFields();
     $browserContent = $this->displayedLinkHandler->render($request);
     $this->initDocumentTemplate();
     $content = $this->doc->startPage('Link Browser');
     $content .= $this->doc->getFlashMessages();
     if (!empty($this->currentLinkParts)) {
         $content .= $this->renderCurrentUrl();
     }
     $content .= '<div class="link-browser-section link-browser-tabs">' . $this->doc->getTabMenuRaw($menuData) . '</div>';
     $content .= $renderLinkAttributeFields;
     $content .= $browserContent;
     $content .= $this->doc->endPage();
     $response->getBody()->write($this->doc->insertStylesAndJS($content));
     return $response;
 }
    /**
     * Main function, rendering the browsable page tree
     *
     * @return void
     */
    public function main()
    {
        // Produce browse-tree:
        $tree = $this->pagetree->getBrowsableTree();
        // Outputting Temporary DB mount notice:
        if ($this->active_tempMountPoint) {
            $flashText = '
				<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $this->getLanguageService()->sl('LLL:EXT:lang/locallang_core.xlf:labels.temporaryDBmount', true) . '</a>		<br />' . $this->getLanguageService()->sl('LLL:EXT:lang/locallang_core.xlf:labels.path', true) . ': <span title="' . htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->active_tempMountPoint['_thePath'], -50)) . '</span>
			';
            $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $flashText, '', FlashMessage::INFO);
            $this->content .= $flashMessage->render();
        }
        // Outputting page tree:
        $this->content .= '<div id="PageTreeDiv">' . $tree . '</div>';
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers = array('WORKSPACEINFO' => $this->getWorkspaceInfo(), 'CONTENT' => $this->content);
        // Build the <body> for the module
        $this->content = $this->doc->startPage('TYPO3 Page Tree');
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
    /**
     * Initialize (page output)
     *
     * @return void
     * @todo Define visibility
     */
    public function init()
    {
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->form = '<form action="alt_shortcut.php" name="shForm" method="post">';
        $this->doc->divClass = 'typo3-shortcut';
        $this->doc->JScode .= $this->doc->wrapScriptTags('
			function jump(url,modName,mainModName) {	//
					// Clear information about which entry in nav. tree that might have been highlighted.
				top.fsMod.navFrameHighlightedID = new Array();
				if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
					top.content.nav_frame.refresh_nav();
				}

				top.nextLoadModuleUrl = url;
				top.goToModule(modName);
			}
			function editSh(uid) {	//
				window.location.href="alt_shortcut.php?editShortcut="+uid;
			}
			function submitEditPage(id) {	//
				window.location.href="alt_shortcut.php?editPage="+top.rawurlencodeAndRemoveSiteUrl(id);
			}
			function changeWorkspace(workspaceId) {	//
				window.location.href="alt_shortcut.php?changeWorkspace="+top.rawurlencodeAndRemoveSiteUrl(workspaceId);
			}
			function changeWorkspacePreview(newstate) {	//
				window.location.href="alt_shortcut.php?changeWorkspacePreview="+newstate;
			}
			function refreshShortcuts() {
				window.location.href = document.URL;
			}

			');
        $this->content .= $this->doc->startPage('Shortcut frame');
    }
Example #23
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);
        }
    }
 /**
  * End page and print content
  *
  * @return void
  * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
  */
 public function printContent()
 {
     GeneralUtility::logDeprecatedFunction();
     echo $this->doc->startPage($this->titleTag) . $this->doc->insertStylesAndJS($this->content) . $this->doc->endPage();
 }
 /**
  * Main function of the module. Write the content to $this->content
  *
  * @return void
  */
 public function main()
 {
     // Template markers
     $markers = array('CSH' => '', 'FUNC_MENU' => '', 'WS_MENU' => '', 'CONTENT' => '');
     // Setting module configuration:
     $this->MCONF['name'] = $this->moduleName;
     $this->REQUEST_URI = str_replace('&sendToReview=1', '', GeneralUtility::getIndpEnv('REQUEST_URI'));
     // Draw the header.
     $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     $this->doc->setModuleTemplate('EXT:version/Resources/Private/Templates/version.html');
     // Setting up the context sensitive menu:
     $this->doc->getContextMenuCode();
     // Getting input data:
     $this->id = (int) GeneralUtility::_GP('id');
     // Record uid. Goes with table name to indicate specific record
     $this->uid = (int) GeneralUtility::_GP('uid');
     // // Record table. Goes with uid to indicate specific record
     $this->table = GeneralUtility::_GP('table');
     $this->details = GeneralUtility::_GP('details');
     // Page id. If set, indicates activation from Web>Versioning module
     $this->diffOnly = GeneralUtility::_GP('diffOnly');
     // Flag. If set, shows only the offline version and with diff-view
     // Force this setting:
     $this->MOD_SETTINGS['expandSubElements'] = true;
     $this->MOD_SETTINGS['diff'] = $this->details || $this->MOD_SETTINGS['diff'] ? 1 : 0;
     // Reading the record:
     $record = BackendUtility::getRecord($this->table, $this->uid);
     if ($record['pid'] == -1) {
         $record = BackendUtility::getRecord($this->table, $record['t3ver_oid']);
     }
     $this->recordFound = is_array($record);
     $pidValue = $this->table === 'pages' ? $this->uid : $record['pid'];
     // Checking access etc.
     if ($this->recordFound && $GLOBALS['TCA'][$this->table]['ctrl']['versioningWS'] && !$this->id) {
         $this->uid = $record['uid'];
         // Might have changed if new live record was found!
         // 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($pidValue, $this->perms_clause);
         $access = is_array($this->pageinfo) ? 1 : 0;
         if ($pidValue && $access || $GLOBALS['BE_USER']->user['admin'] && !$pidValue) {
             // If another page module was specified, replace the default Page module with the new one
             $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
             $this->pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
             // Setting publish access permission for workspace:
             $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);
             $this->versioningMgm();
         }
         // 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 id value, create empty document
         $this->content = '<h2>' . $GLOBALS['LANG']->getLL('clickAPage_header', true) . '</h2><div>' . $GLOBALS['LANG']->getLL('clickAPage_content') . '</div>';
         // 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($GLOBALS['LANG']->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #26
0
    /**
     * Rich Text Editor (RTE) user element selector
     *
     * @param array $openKeys
     * @return string
     */
    public function main_user($openKeys)
    {
        // Starting content:
        $content = $this->doc->startPage(htmlspecialchars($GLOBALS['LANG']->getLL('Insert Custom Element')));
        $RTEtsConfigParts = explode(':', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RTEtsConfigParams'));
        $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($RTEtsConfigParts[5]));
        $thisConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
        if (is_array($thisConfig['userElements.'])) {
            $categories = [];
            foreach ($thisConfig['userElements.'] as $k => $value) {
                $ki = (int) $k;
                $v = $thisConfig['userElements.'][$ki . '.'];
                if (substr($k, -1) == '.' && is_array($v)) {
                    $subcats = [];
                    $openK = $ki;
                    if ($openKeys[$openK]) {
                        $mArray = '';
                        if ($v['load'] === 'images_from_folder') {
                            $mArray = [];
                            if ($v['path'] && @is_dir(PATH_site . $v['path'])) {
                                $files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir(PATH_site . $v['path'], 'gif,jpg,jpeg,png', 0, '');
                                if (is_array($files)) {
                                    $c = 0;
                                    foreach ($files as $filename) {
                                        $iInfo = @getimagesize(PATH_site . $v['path'] . $filename);
                                        $iInfo = $this->calcWH($iInfo, 50, 100);
                                        $ks = (string) (100 + $c);
                                        $mArray[$ks] = $filename;
                                        $mArray[$ks . '.'] = ['content' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" />', '_icon' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" ' . $iInfo[3] . ' />', 'description' => $GLOBALS['LANG']->getLL('filesize') . ': ' . str_replace('&nbsp;', ' ', \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(@filesize(PATH_site . $v['path'] . $filename))) . ', ' . htmlspecialchars($GLOBALS['LANG']->getLL('pixels')) . ': ' . $iInfo[0] . 'x' . $iInfo[1]];
                                        $c++;
                                    }
                                }
                            }
                        }
                        if (is_array($mArray)) {
                            if ($v['merge']) {
                                \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($mArray, $v);
                                $v = $mArray;
                            } else {
                                $v = $mArray;
                            }
                        }
                        foreach ($v as $k2 => $dummyValue) {
                            $k2i = (int) $k2;
                            if (substr($k2, -1) == '.' && is_array($v[$k2i . '.'])) {
                                $title = trim($v[$k2i]);
                                if (!$title) {
                                    $title = '[' . htmlspecialchars($GLOBALS['LANG']->getLL('noTitle')) . ']';
                                } else {
                                    $title = htmlspecialchars($GLOBALS['LANG']->sL($title));
                                }
                                $description = htmlspecialchars($GLOBALS['LANG']->sL($v[$k2i . '.']['description'])) . '<br />';
                                if (!$v[$k2i . '.']['dontInsertSiteUrl']) {
                                    $v[$k2i . '.']['content'] = str_replace('###_URL###', $this->siteUrl, $v[$k2i . '.']['content']);
                                }
                                $logo = $v[$k2i . '.']['_icon'] ?: '';
                                $onClickEvent = '';
                                switch ((string) $v[$k2i . '.']['mode']) {
                                    case 'wrap':
                                        $wrap = explode('|', $v[$k2i . '.']['content']);
                                        $onClickEvent = 'wrapHTML(' . GeneralUtility::quoteJSvalue($wrap[0]) . ',' . GeneralUtility::quoteJSvalue($wrap[1]) . ',false);';
                                        break;
                                    case 'processor':
                                        $script = trim($v[$k2i . '.']['submitToScript']);
                                        if (substr($script, 0, 4) != 'http') {
                                            $script = $this->siteUrl . $script;
                                        }
                                        if ($script) {
                                            $onClickEvent = 'processSelection(' . GeneralUtility::quoteJSvalue($script) . ');';
                                        }
                                        break;
                                    case 'insert':
                                    default:
                                        $onClickEvent = 'insertHTML(' . GeneralUtility::quoteJSvalue($v[$k2i . '.']['content']) . ');';
                                }
                                $A = ['<a href="#" onClick="' . $onClickEvent . 'return false;">', '</a>'];
                                $subcats[$k2i] = '<tr>
									<td></td>
									<td>' . $A[0] . $logo . $A[1] . '</td>
									<td>' . $A[0] . '<strong>' . $title . '</strong><br />' . $description . $A[1] . '</td>
								</tr>';
                            }
                        }
                        ksort($subcats);
                    }
                    $categories[$ki] = implode('', $subcats);
                }
            }
            ksort($categories);
            // Render menu of the items:
            $lines = [];
            foreach ($categories as $k => $v) {
                $title = trim($thisConfig['userElements.'][$k]);
                $openK = $k;
                if (!$title) {
                    $title = '[' . htmlspecialchars($GLOBALS['LANG']->getLL('noTitle')) . ']';
                } else {
                    $title = htmlspecialchars($GLOBALS['LANG']->sL($title));
                }
                $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
                $url = (string) $uriBuilder->buildUriFromRoute('rtehtmlarea_wizard_user_elements', ['OC_key' => ($openKeys[$openK] ? 'C|' : 'O|') . $openK]);
                $lines[] = '<tr><td colspan="3"><a href="#" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('expand')) . '" onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue($url) . ');return false;"><i class="fa fa-caret-square-o-' . ($openKeys[$openK] ? 'left' : 'right') . '" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('expand')) . '"></i><strong>' . $title . '</strong></a></td></tr>';
                $lines[] = $v;
            }
            $content .= '<table class="table table-striped table-hover">' . implode('', $lines) . '</table>';
        }
        $content .= $this->doc->endPage();
        return $content;
    }
Example #27
0
    /**
     * Rich Text Editor (RTE) user element selector
     *
     * @param 	[type]		$openKeys: ...
     * @return 	[type]		...
     * @todo Define visibility
     */
    public function main_user($openKeys)
    {
        // Starting content:
        $content = $this->doc->startPage($GLOBALS['LANG']->getLL('Insert Custom Element', 1));
        $RTEtsConfigParts = explode(':', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RTEtsConfigParams'));
        $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($RTEtsConfigParts[5]));
        $thisConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
        if (is_array($thisConfig['userElements.'])) {
            $categories = array();
            foreach ($thisConfig['userElements.'] as $k => $value) {
                $ki = intval($k);
                $v = $thisConfig['userElements.'][$ki . '.'];
                if (substr($k, -1) == '.' && is_array($v)) {
                    $subcats = array();
                    $openK = $ki;
                    if ($openKeys[$openK]) {
                        $mArray = '';
                        switch ((string) $v['load']) {
                            case 'images_from_folder':
                                $mArray = array();
                                if ($v['path'] && @is_dir(PATH_site . $v['path'])) {
                                    $files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir(PATH_site . $v['path'], 'gif,jpg,jpeg,png', 0, '');
                                    if (is_array($files)) {
                                        $c = 0;
                                        foreach ($files as $filename) {
                                            $iInfo = @getimagesize(PATH_site . $v['path'] . $filename);
                                            $iInfo = $this->calcWH($iInfo, 50, 100);
                                            $ks = (string) (100 + $c);
                                            $mArray[$ks] = $filename;
                                            $mArray[$ks . '.'] = array('content' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" />', '_icon' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" ' . $iInfo[3] . ' />', 'description' => $GLOBALS['LANG']->getLL('filesize') . ': ' . str_replace('&nbsp;', ' ', \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(@filesize(PATH_site . $v['path'] . $filename))) . ', ' . $GLOBALS['LANG']->getLL('pixels', 1) . ': ' . $iInfo[0] . 'x' . $iInfo[1]);
                                            $c++;
                                        }
                                    }
                                }
                                break;
                        }
                        if (is_array($mArray)) {
                            if ($v['merge']) {
                                $v = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($mArray, $v);
                            } else {
                                $v = $mArray;
                            }
                        }
                        foreach ($v as $k2 => $dummyValue) {
                            $k2i = intval($k2);
                            if (substr($k2, -1) == '.' && is_array($v[$k2i . '.'])) {
                                $title = trim($v[$k2i]);
                                if (!$title) {
                                    $title = '[' . $GLOBALS['LANG']->getLL('noTitle', 1) . ']';
                                } else {
                                    $title = $GLOBALS['LANG']->sL($title, 1);
                                }
                                $description = $GLOBALS['LANG']->sL($v[$k2i . '.']['description'], 1) . '<br />';
                                if (!$v[$k2i . '.']['dontInsertSiteUrl']) {
                                    $v[$k2i . '.']['content'] = str_replace('###_URL###', $this->siteUrl, $v[$k2i . '.']['content']);
                                }
                                $logo = $v[$k2i . '.']['_icon'] ? $v[$k2i . '.']['_icon'] : '';
                                $onClickEvent = '';
                                switch ((string) $v[$k2i . '.']['mode']) {
                                    case 'wrap':
                                        $wrap = explode('|', $v[$k2i . '.']['content']);
                                        $onClickEvent = 'wrapHTML(' . $GLOBALS['LANG']->JScharCode($wrap[0]) . ',' . $GLOBALS['LANG']->JScharCode($wrap[1]) . ',false);';
                                        break;
                                    case 'processor':
                                        $script = trim($v[$k2i . '.']['submitToScript']);
                                        if (substr($script, 0, 4) != 'http') {
                                            $script = $this->siteUrl . $script;
                                        }
                                        if ($script) {
                                            $onClickEvent = 'processSelection(' . $GLOBALS['LANG']->JScharCode($script) . ');';
                                        }
                                        break;
                                    case 'insert':
                                    default:
                                        $onClickEvent = 'insertHTML(' . $GLOBALS['LANG']->JScharCode($v[$k2i . '.']['content']) . ');';
                                        break;
                                }
                                $A = array('<a href="#" onClick="' . $onClickEvent . 'return false;">', '</a>');
                                $subcats[$k2i] = '<tr>
									<td><img src="clear.gif" width="18" height="1" /></td>
									<td class="bgColor4" valign="top">' . $A[0] . $logo . $A[1] . '</td>
									<td class="bgColor4" valign="top">' . $A[0] . '<strong>' . $title . '</strong><br />' . $description . $A[1] . '</td>
								</tr>';
                            }
                        }
                        ksort($subcats);
                    }
                    $categories[$ki] = implode('', $subcats);
                }
            }
            ksort($categories);
            // Render menu of the items:
            $lines = array();
            foreach ($categories as $k => $v) {
                $title = trim($thisConfig['userElements.'][$k]);
                $openK = $k;
                if (!$title) {
                    $title = '[' . $GLOBALS['LANG']->getLL('noTitle', 1) . ']';
                } else {
                    $title = $GLOBALS['LANG']->sL($title, 1);
                }
                $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', 1) . '" onClick="jumpToUrl(\'?OC_key=' . ($openKeys[$openK] ? 'C|' : 'O|') . $openK . '\');return false;"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/' . ($openKeys[$openK] ? 'minus' : 'plus') . 'bullet.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('expand', 1) . '" /><strong>' . $title . '</strong></a></td></tr>';
                $lines[] = $v;
            }
            $content .= '<table border="0" cellpadding="1" cellspacing="1">' . implode('', $lines) . '</table>';
        }
        $content .= $this->doc->endPage();
        return $content;
    }
Example #28
0
    /**
     * Main function, redering the actual content of the editing page
     *
     * @return void
     */
    public function main()
    {
        $docHeaderButtons = $this->getButtons();
        $this->content = $this->doc->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle'));
        // Hook	before compiling the output
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) {
            $preOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'];
            if (is_array($preOutputProcessingHook)) {
                $hookParameters = array('content' => &$this->content, 'target' => &$this->target);
                foreach ($preOutputProcessingHook as $hookFunction) {
                    GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        $pageContent = $this->doc->header($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle') . ' ' . htmlspecialchars($this->fileObject->getName()));
        $pageContent .= $this->doc->spacer(2);
        $code = '';
        $extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'];
        try {
            if (!$extList || !GeneralUtility::inList($extList, $this->fileObject->getExtension())) {
                throw new \Exception('Files with that extension are not editable.');
            }
            // Read file content to edit:
            $fileContent = $this->fileObject->getContents();
            // Making the formfields
            $hValue = BackendUtility::getModuleUrl('file_edit', array('target' => $this->origTarget, 'returnUrl' => $this->returnUrl));
            // Edit textarea:
            $code .= '
				<div id="c-edit">
					<textarea rows="30" name="file[editfile][0][data]" wrap="off" ' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="text-monospace t3js-enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea>
					<input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" />
					<input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" />
					' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
				</div>
				<br />';
            // Make shortcut:
            if ($this->getBackendUser()->mayMakeShortcut()) {
                $docHeaderButtons['shortcut'] = $this->doc->makeShortcutIcon('target', '', 'file_edit', 1);
            } else {
                $docHeaderButtons['shortcut'] = '';
            }
        } catch (\Exception $e) {
            $code .= sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'), $extList);
        }
        // Ending of section and outputting editing form:
        $pageContent .= $this->doc->sectionEnd();
        $pageContent .= $code;
        // Hook	after compiling the output
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) {
            $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'];
            if (is_array($postOutputProcessingHook)) {
                $hookParameters = array('pageContent' => &$pageContent, 'target' => &$this->target);
                foreach ($postOutputProcessingHook as $hookFunction) {
                    GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
                }
            }
        }
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => '', 'BUTTONS' => $docHeaderButtons, 'PATH' => $this->title, 'CONTENT' => $pageContent);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
    /**
     * 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);
    }
Example #30
0
    /**
     * Initialises the Class
     *
     * @return void
     */
    protected function init()
    {
        // Setting GET vars (used in frameset script):
        $this->P = GeneralUtility::_GP('P');
        // Setting GET vars (used in colorpicker script):
        $this->colorValue = GeneralUtility::_GP('colorValue');
        $this->fieldChangeFunc = GeneralUtility::_GP('fieldChangeFunc');
        $this->fieldChangeFuncHash = GeneralUtility::_GP('fieldChangeFuncHash');
        $this->fieldName = GeneralUtility::_GP('fieldName');
        $this->formName = GeneralUtility::_GP('formName');
        $this->md5ID = GeneralUtility::_GP('md5ID');
        $this->exampleImg = GeneralUtility::_GP('exampleImg');
        // Resolving image (checking existence etc.)
        $this->imageError = '';
        if ($this->exampleImg) {
            $this->pickerImage = GeneralUtility::getFileAbsFileName($this->exampleImg, 1, 1);
            if (!$this->pickerImage || !@is_file($this->pickerImage)) {
                $this->imageError = 'ERROR: The image, "' . $this->exampleImg . '", could not be found!';
            }
        }
        $update = array();
        if ($this->areFieldChangeFunctionsValid()) {
            // Setting field-change functions:
            $fieldChangeFuncArr = unserialize($this->fieldChangeFunc);
            unset($fieldChangeFuncArr['alert']);
            foreach ($fieldChangeFuncArr as $v) {
                $update[] = 'parent.opener.' . $v;
            }
        }
        // Initialize document object:
        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Wizard/Colorpicker', 'function(Colorpicker) {
				Colorpicker.setFieldChangeFunctions({
					fieldChangeFunctions: function() {' . implode('', $update) . '}
				});
			}');
        // Start page:
        $this->content .= $this->doc->startPage($this->getLanguageService()->getLL('colorpicker_title'));
    }