/[Grep]/share/web/templates/fragments/results
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /share/web/templates/fragments/results

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 43 by dpavlin, Tue Feb 20 16:26:56 2007 UTC revision 56 by dpavlin, Wed Feb 21 17:38:59 2007 UTC
# Line 1  Line 1 
1  <%args>  <%args>
2  $item_fragment => 'long'  $q
3  $max => 10  $max => 10
4    $item_fragment => 'long'
5  $coll => undef  $coll => undef
6  $moniker => 'search'  $result_moniker => 'search'
7  $q  $result => undef
8  </%args>  </%args>
9  <%init>  <%init>
10    
11  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
12    
13  my $results = Jifty->web->response->result( $moniker );  $result ||= Jifty->web->response->result( $result_moniker );
14  if ( $results and $results->content('search') ) {  if ( $result and $result->content('search') ) {
15          $coll = $results->content('search');          $coll = $result->content('search');
16  } elsif (! defined($coll)) {  } elsif (! defined($coll)) {
17          warn "called without results for $moniker";          warn "called without result for $result_moniker";
18  }  }
19    
20  my $i = 1;  #warn "notes: ",dump($result->message, $result->error) if ($result);
21    
22    my $pos = 1;
23    
24    my ($prev,$next) = (undef, $pos + 1);
25    
26  </%init>  </%init>
27    % if ($result and $result->message) {
28    <div class="grep-note">
29    <div class="message"><% $result->message %></div>
30    </div>
31    % }
32    % if ($result and $result->error) {
33    <div class="grep-note">
34    <div class="error"><% $result->error %></div>
35    </div>
36    % }
37  % if ($coll) {  % if ($coll) {
38    % my $count = $coll->count;
39  <div class="results">  <div class="results">
40  %       while ( my $i = $coll->next and $i++ <= $max ) {  %       while ( my $i = $coll->next and $pos <= $max ) {
41  <& "/fragments/item/$item_fragment", item => $i &>  %               $next = ( $pos == $max or $pos == $count ) ? undef : $pos + 1;
42    <& "/fragments/item/$item_fragment", item => $i, pos => $pos, prev => $prev, next => $next &>
43    %               $prev = $pos++;
44  %       }  %       }
45  </div>  </div>
46  %       if ($i > $max) {  %       if ($pos > $max and $pos < $count ) {
47  <div class="grep-note">  <div class="grep-note">
48  <div class="message">  <div class="message">
49  Found more than <% $max %> results for '<% $q %>', refine search query....  Found more than <% $max %> results for '<% $q %>', refine search query....

Legend:
Removed from v.43  
changed lines
  Added in v.56

  ViewVC Help
Powered by ViewVC 1.1.26