X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/89269f652fc46e65006b9aead5eb1ae61ebc311e..d87c7b145a2f8ca073a19d38b39856b328a69c1d:/modules/Output.pm
diff --git a/modules/Output.pm b/modules/Output.pm
index 6139430..cd4e53e 100644
--- a/modules/Output.pm
+++ b/modules/Output.pm
@@ -5,91 +5,77 @@ 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()
-#
-# Generate the foot of a HTML document
+# error_template()
#
-# Params: -nothing-
+# Set the path to the template file used for error messages
+# (I'm lazy...)
#
-# 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. Display a link to this path at the bottom of the page (optional)
+# Please use the unencoded form of the string!
+# 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('BACK',encode_html($path));
+ $tpl->fillin('BACK_URL',escape($path));
+ $tpl->fillin('SCRIPT',encode_html($ENV{'SCRIPT_NAME'}));
+
+ $tpl->parse_if_block('dir',defined $path);
+
+ if(ref($vars) eq 'HASH')
+ {
+ while(my ($key,$value) = each(%$vars))
+ {
+ $tpl->fillin($key,$value);
+ }
+ }
- 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); - - return "\n\n"; -} - # it's true, baby ;-) 1;