Ejemplo n.º 1
0
    /**
     * Get folder configuration record
     *
     * @param Folder $folder
     * @return array
     */
    public function getFolderRecord(Folder $folder)
    {
        if (!isset(self::$folderRecordCache[$folder->getCombinedIdentifier()]) || !array_key_exists($folder->getCombinedIdentifier(), self::$folderRecordCache)) {
            $record = $this->getDatabase()->exec_SELECTgetSingleRow('*', 'tx_falsecuredownload_folder', 'storage = ' . (int) $folder->getStorage()->getUid() . '
				AND folder_hash = ' . $this->getDatabase()->fullQuoteStr($folder->getHashedIdentifier(), 'tx_falsecuredownload_folder'));
            // cache results
            self::$folderRecordCache[$folder->getCombinedIdentifier()] = $record;
        }
        return self::$folderRecordCache[$folder->getCombinedIdentifier()];
    }
Ejemplo n.º 2
0
 /**
  * @throws InsufficientFolderAccessPermissionsException
  * @throws \RuntimeException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->number = GeneralUtility::_GP('number');
     $this->target = $combinedIdentifier = GeneralUtility::_GP('target');
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     // create the folder object
     if ($combinedIdentifier) {
         $this->folderObject = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier);
     }
     // Cleaning and checking target directory
     if (!$this->folderObject) {
         $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1294586845);
     }
     if ($this->folderObject->getStorage()->getUid() === 0) {
         throw new InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889838);
     }
     $pathInfo = ['combined_identifier' => $this->folderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     $this->moduleTemplate->addJavaScriptCode('CreateFolderInlineJavaScript', 'var path = "' . $this->target . '";
         function reload(a) {
         if (!changed || (changed && confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.redraw')) . '))) {
                 var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '";
                 window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('file_newfolder')) . '+params;
             }
         }
         function backToList() {
             top.goToModule("file_FilelistList");
         }
         var changed = 0;');
 }
Ejemplo n.º 3
0
 /**
  * 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);
             }
         }
     }
 }
Ejemplo n.º 4
0
    /**
     * This function renders the upload form
     *
     * @return string The HTML form as a string, ready for outputting
     */
    public function renderUploadForm()
    {
        // Make checkbox for "overwrite"
        $content = '
			<div id="c-override">
				<p><label for="overwriteExistingFiles"><input type="checkbox" class="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="replace" /> ' . $this->getLanguageService()->getLL('overwriteExistingFiles', 1) . '</label></p>
				<p>&nbsp;</p>
				<p>' . $this->getLanguageService()->getLL('uploadMultipleFilesInfo', true) . '</p>
			</div>
			';
        // Produce the number of upload-fields needed:
        $content .= '
			<div id="c-upload">
		';
        // Adding 'size="50" ' for the sake of Mozilla!
        $content .= '
				<input type="file" multiple="true" name="upload_1[]" />
				<input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($this->folderObject->getCombinedIdentifier()) . '" />
				<input type="hidden" name="file[upload][1][data]" value="1" /><br />
			';
        $content .= '
			</div>
		';
        // Submit button:
        $content .= '
			<div id="c-submit">
				<input type="hidden" name="redirect" value="' . $this->returnUrl . '" /><br />
				<input class="btn btn-default" type="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.submit', true) . '" />
			</div>
		';
        return $content;
    }
 /**
  * renders <f:then> child if the current visitor ...
  * otherwise renders <f:else> child.
  *
  * @param Folder $folder
  * @return string
  */
 public function render(Folder $folder)
 {
     /** @var $leafStateService \BeechIt\FalSecuredownload\Service\LeafStateService */
     $leafStateService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('BeechIt\\FalSecuredownload\\Service\\LeafStateService');
     $feUser = !empty($GLOBALS['TSFE']) ? $GLOBALS['TSFE']->fe_user : false;
     if ($feUser && $leafStateService->getLeafStateForUser($feUser, $folder->getCombinedIdentifier())) {
         return $this->renderThenChild();
     } else {
         return $this->renderElseChild();
     }
 }
Ejemplo n.º 6
0
 /**
  * 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()) . '&amp;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()) . '&amp;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;
 }
Ejemplo n.º 7
0
 /**
  * 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;
 }
Ejemplo n.º 8
0
    /**
     * Main function, rendering the content of the rename form
     *
     * @return void
     */
    public function main()
    {
        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) . '" />
			</div>
		';
        $pageContent .= '</form>';
        // Create buttons
        $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
        // csh button
        $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('file_rename');
        $buttonBar->addButton($cshButton);
        // back button
        if ($this->returnUrl) {
            $backButton = $buttonBar->makeLinkButton()->sethref(GeneralUtility::linkThisUrl($this->returnUrl))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL));
            $buttonBar->addButton($backButton);
        }
        // set header
        $this->content = '<h1>' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_rename.php.pagetitle') . '</h1>';
        // add section
        $this->content .= $this->moduleTemplate->section('', $pageContent);
        $this->moduleTemplate->setContent($this->content);
    }
