示例#1
0
    /**
     * Creates the clipboard control pad
     *
     * @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-table
     * @todo Define visibility
     */
    public function makeClip($fileOrFolderObject)
    {
        if (!$fileOrFolderObject->checkActionPermission('read')) {
            return '';
        }
        $cells = array();
        $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
        $md5 = GeneralUtility::shortmd5($fullIdentifier);
        // For normal clipboard, add copy/cut buttons:
        if ($this->clipObj->current == 'normal') {
            $isSel = $this->clipObj->isSelected('_FILE', $md5);
            $cells[] = '<a href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, $isSel == 'copy')) . '">' . IconUtility::getSpriteIcon('actions-edit-copy' . ($isSel == 'copy' ? '-release' : ''), array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE))) . '</a>';
            // we can only cut if file can be moved
            if ($fileOrFolderObject->checkActionPermission('move')) {
                $cells[] = '<a href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, $isSel == 'cut')) . '">' . IconUtility::getSpriteIcon('actions-edit-cut' . ($isSel == 'cut' ? '-release' : ''), array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE))) . '</a>';
            } else {
                $cells[] = IconUtility::getSpriteIcon('empty-empty');
            }
        } else {
            // For numeric pads, add select checkboxes:
            $n = '_FILE|' . $md5;
            $this->CBnames[] = $n;
            $checked = $this->clipObj->isSelected('_FILE', $md5) ? ' checked="checked"' : '';
            $cells[] = '<input type="hidden" name="CBH[' . $n . ']" value="0" />' . '<input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" class="smallCheckboxes"' . $checked . ' />';
        }
        // Display PASTE button, if directory:
        $elFromTable = $this->clipObj->elFromTable('_FILE');
        if (is_a($fileOrFolderObject, 'TYPO3\\CMS\\Core\\Resource\\Folder') && count($elFromTable) && $fileOrFolderObject->checkActionPermission('write')) {
            $addPasteButton = TRUE;
            foreach ($elFromTable as $element) {
                $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
                if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $fileOrFolderObject)) {
                    $addPasteButton = FALSE;
                }
            }
            if ($addPasteButton) {
                $cells[] = '<a class="btn" href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $fullIdentifier)) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $fullIdentifier, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_pasteInto', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
            }
        }
        // Compile items into a DIV-element:
        return '							<!-- CLIPBOARD PANEL: -->
											<div class="typo3-clipCtrl">
												' . implode('
												', $cells) . '
											</div>';
    }
示例#2
0
 /**
  * Creates the clipboard control pad
  *
  * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
  * @return string HTML-table
  */
 public function makeClip($fileOrFolderObject)
 {
     if (!$fileOrFolderObject->checkActionPermission('read')) {
         return '';
     }
     $cells = array();
     $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
     $fullName = $fileOrFolderObject->getName();
     $md5 = GeneralUtility::shortmd5($fullIdentifier);
     // For normal clipboard, add copy/cut buttons:
     if ($this->clipObj->current == 'normal') {
         $isSel = $this->clipObj->isSelected('_FILE', $md5);
         $cells[] = '<a class="btn btn-default"" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, $isSel == 'copy')) . '">' . IconUtility::getSpriteIcon('actions-edit-copy' . ($isSel == 'copy' ? '-release' : ''), array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE))) . '</a>';
         // we can only cut if file can be moved
         if ($fileOrFolderObject->checkActionPermission('move')) {
             $cells[] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, $isSel == 'cut')) . '">' . IconUtility::getSpriteIcon('actions-edit-cut' . ($isSel == 'cut' ? '-release' : ''), array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE))) . '</a>';
         } else {
             $cells[] = $this->spaceIcon;
         }
     } else {
         // For numeric pads, add select checkboxes:
         $n = '_FILE|' . $md5;
         $this->CBnames[] = $n;
         $checked = $this->clipObj->isSelected('_FILE', $md5) ? ' checked="checked"' : '';
         $cells[] = '<label class="btn btn-default btn-checkbox"><input type="hidden" name="CBH[' . $n . ']" value="0" /><input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" ' . $checked . ' /><span class="t3-icon fa"></span></label>';
     }
     // Display PASTE button, if directory:
     $elFromTable = $this->clipObj->elFromTable('_FILE');
     if ($fileOrFolderObject instanceof Folder && !empty($elFromTable) && $fileOrFolderObject->checkActionPermission('write')) {
         $addPasteButton = TRUE;
         $elToConfirm = array();
         foreach ($elFromTable as $key => $element) {
             $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
             if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $fileOrFolderObject)) {
                 $addPasteButton = FALSE;
             }
             $fileInfo = $clipBoardElement->getStorage()->getFileInfoByIdentifier(substr(strstr($element, ':'), 1));
             $elToConfirm[$key] = $fileInfo['name'];
         }
         if ($addPasteButton) {
             $cells[] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $fullIdentifier)) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $fullName, 'into', $elToConfirm)) . '" title="' . $this->getLanguageService()->getLL('clip_pasteInto', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
         }
     }
     // Compile items into a DIV-element:
     return ' <div class="btn-group" role="group">' . implode('', $cells) . '</div>';
 }
