From: pcanterino <> Date: Tue, 23 Sep 2003 20:02:25 +0000 (+0000) Subject: - Added check for binary files in directory view X-Git-Tag: version_1_0~4 X-Git-Url: https://git.p6c8.net/devedit.git/commitdiff_plain/4114079ae7f2e8879071e7ae7c535c6e1416abf8?ds=inline - Added check for binary files in directory view - Several comments added --- diff --git a/modules/Command.pm b/modules/Command.pm index 1a39d67..ad660c3 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: 09-22-2003 +# Last modified: 09-23-2003 # use strict; @@ -113,20 +113,27 @@ sub exec_show($$$) foreach my $file(@$files) { - my @stat = stat($physical."/".$file); + my $phys_path = $physical."/".$file; # Not exactly... my $virt_path = $virtual.$file; + + my @stat = stat($phys_path); my $in_use = $data->{'uselist'}->in_use($virtual.$file); $output .= " " x (10 - length($stat[7])); $output .= $stat[7]; $output .= " "; $output .= strftime("%d.%m.%Y %H:%M",localtime($stat[9])); - $output .= ($in_use) ? " (IN USE) " : " " x 10; + $output .= ($in_use) ? " (IN USE) " : (-B $phys_path) ? " (BINARY) " : " " x 10; $output .= encode_entities($file); $output .= " " x ($max_name_len - length($file))."\t ("; - $output .= "View | "; - $output .= ($in_use) + $output .= (-T $phys_path) + ? "View" + : 'View'; + + $output .= " | "; + + $output .= ($in_use || -B $phys_path) ? 'Edit' : "Edit"; @@ -356,6 +363,9 @@ END if($unused) { + # File is not locked + # Allow renaming and deleting the file + $output .= <Move/rename @@ -374,10 +384,13 @@ END } else { + # File is locked + # Just display a button for unlocking it + $output .= <Unlock file -

Someone else is currently editing this file. At least, the file is marked so. Maybe, someone who was editing the file, has forgotten to unlock it. In this case (and only in this case) you can unlock the file using this button:

+

Someone else is currently editing this file. At least, the file is marked so. Maybe, someone who was editing the file has forgotten to unlock it. In this case (and only in this case) you can unlock the file using this button:

@@ -440,7 +453,7 @@ sub exec_remove($$) my $dir = upper_path($virtual); - unlink($physical); + unlink($physical) or return error("Could not delete file '$virtual'."); my $output = redirect("http://$ENV{'HTTP_HOST'}$script?command=show&file=$dir"); return \$output;