-sub print_project ($)
-{
-my($class,$ListItem)=@_;
-
- print "<h1>".$ListItem->{"name"}."</h1>\n";
- print $ListItem->{"description"};
- print "<hr />\n";
- my @table=(
- {"key"=>qr(^download\b.*),"text"=>sub ($) {
- $_[0]=~s/^download//;
- $_[0]=~s/^-/ /;
- return "Download".$_[0];
- },
- "format"=>sub ($) {
- my $r;
- if ($_[0]=~m#^[a-z]+://#) {
- $r="<a href=\"".$_[0]."\">".CGI::escapeHTML($_[0])."</a>";
- }
- else {
- $r="<a href=\"".$_[0]."\">".CGI::escapeHTML(basename($_[0]))."</a>";
- my $size=(stat $_[0])[7];
- die "Cannot stat \"".$_[0]."\": $!" if !defined $size;
- if ($size>=1024*1024) { $size=int($size/(1024*1024))." MB"; }
- elsif ($size>=1024 ) { $size=int($size/(1024 ))." KB"; }
- else { $size=int($size )." B"; }
- $r.=" ($size)";
- }
- return $r;
- }},
- {"key"=>qr(^link\b.*),"text"=>sub ($) {
- $_[0]=~s/^link-//;
- return $_[0];
- },
- "format"=>sub ($) {
- return "<a href=\"".$_[0]."\">".CGI::escapeHTML($_[0])."</a>";
- }},
- {"key"=>"summary","text"=>"Summary"},
- {"key"=>"ownership","text"=>"Ownership"},
- {"key"=>"license","text"=>"License","format"=>sub ($) {
- my %known=(
- "PD"=>"Public Domain",
- "GPL"=>"<a href=\"http://www.gnu.org/licenses/gpl.html\">GNU General Public License</a>",
- "LGPL"=>"<a href=\"http://www.gnu.org/licenses/lgpl.html\">GNU Lesser General Public License</a>",
- );
- return $known{$_[0]};
- }},
- {"key"=>"maintenance","text"=>"Currently maintained?","format"=>sub ($) {
- my %known=(
- "finished"=>"Project is finished. Possible bug reports welcome although project not actively developed.",
- "dead"=>"Project became dead code, some updates would be required. It is no longer used, project is not supported.",
- "obsolete"=>"Obsolete as some other existing package superseded this one.",
- "merge"=>"Functions of this package should be merged to some other one.",
- "update"=>"Package needs updating to be fully usable, patches welcome.",
- "accepted"=>"This patch was accepted by the original package author. It has no longer any separate meaning.",
- );
- return $known{$_[0]};
- }},
- {"key"=>"reason","text"=>"Reason"},
- {"key"=>"sponsorship","text"=>"Sponsoring Company"},
- {"key"=>"language","text"=>"Programming language","format"=>sub ($) {
- return "<a href=\"http://java.sun.com/\">".CGI::escapeHTML($_[0])."</a>"
- if $_[0]=~/^Java\b/;
- return "<a href=\"http://www.php.net/\">".CGI::escapeHTML($_[0])."</a>"
- if $_[0]=~/^PHP\b/;
- return undef();
- }},
- );
- print '<table border="0">'."\n";