Index: components/class.tx_dam_actionsFile.php =================================================================== --- components/class.tx_dam_actionsFile.php (revision 34999) +++ components/class.tx_dam_actionsFile.php (working copy) @@ -1022,11 +1022,157 @@ +class tx_dam_action_copyFile extends tx_dam_action_renameFile { + var $cmd = 'tx_dam_cmd_filecopy'; + /** + * Returns true if the action is of the wanted type + * + * @param string $type Action type + * @param array $itemInfo Item info array. Eg pathInfo, meta data array + * @param array $env Environment array. Can be set with setEnv() too. + * @return boolean + */ + function isValid ($type, $itemInfo=NULL, $env=NULL) { + $valid = $this->isTypeValid ($type, $itemInfo, $env); + if ($valid) { + $valid = (($this->itemInfo['__type'] === 'file') OR ($this->itemInfo['__type'] === 'record' AND $this->itemInfo['__table'] === 'tx_dam')) AND ($itemInfo['file_status'] != TXDAM_status_file_missing); + } + return $valid; + } + /** + * Returns the icon image tag. + * Additional attributes to the image tagcan be added. + * + * @param string $addAttribute Additional attributes + * @return string + */ + function getIcon ($addAttribute='') { + $iconFile = 'gfx/clip_copy.gif'; + $icon = 'env['backPath'], $iconFile, 'width="13" height="12"').$this->_cleanAttribute($addAttribute).' alt="" />'; + + return $icon; + } + + + /** + * Returns the short label like: Delete + * + * @return string + */ + function getLabel () { + return $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.copy'); + } + + + /** + * Returns a command array for the current type + * + * @return array Command array + * @access private + */ + function _getCommand() { + + $filepath = tx_dam::file_absolutePath($this->itemInfo); + + $script = $this->env['defaultCmdScript']; + $script .= '?CMD='.$this->cmd; + $script .= '&vC='.$GLOBALS['BE_USER']->veriCode(); + $script .= '&file[]='.rawurlencode($filepath); + + if ($this->type === 'context') { + $commands['url'] = $script; + } else { + $script .= '&returnUrl='.rawurlencode($this->env['returnUrl']); + $commands['href'] = $script; + } + + return $commands; + } + +} + + + +class tx_dam_action_moveFile extends tx_dam_action_renameFile { + + var $cmd = 'tx_dam_cmd_filemove'; + + /** + * Returns true if the action is of the wanted type + * + * @param string $type Action type + * @param array $itemInfo Item info array. Eg pathInfo, meta data array + * @param array $env Environment array. Can be set with setEnv() too. + * @return boolean + */ + function isValid ($type, $itemInfo=NULL, $env=NULL) { + $valid = $this->isTypeValid ($type, $itemInfo, $env); + if ($valid) { + $valid = (($this->itemInfo['__type'] === 'file') OR ($this->itemInfo['__type'] === 'record' AND $this->itemInfo['__table'] === 'tx_dam')) AND ($itemInfo['file_status'] != TXDAM_status_file_missing); + } + return $valid; + } + + + /** + * Returns the icon image tag. + * Additional attributes to the image tagcan be added. + * + * @param string $addAttribute Additional attributes + * @return string + */ + function getIcon ($addAttribute='') { + + $iconFile = 'gfx/move_page.gif'; + $icon = 'env['backPath'], $iconFile, 'width="13" height="12"').$this->_cleanAttribute($addAttribute).' alt="" />'; + + return $icon; + } + + + /** + * Returns the short label like: Delete + * + * @return string + */ + function getLabel () { + return $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:move'); + } + + + /** + * Returns a command array for the current type + * + * @return array Command array + * @access private + */ + function _getCommand() { + + $filepath = tx_dam::file_absolutePath($this->itemInfo); + + $script = $this->env['defaultCmdScript']; + $script .= '?CMD='.$this->cmd; + $script .= '&vC='.$GLOBALS['BE_USER']->veriCode(); + $script .= '&file[]='.rawurlencode($filepath); + + if ($this->type === 'context') { + $commands['url'] = $script; + } else { + $script .= '&returnUrl='.rawurlencode($this->env['returnUrl']); + $commands['href'] = $script; + } + + return $commands; + } + +} + + class tx_dam_actionsFile { } Index: ext_tables.php =================================================================== --- ext_tables.php (revision 34999) +++ ext_tables.php (working copy) @@ -320,8 +320,10 @@ tx_dam::register_action ('tx_dam_action_newTextfile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_newTextfile'); tx_dam::register_action ('tx_dam_action_editFileRecord', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_editFileRecord'); tx_dam::register_action ('tx_dam_action_viewFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_viewFile'); + tx_dam::register_action ('tx_dam_action_copyFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_copyFile'); tx_dam::register_action ('tx_dam_action_editFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_editFile'); tx_dam::register_action ('tx_dam_action_infoFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_infoFile'); + tx_dam::register_action ('tx_dam_action_moveFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_moveFile'); tx_dam::register_action ('tx_dam_action_renameFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_renameFile'); tx_dam::register_action ('tx_dam_action_replaceFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_replaceFile'); tx_dam::register_action ('tx_dam_action_deleteFile', 'EXT:dam/components/class.tx_dam_actionsFile.php:&tx_dam_action_deleteFile');