]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
6e48bf30a448b62bce23af03964060fc6e9c98a7
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patshaping@gmx.net>
9 # Last modified: 2003-12-13
22 use base
qw(Exporter);
34 # Generate the head of a HTML document
35 # (a text/html HTTP header will also be created)
37 # Params: Title/heading
39 # Return: Head for the HTML document
45 my $html = header
(-type
=> "text/html");
48 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
49 "http://www.w3.org/TR/html4/loose.dtd">
54 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
56 <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
67 # Generate the foot of a HTML document
71 # Return: Foot for the HTML document
75 return "\n</body>\n</html>";
80 # Format an error message
82 # Params: 1. Error message
83 # 2. Virtual path to which a link should be displayed (optional)
85 # Return: Formatted message (Scalar Reference)
89 my ($message,$path) = @_;
91 my $output = htmlhead
("Error");
92 $output .= "<p>$message</p>";
96 $path = encode_entities
($path);
99 $output .= "<p><a href=\"$ENV{'SCRIPT_NAME'}?command=show&file=$path\">Back to $path</a></p>";
109 # Print an error message and exit script
112 # Params: Error message
116 my $output = error
(shift);
123 # Create a message, which shows, that a
124 # file is currently in use
126 # Params: File, which is in use
128 # Return: Formatted message (Scalar Reference)
134 return error
("The file '".encode_entities
($file)."' is currently edited by someone else.",upper_path
($file));
139 # Create an "equals"-link
141 # Params: 1. HTTP root
144 # Return: Formatted link (String)
148 my ($root,$path) = @_;
153 $url = $root."/".$path;
154 $url = encode_entities
($url);
156 return "<p>(equals <a href=\"$url\" target=\"_blank\">$url</a>)</p>\n\n";
161 # Create the link to the directory of a file
165 # Return: Formatted link (String)
169 my $dir = upper_path
(shift);
170 $dir = encode_entities
($dir);
172 return "<p><a href=\"$ENV{'SCRIPT_NAME'}?command=show&file=$dir\">Back to $dir</a></p>\n\n";
175 # it's true, baby ;-)
patrick-canterino.de