/**
     * 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 = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableTitleHighlight');
        // Create template object:
        $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_file_navframe.html');
        $this->doc->showFlashMessages = FALSE;
        // Adding javascript code for AJAX (prototype), drag&drop and the filetree as well as the click menu code
        $this->doc->getDragDropCode('folders');
        $this->doc->getContextMenuCode();
        // Setting JavaScript for menu.
        $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . '

		// setting prefs for foldertree
		Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";

		// Function, loading the list frame from navigation tree:
		function jumpTo(id, linkObj, highlightID, bank) {
			var theUrl = top.TS.PATH_typo3 + 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\'],\'\');' : ''));
    }
    /**
     * 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;
    }
    /**
     * 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 = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableTitleHighlight');
        // If highlighting is active, define the CSS class for the active item depending on the workspace
        if ($this->doHighlight) {
            $hlClass = $GLOBALS['BE_USER']->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace;
        }
        // Create template object:
        $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_db_navframe.html');
        $this->doc->showFlashMessages = FALSE;
        // Get HTML-Template
        // Adding javascript code for AJAX (prototype), drag&drop and the pagetree as well as the click menu code
        $this->doc->getDragDropCode('pages');
        $this->doc->getContextMenuCode();
        /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
        $pageRenderer = $this->doc->getPageRenderer();
        $pageRenderer->loadScriptaculous('effects');
        $pageRenderer->loadExtJS();
        if ($this->hasFilterBox) {
            $pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/pagetreefiltermenu.js');
        }
        $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . '
		// setting prefs for pagetree and drag & drop
		' . ($this->doHighlight ? 'Tree.highlightClass = "' . $hlClass . '";' : '') . '

		// Function, loading the list frame from navigation tree:
		function jumpTo(id, linkObj, highlightID, bank) { //
			var theUrl = top.TS.PATH_typo3 + 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("web", highlightID + "_" + bank);' : '') . '
			if (linkObj) { linkObj.blur(); }
			return false;
		}
		' . ($this->cMR ? 'jumpTo(top.fsMod.recentIds[\'web\'],\'\');' : '') . ($this->hasFilterBox ? 'var TYPO3PageTreeFilter = new PageTreeFilter();' : '') . '

		');
        $this->doc->bodyTagId = 'typo3-pagetree';
    }
    /**
     * 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:
        $doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight');
        // Create template object:
        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_db_navframe.html');
        $this->doc->showFlashMessages = FALSE;
        // Get HTML-Template
        // Adding javascript for drag & drop activation and highlighting
        $dragDropCode = 'Tree.registerDragDropHandlers();';
        // If highlighting is active, define the CSS class for the active item depending on the workspace
        if ($doHighlight) {
            $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $this->getBackendUser()->workspace;
            $dragDropCode .= '
				Tree.highlightClass = "' . $hlClass . '";
				Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);';
        }
        // Adding javascript code for drag&drop and the pagetree as well as the click menu code
        $this->doc->getDragDropCode('pages', $dragDropCode);
        $this->doc->getContextMenuCode();
        /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
        $pageRenderer = $this->doc->getPageRenderer();
        $pageRenderer->loadExtJS();
        $this->doc->JScode .= $this->doc->wrapScriptTags(($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);

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

		');
        $this->doc->bodyTagId = 'typo3-pagetree';
    }
    /**
     * 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');
        // Create template object:
        $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
        $this->doc->bodyTagId = 'ext-backend-Modules-FileSystemNavigationFrame-index-php';
        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_file_navframe.html');
        $this->doc->showFlashMessages = false;
        // 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
        $this->doc->getDragDropCode('folders', $dragDropCode);
        $this->doc->getContextMenuCode();
        // Setting JavaScript for menu.
        $this->doc->JScode .= $this->doc->wrapScriptTags(($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\'],\'\');' : ''));
    }
    /**
     * 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 = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableTitleHighlight');
        // Create template object:
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->setModuleTemplate('templates/alt_file_navframe.html');
        $this->doc->showFlashMessages = FALSE;
        // Adding javascript code for AJAX (prototype), drag&drop and the filetree as well as the click menu code
        $this->doc->getDragDropCode('folders');
        $this->doc->getContextMenuCode();
        // Setting JavaScript for menu.
        $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . '

		function initFlashUploader(path) {
			path = decodeURIComponent(path);
			var flashUploadOptions = {
				uploadURL: top.TS.PATH_typo3 + "ajax.php",
				uploadFileSizeLimit: "' . \TYPO3\CMS\Core\Utility\GeneralUtility::getMaxUploadFileSize() . '",
				uploadFileTypes: {
					allow:  "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '",
					deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '"
				},
				uploadFilePostName: "upload_1",
				uploadPostParams: {
					"file[upload][1][target]": path,
					"file[upload][1][data]": 1,
					"file[upload][1][charset]": "utf-8",
					"ajaxID": "TYPO3_tcefile::process"
				}
			};

				// get the flashUploaderWindow instance from the parent frame
			var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
				// add an additional function inside the container to show the checkbox option
			var infoComponent = new top.Ext.Panel({
				autoEl: { tag: "div" },
				height: "auto",
				bodyBorder: false,
				border: false,
				hideBorders: true,
				cls: "t3-upload-window-infopanel",
				id: "t3-upload-window-infopanel-addition",
				html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\'
			});
			flashUploader.add(infoComponent);

				// do a reload of this frame once all uploads are done
			flashUploader.on("totalcomplete", function() {
				jumpTo (top.rawurlencode(path), "", "", "");
			});

				// this is the callback function that delivers the additional post parameter to the flash application
			top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
				var uploader = top.TYPO3.getInstance("FileUploadWindow");
				if (uploader.isVisible()) {
					uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
				}
			};
		}


		// setting prefs for foldertree
		Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";

		// Function, loading the list frame from navigation tree:
		function jumpTo(id, linkObj, highlightID, bank) {
			var theUrl = top.TS.PATH_typo3 + 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);' : '') . '
			' . (!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ') . '
			return false;
		}
		' . ($this->cMR ? ' jumpTo(top.fsMod.recentIds[\'file\'],\'\');' : ''));
    }
Ejemplo n.º 7
0
    /**
     * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for folders.
     *
     * @return string HTML content for the module
     */
    protected function main_folder()
    {
        // include JS files
        // Setting prefs for foldertree
        $this->doc->getDragDropCode('folders', 'Tree.ajaxID = "sc_alt_file_navframe_expandtoggle";');
        // 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 = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($this->expandFolder);
        }
        if ($this->selectedFolder) {
            $createFolder = $this->createFolder($this->selectedFolder);
        } else {
            $createFolder = '';
        }
        // Create folder tree:
        /** @var ElementBrowserFolderTreeView $folderTree */
        $folderTree = GeneralUtility::makeInstance(ElementBrowserFolderTreeView::class);
        $folderTree->setLinkParameterProvider($this);
        $folderTree->thisScript = $this->thisScript;
        $folderTree->ext_noTempRecyclerDirs = $this->mode === 'filedrag';
        $tree = $folderTree->getBrowsableTree();
        $folders = '';
        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($this->getLanguageService()->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;
    }