- Timestamp:
- 12/11/10 10:56:15 (14 years ago)
- Location:
- server/trunk/web
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Controller/Rpms.pm
r99 r112 131 131 } 132 132 133 =head2 rpms.location (PKGID)134 135 Return all distribution where the package having C<PKGID> can be found.136 137 =cut138 139 sub location : XMLRPCLocal {140 my ($self, $c, $pkgid) = @_;141 142 $c->stash->{xmlrpc} = [143 map {144 {145 distribution => $_->get_column('name'),146 release => $_->get_column('version'),147 arch => $_->get_column('arch'),148 media => $_->get_column('label'),149 media_group => $_->get_column('group_label'),150 }151 }152 $c->forward('/distrib/distrib_rs', [ {} ])153 ->search_related('MediasPaths')154 ->search_related('Paths')155 ->search_related('Rpmfiles',156 { pkgid => $pkgid },157 {158 select => [ qw(name version arch label group_label) ],159 }160 )->all ]161 162 163 }164 165 133 sub rpms_ :PathPrefix :Chained :CaptureArgs(1) { 166 134 my ( $self, $c, $pkgid ) = @_; … … 178 146 sub rpms : Private { 179 147 my ( $self, $c, $pkgid, $subpart, @args) = @_; 180 $c->stash->{rpmurl} = $c->req->path;181 148 # Because $c->forward don't take into account Chained sub 182 149 $c->forward('rpms_', [ $pkgid ]); … … 185 152 /^files$/ and $c->go('files', [ $pkgid, @args ]); 186 153 /^changelog$/ and $c->go('changelog', [ $pkgid, @args ]); 187 } 154 /^location$/ and $c->go('location', [ $pkgid, @args ]); 155 } 156 $c->stash->{rpmurl} = $c->req->path; 188 157 189 158 return $c->stash->{xmlrpc} = $c->stash->{rpms}; … … 281 250 } 282 251 283 sub changelog :Chained('rpms_') :PathPart('changelog') :Args(0) {252 sub changelog :Chained('rpms_') :PathPart('changelog') :Args(0) :XMLRPCLocal { 284 253 my ( $self, $c, $pkgid ) = @_; 285 254 $pkgid ||= $c->stash->{pkgid}; … … 310 279 } 311 280 281 =head2 rpms.location (PKGID) 282 283 Return all distribution where the package having C<PKGID> can be found. 284 285 =cut 286 287 sub location :Chained('rpms_') :PathPart('location') :Args(0) { 288 my ( $self, $c, $pkgid ) = @_; 289 $pkgid ||= $c->stash->{pkgid}; 290 $c->stash->{rpmurl} = ($c->req->path =~ m:(.*)/[^/]+:)[0]; 291 292 $c->stash->{xmlrpc} = [ 293 map { 294 { 295 distribution => $_->get_column('name'), 296 dist => $_->get_column('shortname'), 297 release => $_->get_column('version'), 298 arch => $_->get_column('arch'), 299 media => $_->get_column('label'), 300 media_group => $_->get_column('group_label'), 301 } 302 } 303 $c->forward('/distrib/distrib_rs', [ {} ]) 304 ->search_related('MediasPaths') 305 ->search_related('Paths') 306 ->search_related('Rpmfiles', 307 { pkgid => $pkgid }, 308 { 309 select => [ qw(shortname name version arch label group_label) ], 310 order_by => [ qw(name version arch label) ], 311 } 312 )->all ] 313 } 314 312 315 =head1 AUTHOR 313 316 -
server/trunk/web/root/templates/html/rpms/menu.tt
r76 r112 3 3 <a href="[% c.uri_for('/', rpmurl, 'files') %]">Files</a> 4 4 <a href="[% c.uri_for('/', rpmurl, 'changelog') %]">ChangeLog</a> 5 <a href="[% c.uri_for('/', rpmurl, 'location') %]">Location</a> -
server/trunk/web/t/controller_Rpms.t
r57 r112 13 13 ok( request("/rpms/$pkgid/files")->is_success, 'Request a pkgid/files should succeed' ); 14 14 ok( request("/rpms/$pkgid/changelog")->is_success, 'Request a pkgid/changelog should succeed' ); 15 ok( request("/rpms/$pkgid/location")->is_success, 'Request a pkgid/location should succeed' ); 15 16 done_testing();
Note: See TracChangeset
for help on using the changeset viewer.