Fixed absolute hostname redirections for mod_perl proxying.
[MyWeb.git] / Project.pm
index 2226a64..3d836d8 100644 (file)
@@ -34,13 +34,15 @@ sub ENTRIES     { return top_dir_disk()."/project/CVS/Entries"; }
 sub ENTRIES_LOG { return top_dir_disk()."/project/CVS/Entries.Log"; }
 
 
-sub print_project ($)
+sub print_project
 {
-my($class,$ListItem)=@_;
+my($class,$ListItem,%args)=@_;
 
        print "<h1>".$W->{"title"}."</h1>\n";
        print $ListItem->{"description"};
        print "<hr />\n";
+       print $args{"before_project_data"} || "";
+       return if $args{"no_project_data"};
        my @table=(
                {"key"=>"summary","text"=>"Summary"},
                {"key"=>"license","text"=>"License","format"=>sub ($) {
@@ -56,12 +58,13 @@ my($class,$ListItem)=@_;
                                my %known=(
                                                "active"=>"Ready to use. Project is now actively developed.",
                                                "ready"=>"Ready to use. Maintained.",
-                                               "pending"=>"Patch is ready to be applied to the mainstream.",
                                                "dead"=>"Dead code, no longer supported.",
                                                "merge"=>"Functions belong to existing other project.",
                                                "obsolete"=>"Obsoleted.",
                                                "update"=>"Package needs updating to recent software.",
                                                "accepted"=>"This patch got already integrated by the original package maintainer.",
+                                               "pending"=>"Patch is ready to be applied to the mainstream.",
+                                               "ignored"=>"Patch was ignored. It is not applied in the mainstream.",
                                                ""=>"",
                                                );
                                my @r;
@@ -113,7 +116,7 @@ my($class,$ListItem)=@_;
                                                                                                ["Download CVS snapshot" ,
                                                                                                                $W->{"project_viewcvs"}.$val."/".File::Basename::basename($val).".tar.gz?tarball=1"
                                                                                                                                .(!$branch ? "" : '&only_with_tag='.$branch)],
-                                                                                               ["CVS ChangeLog"         ,top_dir()."/project/ChangeLog.txt.pl?cvs=$val"])));
+                                                                                               ["CVS ChangeLog"         ,"/project/ChangeLog.txt.pl?cvs=$val"])));
                                                }},
                {"key"=>"ownership","text"=>"Ownership"},
                {"key"=>"sponsorship","text"=>"Sponsorship"},
@@ -175,6 +178,13 @@ my(@arr)=@_;
                        );
 }
 
+sub title ($$)
+{
+my($class,$hashref)=@_;
+
+       return $hashref->{"name"}.": ".$hashref->{"summary"},
+}
+
 # $args{"ListItem"}=\%...;
 sub init_project ($%)
 {
@@ -182,7 +192,11 @@ my($class,%args)=@_;
 
        my $ListItem={ project_arr_to_hash(@{$args{"ListItem"}}) };
        my $W=$class->init(
-                       "title"=>$ListItem->{"name"}.": ".$ListItem->{"summary"},
+                       "title"=>$class->title($ListItem),
+                       map(("rel_$_"=>top_dir('/project/Rel.pl?rel='.$_.'&project='.($args{"__PACKAGE__"}=~/^.*::([^:]+)::[^:]+$/)[0])),
+                                       qw(prev next)),
+                       "rel_up"=>top_dir('/project/'),
+                       "rel_start"=>top_dir(),
                        %args,
                        "head_css"=>($args{"head_css"} || "")."
 table.print_project td { vertical-align: top; }
@@ -191,12 +205,23 @@ table.print_project td { vertical-align: top; }
                        );
        $class->heading();
        print $class->platforms($ListItem->{"platform"});
-       $class->print_project({ %$ListItem });
+       $class->print_project({ %$ListItem },%args);
        return $W;
 }
 
