From 95776adf49e30670617ff09f6ff6cd32b4acf321 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 17 Aug 2012 13:34:19 +0200 Subject: [PATCH] www: Added information link to package pages of some systems --- www/index.pl | 23 +++++++++++++++++++++++ www/man.css | 2 ++ 2 files changed, 25 insertions(+) diff --git a/www/index.pl b/www/index.pl index 694ca10..b6fe879 100755 --- a/www/index.pl +++ b/www/index.pl @@ -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( qr// => \&home, qr{info/about} => \&about, @@ -363,6 +375,17 @@ sub browsepkg { $self->htmlHeader(title => $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 h2 'Versions'; diff --git a/www/man.css b/www/man.css index d8e2b27..e214874 100644 --- a/www/man.css +++ b/www/man.css @@ -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; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } +i.grayedout { color: #aaa; font-size: 13px; } + #about { max-width: 900px } #about p, #about dd { text-align: justify } #about ul { padding-left: 20px }