use Exporter;
our @EXPORT=qw();
-our @ISA=qw(My::Web Exporter);
+Wrequire 'Lib';
+our @ISA=qw(My::Web Lib Exporter);
-sub LIST_FILENAME()
-{
- # Do not: path_abs_disk("/project/SUBDIRS");
- # as we would need $W->{"r"} for the possibly relative path resolving.
- return My::Web::dir_top_abs_disk()."/project/SUBDIRS";
-}
+my $LIST_ABSPATH="/project/SUBDIRS";
sub print_project
my $branch="";
$branch=$1 if $val=~s/:(.*)//;
return join("<br />\n\t\t",
- escapeHTML("cvs -d ".$W->{"pserver"}.":".$W->{"pserver_path"}." -z3"
- ." checkout".(!$branch ? "" : " -r $branch -kk")
- .($val!~m#/# ? "" : " -d ".File::Basename::basename($val))
- ." $val"),
+#pserver:
+# escapeHTML("cvs -d ".$W->{"pserver"}.":".$W->{"pserver_path"}." -z3"
+# ." checkout".(!$branch ? "" : " -r $branch -kk")
+# .($val!~m#/# ? "" : " -d ".File::Basename::basename($val))
+# ." $val"),
join(" | \n\t\t",
map({ a_href($_->[1],$_->[0]); }
["ViewCVS CVS repository",$W->{"project_viewcvs"}.$val."/".(!$branch ? "" : '?only_with_tag='.$branch)],
print vskip;
}
-sub hashlikearray_get_keys(@)
-{
-my(@hashlikearray)=@_;
-
- my @r;
- while (@hashlikearray) {
- push @r,shift @hashlikearray; # key
- shift @hashlikearray; # val
- }
- return @r;
-}
-
-sub project_arrayref_to_hashref($$)
-{
-my($self,$arrayref)=@_;
-
- Wrequire 'My::Hash';
- return My::Hash->new({
- @$arrayref,
- "keys_array"=>[ hashlikearray_get_keys(@$arrayref) ],
- },"My::Hash::Sub","My::Hash::Readonly");
-}
-
-sub title ($$)
-{
-my($class,$hashref)=@_;
-
- cluck if !$hashref->{"name"} || !$hashref->{"summary"};
- return $hashref->{"name"}.": ".$hashref->{"summary"},
-}
-
# Returns: hashref if !wantarray(), list if wantarray().
sub list($)
{
my($self)=@_;
- # This cache is "headers_in" hits safe - only local files reading.
- our %list_cache;
- our @list_cache;
- if (!@list_cache) {
- My::Web->make_file(LIST_FILENAME());
- local *F;
- open F,LIST_FILENAME() or do {
- cluck "Error opening \"".LIST_FILENAME()."\": $!";
- return;
- };
- my @r=split(" ",do { undef $/; <F>; });
- close F or cluck "Error closing \"".LIST_FILENAME()."\": $!";
- cluck "No projects found?" if !@r;
- @list_cache=@r;
- %list_cache=map(($_=>1),@list_cache);
- }
- return \%list_cache if !wantarray();
- return @list_cache;
-}
-
-# Returns: hashlist of hashrefs if !$name.
-sub name_to_hashref($;$)
-{
-my($class,$name)=@_;
-
- cluck if !wantarray() && !$name;
- # Do not cache the result to get all the items &Wrequire-mapped.
- return map(($_=>$class->name_to_hashref($_)),$class->list()) if !$name;
- cluck join(" ","Project name \"$name\" not listed in 'list_cache':",$class->list())
- if !$class->list()->{$name};
- # Never cache anything to be stable for "headers_in" hits.
- Wrequire "project::${name}::Index";
- my $arrayref=eval('\@project::'.$name.'::Index::ListItem');
- do { warn "Broken project/$name/Index.pm"; return undef(); } if !@$arrayref;
- return $class->project_arrayref_to_hashref($arrayref);
+ return $self->list_abspath($LIST_ABSPATH);
}
# $args{"ListItem"}=\%...;
%args,
"heading_novskip"=>1,
);
+ do { &{$_}() if $_; } for $W->{__PACKAGE__."-init-hook"};
$class->heading();
print $class->platforms($ListItem->{"platform"});
$class->print_project($ListItem,%args);
$r.='</td>'."\n";
$r.='</tr></table>'."\n";
if (!$args{"novskip"}) {
- $r.="<hr />\n";
- $r.=My::Web::vskip "6ex";
+ Wrequire 'WebConfig';
+ $r.=WebConfig->vskip_hr();
}
return $r;
}
-sub section ($$)
+sub section($$)
{
my($class,$name)=@_;
my $item=$class->name_to_hashref($name);
- my $title=$class->title($item);
- my $r="";
-
- print $class->platforms($item->{"platform"},"novskip"=>1);
-
- $r.='<table border="1" style="border-collapse: collapse; border-style: solid;" class="margin-center">'."\n";
- $r.='<tr><td style="font-size: larger;">'."\n";
- $r.=a_href "/project/$name/",$title;
- $r.='</td></tr>'."\n";
- $r.='</table>'."\n";
- $r.=vskip "1ex";
- return $r;
+ return ""
+ .$class->platforms($item->{"platform"},"novskip"=>1)
+ .$class->SUPER::section($name);
}
1;