From 4b380ca119143a574074f61dc643ab814b819b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Wed, 23 Mar 2011 20:07:07 +0000 Subject: [PATCH] Improved nextmatch row aoi and added AJAX-actions for createdir and symlink to filemanager_ui --- etemplate/js/nextmatch_action.js | 9 ++++-- filemanager/inc/class.filemanager_ui.inc.php | 30 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/etemplate/js/nextmatch_action.js b/etemplate/js/nextmatch_action.js index d683465939..f2e3bf5be4 100644 --- a/etemplate/js/nextmatch_action.js +++ b/etemplate/js/nextmatch_action.js @@ -54,8 +54,13 @@ function nextmatchRowAOI(_node) }); $(aoi.checkBox).change(function() { - aoi.updateState(EGW_AO_STATE_SELECTED, this.checked, EGW_AO_SHIFT_STATE_MULTI); - }); + aoi.updateState(EGW_AO_STATE_SELECTED, this.checked, EGW_AO_SHIFT_STATE_MULTI); + }); + + // Don't execute the default action when double clicking on an entry + $(aoi.checkBox).dblclick(function() { + return false; + }); aoi.doSetState = function(_state) { var selected = egwBitIsSet(_state, EGW_AO_STATE_SELECTED); diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index ef4c847a47..04a3f678ed 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -1171,6 +1171,36 @@ class filemanager_ui break; + case "createdir": + $curdir = $selected[0]; + $newdir = $selected[1]; + + $dst = egw_vfs::concat($curdir, $newdir); + if (egw_vfs::mkdir($dst, null, STREAM_MKDIR_RECURSIVE)) + { + $arr['msg'] = lang("Directory successfully created."); + } + else + { + $arr['msg'] = lang("Error while creating directory."); + } + break; + + case "symlink": + $curdir = $selected[0]; + $target = $selected[1]; + + $link = egw_vfs::concat($curdir, egw_vfs::basename($target)); + $abs_target = $target[0] == '/' ? $target : egw_vfs::concat($target, $target); + if (!egw_vfs::stat($abs_target)) + { + $arr['msg'] = lang('Link target %1 not found!', egw_vfs::decodePath($abs_target)); + break; + } + $arr['msg'] = egw_vfs::symlink($target,$link) ? + lang('Symlink to %1 created.',$target) : lang('Error creating symlink to target %1!',egw_vfs::decodePath($target)); + break; + default: $arr['msg'] = self::action($action,$selected,null,$arr['errs'],$arr['dirs'],$arr['files']); break;