X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/f0cd6d2f27ac9fcf1b121b9c2f7f8eb40b7a222c..9ba648e57a6e37366c685326c9997c3e643ce1ef:/modules/Command.pm?ds=sidebyside diff --git a/modules/Command.pm b/modules/Command.pm index 635d43d..6b413d0 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-21 # 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 @@ -566,19 +566,19 @@ sub exec_workwithdir($$)
-

Move/Rename directory '$virtual' to: $dir

+

Move/Rename directory '$virtual' to:
$dir


-

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)); @@ -642,7 +679,44 @@ sub exec_rename($$) 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!",upper_path($virtual)); + } + 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); } rename($physical,$new_physical) or return error("Could not move/rename '".encode_entities($virtual)."' to '$new_virtual'.",upper_path($virtual)); @@ -686,6 +760,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 +787,14 @@ sub exec_rmdir($$) - +

- +

END