source: server/trunk/web/lib/Sophie/Controller/Explorer.pm @ 43

Last change on this file since 43 was 43, checked in by nanardon, 14 years ago
  • add search functions
File size: 1.4 KB
Line 
1package Sophie::Controller::Explorer;
2use Moose;
3use namespace::autoclean;
4
5BEGIN {extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9Sophie::Controller::Explorer - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19
20=head2 index
21
22=cut
23
24sub index :Path {
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};
35
36    $c->stash->{path} = join('/', grep { $_  } @args);
37    for(my $i=0; $i < @args; $i++) {
38        push(@{$c->stash->{eachpath}}, { dir=>$args[$i], path =>join('/',
39                    @args[0 .. $i] ) });
40    }
41    $c->stash->{dirurl} = $c->uri_for('/0explorer/dir',
42        $c->stash->{path} ?
43            ($c->stash->{path})
44        : ()
45    );
46    $c->stash->{fileurl} = $c->uri_for('/0explorer/file',
47        $c->stash->{path} ?
48            ($c->stash->{path})
49        : ()
50    );
51}
52
53=head1 AUTHOR
54
55Olivier Thauvin
56
57=head1 LICENSE
58
59This library is free software. You can redistribute it and/or modify
60it under the same terms as Perl itself.
61
62=cut
63
64__PACKAGE__->meta->make_immutable;
65
661;
Note: See TracBrowser for help on using the repository browser.