# Dev-Editor's main program
#
# Author: Patrick Canterino <patrick@patshaping.de>
-# Last modified: 2005-01-06
+# Last modified: 2005-02-10
#
use strict;
version => $VERSION,
configfile => CONFIGFILE);
- my $output = exec_command($command,\%data,$config); # Execute the command...
+ # Execute the command...
- $uselist->unlock; # ... unlock the list with files in use...
- print $$output; # ... and show the output of the command
+ my $output = exec_command($command,\%data,$config);
+
+ # ... unlock the list with files in use and show the output of the command
+
+ $uselist->unlock or abort($config->{'errors'}->{'unlock_failed'},undef,{USELIST => $uselist->{'listfile'}, LOCK_FILE => $uselist->{'lockfile'}});
+ print $$output;
}
else
{
rename_failed = Could not move/rename '{FILE}' to '{NEW_FILE}'.
rename_root = You are not allowed to move/rename the root directory.
text_to_binary = You are not allowed to write text data into a binary file.
+ul_add_failed = Could not add '{FILE}' to the list of files in use.
+ul_rm_failed = Could not remove '{FILE}' from the list of files in use. Try it again using the 'unlock' command of Dev-Editor or by removing the file manually from '{USELIST}'.
+unlock_failed = Unlocking of '{USELIST}' failed. Ask the administrator to check the lock file ('{LOCK_FILE}') and to recreate it if necessary.
# End of configuration file
\ No newline at end of file
# Execute Dev-Editor's commands
#
# Author: Patrick Canterino <patrick@patshaping.de>
-# Last modified: 2005-01-24
+# Last modified: 2005-02-10
#
use strict;
# Lock the file...
- $uselist->add_file($virtual);
- $uselist->save;
+ ($uselist->add_file($virtual) and
+ $uselist->save) or return error($config->{'errors'}->{'ul_add_failed'},$dir,{FILE => $virtual});
# ... and show the editing form
{
my ($data,$config) = @_;
my $virtual = $data->{'virtual'};
+ my $dir = upper_path($virtual);
+ my $uselist = $data->{'uselist'};
- file_unlock($data->{'uselist'},$virtual);
- return devedit_reload({command => 'show', file => upper_path($virtual)});
+ file_unlock($uselist,$virtual) or return error($config->{'errors'}->{'ul_rm_failed'},$dir,{FILE => $virtual, USELIST => $uselist->{'listfile'}});
+ return devedit_reload({command => 'show', file => $dir});
}
# exec_endedit()
# No other user of Dev-Editor will access the file during this
# routine because of the concept of File::UseList.
- file_unlock($uselist,$virtual);
+ file_unlock($uselist,$virtual) or return error($config->{'errors'}->{'ul_rm_failed'},$dir,{FILE => $virtual, USELIST => $uselist->{'listfile'}});
# Normalize newlines
if($data->{'cgi'}->param('confirmed'))
{
- file_unlock($uselist,$virtual);
+ file_unlock($uselist,$virtual) or return error($config->{'errors'}->{'ul_rm_failed'},$dir,{FILE => $virtual, USELIST => $uselist->{'listfile'}});
return devedit_reload({command => 'show', file => $dir});
}
else
# using only one command
#
# Author: Patrick Canterino <patrick@patshaping.de>
-# Last modified: 2005-02-09
+# Last modified: 2005-02-10
#
use strict;
# Params: 1. File::UseList object
# 2. File to remove
#
-# Return: -nothing-
+# Return: Status code (Boolean)
sub file_unlock($$)
{
my ($uselist,$file) = @_;
- $uselist->remove_file($file);
- $uselist->save;
+ $uselist->remove_file($file) or return;
+ $uselist->save or return;
- return;
+ return 1;
}
# it's true, baby ;-)