X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/3e6b9e338fe5ea06b487202fe54217f2082cd13d..a1cc5ce8035db2ac85e3a4ae675c504ff595d3b6:/modules/Output.pm diff --git a/modules/Output.pm b/modules/Output.pm index e8d4bad..6e48bf3 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-12-13 # use strict; @@ -32,8 +32,9 @@ 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 +# Params: Title/heading # # Return: Head for the HTML document @@ -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 @@ -108,7 +120,8 @@ sub abort($) # error_in_use() # -# Create a message, that a file is currently in use +# Create a message, which shows, that a +# file is currently in use # # Params: File, which is in use # @@ -116,20 +129,14 @@ 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 edited by someone else.",upper_path($file)); } # equal_url() # -# Create an "equals"-link and print it out +# Create an "equals"-link # # Params: 1. HTTP root # 2. Relative path @@ -151,8 +158,7 @@ sub equal_url($$) # dir_link() # -# Create the link to the directory of a file and -# print it out +# Create the link to the directory of a file # # Params: File #