===================================================================
RCS file: /cvs/cvsweb/cvsweb.cgi,v
retrieving revision 3.34
retrieving revision 3.35
diff -u -p -r3.34 -r3.35
--- cvsweb/cvsweb.cgi 2000/10/10 18:48:59 3.34
+++ cvsweb/cvsweb.cgi 2000/10/10 21:14:05 3.35
@@ -43,7 +43,7 @@
# SUCH DAMAGE.
#
# $zId: cvsweb.cgi,v 1.103 2000/09/20 17:02:29 jumager Exp $
-# $Id: cvsweb.cgi,v 3.34 2000/10/10 18:48:59 knu Exp $
+# $Id: cvsweb.cgi,v 3.35 2000/10/10 21:14:05 knu Exp $
#
###
@@ -74,7 +74,7 @@ use vars qw (
$difffontsize $inputTextSize $mime_types $allow_annotate
$allow_markup $use_java_script $open_extern_window
$extern_window_width $extern_window_height $edit_option_form
- $checkout_magic $show_subdir_lastmod $show_log_in_markup $v
+ $show_subdir_lastmod $show_log_in_markup $v
$navigationHeaderColor $tableBorderColor $markupLogColor
$tabstop $state $annTable $sel $curbranch @HideModules
$module $use_descriptions %descriptions @mytz $dwhere $moddate
@@ -116,6 +116,7 @@ sub download_url($$;$);
sub download_link($$$;$);
sub toggleQuery($$);
sub urlencode($);
+sub htmlquote($);
sub http_header(;$);
sub html_header($);
sub html_footer();
@@ -156,7 +157,7 @@ $diffcolorChange = $diffcolorAdd = $diffcolorDarkChang
$difffontsize = $inputTextSize = $mime_types = $allow_annotate =
$allow_markup = $use_java_script = $open_extern_window =
$extern_window_width = $extern_window_height = $edit_option_form =
-$checkout_magic = $show_subdir_lastmod = $show_log_in_markup = $v =
+$show_subdir_lastmod = $show_log_in_markup = $v =
$navigationHeaderColor = $tableBorderColor = $markupLogColor =
$tabstop = $use_moddate = $moddate = $gzip_open = undef;
@@ -294,9 +295,9 @@ foreach (@stickyvars) {
}
# is there any query ?
if (@barequery) {
- $barequery = join('&', @barequery);
+ $barequery = join('&', @barequery);
$query = "?$barequery";
- $barequery = "&$barequery";
+ $barequery = "&$barequery";
}
else {
$query = "";
@@ -354,7 +355,8 @@ foreach $k (keys %ICONS) {
no strict 'refs';
my ($itxt,$ipath,$iwidth,$iheight) = @{$ICONS{$k}};
if ($ipath) {
- ${"${k}icon"} = "";
+ ${"${k}icon"} = sprintf('',
+ htmlquote($ipath), htmlquote($itxt), $iwidth, $iheight)
}
else {
${"${k}icon"} = $itxt;
@@ -483,10 +485,12 @@ elsif (-d $fullname) {
print "
";
- print "" if (!$byfile);
- print "File";
- print "" if (!$byfile);
+ if ($byfile) {
+ print 'File';
+ } else {
+ print &link('File', sprintf('./%s#dirlist',
+ &toggleQuery("sortby", "file")));
+ }
print " | ";
# do not display the other column-headers, if we do not have any files
# with revision information:
@@ -495,38 +499,47 @@ elsif (-d $fullname) {
print "";
- print "" if (!$byrev);
- print "Rev.";
- print "" if (!$byrev);
+ if ($byrev) {
+ print 'Rev.';
+ } else {
+ print &link('Rev.', sprintf('./%s#dirlist',
+ &toggleQuery("sortby", "rev")));
+ }
print " | ";
$infocols++;
print "";
- print "" if (!$bydate);
- print "Age";
- print "" if (!$bydate);
+ if ($bydate) {
+ print 'Age';
+ } else {
+ print &link('Age', sprintf('./%s#dirlist',
+ &toggleQuery("sortby", "date")));
+ }
print " | ";
if ($show_author) {
$infocols++;
print "";
- print "" if (!$byauthor);
- print "Author";
- print "" if (!$byauthor);
+ if ($byauthor) {
+ print 'Author';
+ } else {
+ print &link('Author', sprintf('./%s#dirlist',
+ &toggleQuery("sortby", "author")));
+ }
print " | ";
}
$infocols++;
print "";
- print "" if (!$bylog);
- print "Last log entry";
- print "" if (!$bylog);
+ if ($bylog) {
+ print 'Last log entry';
+ } else {
+ print &link('Last log entry', sprintf('./%s#dirlist',
+ &toggleQuery("sortby", "log")));
+ }
print " | ";
}
elsif ($use_descriptions) {
@@ -555,9 +568,9 @@ elsif (-d $fullname) {
closedir($dh);
}
- my $hideAtticToggleLink = "[Hide]" if (!$input{'hideattic'});
+ my $hideAtticToggleLink = $input{'hideattic'} ? '' :
+ &link('[Hide]', sprintf('./%s#dirlist',
+ &toggleQuery ("hideattic")));
# Sort without the Attic/ pathname.
# place directories first
@@ -602,9 +615,9 @@ elsif (-d $fullname) {
print $backicon;
}
else {
- print &link($backicon,$url);
+ print &link($backicon, $url);
}
- print " ", &link("Previous Directory",$url);
+ print " ", &link("Previous Directory", $url);
}
else {
$url = urlencode($_) . '/' . $query;
@@ -613,13 +626,13 @@ elsif (-d $fullname) {
print $diricon;
}
else {
- print &link($diricon,$url);
+ print &link($diricon, $url);
}
- print " ", &link($_ . "/", $url), $attic;
+ print " ", &link("$_/", $url), $attic;
if ($_ eq "Attic") {
- print " [Don't hide]";
+ print " ";
+ print &link("[Don't hide]", sprintf('./%s#dirlist',
+ &toggleQuery ("hideattic")));
}
}
# Show last change in dir
@@ -690,8 +703,8 @@ elsif (-d $fullname) {
print " ", &link($_, $url), $attic;
print " " if ($dirtable);
download_link($fileurl,
- $rev, $rev,
- $defaultViewable ? "text/x-cvsweb-markup" : undef);
+ $rev, $rev,
+ $defaultViewable ? "text/x-cvsweb-markup" : undef);
print " | " if ($dirtable);
if ($date) {
print " " . readableTime(time() - $date,0) . "";
@@ -921,33 +934,29 @@ sub findLastModifiedSubdirs(@) {
}
sub htmlify($;$) {
- my($string, $extra) = @_;
+ (local $_, my $extra) = @_;
- # Special Characters; RFC 1866
- $string =~ s/&/&/g;
- $string =~ s/\"/"/g;
- $string =~ s/</g;
- $string =~ s/>/>/g;
+ $_ = htmlquote($_);
- # get URL's as link ..
- $string =~ s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`$1$2$3`g; # `
+ # get URL's as link
+ s`(http|ftp|https)(://[-a-zA-Z0-9%.~:_/]+)([?&]([-a-zA-Z0-9%.~:_]+)=([-a-zA-Z0-9%.~:_])+)*`&link("$1$2$3", "$1$2$3")`ge; # `
# get e-mails as link
- $string =~ s`([-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4})`$1`g; # `
+ s`[-a-zA-Z0-9_.]+@([-a-zA-Z0-9]+\.)+[A-Za-z]{2,4}`&link($&, "mailto:$&")`ge; # `
if ($extra) {
- # get PR #'s as link ..
+ # get PR #'s as link: "PR#nnnn" "PR: nnnn, ..." "PR nnnn, ..." "bin/nnnn"
if (defined($prcgi)) {
- 1 while $string =~ s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1 . &link($2, sprintf($prcgi, $2))`ie; # `;
- $string =~ s`\b${prcategories}/(\d+)\b`&link($&, sprintf($prcgi, $1))`igeo; # `;
+ 1 while s`\b(pr[:#]?\s*(?:#?\d+[,\s]\s*)*#?)(\d+)\b`$1 . &link($2, sprintf($prcgi, $2))`ie; # `;
+ s`\b${prcategories}/(\d+)\b`&link($&, sprintf($prcgi, $1))`igeo; # `;
}
- # get manpage specs as link ..
+ # get manpage specs as link: "foo.1" "foo(1)"
if (defined($mancgi)) {
- $string =~ s`\b([a-zA-Z]\w+)(?:\(([0-9n])\)\B|\.([0-9n])\b)`&link($&, sprintf($mancgi, $2 ne '' ? $2 : $3, $1))`ge; # `x;
+ s`\b([a-zA-Z]\w+)(?:\(([0-9n])\)\B|\.([0-9n])\b)`&link($&, sprintf($mancgi, $2 ne '' ? $2 : $3, $1))`ge; # `x;
}
}
- return $string;
+ $_;
}
sub spacedHtmlText($;$) {
@@ -983,7 +992,7 @@ sub spacedHtmlText($;$) {
sub link($$) {
my($name, $where) = @_;
- return "$name";
+ sprintf '%s', htmlquote($where), $name;
}
sub revcmp($$) {
@@ -1031,7 +1040,7 @@ sub redirect($) {
print "Location: $url\r\n";
}
html_header("Moved");
- print "This document is located here.\n";
+ print "This document is located ", &link('here', $url), "\n";
print &html_footer;
exit(1);
}
@@ -1256,7 +1265,7 @@ sub doAnnotate($$) {
}
else {
$revprint = sprintf('%-8s', $lrev);
- $revprint =~ s`\S+`$&`; # `
+ $revprint =~ s`\S+`&link($&, "$scriptwhere$barequery#rev$&")`e; # `
$oldLusr = '';
}
if ($lusr eq $oldLusr) {
@@ -1404,12 +1413,14 @@ sub cvswebMarkup($$$) {
print " ";
print "";
print "File: ", &clickablePath($where, 1);
- print " ";
- &download_link(urlencode($fileurl), $revision, "(download)");
+ print " (";
+ &download_link($fileurl, $revision, "download");
+ print ")";
if (!$defaultTextPlain) {
- print " ";
- &download_link(urlencode($fileurl), $revision, "(as text)",
+ print " (";
+ &download_link($fileurl, $revision, "as text",
"text/plain");
+ print ")";
}
print " \n";
if ($show_log_in_markup) {
@@ -1425,10 +1436,10 @@ sub cvswebMarkup($$$) {
my $url = download_url($fileurl, $revision, $mimetype);
print " ";
if ($mimetype =~ /^image/) {
- print " ";
+ printf ' ', htmlquote("$url$barequery");
}
elsif ($mimetype =~ m%^application/pdf%) {
- print " |
|
---|