Ejemplo n.º 9
0
    /**
     * 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);
    }
Ejemplo n.º 10
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param int $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  */
 protected function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $lang = $this->getLanguageService();
     $out = '';
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $this->getBackendUser()->getTSConfigVal('options.noThumbsInEB');
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = GeneralUtility::implodeArrayForUrl('', $this->getUrlParameters(['identifier' => $this->selectedFolder->getCombinedIdentifier()]));
         $thumbNailCheck = '<div class="checkbox" style="padding:5px 0 15px 0"><label for="checkDisplayThumbs">' . BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', true) . '</label></div>';
         $out .= $thumbNailCheck;
     } else {
         $out .= '<div style="padding-top: 15px;"></div>';
     }
     return $out;
 }
Ejemplo n.º 11
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param int $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  */
 protected function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $lang = $this->getLanguageService();
     $labelToggleSelection = $lang->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', true);
     $labelImportSelection = $lang->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', true);
     $out = $this->doc->spacer(10) . '<div>' . '<a href="#" id="t3-js-importSelection" title="' . $labelImportSelection . '">' . $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL) . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" id="t3-js-toggleSelection" title="' . $labelToggleSelection . '">' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL) . $labelToggleSelection . '</a>' . '</div>';
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $this->getBackendUser()->getTSConfigVal('options.noThumbsInEB');
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = GeneralUtility::implodeArrayForUrl('', $this->getUrlParameters(['identifier' => $this->selectedFolder->getCombinedIdentifier()]));
         $thumbNailCheck = '<div class="checkbox"><label for="checkDisplayThumbs">' . BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', true) . '</label></div>';
         $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
     } else {
         $out .= $this->doc->spacer(15);
     }
     return $out;
 }
