From 8b505d2b02fe7154f0cb3794e562d98750051f08 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Thu, 4 Mar 2004 17:21:38 +0000 Subject: [PATCH] Now, all the error messages are defined in the configuration file. --- devedit.dat | 3 +++ modules/Command.pm | 12 ++++++------ modules/Output.pm | 18 +----------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/devedit.dat b/devedit.dat index 285e463..f180cae 100644 --- a/devedit.dat +++ b/devedit.dat @@ -21,6 +21,8 @@ tpl_viewfile = templates/viewfile.htm tpl_editfile = templates/editfile.htm tpl_copyfile = templates/copyfile.htm tpl_renamefile = templates/renamefile.htm +tpl_mkfile = templates/mkfile.htm +tpl_mkdir = templates/mkdir.htm tpl_upload = templates/upload.htm tpl_confirm_rmfile = templates/confirm_rmfile.htm tpl_confirm_rmdir = templates/confirm_rmdir.htm @@ -48,6 +50,7 @@ err_above_root = Accessing files and directories above the virtual root direc err_create_ar = You aren't allowed to create files and directories above the virtual root directory. err_file_exists = A file or directory called '{FILE}' already exists. err_exist_edited = The target file '{FILE}' already exists and is edited by someone else. +err_in_use = The file '{FILE}' is currently edited by someone else. err_noview = You have not enough permissions to view this file. err_nocopy = You have not enough permissions to copy this file. err_dircopy = This editor is not able to copy directories. diff --git a/modules/Command.pm b/modules/Command.pm index f9de6fc..8e899d3 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: 2004-03-01 +# Last modified: 2004-03-04 # use strict; @@ -221,9 +221,9 @@ sub exec_beginedit($$) my $virtual = $data->{'virtual'}; my $uselist = $data->{'uselist'}; - return error($config->{'err_editdir'},upper_path($virtual)) if(-d $physical); - return error_in_use($virtual) if($uselist->in_use($virtual)); - return error($config->{'err_noedit'},upper_path($virtual)) unless(-r $physical && -w $physical); + return error($config->{'err_editdir'},upper_path($virtual)) if(-d $physical); + return error($config->{'err_in_use'},upper_path($virtual),{FILE => $virtual}) if($uselist->in_use($virtual)); + return error($config->{'err_noedit'},upper_path($virtual)) unless(-r $physical && -w $physical); # Check on binary files @@ -534,7 +534,7 @@ sub exec_rename($$) my $virtual = $data->{'virtual'}; my $new_physical = $data->{'new_physical'}; - return error_in_use($virtual) if($data->{'uselist'}->in_use($virtual)); + return error($config->{'err_in_use'},upper_path($virtual),{FILE => $virtual}) if($data->{'uselist'}->in_use($virtual)); if($new_physical) { @@ -635,7 +635,7 @@ sub exec_remove($$) { # Remove a file - return error_in_use($virtual) if($data->{'uselist'}->in_use($virtual)); + return error($config->{'err_in_use'},upper_path($virtual),{FILE => $virtual}) if($data->{'uselist'}->in_use($virtual)); if($data->{'cgi'}->param('confirmed')) { diff --git a/modules/Output.pm b/modules/Output.pm index ba41e38..22d4e3c 100644 --- a/modules/Output.pm +++ b/modules/Output.pm @@ -6,7 +6,7 @@ package Output; # HTML generating routines # # Author: Patrick Canterino -# Last modified: 2004-02-23 +# Last modified: 2004-03-04 # use strict; @@ -94,22 +94,6 @@ sub abort($;$) exit; } -# error_in_use() -# -# Create a message, which shows, that a -# file is currently in use -# -# Params: File, which is in use -# -# Return: Formatted message (Scalar Reference) - -sub error_in_use($) -{ - my $file = shift; - - return error("The file '".encode_entities($file)."' is currently edited by someone else.",upper_path($file)); -} - # it's true, baby ;-) 1; -- 2.34.1