git://git.jankratochvil.net
/
MyWeb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
debfd3c
)
heading+topdir
author
short
<>
Sat, 4 Oct 2003 11:00:59 +0000
(11:00 +0000)
committer
short
<>
Sat, 4 Oct 2003 11:00:59 +0000
(11:00 +0000)
Project.pm
patch
|
blob
|
history
Web.pm
patch
|
blob
|
history
diff --git
a/Project.pm
b/Project.pm
index
d18a860
..
e22eaf6
100644
(file)
--- a/
Project.pm
+++ b/
Project.pm
@@
-77,7
+77,7
@@
my($class,$ListItem)=@_;
return "Download".$_[0];
},
"format"=>sub ($) {
return "Download".$_[0];
},
"format"=>sub ($) {
- return a_href($_[0],CGI::escapeHTML(
$_[0]
));
+ return a_href($_[0],CGI::escapeHTML(
File::Basename::basename($_[0])
));
}},
{"key"=>qr(^link\b),"text"=>sub ($) {
$_[0]=~s/^link-//;
}},
{"key"=>qr(^link\b),"text"=>sub ($) {
$_[0]=~s/^link-//;
@@
-108,7
+108,7
@@
my($class,$ListItem)=@_;
["Download CVS snapshot" ,
$W->{"project_viewcvs"}.$val."/".File::Basename::basename($val).".tar.gz?tarball=1"
.(!$branch ? "" : '&only_with_tag='.$branch)],
["Download CVS snapshot" ,
$W->{"project_viewcvs"}.$val."/".File::Basename::basename($val).".tar.gz?tarball=1"
.(!$branch ? "" : '&only_with_tag='.$branch)],
- ["CVS ChangeLog" ,
$W->{"top_dir"}
."/project/ChangeLog.txt.pl?cvs=$val"])));
+ ["CVS ChangeLog" ,
top_dir()
."/project/ChangeLog.txt.pl?cvs=$val"])));
}},
{"key"=>"ownership","text"=>"Ownership"},
{"key"=>"sponsorship","text"=>"Sponsorship"},
}},
{"key"=>"ownership","text"=>"Ownership"},
{"key"=>"sponsorship","text"=>"Sponsorship"},
diff --git
a/Web.pm
b/Web.pm
index
c522082
..
4b8d6cb
100644
(file)
--- a/
Web.pm
+++ b/
Web.pm
@@
-24,7
+24,7
@@
use strict;
use warnings;
use Exporter;
use warnings;
use Exporter;
-our @EXPORT=qw(&require &a_href &a_href_cz &vskip &img $W);
+our @EXPORT=qw(&require &a_href &a_href_cz &vskip &img $W
&top_dir
);
our @ISA=qw(Exporter);
use WebConfig; # for %WebConfig
our @ISA=qw(Exporter);
use WebConfig; # for %WebConfig
@@
-70,6
+70,7
@@
my($class,%args)=@_;
do { $W->{$_}=0 if !defined $W->{$_}; } for ("detect_ent");
do { $W->{$_}=0 if !defined $W->{$_}; } for ("detect_js");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("have_css"); # AFAIK it does not hurt anyone.
do { $W->{$_}=0 if !defined $W->{$_}; } for ("detect_ent");
do { $W->{$_}=0 if !defined $W->{$_}; } for ("detect_js");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("have_css"); # AFAIK it does not hurt anyone.
+ do { $W->{$_}=1 if !defined $W->{$_}; } for ("heading");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("footer");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("footer_delimit");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("footer_mailme");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("footer");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("footer_delimit");
do { $W->{$_}=1 if !defined $W->{$_}; } for ("footer_mailme");
@@
-119,7
+120,7
@@
my($class,%args)=@_;
$W->{"have_js"}=($W->{"args"}{"have_js"} ? 1 : 0);
if ($W->{"detect_js"} && !$W->{"have_js"}) {
$W->{"have_js"}=($W->{"args"}{"have_js"} ? 1 : 0);
if ($W->{"detect_js"} && !$W->{"have_js"}) {
- $W->{"head"}.='<script type="text/javascript" src="'.
$W->{"top_dir"}
.'/have_js.js.pl"></script>'."\n";
+ $W->{"head"}.='<script type="text/javascript" src="'.
top_dir()
.'/have_js.js.pl"></script>'."\n";
}
do { args_check(%$_) if $_; } for ($W->{"args_check"});
}
do { args_check(%$_) if $_; } for ($W->{"args_check"});
@@
-127,6
+128,12
@@
my($class,%args)=@_;
return $W;
}
return $W;
}
+sub top_dir ()
+{
+ do { return $_ if $_; } for ($W->{"top_dir"});
+ return $INC[0]; # fallback
+}
+
sub require ($)
{
my($file)=@_;
sub require ($)
{
my($file)=@_;
@@
-189,7
+196,7
@@
sub footer (;$)
print "<hr />\n" if $W->{"footer"};
if ($W->{"footer_mailme"}) {
print "<hr />\n" if $W->{"footer"};
if ($W->{"footer_mailme"}) {
- print '<form action="'.
$W->{"top_dir"}
.'/SendMsg.pl" method="post" onsubmit="'
+ print '<form action="'.
top_dir()
.'/SendMsg.pl" method="post" onsubmit="'
."this.elements['msgscript'].value=this.elements['msghtml'].value;"
."this.elements['msghtml'].value='';"
."this.submit();"
."this.elements['msgscript'].value=this.elements['msghtml'].value;"
."this.elements['msghtml'].value='';"
."this.submit();"
@@
-220,7
+227,7
@@
sub footer (;$)
my $ext;
for (qw(.html.pl .pl .pm),"") {
$ext=$_;
my $ext;
for (qw(.html.pl .pl .pm),"") {
$ext=$_;
- last if -r
$W->{"top_dir"}
."/$file$ext";
+ last if -r
top_dir()
."/$file$ext";
cluck "Class file $file not found" if !$ext;
}
$file.=$ext;
cluck "Class file $file not found" if !$ext;
}
$file.=$ext;
@@
-241,6
+248,11
@@
sub footer (;$)
)));
print "</p>\n";
}
)));
print "</p>\n";
}
+
+ if ($W->{"heading"}) {
+ do { &{$_}() if $_; } for ($W->{"footing"});
+ }
+
print "</body></html>\n";
exit(0);
}
print "</body></html>\n";
exit(0);
}
@@
-298,7
+310,7
@@
my($url,$contents,%args)=@_;
elsif ($W->{"have_ent"}) # ent client
{ $r.=$urlent; }
else # unknown client, &CGI::escapeHTML should not be needed here
elsif ($W->{"have_ent"}) # ent client
{ $r.=$urlent; }
else # unknown client, &CGI::escapeHTML should not be needed here
- { $r.=CGI::escapeHTML(
$W->{"top_dir"}
."/Redirect.pl?location=".uri_escape($url)); }
+ { $r.=CGI::escapeHTML(
top_dir()
."/Redirect.pl?location=".uri_escape($url)); }
$r.='">'.$contents.'</a>';
if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/) { # Downloadable?
if (!-r $url)
$r.='">'.$contents.'</a>';
if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/) { # Downloadable?
if (!-r $url)
@@
-476,6
+488,10
@@
HERE
print ' bgcolor="black" text="white" link="aqua" vlink="teal"'
if $W->{"browser"}->netscape() && $W->{"browser"}->major<=4;
print ">\n";
print ' bgcolor="black" text="white" link="aqua" vlink="teal"'
if $W->{"browser"}->netscape() && $W->{"browser"}->major<=4;
print ">\n";
+
+ if ($W->{"heading"}) {
+ do { &{$_}() if $_; } for ($W->{"heading"});
+ }
}
1;
}
1;