Ignore:
Timestamp:
12/08/10 17:00:50 (14 years ago)
Author:
nanardon
Message:
  • add /sources in menu
  • add all view under /sources
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Sources.pm

    r97 r98  
    2525    my ( $self, $c ) = @_; 
    2626 
    27     $c->response->body('Matched Sophie::Controller::Sources in Sources.'); 
     27    if ($c->req->param('search')) { 
     28        $c->stash->{xmlrpc} = [ $c->model('Base::Rpms') 
     29        ->search( 
     30            { 
     31                name => { 'LIKE' => $c->req->param('search') . '%' }, 
     32                issrc => 1, 
     33            }, 
     34            { 
     35                group_by => [ qw(name) ], 
     36                select => [ qw(name) ], 
     37            } 
     38        )->get_column('name')->all ]; 
     39    } else { 
     40        $c->stash->{xmlrpc} = []; 
     41    } 
    2842} 
    2943 
     
    92106        )->search_related('SrcFiles')->search( 
    93107            { 
    94                 #has_content => 1, 
     108                has_content => 1, 
    95109                basename => $filename, 
    96110            }, 
    97111            { 
     112                    '+columns' => [ qw(me.evr) ], 
    98113                    order_by => [ 'evr using >>' ], 
    99114            } 
     
    102117} 
    103118 
    104 sub rpm_sources :Path :Args(1) { 
     119sub rpm_sources_ :PathPrefix :Chained :CaptureArgs(1) { 
     120    my ($self, $c, $rpm) = @_; 
     121    $c->stash->{rpm} = $rpm; 
     122} 
     123 
     124sub rpm_sources :Chained('rpm_sources_') :PathPart('') :Args(0) { 
    105125    my ($self, $c, $rpm) = @_; 
    106126 
    107     $c->forward('srcfiles', [ {}, $rpm ]); 
     127    $c->forward('srcfiles', [ {}, $c->stash->{rpm} ]); 
    108128 
    109129} 
    110130 
    111 sub rpm_sources_file :Path :Args(2) { 
    112     my ($self, $c, $rpm, $filename) = @_; 
     131sub rpm_sources_file_ :Chained('rpm_sources_') :PathPart('') :CaptureArgs(1) { 
     132    my ($self, $c, $filename) = @_; 
     133    $c->stash->{filename} = $filename; 
    113134 
    114     $c->forward('srcfilesbyfile', [ {}, $rpm, $filename ]); 
     135    $c->stash->{list} = $c->forward('srcfilesbyfile', [ {}, 
     136        $c->stash->{rpm}, $c->stash->{filename} ] ); 
     137} 
     138 
     139sub rpm_sources_file :Chained('rpm_sources_file_') :PathPart('') :Args(0) { 
     140    my ($self, $c ) = @_; 
     141 
     142    #$c->forward('srcfilesbyfile', [ {}, 
     143    #        $c->stash->{rpm}, $c->stash->{filename} ] ); 
     144 
     145} 
     146 
     147sub rpm_sources_file_pkg_ :Chained('rpm_sources_file_') :PathPart('') :CaptureArgs(1) { 
     148    my ($self, $c, $pkgid) = @_; 
     149    $c->stash->{pkgid} = $pkgid; 
     150    $c->stash->{xmlrpc} = { $c->model('Base::SrcFiles')->find( 
     151        { 
     152 
     153            pkgid => $c->stash->{pkgid}, 
     154            basename => $c->stash->{filename}, 
     155        }, 
     156        { 
     157            '+columns' => ['contents'], 
     158        } 
     159    )->get_columns }; 
     160} 
     161 
     162sub rpm_sources_file_pkg :Chained('rpm_sources_file_pkg_') :PathPart('') :Args(0) { 
     163    my ($self, $c) = @_; 
    115164 
    116165} 
Note: See TracChangeset for help on using the changeset viewer.