]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
30d60b419fe0560996dfafc7f9916df71491241a
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patrick@patshaping.de>
9 # Last modified: 2005-05-09
11 # Copyright (C) 1999-2000 Roland Bluethgen, Frank Schoenmann
12 # Copyright (C) 2003-2009 Patrick Canterino
13 # All Rights Reserved.
15 # This file can be distributed and/or modified under the terms of
16 # of the Artistic License 1.0 (see also the LICENSE file found at
17 # the top level of the Dev-Editor distribution).
32 use base
qw(Exporter);
34 @EXPORT = qw(error_template
42 # Set the path to the template file used for error messages
45 # Params: Template file
54 # Format an error message
56 # Params: 1. Error message
57 # 2. Display a link to this path at the bottom of the page (optional)
58 # Please use the unencoded form of the string!
59 # 3. Hash reference: Template variables (optional)
61 # Return: Formatted message (Scalar Reference)
65 my ($message,$path,$vars) = @_;
67 my $tpl = new Template
;
68 $tpl->read_file($tpl_error);
70 $tpl->set_var('ERROR',$message);
71 $tpl->set_var('BACK',encode_html
($path));
72 $tpl->set_var('BACK_URL',escape
($path));
73 $tpl->set_var('SCRIPT',encode_html
($ENV{'SCRIPT_NAME'}));
75 $tpl->parse_if_block('dir',defined $path);
77 if(ref($vars) eq 'HASH')
79 while(my ($key,$value) = each(%$vars))
81 $tpl->set_var($key,$value);
87 my $output = header
(-type
=> 'text/html');
88 $output .= $tpl->get_template;
95 # Print an error message and exit script
98 # Params: 1. Error message
99 # 2. Display a link to this path at the bottom of the page (optional)
100 # 3. Hash reference: Template variables (optional)
104 my $output = error
(shift,shift,shift);
109 # it's true, baby ;-)
patrick-canterino.de