/**
  * Additional access check
  *
  * @return	boolean Return true if access is granted
  */
 function accessCheck()
 {
     return tx_dam::access_checkFileOperation('editFile');
 }
 /**
  * Additional access check
  *
  * @return	boolean Return true if access is granted
  */
 function accessCheck()
 {
     return tx_dam::access_checkFileOperation('renameFolder');
 }
 function main(&$backRef, $menuItems, $file, $uid)
 {
     // Returns directly, because the clicked item was not a file
     if ($backRef->cmLevel == 0 && $uid != '') {
         return $menuItems;
     }
     // Returns directly, because the clicked item was not the second level menu from DAM records
     if ($backRef->cmLevel == 1 && t3lib_div::_GP('subname') != 'tx_dam_cm_file') {
         return $menuItems;
     }
     $this->backRef =& $backRef;
     // this is second level menu from DAM records
     $fileDAM = t3lib_div::_GP('txdamFile');
     $file = $fileDAM ? $fileDAM : $file;
     if (@is_file($file)) {
         $item = tx_dam::file_compileInfo($file);
         $permsEdit = tx_dam::access_checkFile($item) && tx_dam::access_checkFileOperation('editFile');
         $permsDelete = tx_dam::access_checkFile($item) && tx_dam::access_checkFileOperation('deleteFile');
     } elseif (@is_dir($file)) {
         $item = tx_dam::path_compileInfo($file);
         $permsEdit = tx_dam::access_checkPath($item) && tx_dam::access_checkFileOperation('renameFolder');
         $permsDelete = tx_dam::access_checkPath($item) && tx_dam::access_checkFileOperation('deleteFolder');
     } else {
         return $menuItems;
     }
     // clear the existing menu now and fill it with DAM specific things
     $damMenuItems = array();
     // see typo3/alt_clickmenu.php:clickmenu::enableDisableItems() for iParts[3]
     // which is called after this function
     $backRef->iParts[3] = '';
     $actionCall = t3lib_div::makeInstance('tx_dam_actionCall');
     if (is_array($backRef->disabledItems)) {
         foreach ($backRef->disabledItems as $idName) {
             $actionCall->removeAction($idName);
         }
     }
     $actionCall->setRequest('context', $item);
     $actionCall->setEnv('returnUrl', t3lib_div::_GP('returnUrl'));
     $actionCall->setEnv('backPath', $backRef->PH_backPath);
     $actionCall->setEnv('defaultCmdScript', PATH_txdam_rel . 'mod_cmd/index.php');
     $actionCall->setEnv('defaultEditScript', PATH_txdam_rel . 'mod_edit/index.php');
     $actionCall->setEnv('actionPerms', tx_dam::access_checkFileOperation());
     $actionCall->setEnv('permsEdit', $permsEdit);
     $actionCall->setEnv('permsDelete', $permsDelete);
     $actionCall->setEnv('cmLevel', $backRef->cmLevel);
     $actionCall->setEnv('cmParent', t3lib_div::_GP('parentname'));
     $actionCall->initActions(true);
     $actions = $actionCall->renderActionsContextMenu(true);
     foreach ($actions as $id => $action) {
         if ($action['isDivider']) {
             $damMenuItems[$id] = 'spacer';
         } else {
             $onclick = $action['onclick'] ? $action['onclick'] : $this->createOnClick($action['url'], $action['dontHide']);
             $damMenuItems[$id] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($action['label']), $backRef->excludeIcon($action['icon']), $onclick, $action['onlyCM'], $action['dontHide']);
         }
     }
     // clear the file context menu, allow additional items from extensions,
     // like TemplaVoila, and the display constraints
     // once a DAM file is found
     foreach ($menuItems as $key => $var) {
         if (!t3lib_div::inList('edit,rename,info,copy,cut,delete', $key) && !array_key_exists($key, $damMenuItems)) {
             $damMenuItems[$key] = $var;
         }
     }
     return $damMenuItems;
 }
    /**
     * Making the form for delete
     *
     * @return	string		HTML content
     */
    function renderForm()
    {
        global $BACK_PATH, $LANG, $TYPO3_CONF_VARS;
        $content = '';
        if (!$this->path_isEmpty($this->folder['dir_path_absolute']) and !tx_dam::access_checkFileOperation('deleteFolderRecursively')) {
            $content .= $GLOBALS['SOBE']->getMessageBox($LANG->getLL('actionDenied'), $LANG->getLL('tx_dam_cmd_folderdelete.messageRecursiveDenied', 1), $this->pObj->buttonBack(0), 2);
        } else {
            $msg = array();
            $this->pObj->markers['FOLDER_INFO'] = tx_dam_guiFunc::getFolderInfoBar($this->folder);
            $msg[] = ' ';
            if (!$this->path_isEmpty($this->folder['dir_path_absolute'])) {
                $msg[] = '<strong><span class="typo3-red">' . $LANG->getLL('labelWarning', 1) . '</span> ' . $LANG->getLL('tx_dam_cmd_folderdelete.messageRecursive', 1) . '</strong>';
            }
            $msg[] = sprintf($LANG->sL('LLL:EXT:lang/locallang_core.xml:mess.delete', 1), $this->folder['dir_path_relative']);
            if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
                $buttons = '
					<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:cm.delete', 1) . '" />
					<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.cancel', 1) . '" onclick="jumpBack(); return false;" />';
            }
            $this->pObj->docHeaderButtons['SAVE'] = '<input class="c-inputButton" name="_savedok"' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/deletedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:cm.delete', 1) . '" height="16" type="image" width="16">';
            $this->pObj->docHeaderButtons['CLOSE'] = '<a href="#" onclick="jumpBack(); return false;"><img' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.cancel', 1) . '" alt="" height="16" width="16"></a>';
            $content .= $GLOBALS['SOBE']->getMessageBox($GLOBALS['SOBE']->pageTitle, $msg, $buttons, 1);
            $content .= '<input type="hidden" name="folder" value="' . $this->folder['dir_path_absolute'] . '" />
					<input type="hidden" name="data[delete_confirmed]" value="1" />';
        }
        if (!$this->path_isEmpty($this->folder['dir_path_absolute'])) {
            $content .= $GLOBALS['SOBE']->doc->spacer(5);
            require_once PATH_txdam . 'lib/class.tx_dam_filebrowser.php';
            $filelist = t3lib_div::makeInstance('tx_dam_filebrowser');
            $filelisting = $filelist->getStaticFolderList($this->folder['dir_path_absolute'], false);
            $content .= $GLOBALS['SOBE']->doc->section($LANG->getLL('folder', 1), $filelisting, 0, 0, 0);
        }
        return $content;
    }