Ejemplo n.º 12
0
 /**
  * Generates the "PM" string to sent to expand/collapse items
  *
  * @param string $mountKey The mount key / storage UID
  * @param bool $doExpand Whether to expand/collapse
  * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folder object
  * @param string $treeName The name of the tree
  * @return string
  */
 protected function generateExpandCollapseParameter($mountKey = NULL, $doExpand = FALSE, \TYPO3\CMS\Core\Resource\Folder $folderObject = NULL, $treeName = NULL)
 {
     $parts = array($mountKey !== NULL ? $mountKey : $this->bank, $doExpand == 1 ? 1 : 0, $folderObject !== NULL ? GeneralUtility::md5int($folderObject->getCombinedIdentifier()) : '', $treeName !== NULL ? $treeName : $this->treeName);
     return implode('_', $parts);
 }
    /**
     * Creates the edit control section
     *
     * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
     * @return string HTML-table
     * @todo Define visibility
     */
    protected function makeEdit62($fileOrFolderObject)
    {
        $cells = array();
        $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
        // Edit metadata of file
        try {
            if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->isIndexed() && $fileOrFolderObject->checkActionPermission('write')) {
                $metaData = $fileOrFolderObject->_getMetaData();
                $data = array('sys_file_metadata' => array($metaData['uid'] => 'edit'));
                $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
                $cells['editmetadata'] = '<a href="#" onclick="' . $editOnClick . '" title="Edit Metadata of this file">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
            } else {
                $cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty');
            }
        } catch (\Exception $e) {
            $cells['editmetadata'] = IconUtility::getSpriteIcon('empty-empty');
        }
        // Edit file content (if editable)
        if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File') && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
            $editOnClick = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'file_edit.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
            $cells['edit'] = '<a href="#" onclick="' . $editOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
        } else {
            $cells['edit'] = IconUtility::getSpriteIcon('empty-empty');
        }
        // rename the file
        if ($fileOrFolderObject->checkActionPermission('rename')) {
            $renameOnClick = 'top.content.list_frame.location.href = top.TS.PATH_typo3+\'file_rename.php?target=' . rawurlencode($fullIdentifier) . '&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
            $cells['rename'] = '<a href="#" onclick="' . $renameOnClick . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . IconUtility::getSpriteIcon('actions-edit-rename') . '</a>';
        } else {
            $cells['rename'] = IconUtility::getSpriteIcon('empty-empty');
        }
        if ($fileOrFolderObject->checkActionPermission('read')) {
            if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\Folder')) {
                $infoOnClick = 'top.launchView( \'_FOLDER\', \'' . $fullIdentifier . '\');return false;';
            } elseif (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\File')) {
                $infoOnClick = 'top.launchView( \'_FILE\', \'' . $fullIdentifier . '\');return false;';
            }
            $cells['info'] = '<a href="#" onclick="' . $infoOnClick . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
        } else {
            $cells['info'] = IconUtility::getSpriteIcon('empty-empty');
        }
        // delete the file
        if ($fileOrFolderObject->checkActionPermission('delete')) {
            $identifier = $fileOrFolderObject->getIdentifier();
            if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
                $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' (There are %s reference(s) to this folder!)');
            } else {
                $referenceCountText = BackendUtility::referenceCount('sys_file', $identifier, ' (There are %s reference(s) to this file!)');
            }
            if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
                $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
            } else {
                $confirmationCheck = '1 == 1';
            }
            $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
            $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars($removeOnClick) . '"  title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
        } else {
            $cells['delete'] = IconUtility::getSpriteIcon('empty-empty');
        }
        // Hook for manipulating edit icons.
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
                $hookObject = GeneralUtility::getUserObj($classData);
                if (!$hookObject instanceof \TYPO3\CMS\Filelist\FileListEditIconHookInterface) {
                    throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface', 1235225797);
                }
                $hookObject->manipulateEditIcons($cells, $this);
            }
        }
        $cells = array_merge($cells, $this->addAdditionalCells($fileOrFolderObject));
        // Compile items into a DIV-element:
        return '							<!-- EDIT CONTROLS: -->
											<div class="typo3-editCtrl">
												' . implode('
												', $cells) . '
											</div>';
    }
 /**
  * Update folder permissions records when a folder is renamed
  *
  * @param Folder $folder
  * @param string $newName
  */
 public function postFolderRename(Folder $folder, $newName)
 {
     $newFolder = $folder->getParentFolder()->getSubfolder($newName);
     $oldStorageUid = $folder->getStorage()->getUid();
     $newStorageUid = $newFolder->getStorage()->getUid();
     $this->utilityService->updateFolderRecord($oldStorageUid, $folder->getHashedIdentifier(), $folder->getIdentifier(), array('storage' => $newStorageUid, 'folder_hash' => $newFolder->getHashedIdentifier(), 'folder' => $newFolder->getIdentifier()));
     if (!empty($this->folderMapping[$folder->getCombinedIdentifier()])) {
         $newMapping = $this->getSubFolderIdentifiers($newFolder);
         foreach ($this->folderMapping[$folder->getCombinedIdentifier()] as $key => $folderInfo) {
             $this->utilityService->updateFolderRecord($oldStorageUid, $folderInfo[0], $folderInfo[1], array('storage' => $newStorageUid, 'folder_hash' => $newMapping[$key][0], 'folder' => $newMapping[$key][1]));
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * Make reference count
  *
  * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
  * @return string HTML
  * @todo Define visibility
  */
 public function makeRef($fileOrFolderObject)
 {
     if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FolderInterface) {
         return '-';
     }
     // Look up the path:
     $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('sys_file', 'sys_refindex') . ' AND ref_uid = ' . $fileOrFolderObject->getUid() . ' AND deleted=0');
     return $this->generateReferenceToolTip($rows, '\'_FILE\', \'' . $fileOrFolderObject->getCombinedIdentifier() . '\'');
 }
 /**
  * Gets the items criteria.
  *
  * @return string
  */
 public function getItemsCriteria()
 {
     return $this->folder->getCombinedIdentifier();
 }
Ejemplo n.º 17
0
 /**
  * Checks if a given object or identifier is within a container, e.g. if
  * a file or folder is within another folder.
  * This can e.g. be used to check for webmounts.
  *
  * @param \TYPO3\CMS\Core\Resource\Folder $container
  * @param mixed $content An object or an identifier to check
  * @return boolean TRUE if $content is within $container
  */
 public function isWithin(\TYPO3\CMS\Core\Resource\Folder $container, $content)
 {
     // TODO: Implement isWithin() method.
     error_log('CALLED: ' . __FUNCTION__ . ' with ' . $content . ' in folder ' . $container->getCombinedIdentifier());
 }
Ejemplo n.º 18
0
 /**
  * Returns TRUE if folder that is in current storage  is set as
  * processing folder for one of the existing storages
  *
  * @param Folder $folder
  * @return bool
  */
 public function isProcessingFolder(Folder $folder)
 {
     $isProcessingFolder = false;
     foreach ($this->getProcessingFolders() as $processingFolder) {
         if ($folder->getCombinedIdentifier() === $processingFolder->getCombinedIdentifier()) {
             $isProcessingFolder = true;
             break;
         }
     }
     return $isProcessingFolder;
 }
Ejemplo n.º 19
0
 /**
  * Makes an upload form for uploading files to the filemount the user is browsing.
  * The files are uploaded to the tce_file.php script in the core which will handle the upload.
  *
  * @param Folder $folderObject
  * @param string[] $allowedExtensions
  *
  * @return string HTML for an upload form.
  */
 public function uploadForm(Folder $folderObject, array $allowedExtensions)
 {
     if (!$folderObject->checkActionPermission('write')) {
         return '';
     }
     // Read configuration of upload field count
     $userSetting = $this->getBackendUser()->getTSConfigVal('options.folderTree.uploadFieldsInLinkBrowser');
     $count = isset($userSetting) ? (int) $userSetting : 1;
     if ($count === 0) {
         return '';
     }
     $count = (int) $count === 0 ? 1 : (int) $count;
     // Create header, showing upload path:
     $header = $folderObject->getIdentifier();
     $lang = $this->getLanguageService();
     // Create a list of allowed file extensions with the readable format "youtube, vimeo" etc.
     $fileExtList = array();
     foreach ($allowedExtensions as $fileExt) {
         if (GeneralUtility::verifyFilenameAgainstDenyPattern($fileExt)) {
             $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>';
         }
     }
     $formAction = BackendUtility::getModuleUrl('tce_file');
     $combinedIdentifier = $folderObject->getCombinedIdentifier();
     $markup = array();
     $markup[] = '<div class="element-browser-section element-browser-upload">';
     $markup[] = '   <form action="' . htmlspecialchars($formAction) . '" method="post" name="editform" enctype="multipart/form-data">';
     $markup[] = '   <h3>' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle', true) . ':</h3>';
     $markup[] = '   <p><strong>' . $lang->getLL('path', true) . ':</strong>' . htmlspecialchars($header) . '</p>';
     // Traverse the number of upload fields:
     for ($a = 1; $a <= $count; $a++) {
         $markup[] = '<div class="form-group">';
         $markup[] = '<span class="btn btn-default btn-file">';
         $markup[] = '<input type="file" multiple="multiple" name="upload_' . $a . '[]" size="50" />';
         $markup[] = '</span>';
         $markup[] = '</div>';
         $markup[] = '<input type="hidden" name="file[upload][' . $a . '][target]" value="' . htmlspecialchars($combinedIdentifier) . '" />';
         $markup[] = '<input type="hidden" name="file[upload][' . $a . '][data]" value="' . $a . '" />';
     }
     $redirectValue = $this->parameterProvider->getScriptUrl() . GeneralUtility::implodeArrayForUrl('', $this->parameterProvider->getUrlParameters(['identifier' => $combinedIdentifier]));
     $markup[] = '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />';
     if (!empty($fileExtList)) {
         $markup[] = '<div class="form-group">';
         $markup[] = '    <label>';
         $markup[] = $lang->sL('LLL:EXT:lang/locallang_core.xlf:cm.allowedFileExtensions', true) . '<br/>';
         $markup[] = '    </label>';
         $markup[] = '    <div class="form-control">';
         $markup[] = implode(' ', $fileExtList);
         $markup[] = '    </div>';
         $markup[] = '</div>';
     }
     $markup[] = '<div class="checkbox">';
     $markup[] = '    <label>';
     $markup[] = '    <input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" />';
     $markup[] = $lang->sL('LLL:EXT:lang/locallang_misc.xlf:overwriteExistingFiles', true);
     $markup[] = '    </label>';
     $markup[] = '</div>';
     $markup[] = '<input class="btn btn-default" type="submit" name="submit" value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.submit', true) . '" />';
     $markup[] = '   </form>';
     $markup[] = '</div>';
     $code = implode(LF, $markup);
     // Add online media
     // Create a list of allowed file extensions in a readable format "youtube, vimeo" etc.
     $fileExtList = array();
     $onlineMediaFileExt = OnlineMediaHelperRegistry::getInstance()->getSupportedFileExtensions();
     foreach ($onlineMediaFileExt as $fileExt) {
         if (GeneralUtility::verifyFilenameAgainstDenyPattern($fileExt) && (empty($allowedExtensions) || in_array($fileExt, $allowedExtensions, true))) {
             $fileExtList[] = '<span class="label label-success">' . strtoupper(htmlspecialchars($fileExt)) . '</span>';
         }
     }
     if (!empty($fileExtList)) {
         $formAction = BackendUtility::getModuleUrl('online_media');
         $markup = array();
         $markup[] = '<div class="element-browser-section element-browser-mediaurls">';
         $markup[] = '   <form action="' . htmlspecialchars($formAction) . '" method="post" name="editform1" id="typo3-addMediaForm" enctype="multipart/form-data">';
         $markup[] = '<h3>' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media', true) . ':</h3>';
         $markup[] = '<p><strong>' . $lang->getLL('path', true) . ':</strong>' . htmlspecialchars($header) . '</p>';
         $markup[] = '<div class="form-group">';
         $markup[] = '<input type="hidden" name="file[newMedia][0][target]" value="' . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />';
         $markup[] = '<input type="hidden" name="file[newMedia][0][allowed]" value="' . htmlspecialchars(implode(',', $allowedExtensions)) . '" />';
         $markup[] = '<input type="text" name="file[newMedia][0][url]" class="form-control" placeholder="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.placeholder', true) . '" />';
         $markup[] = '<button class="btn btn-default">' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.submit', true) . '</button>';
         $markup[] = '</div>';
         $markup[] = '<div class="form-group">';
         $markup[] = '    <label>';
         $markup[] = $lang->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.allowedProviders') . '<br/>';
         $markup[] = '    </label>';
         $markup[] = '    <div class="form-control">';
         $markup[] = implode(' ', $fileExtList);
         $markup[] = '    </div>';
         $markup[] = '</div>';
         $markup[] = '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />';
         $markup[] = '</div>';
         $markup[] = '</form>';
         $markup[] = '</div>';
         $code .= implode(LF, $markup);
     }
     return $code;
 }
