Index: server/trunk/web/lib/Sophie/Controller/Distrib.pm
===================================================================
--- server/trunk/web/lib/Sophie/Controller/Distrib.pm	(revision 20)
+++ server/trunk/web/lib/Sophie/Controller/Distrib.pm	(revision 21)
@@ -33,18 +33,20 @@
     my $rs = $c->model('Base')->resultset('Distribution');
     if (!$distribution) {
-        return $c->stash->{xmlrpc} = [ map { $_->name } $rs->all ];
+        return $c->stash->{xmlrpc} = [ map { $_->name }
+            $rs->search(undef, { order_by => ['name'] })->all ];
     }
     $rs = $rs->search(name => $distribution)->search_related('Release');
     if (!$release) {
-        return $c->stash->{xmlrpc} = [ map { $_->version } $rs->all ];
-        
+        return $c->stash->{xmlrpc} = [ map { $_->version }
+            $rs->search(undef, { order_by => ['version'] })->all ];
     }
     $rs = $rs->search(version => $release)->search_related('Arch');
     if (!$arch) {
-        return $c->stash->{xmlrpc} = [ map { $_->arch } $rs->all ];
+        return $c->stash->{xmlrpc} = [ map { $_->arch } 
+            $rs->search(undef, { order_by => ['arch'] })->all ];
     }
     $rs = $rs->search(arch => $arch)->search_related('Medias');
-    $c->stash->{xmlrpc} = [ map { $_->label } $rs->all ];
-    $c->stash->{xmlrpc}
+    return $c->stash->{xmlrpc} = [ map { $_->label }
+        $rs->search(undef, { order_by => ['label'] })->all ];
 }
 
@@ -117,6 +119,5 @@
 sub distrib :Chained('distrib_view') PathPart('') {
     my ( $self, $c ) = @_;
-    $c->forward('list', $c->stash->{dist});
-    $c->forward('rpms', $c->stash->{dist});
+    $c->forward('list', [ $c->stash->{dist} ]);
     # TODO store properly results
     # No call from json here
@@ -208,5 +209,5 @@
 sub rpm_by_name :Chained('distrib_view') PathPart('rpms/by-name') Args(1) {
 }
-sub rpm_by_pkid :Chained('distrib_view') PathPart('rpms/by-pkgid') Args(1) {
+sub rpm_by_pkid :Chained('distrib_view') PathPart('by-pkgid') Args(1) {
 }
 
@@ -250,12 +251,14 @@
     $c->forward('media_rpms', [ $c->stash->{dist}, $c->stash->{media} ]);
 }
-sub media_rpm_byname :Chained('_media_list_rpms') PathPart('rpms/by_name') {
-    my ( $self, $c ) = @_;
-}
-sub media_srpm_byname :Chained('_media_list_rpms') PathPart('srpms/by_name') {
-    my ( $self, $c ) = @_;
-}
-sub media_rpm_bypkgid :Chained('_media_list_rpms') PathPart('rpms/by_pkgid') {
-    my ( $self, $c ) = @_;
+
+sub media_rpm_byname :Chained('_media_list_rpms') PathPart('rpms/by-name') {
+    my ( $self, $c ) = @_;
+}
+sub media_srpm_byname :Chained('_media_list_rpms') PathPart('srpms/by-name') {
+    my ( $self, $c ) = @_;
+}
+sub media_rpm_bypkgid :Chained('_media_list_rpms') PathPart('by-pkgid') {
+    my ( $self, $c, $pkgid ) = @_;
+    $c->forward('/rpms/queryformat', [ $pkgid, '%{name}' ]);
 }
 
Index: server/trunk/web/root/templates/html/distrib/distrib.html
===================================================================
--- server/trunk/web/root/templates/html/distrib/distrib.html	(revision 21)
+++ server/trunk/web/root/templates/html/distrib/distrib.html	(revision 21)
@@ -0,0 +1,5 @@
+<ol>
+[% FOREACH media = xmlrpc %]
+<li><a href="[% c.uri_for('/', c.req.path, 'media', media) %]">[% media %]</a></li>
+[% END %]
+</ol>
Index: server/trunk/web/root/templates/html/distrib/list_arch.html
===================================================================
--- server/trunk/web/root/templates/html/distrib/list_arch.html	(revision 21)
+++ server/trunk/web/root/templates/html/distrib/list_arch.html	(revision 21)
@@ -0,0 +1,3 @@
+<!-- $Id$ -->
+
+[% INCLUDE 'distrib/list_arch.tt' %]
Index: server/trunk/web/root/templates/html/distrib/list_arch.tt
===================================================================
--- server/trunk/web/root/templates/html/distrib/list_arch.tt	(revision 21)
+++ server/trunk/web/root/templates/html/distrib/list_arch.tt	(revision 21)
@@ -0,0 +1,7 @@
+<!-- $Id$ -->
+
+<ol>
+[% FOREACH arch = xmlrpc %]
+<li><a href="[% c.uri_for('/', c.req.path, arch ) %]">[% arch %]</a></li>
+[% END %]
+<ol>
Index: server/trunk/web/root/templates/html/distrib/media_list_rpms.html
===================================================================
--- server/trunk/web/root/templates/html/distrib/media_list_rpms.html	(revision 21)
+++ server/trunk/web/root/templates/html/distrib/media_list_rpms.html	(revision 21)
@@ -0,0 +1,3 @@
+<!-- $Id$ -->
+
+[% INCLUDE 'distrib/media_list_rpms.tt' %]
Index: server/trunk/web/root/templates/html/distrib/media_list_rpms.tt
===================================================================
--- server/trunk/web/root/templates/html/distrib/media_list_rpms.tt	(revision 21)
+++ server/trunk/web/root/templates/html/distrib/media_list_rpms.tt	(revision 21)
@@ -0,0 +1,12 @@
+<!-- $Id$ -->
+[% FOREACH rpm = xmlrpc %]
+[% IF loop.first %]
+<ul>
+[% END %]
+<li>
+    <a href="[% c.uri_for('/', c.req.path, 'by-pkgid', rpm.pkgid) %]">[% rpm.filename | html %]</a>
+</li>
+[% IF loop.last %]
+</ul>
+[% END %]
+[% END %]
Index: server/trunk/web/t/controller_Distrib.t
===================================================================
--- server/trunk/web/t/controller_Distrib.t	(revision 20)
+++ server/trunk/web/t/controller_Distrib.t	(revision 21)
@@ -7,4 +7,6 @@
 # know existing data:
 my $distribution = 'Mandriva';
+my $release = 'cooker';
+my $arch = 'i586';
 
 BEGIN { use_ok 'Catalyst::Test', 'Sophie' }
@@ -26,3 +28,5 @@
 ok( request( xmlrpcreq('distrib.list') ), "XMLRPC");
 ok( request( xmlrpcreq('distrib.list', $distribution) ), "XMLRPC");
+ok( request("/distrib/$distribution/$release")->is_success, 'Request should succeed' );
+ok( request("/distrib/$distribution/$release/$arch")->is_success, 'Request should succeed' );
 done_testing();
