X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/89269f652fc46e65006b9aead5eb1ae61ebc311e..a1cc5ce8035db2ac85e3a4ae675c504ff595d3b6:/modules/Output.pm?ds=sidebyside diff --git a/modules/Output.pm b/modules/Output.pm index 6139430..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-23-2003 +# Last modified: 2003-12-13 # use strict; @@ -34,7 +34,7 @@ use base qw(Exporter); # 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 @@ -53,7 +53,7 @@ sub htmlhead($) $title - +

$title

@@ -79,17 +79,27 @@ 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; } @@ -110,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 # @@ -118,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 @@ -153,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 #