Ejemplo n.º 20
0
 /**
  * Generates the "PM" string to sent to expand/collapse items
  *
  * @param string $mountKey The mount key / storage UID
  * @param bool $doExpand Whether to expand/collapse
  * @param Folder $folderObject The folder object
  * @param string $treeName The name of the tree
  *
  * @return string
  */
 protected function generateExpandCollapseParameter($mountKey = null, $doExpand = false, Folder $folderObject = null, $treeName = null)
 {
     $parts = array($mountKey !== null ? $mountKey : $this->bank, $doExpand == 1 ? 1 : 0, $folderObject !== null ? GeneralUtility::md5int($folderObject->getCombinedIdentifier()) : '', $treeName !== null ? $treeName : $this->treeName);
     return implode('_', $parts);
 }
Ejemplo n.º 21
0
 /**
  * Make reference count
  *
  * @param \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
  * @return string HTML
  * @todo Define visibility
  */
 public function makeRef($fileOrFolderObject)
 {
     if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\FolderInterface) {
         return '-';
     }
     // Look up the file in the sys_refindex.
     // Exclude sys_file_metadata records as these are no use references
     $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table=\'sys_file\' AND ref_uid = ' . (int) $fileOrFolderObject->getUid() . ' AND deleted=0 AND tablename != "sys_file_metadata"');
     return $this->generateReferenceToolTip($rows, '\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
 }
