]>
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: 2003-10-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 and 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, that a file is currently in use
125 # Params: File, which is in use
127 # Return: Formatted message (Scalar Reference)
133 return error
("The file '".encode_entities
($file)."' is currently editet by someone else.",upper_path
($file));
138 # Create an "equals"-link and print it out
140 # Params: 1. HTTP root
143 # Return: Formatted link (String)
147 my ($root,$path) = @_;
152 $url = $root."/".$path;
153 $url = encode_entities
($url);
155 return "<p>(equals <a href=\"$url\" target=\"_blank\">$url</a>)</p>\n\n";
160 # Create the link to the directory of a file and
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