X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/3e6b9e338fe5ea06b487202fe54217f2082cd13d..6f588e8b3a25f4ff562e0294e0a6a507c1a094d2:/modules/Output.pm?ds=inline diff --git a/modules/Output.pm b/modules/Output.pm index e8d4bad..e30dd83 100644 --- a/modules/Output.pm +++ b/modules/Output.pm @@ -6,7 +6,7 @@ package Output; # HTML generating routines # # Author: Patrick Canterino -# Last modified: 09-22-2003 +# Last modified: 2003-10-13 # use strict; @@ -32,6 +32,7 @@ use base qw(Exporter); # htmlhead() # # Generate the head of a HTML document +# (a text/html HTTP header will also be created) # # Params: Title and heading # @@ -52,7 +53,7 @@ sub htmlhead($) $title - +

$title

@@ -78,24 +79,35 @@ sub htmlfoot # # Format an error message # -# Params: Error message +# Params: 1. Error message +# 2. Virtual path to which a link should be displayed (optional) # # Return: Formatted message (Scalar Reference) -sub error($) +sub error($;$) { - my $message = shift; + my ($message,$path) = @_; my $output = htmlhead("Error"); $output .= "

$message

"; - $output .= htmlfoot; + + if($path) + { + $path = encode_entities($path); + + $output .= "\n\n"; + $output .= "

Back to $path

"; + } + + $output .= htmlfoot; return \$output; } # abort() # -# Print and error message and exit script +# Print an error message and exit script +# ^^^^^ # # Params: Error message @@ -116,15 +128,9 @@ sub abort($) sub error_in_use($) { - my $file = encode_entities(shift); - my $dir = upper_path($file); - - my $message = htmlhead("File in use"); - $message .= "

The file '$file' is currently editet by someone else.

\n\n"; - $message .= "

Back to $dir

"; - $message .= htmlfoot; + my $file = shift; - return \$message; + return error("The file '".encode_entities($file)."' is currently editet by someone else.",upper_path($file)); } # equal_url()