From 0d3fcf0e34902845852297696024204919ffc164 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Fri, 19 Dec 2003 09:24:41 +0000 Subject: [PATCH] - If a file shall be copied and the destination file already exists, a confirmation dialog, which asks if the file should be overwritten, will be displayed. If the destination file already exists and it is a directory, copying is not allowed. - Some small enhancements --- modules/Command.pm | 61 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/modules/Command.pm b/modules/Command.pm index 635d43d..1718982 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2003-12-02 +# Last modified: 2003-12-18 # use strict; @@ -385,7 +385,7 @@ sub exec_endedit($$) } else { - return error("Saving of file '".encode_entities($virtual)."' failed'.",upper_path($virtual)); + return error("Saving of file '".encode_entities($virtual)."' failed'. The file could be damaged, please check it's integrity.",upper_path($virtual)); } } @@ -437,7 +437,7 @@ sub exec_mkdir($$) # exec_workwithfile() # -# Display a form for renaming/copying/deleting/unlocking a file +# Display a form for renaming/copying/removing/unlocking a file # # Params: 1. Reference to user input hash # 2. Reference to config hash @@ -499,14 +499,14 @@ END
-

Delete

+

Remove

Click on the button below to remove the file '$virtual'.

-

+

END } @@ -536,7 +536,7 @@ END # exec_workwithdir() # -# Display a form for renaming/deleting a directory +# Display a form for renaming/removing a directory # # Params: 1. Reference to user input hash # 2. Reference to config hash @@ -571,14 +571,14 @@ sub exec_workwithdir($$)
-

Delete

+

Remove

Click on the button below to completely remove the directory '$virtual' and oll of it's files and sub directories.

-

+

END @@ -612,7 +612,44 @@ sub exec_copy($$) if(-e $new_physical) { - return error("A file or directory called '$new_virtual' already exists and this editor is currently not able to ask to overwrite the existing file or directory.",upper_path($virtual)); + if(-d $new_physical) + { + return error("A directory called '$new_virtual' already exists. You cannot replace a directory by a file!",$dir); + } + elsif(not $data->{'cgi'}->param('confirmed')) + { + $dir = encode_entities($dir); + + my $output = htmlhead("Replace existing file"); + $output .= <<"END"; +

A file called '$new_virtual' already exists. Do you want to replace it?

+ +
+ + + + + +

+
+ +
+ + + +

+
+END + + $output .= htmlfoot; + + return \$output; + } + } + + if($data->{'uselist'}->in_use($data->{'new_virtual'})) + { + return error("The target file '$new_virtual' already exists and it is edited by someone else.",$dir); } copy($physical,$new_physical) or return error("Could not copy '$virtual' to '$new_virtual'",upper_path($virtual)); @@ -686,6 +723,8 @@ sub exec_rmdir($$) my $physical = $data->{'physical'}; my $virtual = $data->{'virtual'}; + return exec_remove($data,$config) if(not -d $physical); + if($data->{'cgi'}->param('confirmed')) { rmtree($physical); @@ -711,14 +750,14 @@ sub exec_rmdir($$) - +

- +

END -- 2.34.1