Changeset 134 for server/trunk/web


Ignore:
Timestamp:
12/18/10 17:28:09 (13 years ago)
Author:
nanardon
Message:
  • add search by file
Location:
server/trunk/web
Files:
3 edited

Legend:

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

    r130 r134  
    4242    for ($c->req->param('type')) { 
    4343        /^byname$/ and do { 
     44            $c->stash->{sargs} = [ {}, $c->req->param('search') ]; 
    4445            $c->forward('byname', [ $searchspec, $c->req->param('search') || 
    4546                    undef ]); 
     
    4748        }; 
    4849        /^bydep$/ and do { 
    49             $c->forward('bydep', [ $searchspec, $c->req->param('deptype'), grep { $_ } split (/\s+/, 
    50                         $c->req->param('search') || '') ]); 
     50            my @args = ($c->req->param('deptype'), grep { $_ } 
     51                split(/\s+/, $c->req->param('search') || '' )); 
     52            $c->stash->{sargs} = [ {}, @args ], 
     53            $c->forward('bydep', [ $searchspec, @args ]); 
     54            last; 
     55        }; 
     56        /^byfile$/ and do { 
     57            my @args = ($c->req->param('search') || ''); 
     58            $c->stash->{sargs} = [ {}, @args ], 
     59            $c->forward('byfile', [ $searchspec, @args ]); 
    5160            last; 
    5261        }; 
     
    450459    $c->stash->{rs} = $c->model('Base')->resultset('Rpms')->search( 
    451460        { 
    452             $distrs 
    453                 ? { pkgid => { IN => $distrs->get_column('pkgid')->as_query, }, } 
    454                 : (), 
     461            pkgid => { IN => $filers->as_query, }, 
    455462        }, 
    456463    ); 
  • server/trunk/web/root/templates/html/search/adv_search.tt

    r129 r134  
    11<!-- $Id$ --> 
     2<table border="1"> 
     3<tr> 
     4    <td></td> 
     5    <td> 
     6<input type="text" name="search" value="[% c.req.param('search') | html %]"> 
     7    </td> 
     8</tr> 
     9<tr> 
     10    <td> 
     11    </td> 
     12    <td> 
    213<select name="type" OnChange=" 
    314    if (value == 'bydep') { 
    4         document.getElementById('deptype').style.display = ''; 
     15        document.getElementById('deptype').style.visibility = ''; 
    516    } else { 
    6         document.getElementById('deptype').style.display = 'none'; 
     17        document.getElementById('deptype').style.visibility = 'hidden'; 
    718    } 
    819"> 
    920<option value="byname"[% " selected=selected" IF c.req.param('type') == 'byname' %]>rpm named</option> 
    10 <option value="bydep"[% " selected=selected" IF c.req.param('type') == 'bydep' 
    11 %]>dependency match</option> 
     21<option value="bydep"[% " selected=selected" IF c.req.param('type') == 'bydep' %]>dependency match</option> 
     22<option value="byfile"[% " selected=selected" IF c.req.param('type') == 'byfile' %]>File</option> 
    1223</select> 
    13 <input type="text" name="search" value="[% c.req.param('search') | html %]"> 
    14 <span id="deptype" style="[% 'display:none;' IF c.req.param('type') != 'bydep' %]"> 
    15 Dep type: 
     24    </td> 
     25</tr> 
     26<tr> 
     27<td> 
     28</td> 
     29<td> 
     30<span id="deptype" style="[% 'visibility:hidden;' IF c.req.param('type') != 'bydep' %]"> 
    1631<select id="deptype" name="deptype"> 
    17     <option value="P">Provides</option> 
    18     <option value="R">Requires</option> 
     32    <option value="P"[% " selected=selected" IF c.req.param('deptype') == 'P' %]>Provides</option> 
     33    <option value="R"[% " selected=selected" IF c.req.param('deptype') == 'R' %]>Requires</option> 
    1934</select> 
    2035</span> 
     36</td> 
     37</tr> 
     38<tr> 
     39<td></td> 
     40<td> 
    2141<input type="submit"> 
     42</td> 
     43</tr> 
     44</table> 
  • server/trunk/web/root/templates/html/search/results.tt

    r94 r134  
    3030[% info.summary | guessencode | html %] 
    3131</p> 
     32 
     33[%# Depending the search, we have to perform a quick search per package to show 
     34result detail %] 
     35[% IF c.req.param('type') == 'bydep' %] 
     36[% sargs.0.pkgid = pkgid %] 
     37<ul> 
     38[% FOREACH dep = c.forward('/search/dep_search', sargs).results %] 
     39<li>[% dep.name | html %] [% dep.sense | html %] [% dep.evr | html %]</li> 
     40[% END %] 
     41</ul> 
     42[% END %] 
     43 
     44[% IF c.req.param('type') == 'byfile' %] 
     45[% sargs.0.pkgid = pkgid %] 
     46<ul class="filename"> 
     47[% FOREACH file = c.forward('/search/file_search', sargs).results %] 
     48<li>[% file.dirname | html -%][%- file.basename | html %]</li> 
     49[% END %] 
     50</ul> 
     51[% END %] 
     52 
    3253</div> 
    3354[% END %] 
Note: See TracChangeset for help on using the changeset viewer.