示例#3
0
 /**
  * Creates the clipboard control pad
  *
  * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
  * @return string HTML-table
  */
 public function makeClip($fileOrFolderObject)
 {
     if (!$fileOrFolderObject->checkActionPermission('read')) {
         return '';
     }
     $cells = [];
     $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
     $fullName = $fileOrFolderObject->getName();
     $md5 = GeneralUtility::shortMD5($fullIdentifier);
     // For normal clipboard, add copy/cut buttons:
     if ($this->clipObj->current === 'normal') {
         $isSel = $this->clipObj->isSelected('_FILE', $md5);
         $copyTitle = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.copy'));
         $cutTitle = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.cut'));
         $copyIcon = $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render();
         $cutIcon = $this->iconFactory->getIcon('actions-edit-cut', Icon::SIZE_SMALL)->render();
         if ($isSel === 'copy') {
             $copyIcon = $this->iconFactory->getIcon('actions-edit-copy-release', Icon::SIZE_SMALL)->render();
         } elseif ($isSel === 'cut') {
             $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL)->render();
         }
         $cells[] = '<a class="btn btn-default"" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, $isSel === 'copy')) . '" title="' . $copyTitle . '">' . $copyIcon . '</a>';
         // we can only cut if file can be moved
         if ($fileOrFolderObject->checkActionPermission('move')) {
             $cells[] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, $isSel === 'cut')) . '" title="' . $cutTitle . '">' . $cutIcon . '</a>';
         } else {
             $cells[] = $this->spaceIcon;
         }
     } else {
         // For numeric pads, add select checkboxes:
         $n = '_FILE|' . $md5;
         $this->CBnames[] = $n;
         $checked = $this->clipObj->isSelected('_FILE', $md5) ? ' checked="checked"' : '';
         $cells[] = '<input type="hidden" name="CBH[' . $n . ']" value="0" /><label class="btn btn-default btn-checkbox"><input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" ' . $checked . ' /><span class="t3-icon fa"></span></label>';
     }
     // Display PASTE button, if directory:
     $elFromTable = $this->clipObj->elFromTable('_FILE');
     if ($fileOrFolderObject instanceof Folder && !empty($elFromTable) && $fileOrFolderObject->checkActionPermission('write')) {
         $addPasteButton = true;
         $elToConfirm = [];
         foreach ($elFromTable as $key => $element) {
             $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
             if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $fileOrFolderObject)) {
                 $addPasteButton = false;
             }
             $elToConfirm[$key] = $clipBoardElement->getName();
         }
         if ($addPasteButton) {
             $cells[] = '<a class="btn btn-default t3js-modal-trigger" ' . ' href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $fullIdentifier)) . '"' . ' data-content="' . htmlspecialchars($this->clipObj->confirmMsgText('_FILE', $fullName, 'into', $elToConfirm)) . '"' . ' data-severity="warning"' . ' data-title="' . htmlspecialchars($this->getLanguageService()->getLL('clip_pasteInto')) . '"' . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('clip_pasteInto')) . '"' . '>' . $this->iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render() . '</a>';
         }
     }
     // Compile items into a DIV-element:
     return ' <div class="btn-group" role="group">' . implode('', $cells) . '</div>';
 }