Ejemplo n.º 22
0
    /**
     * For TBE: Makes a form for creating new folders in the filemount the user is browsing.
     * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
     *
     * @param \TYPO3\CMS\Core\Resource\Folder $folderObject Absolute filepath on server in which to create the new folder.
     * @return string HTML for the create folder form.
     * @todo Define visibility
     */
    public function createFolder(\TYPO3\CMS\Core\Resource\Folder $folderObject)
    {
        if (!$folderObject->checkActionPermission('write')) {
            return '';
        }
        // Don't show Folder-create form if it's denied
        if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
            return '';
        }
        // Create header, showing upload path:
        $header = $folderObject->getIdentifier();
        $code = '

			<!--
				Form, for creating new folders:
			-->
			<form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform2" id="typo3-crFolderForm">
				<table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder">
					<tr>
						<td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle') . ':') . '</td>
					</tr>
					<tr>
						<td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
					</tr>
					<tr>
						<td class="c-wCell c-hCell">';
        // Create the new-folder name field:
        $a = 1;
        $code .= '<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" />' . '<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />';
        // Make footer of upload form, including the submit button:
        $redirectValue = $this->thisScript . '?act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
        $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />' . '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit', 1) . '" />';
        $code .= '</td>
					</tr>
				</table>
			</form>';
        return $code;
    }
