X-Git-Url: http://git.jankratochvil.net/?p=MyWeb.git;a=blobdiff_plain;f=Web.pm;h=524cf143e94cc8cfa6a8ee8df4b85b4d6e50a5ee;hp=8073616cfc2a94ef1c5eb8c3bf91de3a17f517ce;hb=4cd6b19ddd7d185a7b56d1f3de77e5646917bc48;hpb=6d23b1099df83eca4de8735f75fd1f16a14c63e1 diff --git a/Web.pm b/Web.pm index 8073616..524cf14 100644 --- a/Web.pm +++ b/Web.pm @@ -182,6 +182,19 @@ sub top_dir (;$) my($in)=@_; if (my $uri=$ENV{"REQUEST_URI"}) { + if ($W->{"args"}{"Wabs"}) { + # FIXME: $in may not be defined here! + # to prevent: Use of uninitialized value in ... + if ($in=~m#^/#) { + $in=~s#^/*##; + } + else { + $in=$ENV{"REQUEST_URI"}."/".$in; + $in=~tr#/#/#s; + 1 while $in=~s#/(?:[^/]+)/\Q..\E/#/#g + } + return "http://".&{$W->{"web_hostname_sub"}}()."/".(defined $in ? $in : ""); + } $uri.="Index" if $uri=~m#/$#; if (defined $in) { my($inpath,$inquery)=split /[?]/,$in,2; @@ -300,7 +313,10 @@ sub footer (;$) $cvs_id_split[2]="" .a_href((map({ my $s=$_; $s=~s#/viewcvs/#$&~checkout~/#; $s; } $W->{"viewcvs"}))[0]."$file?rev=".$cvs_id_split[2], $cvs_id_split[2]); - $cvs_id_split[1]=a_href($W->{"viewcvs"}.$file, + # FIXME: Use 'CVS/Repository' here. + my $viewcvs=$W->{"viewcvs"}; + $viewcvs=~s#(/viewcvs)/.*$#$1/MyWeb/# if $file=~s#^My/##; + $cvs_id_split[1]=a_href($viewcvs.$file, ($package!~/^Apache::/ ? $package : $cvs_id_split[1])); $cvs_id_split[5]=&{$W->{"cvs_id_author"}}($cvs_id_split[5]); } @@ -373,7 +389,11 @@ sub a_href ($;$%) my($url,$contents,%args)=@_; do { $$_=1 if !defined $$_; } for (\$args{"size"}); - $contents=CGI::escapeHTML($url) if !defined $contents; + if (!defined $contents) { + $contents=$url; + $contents=File::Basename::basename($contents) if $args{"basename"}; + $contents=CGI::escapeHTML($contents); + } $contents=~s#]*>##gi; $contents=~s###gi; @@ -394,7 +414,7 @@ my($url,$contents,%args)=@_; $r.='"'; do { $r.=" $_" if $_; } for ($args{"attr"}); $r.='>'.$contents.''; - if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/) { # Downloadable? + if ($args{"size"} && url_is_local($url) && ($args{"size"}>=2 || $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/)) { # Downloadable? $url=top_dir_disk().$url if $url=~m#^/#; if (!-r $url) { cluck "File not readable: $url"; } @@ -615,6 +635,8 @@ my($class)=@_; .nowrap { white-space: nowrap; } .centered { text-align: center; } .tab-bold { font-weight: bold; } +.tab-head { font-weight: bold; } +/* .tab-head { font-weight: bold; color: yellow; background-color: transparent; } body { background-color: black; @@ -623,6 +645,7 @@ body { :link { color: aqua; background-color: transparent; } :visited { color: teal; background-color: transparent; } h1,h2 { color: yellow; background-color: transparent; } +*/ td { padding: 2px; } caption { caption-side: bottom; } .footer img { vertical-align: middle; } @@ -637,8 +660,8 @@ HERE do { print ''."\n" if $_; } for ($W->{"rel_$type"}); } print "{"browser"}->netscape() && (!$W->{"browser"}->major() || $W->{"browser"}->major()<=4); +# print ' bgcolor="black" text="white" link="aqua" vlink="teal"' +# if $W->{"browser"}->netscape() && (!$W->{"browser"}->major() || $W->{"browser"}->major()<=4); print ">\n"; if ($W->{"heading"}) {