コード例 #1
0
    /**
     * initialization for the visual parts of the class
     * Use template rendering only if this is a non-AJAX call
     *
     * @return void
     */
    public function initPage()
    {
        // Setting highlight mode:
        $this->doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight');
        $this->moduleTemplate->setBodyTag('<body id="ext-backend-Modules-FileSystemNavigationFrame-index-php">');
        // Adding javascript code for drag&drop and the filetree as well as the click menu code
        $dragDropCode = '
			Tree.ajaxID = "sc_alt_file_navframe_expandtoggle";
			Tree.registerDragDropHandlers()';
        if ($this->doHighlight) {
            $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace;
            $dragDropCode .= '
			Tree.highlightClass = "' . $hlClass . '";
			Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);
			';
        }
        // Adding javascript for drag & drop activation and highlighting
        $pageRenderer = $this->moduleTemplate->getPageRenderer();
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree', 'function() {
            DragDrop.table = "folders";
            ' . $dragDropCode . '
        }');
        // Setting JavaScript for menu.
        $inlineJs = ($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . '
		// Function, loading the list frame from navigation tree:
		function jumpTo(id, linkObj, highlightID, bank) {
			var theUrl = top.currentSubScript;
			if (theUrl.indexOf("?") != -1) {
				theUrl += "&id=" + id
			} else {
				theUrl += "?id=" + id
			}
			top.fsMod.currentBank = bank;
			top.TYPO3.Backend.ContentContainer.setUrl(theUrl);

			' . ($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '') . '
			if (linkObj) { linkObj.blur(); }
			return false;
		}
		' . ($this->cMR ? ' jumpTo(top.fsMod.recentIds[\'file\'],\'\');' : '');
        $this->moduleTemplate->getPageRenderer()->addJsInlineCode('FileSystemNavigationFrame', $inlineJs);
    }