Changeset 43 for server/trunk
- Timestamp:
- 11/28/10 19:30:07 (14 years ago)
- Location:
- server/trunk/web
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Base/Result/Files.pm
r16 r43 6 6 7 7 __PACKAGE__->table('files'); 8 __PACKAGE__->add_columns(qw/pkgid count dirname basename md5/); 8 __PACKAGE__->add_columns(qw/pkgid count dirname basename md5 user group linkto 9 mode fflags size class color vflags mtime nlink/); 9 10 __PACKAGE__->set_primary_key(qw/pkgid count/); 10 11 __PACKAGE__->belongs_to(Rpms => 'Sophie::Base::Result::Rpms', 'pkgid'); -
server/trunk/web/lib/Sophie/Controller/0Explorer.pm
r38 r43 27 27 $c->stash->{path} = $dir; 28 28 $c->stash->{explorerurl} = '/explorer' . ($dir ? "/$dir" : ''); 29 30 my $rsdist = $c->forward('/search/distrib_search', [ $c->session->{__explorer} ]); 29 31 $c->stash->{xmlrpc} = [ $c->model('Base') 30 32 ->resultset('Files') 31 33 ->search( 32 { dirname => '/' . ($dir ? "$dir/" : '') }, 34 { 35 dirname => '/' . ($dir ? "$dir/" : ''), 36 pkgid => { IN => $rsdist->get_column('pkgid')->as_query, }, 37 }, 33 38 { 34 39 order_by => [ 'basename' ], … … 45 50 $c->stash->{path} = $dir; 46 51 $c->stash->{explorerurl} = '/explorer' . ($dir ? "/$dir" : ''); 52 53 my $rsdist = $c->forward('/search/distrib_search', [ $c->session->{__explorer} ]); 54 47 55 $c->stash->{xmlrpc} = [ 48 56 map { { pkgid => $_->get_column('pkgid') } } … … 50 58 ->resultset('Files') 51 59 ->search({ 52 dirname => '/' . ($dir ? "$dir/" : ''), basename => $basename 60 dirname => '/' . ($dir ? "$dir/" : ''), basename => $basename, 61 pkgid => { IN => $rsdist->get_column('pkgid')->as_query, }, 53 62 }, 54 63 { -
server/trunk/web/lib/Sophie/Controller/Explorer.pm
r40 r43 24 24 sub index :Path { 25 25 my ( $self, $c, @args ) = @_; 26 27 if (grep { exists($c->req->params->{$_}) } qw(distribution release arch)) { 28 $c->session->{explorer} = { 29 distribution => $c->req->param('distribution') || undef, 30 release => $c->req->param('release') || undef, 31 arch => $c->req->param('arch') || undef, 32 }; 33 } 34 $c->session->{__explorer} = $c->session->{explorer}; 26 35 27 36 $c->stash->{path} = join('/', grep { $_ } @args); -
server/trunk/web/lib/Sophie/Controller/Search.pm
r40 r43 23 23 =cut 24 24 25 my $search_param = {26 rows => Sophie->config()->{'max_reply'} || 20000,27 order_by => [ 'name', 'evr using >>', 'issrc' ],28 select => [ 'pkgid' ],29 };30 31 25 sub index :Path :Args(0) { 32 26 my ( $self, $c ) = @_; 33 27 34 $c->response->body('Matched Sophie::Controller::Search in Search.'); 28 if ($c->req->param('page')) { 29 $c->req->params->{search} = $c->session->{search}; 30 } 31 32 if ($c->req->param('search')) { 33 $c->session->{search} = $c->req->param('search'); 34 $c->forward('fuzzy', [ undef, $c->req->param('search') ]); 35 my $pager = $c->stash->{rs}->pager; 36 $c->stash->{pager} = $pager; 37 $c->stash->{xmlrpc} = [ 38 $c->stash->{rs}->get_column('pkgid')->all 39 ]; 40 } 41 } 42 43 sub search_param : Private { 44 my ($self, $c) = @_; 45 my $r = { 46 rows => Sophie->config()->{'max_reply'} || 20000, 47 order_by => [ 'name', 'evr using >>', 'issrc' ], 48 select => [ 'pkgid' ], 49 }; 50 if (!$c->req->xmlrpc->method) { 51 $r->{page} = $c->req->param('page') || 1; 52 $r->{rows} = 25; 53 } 54 return $r; 35 55 } 36 56 … … 48 68 { 49 69 $searchspec->{release} 50 ? ( release=> $searchspec->{release})70 ? (version => $searchspec->{release}) 51 71 : () 52 72 } … … 84 104 ] 85 105 }, 86 $ search_param,106 $c->forward('search_param'), 87 107 )->get_column('pkgid')->all ] 88 108 … … 120 140 ] 121 141 }, 122 $ search_param,142 $c->forward('search_param'), 123 143 )->get_column('pkgid')->all ] 124 144 } … … 151 171 ] 152 172 }, 153 $ search_param,173 $c->forward('search_param'), 154 174 )->get_column('pkgid')->all ] 155 175 } … … 165 185 )->get_column('pkgid'); 166 186 167 $c->stash->{xmlrpc} = [ $c->model('Base')->resultset('Rpms')->search( 187 $c->stash->{rs} = 188 189 $c->model('Base')->resultset('Rpms')->search( 168 190 { 169 191 -and => [ … … 185 207 ] 186 208 }, 187 $search_param, 188 )->get_column('pkgid')->all ] 209 $c->forward('search_param'), 210 ); 211 212 if ($c->req->xmlrpc->method) { 213 $c->stash->{xmlrpc} = [ 214 $c->stash->{rs}->get_column('pkgid')->all 215 ]; 216 } 189 217 } 190 218 … … 208 236 }, 209 237 { 210 % $search_param,238 %{$c->forward('search_param')}, 211 239 select => [ 212 240 "ts_rank_cd(to_tsvector('english', description),to_tsquery(?)) as rank", -
server/trunk/web/root/templates/includes/header.tt
r40 r43 11 11 <meta name="REVISIT-AFTER" content="[% IF metarevisite %][% metarevisite %][% ELSE %]15[% END %] days"> 12 12 <link rel="icon" href="[%- c.uri_for('/static', 'sophie.ico') -%]" type="image/x-icon"> 13 <script type="text/javascript" language="JavaScript" src="[% c.uri_for('/static', 'CalendarPopup.js') %]"></script>14 13 <script type="text/javascript" language="JavaScript" src="[% c.uri_for('/static', 'prototype.js') %]"></script> 15 14 <script type="text/javascript" language="JavaScript" src="[% c.uri_for('/static', 'effects.js') %]"></script> … … 24 23 <p id="sitename">Sophie</p> 25 24 <p id="sophie_menu"> 25 <span><a href="[% c.uri_for('/search') %]">Search</a></span> 26 26 <span><a href="[% c.uri_for('/distrib') %]">Distribution</a></span> 27 27 <span><a href="[% c.uri_for('/explorer') %]">Explorer</a></span>
Note: See TracChangeset
for help on using the changeset viewer.