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 $section ||= 'administration';
27 $gcgi->{cgi
} = CGI
->new;
29 my $cgiurl = $gcgi->{cgi
}->url(-absolute
=> 1);
30 ($gcgi->{srcname
}) = ($cgiurl =~ m
#^.*/\([a-zA-Z0-9_.\/-]+?\.cgi\)$#); #
31 $gcgi->{srcname
} = "cgi/".$gcgi->{srcname
} if $gcgi->{srcname
};
33 print $gcgi->{cgi
}->header(-type
=>'text/html', -charset
=> 'utf-8');
36 <?xml version="1.0" encoding="utf-8"?>
37 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
38 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
41 <title>$Girocco::Config::name :: $heading</title>
42 <link rel="stylesheet" type="text/css" href="$Girocco::Config::gitwebfiles/gitweb.css"/>
43 <link rel="stylesheet" type="text/css" href="$Girocco::Config::gitwebfiles/girocco.css"/>
44 <link rel="shortcut icon" href="$Girocco::Config::gitwebfiles/git-favicon.png" type="image/png"/>
45 <script src="$Girocco::Config::gitwebfiles/mootools.js" type="text/javascript"></script>
46 <script src="$Girocco::Config::gitwebfiles/girocco.js" type="text/javascript"></script>
51 <div class="page_header">
52 <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>
53 <a href="$Girocco::Config::gitweburl">$Girocco::Config::name</a> / $section / $heading
63 if ($self->{srcname
} and $Girocco::Config
::giroccourl
) {
64 my $hb = $Girocco::Config
::giroccobranch ?
65 "hb=$Girocco::Config::giroccobranch;" : "";
68 <a href="$Girocco::Config::giroccourl?a=blob;${hb}f=$self->{srcname}">(view source)</a>
85 print "<p style=\"color: red\">@_</p>\n";
91 my $err = $self->{err
};
92 my $s = $err == 1 ?
'' : 's';
93 $err and print "<p style=\"font-weight: bold\">Operation aborted due to $err error$s.</p>\n";
100 my $val = $self->{cgi
}->param($param);
101 defined $val and $val =~ s/^\s*(.*?)\s*$/$1/;
108 $self->{srcname
} = $srcname if $srcname;
115 $str =~ s/</</g; $str =~ s/>/>/g;
116 $str =~ s/"/"/g;
120 sub print_form_fields
{
122 my ($fieldmap, $valuemap, @fields) = @_;
124 foreach my $field (map { $fieldmap->{$_} } @fields) {
125 print '<tr><td class="formlabel">'.$field->[0].':</td><td>';
126 if ($field->[2] eq 'text') {
127 print '<input type="text" name="'.$field->[1].'" size="80"';
128 print ' value="'.$valuemap->{$field->[1]}.'"' if $valuemap;
131 print '<textarea name="'.$field->[1].'" rows="5" cols="80">';
132 print $valuemap->{$field->[1]} if $valuemap;
135 print "</td></tr>\n";