www: Added information link to package pages of some systems

This commit is contained in:
Yorhel 2012-08-17 13:34:19 +02:00
parent 9c45a91213
commit 95776adf49
2 changed files with 25 additions and 0 deletions

View file

@ -42,6 +42,18 @@ TUWF::set(
); );
# TODO: Abstract this into the systems table?
$TUWF::OBJ->{pkglinks} = {
arch => sub { "http://www.archlinux.org/packages/$_[0]{category}/i686/$_[0]{name}/" },
'debian-squeeze' => sub { "http://packages.debian.org/squeeze/$_[0]{name}" },
'ubuntu-hardy' => sub { "http://packages.ubuntu.com/hardy/$_[0]{name}" },
'ubuntu-lucid' => sub { "http://packages.ubuntu.com/lucid/$_[0]{name}" },
'ubuntu-natty' => sub { "http://packages.ubuntu.com/natty/$_[0]{name}" },
'ubuntu-oneiric' => sub { "http://packages.ubuntu.com/oneiric/$_[0]{name}" },
'ubuntu-precise' => sub { "http://packages.ubuntu.com/precise/$_[0]{name}" },
};
TUWF::register( TUWF::register(
qr// => \&home, qr// => \&home,
qr{info/about} => \&about, qr{info/about} => \&about,
@ -363,6 +375,17 @@ sub browsepkg {
$self->htmlHeader(title => $title); $self->htmlHeader(title => $title);
h1 $title; h1 $title;
my $lnk = $self->{pkglinks}{$sys->{short}};
if($lnk) {
$lnk = $lnk->($sel);
(my $domain = $lnk) =~ s{^https?://(?:[^/]+\.)?([^/\.]+\.[^/\.]+)/.+}{$1};
p;
br;
a href => $lnk, 'Package information';
i class => 'grayedout', " [$domain]";
end;
}
# TODO: Link back to the system browsing page # TODO: Link back to the system browsing page
h2 'Versions'; h2 'Versions';

View file

@ -50,6 +50,8 @@ td { padding: 1px 5px; font-size: 12px; border-left: 1px solid #ccc; }
#nav b { font-size: 13px; background: #cde; padding: 3px 5px; #nav b { font-size: 13px; background: #cde; padding: 3px 5px;
-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }
i.grayedout { color: #aaa; font-size: 13px; }
#about { max-width: 900px } #about { max-width: 900px }
#about p, #about dd { text-align: justify } #about p, #about dd { text-align: justify }
#about ul { padding-left: 20px } #about ul { padding-left: 20px }