X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/89269f652fc46e65006b9aead5eb1ae61ebc311e..03d83644ce2d958fe3e0466fa272c67f0566f4ab:/modules/Output.pm
diff --git a/modules/Output.pm b/modules/Output.pm
index 6139430..449731f 100644
--- a/modules/Output.pm
+++ b/modules/Output.pm
@@ -6,7 +6,7 @@ package Output;
# HTML generating routines
#
# Author: Patrick Canterino $message The file '$file' is currently editet by someone else. Back to $dir$title
-
-END
-
- return $html;
-}
-
-# htmlfoot()
+# error_template()
#
-# Generate the foot of a HTML document
+# Set the path to the template file using for error messages
+# (I'm lazy...)
#
-# Params: -nothing-
-#
-# Return: Foot for the HTML document
+# Params: Template file
-sub htmlfoot
+sub error_template($)
{
- return "\n\n";
+ $tpl_error = shift;
}
# error()
#
# Format an error message
#
-# Params: Error message
+# Params: 1. Error message
+# 2. Virtual path to which a link should be displayed (optional)
+# 3. Hash reference: Template variables (optional)
#
# Return: Formatted message (Scalar Reference)
-sub error($)
+sub error($;$$)
{
- my $message = shift;
+ my ($message,$path,$vars) = @_;
+
+ my $tpl = new Template;
+ $tpl->read_file($tpl_error);
+
+ $tpl->fillin("ERROR",$message);
+ $tpl->fillin("DIR",$path);
+ $tpl->fillin("SCRIPT",encode_entities($ENV{'SCRIPT_NAME'}));
+
+ $tpl->parse_if_block("dir",defined $path);
- my $output = htmlhead("Error");
- $output .= "
(equals $url)
\n\n"; -} - -# dir_link() -# -# Create the link to the directory of a file and -# print it out -# -# Params: File -# -# Return: Formatted link (String) - -sub dir_link($) -{ - my $dir = upper_path(shift); - $dir = encode_entities($dir); + my $file = shift; - return "\n\n"; + return error("The file '".encode_entities($file)."' is currently edited by someone else.",upper_path($file)); } # it's true, baby ;-)