]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patshaping@gmx.net>
9 # Last modified: 2004-02-06
24 use base
qw(Exporter);
26 @EXPORT = qw(error_template
35 # Set the path to the template file using for error messages
38 # Params: Template file
47 # Format an error message
49 # Params: 1. Error message
50 # 2. Virtual path to which a link should be displayed (optional)
51 # 3. Hash reference: Template variables (optional)
53 # Return: Formatted message (Scalar Reference)
57 my ($message,$path,$vars) = @_;
59 my $tpl = new Template
;
60 $tpl->read_file($tpl_error);
62 $tpl->fillin("ERROR",$message);
63 $tpl->fillin("DIR",$path);
64 $tpl->fillin("SCRIPT",encode_entities
($ENV{'SCRIPT_NAME'}));
66 $tpl->parse_if_block("dir",defined $path);
68 if(ref($vars) eq "HASH")
70 while(my ($key,$value) = each(%$vars))
72 $tpl->fillin($key,$value);
76 my $output = header
(-type
=> "text/html");
77 $output .= $tpl->get_template;
84 # Print an error message and exit script
87 # Params: Error message
91 my $output = error
(shift);
98 # Create a message, which shows, that a
99 # file is currently in use
101 # Params: File, which is in use
103 # Return: Formatted message (Scalar Reference)
109 return error
("The file '".encode_entities
($file)."' is currently edited by someone else.",upper_path
($file));
112 # it's true, baby ;-)
patrick-canterino.de