10 our @ISA = qw(Exporter);
11 our @EXPORT = qw(html_esc);
13 use CGI
qw(:standard :escapeHTML -nosticky);
14 use CGI
::Util
qw(unescape);
15 use CGI
::Carp
qw(fatalsToBrowser);
21 my ($heading, $section, $extrahead) = @_;
24 $heading = CGI
::escapeHTML
($heading || '');
25 $section = CGI
::escapeHTML
($section || 'administration');
26 $extrahead = CGI
::escapeHTML
($extrahead || '');
27 my $name = CGI
::escapeHTML
($Girocco::Config
::name
|| '');
29 $gcgi->{cgi
} = CGI
->new;
31 my $cgiurl = $gcgi->{cgi
}->url(-absolute
=> 1);
32 ($gcgi->{srcname
}) = ($cgiurl =~ m
#^.*/\([a-zA-Z0-9_.\/-]+?\.cgi\)$#); #
33 $gcgi->{srcname
} = "cgi/".$gcgi->{srcname
} if $gcgi->{srcname
};
35 print $gcgi->{cgi
}->header(-type
=>'text/html', -charset
=> 'utf-8');
38 <?xml version="1.0" encoding="utf-8"?>
39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
40 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
43 <title>$name :: $heading</title>
44 <link rel="stylesheet" type="text/css" href="$Girocco::Config::gitwebfiles/gitweb.css"/>
45 <link rel="stylesheet" type="text/css" href="$Girocco::Config::gitwebfiles/girocco.css"/>
46 <link rel="shortcut icon" href="$Girocco::Config::gitwebfiles/git-favicon.png" type="image/png"/>
47 <script src="$Girocco::Config::gitwebfiles/mootools.js" type="text/javascript"></script>
48 <script src="$Girocco::Config::gitwebfiles/girocco.js" type="text/javascript"></script>
53 <div class="page_header">
54 <a href="http://git.or.cz/" title="Git homepage"><img src="$Girocco::Config::gitwebfiles/git-logo.png" width="72" height="27" alt="git" style="float:right; border-width:0px;"/></a>
55 <a href="$Girocco::Config::gitweburl">$name</a> / $section / $heading
65 if ($self->{srcname
} and $Girocco::Config
::giroccourl
) {
66 my $hb = $Girocco::Config
::giroccobranch ?
67 "hb=$Girocco::Config::giroccobranch;" : "";
70 <a href="$Girocco::Config::giroccourl?a=blob;${hb}f=$self->{srcname}">(view source)</a>
87 print "<p style=\"color: red\">@_</p>\n";
93 my $err = $self->{err
};
94 my $s = $err == 1 ?
'' : 's';
95 $err and print "<p style=\"font-weight: bold\">Operation aborted due to $err error$s.</p>\n";
102 my $val = $self->{cgi
}->param($param);
103 defined $val and $val =~ s/^\s*(.*?)\s*$/$1/;
110 $self->{srcname
} = $srcname if $srcname;
117 $str =~ s/</</g; $str =~ s/>/>/g;
118 $str =~ s/"/"/g;
122 sub print_form_fields
{
124 my ($fieldmap, $valuemap, @fields) = @_;
126 foreach my $field (map { $fieldmap->{$_} } @fields) {
127 print '<tr><td class="formlabel">'.$field->[0].':</td><td>';
128 if ($field->[2] eq 'text') {
129 print '<input type="text" name="'.$field->[1].'" size="80"';
130 print ' value="'.$valuemap->{$field->[1]}.'"' if $valuemap;
133 print '<textarea name="'.$field->[1].'" rows="5" cols="80">';
134 print $valuemap->{$field->[1]} if $valuemap;
137 print "</td></tr>\n";