Index: /server/trunk/web/lib/Sophie/Controller/Distrib.pm
===================================================================
--- /server/trunk/web/lib/Sophie/Controller/Distrib.pm	(revision 183)
+++ /server/trunk/web/lib/Sophie/Controller/Distrib.pm	(revision 184)
@@ -14,4 +14,15 @@
 
 =head1 METHODS
+
+=cut
+
+=head2 distrib.list( [ DISTRIBUTION [, RELEASE [, ARCH ]]]
+
+List content of distrib according arguments given. IE list availlable
+C<distribution> if no argument is given, list C<release> if C<DISTRIBUTION> is
+given, list C<arch> if both C<DISTRIBUTION> and C<RELEASE> are given. Etc... Up
+to give C<MEDIA> if C<ARCH> is specified.
+
+Results are given as C<ARRAY>.
 
 =cut
@@ -133,4 +144,30 @@
 }
 
+=head2 distrib.exists( DISTRIB )
+
+Return true or false if disteibution C<DISTRIB> exists.
+
+C<DISTRIB> is a structure with following key/value:
+
+=over 4
+
+=item distribution
+
+The distribution name
+
+=item release
+
+The release name
+
+=item arch
+
+The arch name
+
+=back
+
+This function is usefull to check if a search have chance to suceed, eg if the
+user is not searching a rpm on a not existing ditribution.
+
+=cut
 
 sub exists : XMLRPC {
@@ -150,4 +187,10 @@
 =cut
 
+=head2 Url: /distrib
+
+Return the list of currently stored distributions.
+
+=cut
+
 sub index :Path :Chained :Args(0)  {
     my ( $self, $c ) = @_;
@@ -156,5 +199,11 @@
 }
 
-=head release
+=head2 release
+
+=cut
+
+=head2 Url: /distrib/<DISTRIBUTION>
+
+Return the list of availlaible release for given C<DISTRIBUTION>.
 
 =cut
@@ -168,4 +217,11 @@
     $c->forward('list', [ $c->stash->{dist} ] );
 }
+
+=head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>
+
+Return the list of availlaible architecture for given C<DISTRIBUTION>,
+C<RELEASE>.
+
+=cut
 
 sub list_arch :Path :Args(2) {
@@ -185,4 +241,11 @@
 }
 
+=head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>/<ARCH>
+
+Return the list of availlaible medias for given C<DISTRIBUTION>,
+C<RELEASE>, C<ARCH>.
+
+=cut
+
 sub distrib :Chained('distrib_view') PathPart('') :Args(0) {
     my ( $self, $c ) = @_;
@@ -197,4 +260,28 @@
 }
 
+=head2 distrib.anyrpms( DISTRIB )
+
+Return a list of packages availlable for C<DISTRIB>.
+
+C<DISTRIB> is a struct with following keys/values:
+
+=over 4
+
+=item distribution
+
+The distribution name
+
+=item release
+
+The release name
+
+=item arch
+
+The arch name
+
+=back
+
+=cut
+
 sub anyrpms :XMLRPC {
     my ( $self, $c, $distribution, $release, $arch ) = @_;
@@ -222,4 +309,28 @@
     $c->stash->{xmlrpc} = $c->stash->{rpm};
 }
+
+=head2 distrib.rpms( DISTRIB )
+
+Return a list of binary packages availlable for C<DISTRIB>.
+
+C<DISTRIB> is a struct with following keys/values:
+
+=over 4
+
+=item distribution
+
+The distribution name
+
+=item release
+
+The release name
+
+=item arch
+
+The arch name
+
+=back
+
+=cut
 
 sub rpms :XMLRPC {
@@ -251,4 +362,28 @@
     $c->stash->{xmlrpc} = $c->stash->{rpm};
 }
+
+=head2 distrib.srpms( DISTRIB )
+
+Return a list of sources packages availlable for C<DISTRIB>.
+
+C<DISTRIB> is a struct with following keys/values:
+
+=over 4
+
+=item distribution
+
+The distribution name
+
+=item release
+
+The release name
+
+=item arch
+
+The arch name
+
+=back
+
+=cut
 
 sub srpms :XMLRPC {
@@ -305,12 +440,20 @@
 }
 
+
+=head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>/<ARCH>/RPMS
+
+Return the list of availlaible rpms for given C<DISTRIBUTION>,
+C<RELEASE>, C<ARCH>.
+
+=cut
+
 sub list_rpms :Chained('distrib_view') PathPart('rpms') Args(0) {
     my ( $self, $c ) = @_;
-    $c->forward('rpms', $c->stash->{dist});
+    $c->forward('rpms', [ $c->stash->{dist} ]);
 }
 
 sub list_srpms :Chained('distrib_view') PathPart('srpms') Args(0) {
     my ( $self, $c ) = @_;
-    $c->forward('srpms', $c->stash->{dist});
+    $c->forward('srpms', [ $c->stash->{dist} ]);
 }
 
Index: /server/trunk/web/root/templates/html/distrib/list_rpms.html
===================================================================
--- /server/trunk/web/root/templates/html/distrib/list_rpms.html	(revision 184)
+++ /server/trunk/web/root/templates/html/distrib/list_rpms.html	(revision 184)
@@ -0,0 +1,3 @@
+<!-- $Id$ -->
+
+[% INCLUDE 'distrib/list_rpms.tt' %]
Index: /server/trunk/web/root/templates/html/distrib/list_rpms.tt
===================================================================
--- /server/trunk/web/root/templates/html/distrib/list_rpms.tt	(revision 184)
+++ /server/trunk/web/root/templates/html/distrib/list_rpms.tt	(revision 184)
@@ -0,0 +1,12 @@
+<!-- $Id$ -->
+[% FOREACH rpm = xmlrpc %]
+[% IF loop.first %]
+<ul class="sophie_tag" >
+[% 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 183)
+++ /server/trunk/web/t/controller_Distrib.t	(revision 184)
@@ -18,5 +18,11 @@
 
 ok( request('/distrib')->is_success, 'Request should succeed' );
-ok( request("/distrib/$distribution")->is_success, 'Request should succeed' );
+ok( request('/distrib', { ajax => 1 })->is_success, 'Request ajax should succeed' );
+ok( request('/distrib', { json => 1 })->is_success, 'Request json should succeed' );
+ok( request("/distrib/$distribution")->is_success, 'Request distribution should succeed' );
+ok( request("/distrib/$distribution", { ajax => 1 })->is_success,
+    'Request distribution as ajax should succeed' );
+ok( request("/distrib/$distribution", { json => 1 })->is_success,
+    'Request distribution as ajax should succeed' );
 ok( xmlrequest_ok( 'distrib.list'), "XMLRPC");
 ok( xmlrequest_ok( 'distrib.list', $distribution), "XMLRPC");
@@ -24,4 +30,7 @@
 ok( request("/distrib/$distribution/$release/$arch")->is_success, 'Request should succeed' );
 ok( request("/distrib/$distribution/$release/$arch/media")->is_success, 'Request should succeed' );
+
+ok( request("/distrib/$distribution/$release/rpms")->is_success, 'Request should succeed' );
+
 ok(
     request("/distrib/$distribution/$release/$arch/media/$media/by-pkgid/$pkgid")