Ejemplo n.º 23
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param integer $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  * @todo Define visibility
  */
 public function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', TRUE);
     $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', TRUE);
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
     $out = $this->doc->spacer(10) . '<div>' . '<a href="#" onclick="BrowseLinks.Selector.handle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/import.gif', 'width="12" height="12"') . ' title="' . $labelImportSelection . '" alt="" /> ' . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" onclick="BrowseLinks.Selector.toggle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/clip_select.gif', 'width="12" height="12"') . ' title="' . $labelToggleSelection . '" alt="" /> ' . $labelToggleSelection . '</a>' . '</div>';
     $thumbNailCheck = '';
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
         $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], GeneralUtility::_GP('M') ? '' : $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
         $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
     } else {
         $out .= $this->doc->spacer(15);
     }
     return $out;
 }
Ejemplo n.º 24
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param int $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  */
 public function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $lang = $this->getLanguageService();
     $labelToggleSelection = $lang->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', TRUE);
     $labelImportSelection = $lang->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', TRUE);
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $this->getBackendUserAuthentication()->getTSConfigVal('options.noThumbsInEB');
     $out = $this->doc->spacer(10) . '<div>' . '<a href="#" onclick="BrowseLinks.Selector.handle()">' . IconUtility::getSpriteIcon('actions-document-import-t3d', array('title' => $labelImportSelection)) . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" onclick="BrowseLinks.Selector.toggle()">' . IconUtility::getSpriteIcon('actions-document-select', array('title' => $labelToggleSelection)) . $labelToggleSelection . '</a>' . '</div>';
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
         $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], GeneralUtility::_GP('M') ? '' : $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
         $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
     } else {
         $out .= $this->doc->spacer(15);
     }
     return $out;
 }
Ejemplo n.º 25
0
 /**
  * Make reference count
  *
  * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
  * @return string HTML
  */
 public function makeRef($fileOrFolderObject)
 {
     if ($fileOrFolderObject instanceof FolderInterface) {
         return '-';
     }
     // Look up the file in the sys_refindex.
     // Exclude sys_file_metadata records as these are no use references
     $databaseConnection = $this->getDatabaseConnection();
     $table = 'sys_refindex';
     $referenceCount = $databaseConnection->exec_SELECTcountRows('*', $table, 'ref_table=' . $databaseConnection->fullQuoteStr('sys_file', $table) . ' AND ref_uid=' . (int) $fileOrFolderObject->getUid() . ' AND deleted=0' . ' AND tablename != ' . $databaseConnection->fullQuoteStr('sys_file_metadata', $table));
     return $this->generateReferenceToolTip($referenceCount, '\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
 }
Ejemplo n.º 26
0
 /**
  * Find the affected page ids by going through all the flexforms of all
  * active fal gallery content elements and checking if the current folder
  * is contained in the settings folder.
  *
  * @param Folder $folder The folder to check
  *
  * @return array
  */
 protected function getAffectedPageIds(Folder $folder)
 {
     $pids = array();
     if ($folder->getStorage()->getDriverType() === 'Local') {
         $res = $this->databaseConnection->sql_query("\n\t\t\t\tSELECT\n\t\t\t\t\tpid,\n\t\t\t\t\tExtractValue(pi_flexform, '/T3FlexForms/data/sheet[@index=''list'']/language/field[@index=''settings.default.folder'']/value') as folder\n\t\t\t\tFROM\n\t\t\t\t\ttt_content\n\t\t\t\tWHERE\n\t\t\t\t\tlist_type = 'falgallery_pi1'\n\t\t\t\t\tAND deleted = 0\n\t\t\t\t\tAND hidden = 0\n\t\t\t\t\tAND ExtractValue(pi_flexform, '/T3FlexForms/data/sheet[@index=''list'']/language/field[@index=''settings.default.folder'']/value') LIKE 'file:" . $folder->getCombinedIdentifier() . "%'");
         while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
             $pids[] = $row['pid'];
         }
         $this->databaseConnection->sql_free_result($res);
     }
     return $pids;
 }
