Changeset 331


Ignore:
Timestamp:
01/21/11 18:06:58 (13 years ago)
Author:
nanardon
Message:
  • add rpms/scriptlet page
Location:
server/trunk/web
Files:
2 added
2 edited

Legend:

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

    r328 r331  
    382382        /^analyse$/    and $c->go('analyse',     [ $pkgid, @args ]); 
    383383        /^dependency$/ and $c->go('dependency',  [ $pkgid, @args ]); 
    384         /^history$/    and $c->go('history',  [ $pkgid, @args ]); 
     384        /^history$/    and $c->go('history',     [ $pkgid, @args ]); 
    385385        /^query$/      and $c->go('query',       [ $pkgid, @args ]); 
     386        /^scriptlet$/  and $c->go('scriptlet',   [ $pkgid, @args ]); 
    386387        /./            and $c->go('/404/index'); # other subpart dont exists 
    387388    } 
     
    511512} 
    512513 
     514sub scriptlet :Chained('rpms_') :PathPart('scriptlet') :Args(0) :XMLRPCLocal { 
     515    my ( $self, $c, $pkgid ) = @_; 
     516    $pkgid ||= $c->stash->{pkgid}; 
     517    $c->stash->{rpmurl} = ($c->req->path =~ m:(.*)/[^/]+:)[0]; 
     518 
     519    $c->stash->{xmlrpc} = {}; 
     520    foreach ( 
     521            [ 'PREIN', 'PREINPROG' ], 
     522            [ 'POSTIN', 'POSTINPROG' ], 
     523            [ 'PREUN', 'PREUNPROG' ], 
     524            [ 'POSTUN', 'POSTUNPROG' ], 
     525            [ 'PRETRANS', 'PRETRANSPROG' ], 
     526            [ 'POSTTRANS', 'POSTTRANSPROG' ], 
     527        ) { 
     528             
     529        my ($res) = $c->model('Base::Rpms')->search( 
     530            { pkgid => $pkgid }, 
     531            {  
     532                select => [  
     533                    qq{rpmquery("header", ?)}, 
     534                    qq{rpmquery("header", ?)}, 
     535                ], 
     536                as => [ qw(script prog) ], 
     537                bind => $_, 
     538            } 
     539        )->all; 
     540         
     541        $c->stash->{xmlrpc}{$_->[0]} = { $res->get_columns } if ($res); 
     542    } 
     543    $c->stash->{xmlrpc}{triggers} = [ 
     544        map { { $_->get_columns } } 
     545        $c->model('Base::Rpms')->search( 
     546            { pkgid => $pkgid }, 
     547            {  
     548                select => [  
     549                    qq{rpmquery("header", ?)}, 
     550                    qq{rpmquery("header", ?)}, 
     551                    qq{rpmquery("header", ?)}, 
     552                    qq{rpmsenseflag(rpmquery("header", ?)::int)}, 
     553                    qq{rpmquery("header", ?)}, 
     554                ], 
     555                as => [ qw(script prog name sense version) ], 
     556                bind => [qw( 
     557                    TRIGGERSCRIPTS 
     558                    TRIGGERSCRIPTPROG 
     559                    TRIGGERNAME 
     560                    TRIGGERFLAGS 
     561                    TRIGGERVERSION 
     562                    )] 
     563            } 
     564        )->all ]; 
     565 
     566    return $c->stash->{xmlrpc}; 
     567} 
     568 
    513569=head2 rpms.location( PKGID ) 
    514570 
  • server/trunk/web/root/templates/html/rpms/menu.tt

    r278 r331  
    88<li><a href="[% c.uri_for('/', rpmurl, 'deps') %]">Deps</a></li> 
    99<li><a href="[% c.uri_for('/', rpmurl, 'files') %]">Files</a></li> 
     10<li><a href="[% c.uri_for('/', rpmurl, 'scriptlet') %]">Scripts</a></li> 
    1011<li><a href="[% c.uri_for('/', rpmurl, 'changelog') %]">ChangeLog</a></li> 
    1112<li><a href="[% c.uri_for('/', rpmurl, 'location') %]">Location</a></li> 
Note: See TracChangeset for help on using the changeset viewer.