+sub one_item_list_read($$)
+{
+my($class,$name)=@_;
+
+       Wrequire "project::${name}::ListItem";
+       my $item=eval('\@project::'.$name.'::ListItem::ListItem');
+       do { warn "Broken project/$name/ListItem.pm"; next; } if !defined $item;
+       return @$item;
+}
+
 sub item_hash_read ()
 {
+# FIXME: $class
        my %dirs;
        for my $ENTRIES (ENTRIES(),ENTRIES_LOG()) {
                local *E;
@@ -216,14 +241,14 @@ sub item_hash_read ()
                Wrequire "project::${dir}::ListItem";
                my $item=eval('\@project::'.$dir.'::ListItem::ListItem');
                do { warn "Broken project/$dir/ListItem.pm"; next; } if !defined $item;
-               $item{$dir}={ My::Project::project_arr_to_hash(@$item) };
+               $item{$dir}={ My::Project::project_arr_to_hash(My::Project->one_item_list_read($dir)) };
                }
        return %item;
 }
 
 our @platforms=(
-               "unixuser"=>"GNU/Linux",
-               "unixdevel"=>"GNU/Linux Development",
+               "unixuser"=>"UNIX",
+               "unixdevel"=>"UNIX-devel",
                "web"=>"Web",
                "amiga"=>"Amiga",
                "w32"=>"MS-Windows",
@@ -247,19 +272,19 @@ my($class,$view_selected)=@_;
 <h1>Project List of @{[ a_href 'http://www.jankratochvil.net/','Jan Kratochvil' ]}</h1>
 
 <ul>
-       <li>@{[ &{$view}('Detailed'     ,top_dir().'/project/','Detailed project listing per platform') ]}</li>
-       <li>@{[ &{$view}('BriefPlatform',top_dir().'/project/List.html.pl?platform=platform',
+       <li>@{[ &{$view}('Detailed'     ,'/project/','Detailed project listing per platform') ]}</li>
+       <li>@{[ &{$view}('BriefPlatform','/project/List.html.pl?platform=platform',
                        'Brief project listing per platform') ]}</li>
-       <li>@{[ &{$view}('BriefUnified' ,top_dir().'/project/List.html.pl',
+       <li>@{[ &{$view}('BriefUnified' ,'/project/List.html.pl',
                        'Unified brief project listing') ]}</li>
 </ul>
 @{[ vskip "1ex" ]}
 HERE
 }
 
-sub platforms ($;$)
+sub platforms ($;$%)
 {
-my($class,$platform_selected)=@_;
+my($class,$platform_selected,%args)=@_;
 
        my $r="";
        $r.='<table border="0" align="center"><tr>'."\n";
@@ -273,7 +298,7 @@ my($class,$platform_selected)=@_;
                                                my $platform_name=shift @platforms;
                                                my $chosen=($platform_selected && $platform_selected eq $platform_sym);
                                                $r.='<td style="padding: 5px;">';
-                                                       $r.=a_href((!$platform_selected ? "" : top_dir()."/project/").'#'.$platform_sym,$platform_name,
+                                                       $r.=a_href((!$platform_selected ? "" : "/project/").'#'.$platform_sym,$platform_name,
                                                                        "attr"=>($chosen
                                                                                        ? 'style="text-decoration: underline; font-weight: bold;"'
                                                                                        : 'style="text-decoration: inherit; /* revoke underline */"'));
@@ -283,6 +308,29 @@ my($class,$platform_selected)=@_;
                        $r.='</table>'."\n";
                $r.='</td>'."\n";
        $r.='</tr></table>'."\n";
+       $r.=vskip "1ex" if !$args{"novskip"};
+       $r;
+}
+
+sub section ($$)
+{
+my($class,$name)=@_;
+
+       my %item=( $class->one_item_list_read($name) );
+       my $title=$class->title(\%item);
+       my $r="";
+
+       print $class->platforms($item{"platform"},"novskip"=>1);
+
+       $r.='<table border="0" align="center"><tr>'."\n";
+               $r.='<td>';
+                       $r.='<table border="1" align="center" style="border-collapse: collapse; border-style: solid;">'."\n";
+                               $r.='<tr><td style="font-size: larger;">'."\n";
+                                       $r.=a_href "/project/$name/",$title;
+                               $r.='</td></tr>'."\n";
+                       $r.='</table>'."\n";
+               $r.='</td>'."\n";
+       $r.='</tr></table>'."\n";
        $r.=vskip "1ex";
        $r;
 }