/[webpac2]/Webpacus/lib/Webpacus/Controller/Results.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /Webpacus/lib/Webpacus/Controller/Results.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 118 - (hide annotations)
Wed Nov 23 21:52:30 2005 UTC (18 years, 6 months ago) by dpavlin
File size: 1308 byte(s)
 r9076@llin:  dpavlin | 2005-11-23 22:53:24 +0100
 split queries in separate ISTRINC based on whitespace

1 dpavlin 83 package Webpacus::Controller::Results;
2    
3     use strict;
4     use warnings;
5 dpavlin 97 use base qw/Catalyst::Controller/;
6 dpavlin 83
7     =head1 NAME
8    
9 dpavlin 97 Webpacus::Controller::Results - Display results from WebPAC
10 dpavlin 83
11     =head1 SYNOPSIS
12    
13     See L<Webpacus>
14    
15     =head1 DESCRIPTION
16    
17     Catalyst Controller.
18    
19     =head1 METHODS
20    
21     =over 4
22    
23     =item default
24    
25     =cut
26    
27     sub default : Private {
28     my ( $self, $c ) = @_;
29    
30 dpavlin 93 my $webpac = $c->comp('Model::WebPAC');
31     my $params = $c->req->params;
32     my $log = $c->log;
33 dpavlin 83
34 dpavlin 93 use Data::Dumper;
35 dpavlin 99 $log->debug("results got params: " . Dumper( $params ) );
36 dpavlin 93
37 dpavlin 94 my $q;
38     my @attr;
39    
40     foreach my $f (keys %{ $params }) {
41 dpavlin 98
42 dpavlin 94 next if ($f =~ m/^_/o);
43 dpavlin 98
44     my $v = $params->{$f} || next;
45    
46     $q .= "$v ";
47 dpavlin 118
48     next if ($f eq 'all'); # don't add_attr for magic field all
49    
50     if ($v !~ /\s/) {
51     push @attr, "$f ISTRINC $v";
52     } else {
53     map { push @attr, "$f ISTRINC $_"; } split(/\s+/, $v);
54     }
55 dpavlin 94 }
56    
57 dpavlin 100 $c->stash->{html_results} = sub {
58 dpavlin 118 my $res = $webpac->search( $q, $params->{'_template'}, \@attr );
59 dpavlin 101 # $log->debug("controller got " . ( $#{$res} + 1 ) . " results for '$q' " . Dumper( $res ));
60 dpavlin 94 return $res;
61 dpavlin 93 };
62    
63 dpavlin 83 $c->stash->{template} = 'results.tt';
64     }
65    
66     =back
67    
68    
69     =head1 AUTHOR
70    
71     Dobrica Pavlinusic,,,
72    
73     =head1 LICENSE
74    
75     This library is free software, you can redistribute it and/or modify
76     it under the same terms as Perl itself.
77    
78     =cut
79    
80     1;

  ViewVC Help
Powered by ViewVC 1.1.26