/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ public function getButtons() { $buttons = array('csh' => '', 'shortcut' => '', 'upload' => '', 'new' => ''); // Add shortcut if ($this->getBackendUser()->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->moduleName); } // FileList Module CSH: $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_module'); // Upload button (only if upload to this directory is allowed) if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) { $buttons['upload'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('file_upload', array('target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()))) . '" id="button-upload" title="' . $this->getLanguageService()->makeEntities($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . IconUtility::getSpriteIcon('actions-edit-upload') . '</a>'; } // New folder button if ($this->folderObject && $this->folderObject->checkActionPermission('write') && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))) { $buttons['new'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('file_newfolder', array('target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()))) . '" title="' . $this->getLanguageService()->makeEntities($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>'; } return $buttons; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array */ protected function registerButtons() { /** @var ButtonBar $buttonBar */ $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar(); /** @var IconFactory $iconFactory */ $iconFactory = $this->view->getModuleTemplate()->getIconFactory(); /** @var $resourceFactory ResourceFactory */ $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class); $lang = $this->getLanguageService(); // Refresh page $refreshLink = GeneralUtility::linkThisScript(['target' => rawurlencode($this->folderObject->getCombinedIdentifier()), 'imagemode' => $this->filelist->thumbs]); $refreshButton = $buttonBar->makeLinkButton()->setHref($refreshLink)->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.reload'))->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)); $buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT); // Level up try { $currentStorage = $this->folderObject->getStorage(); $parentFolder = $this->folderObject->getParentFolder(); if ($parentFolder->getIdentifier() !== $this->folderObject->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) { $levelUpClick = 'top.document.getElementsByName("navigation")[0].contentWindow.Tree.highlightActiveItem("file","folder' . GeneralUtility::md5int($parentFolder->getCombinedIdentifier()) . '_"+top.fsMod.currentBank)'; $levelUpButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('file_FilelistList', ['id' => $parentFolder->getCombinedIdentifier()]))->setOnClick($levelUpClick)->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.upOneLevel'))->setIcon($iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL)); $buttonBar->addButton($levelUpButton, ButtonBar::BUTTON_POSITION_LEFT, 1); } } catch (\Exception $e) { } // Shortcut if ($this->getBackendUser()->mayMakeShortcut()) { $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName('file_FilelistList'); $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT); } // Upload button (only if upload to this directory is allowed) if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) { $uploadButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('file_upload', ['target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()]))->setClasses('t3js-drag-uploader-trigger')->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.upload'))->setIcon($iconFactory->getIcon('actions-edit-upload', Icon::SIZE_SMALL)); $buttonBar->addButton($uploadButton, ButtonBar::BUTTON_POSITION_LEFT, 1); } // New folder button if ($this->folderObject && $this->folderObject->checkActionPermission('write') && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))) { $newButton = $buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('file_newfolder', ['target' => $this->folderObject->getCombinedIdentifier(), 'returnUrl' => $this->filelist->listURL()]))->setTitle($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.new'))->setIcon($iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)); $buttonBar->addButton($newButton, ButtonBar::BUTTON_POSITION_LEFT, 1); } // Add paste button if clipboard is initialized if ($this->filelist->clipObj instanceof Clipboard && $this->folderObject->checkActionPermission('write')) { $elFromTable = $this->filelist->clipObj->elFromTable('_FILE'); if (!empty($elFromTable)) { $addPasteButton = true; $elToConfirm = []; foreach ($elFromTable as $key => $element) { $clipBoardElement = $resourceFactory->retrieveFileOrFolderObject($element); if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $this->folderObject)) { $addPasteButton = false; } $elToConfirm[$key] = $clipBoardElement->getName(); } if ($addPasteButton) { $confirmText = $this->filelist->clipObj->confirmMsgText('_FILE', $this->folderObject->getReadablePath(), 'into', $elToConfirm); $pasteButton = $buttonBar->makeLinkButton()->setHref($this->filelist->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier()))->setClasses('t3js-modal-trigger')->setDataAttributes(['severity' => 'warning', 'content' => $confirmText, 'title' => $lang->getLL('clip_paste')])->setTitle($lang->getLL('clip_paste'))->setIcon($iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)); $buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 2); } } } }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array All available buttons as an assoc. array * @todo Define visibility */ public function getButtons() { $buttons = array('csh' => '', 'shortcut' => '', 'upload' => '', 'new' => ''); // Add shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); } // FileList Module CSH: $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE); // Upload button (only if upload to this directory is allowed) if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) { $buttons['upload'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_upload.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) . '&returnUrl=' . rawurlencode($this->filelist->listURL()) . '" id="button-upload" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-upload') . '</a>'; } // New folder button if ($this->folderObject && $this->folderObject->checkActionPermission('write') && ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File') || $this->folderObject->checkActionPermission('add'))) { $buttons['new'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_newfolder.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) . '&returnUrl=' . rawurlencode($this->filelist->listURL()) . '" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.new', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-new') . '</a>'; } return $buttons; }