Ejemplo n.º 27
0
    /**
     * @param Folder $parentFolder
     * @return string HTML code
     */
    protected function renderFolders(Folder $parentFolder)
    {
        if (!$parentFolder->checkActionPermission('read')) {
            return '';
        }
        $content = '';
        $lang = $this->getLanguageService();
        $folders = $parentFolder->getSubfolders();
        $folderIdentifier = $parentFolder->getCombinedIdentifier();
        // Create headline (showing number of folders):
        $content .= '<h3>' . sprintf($lang->getLL('folders', true) . ' (%s):', count($folders)) . '</h3>';
        $titleLength = (int) $this->getBackendUser()->uc['titleLen'];
        // Create the header of current folder:
        $folderIcon = '<a href="#" data-folder-id="' . htmlspecialchars($folderIdentifier) . '" data-close="1">';
        $folderIcon .= $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL);
        $folderIcon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs($parentFolder->getName(), $titleLength));
        $folderIcon .= '</a>';
        $content .= $folderIcon . '<br />';
        $lines = array();
        // Traverse the folder list:
        foreach ($folders as $subFolder) {
            $subFolderIdentifier = $subFolder->getCombinedIdentifier();
            // Create folder icon:
            $icon = '<span style="width: 16px; height: 16px; display: inline-block;"></span>';
            $icon .= '<span title="' . htmlspecialchars($subFolder->getName()) . '">' . $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL) . '</span>';
            // Create links for adding the folder:
            $aTag = '<a href="#" data-folder-id="' . htmlspecialchars($folderIdentifier) . '" data-close="0">';
            $aTag_alt = '<a href="#" data-folder-id="' . htmlspecialchars($folderIdentifier) . '" data-close="1">';
            if (strstr($subFolderIdentifier, ',') || strstr($subFolderIdentifier, '|')) {
                // In case an invalid character is in the filepath, display error message:
                $errorMessage = sprintf($lang->getLL('invalidChar', true), ', |');
                $aTag = '<a href="#" class="t3-js-folderIdError" data-message="' . $errorMessage . '">';
            }
            $aTag_e = '</a>';
            // Combine icon and folderpath:
            $foldernameAndIcon = $aTag_alt . $icon . htmlspecialchars(GeneralUtility::fixed_lgd_cs($subFolder->getName(), $titleLength)) . $aTag_e;
            $lines[] = '
				<tr class="bgColor4">
					<td nowrap="nowrap">' . $foldernameAndIcon . '&nbsp;</td>
					<td>' . $aTag . '<span title="' . $lang->getLL('addToList', true) . '">' . $this->iconFactory->getIcon('actions-edit-add', Icon::SIZE_SMALL)->render() . '</span>' . $aTag_e . '</td>
					<td>&nbsp;</td>
				</tr>';
            $lines[] = '
					<tr>
						<td colspan="3"><span style="width: 1px; height: 3px; display: inline-block;"></span></td>
					</tr>';
        }
        // Wrap all the rows in table tags:
        $content .= '

	<!--
		Folder listing
	-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-folderList">
				' . implode('', $lines) . '
			</table>';
        return $content;
    }
Ejemplo n.º 28
0
 /**
  * Make reference count
  *
  * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
  * @return string HTML
  */
 public function makeRef($fileOrFolderObject)
 {
     if ($fileOrFolderObject instanceof FolderInterface) {
         return '-';
     }
     // Look up the file in the sys_refindex.
     // Exclude sys_file_metadata records as these are no use references
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_refindex');
     $referenceCount = $queryBuilder->count('*')->from('sys_refindex')->where($queryBuilder->expr()->eq('ref_table', $queryBuilder->quote('sys_file')))->andWhere($queryBuilder->expr()->eq('ref_uid', (int) $fileOrFolderObject->getUid()))->andWhere($queryBuilder->expr()->neq('tablename', $queryBuilder->quote('sys_file_metadata')))->execute()->fetchColumn();
     return $this->generateReferenceToolTip($referenceCount, '\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
 }