/[jquery]/no_pager/index.cgi
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 /no_pager/index.cgi

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

revision 20 by dpavlin, Thu Aug 17 00:16:51 2006 UTC revision 24 by dpavlin, Thu Aug 17 21:16:18 2006 UTC
# Line 97  sub get_results { Line 97  sub get_results {
97          my $out;          my $out;
98    
99          if (defined($nres)) {          if (defined($nres)) {
100    
101                    if ($nres->doc_num == 0) {
102                            $v->{status} = qq{<strong>Error getting results for page $page.</strong>};
103                            return next_page('<strong>No results found.</strong>');
104                    }
105    
106                  $v->{hits} = $nres->hits;                  $v->{hits} = $nres->hits;
107                  $v->{time} = $nres->hint('TIME');                  $v->{time} = $nres->hint('TIME');
108                  $v->{max_page} = int( ($nres->hits + $on_page - 1) / $on_page );                  $v->{max_page} = int( ($nres->hits + $on_page - 1) / $on_page );
# Line 136  sub get_results { Line 142  sub get_results {
142                          return $text;                          return $text;
143                  }                  }
144    
145                    my @template;
146                    open(my $t, 'result.html')  || die "result.html: $!";
147                    while(<$t>) {
148                            push @template, $_;
149                    }
150                    close($t);
151    
152                  # for each document in results                  # for each document in results
153                  for my $i ( 0 ... $nres->doc_num - 1 ) {                  for my $i ( 0 ... $nres->doc_num - 1 ) {
154    
155                          my $rdoc = $nres->get_doc($i);                          my $rdoc = $nres->get_doc($i);
   
                         $out .= '<div class="item">' .  
                                 '<h1>' . $rdoc->attr('@title') . '</h1>' .  
                                 '<p>' . html_snippet( $rdoc->snippet ) . '</p>' .  
                                 '<strong>' . attr_regex( $rdoc, 'source' ) . '</strong>' .  
                                 ' [' . attr_regex( $rdoc, '@size' ) . ' bytes]<br/>';  
156                          my $uri = attr_regex( $rdoc, '@uri' );                          my $uri = attr_regex( $rdoc, '@uri' );
157                          $out .=                          my $nr = $skip + $i + 1;
158                                  qq{<a href="$uri"><tt>$uri</tt></a> } .  
159                                  attr_regex( $rdoc, '@mdate' ) .                          map {
160                                  ' [' . ( $skip + $i + 1 ) . ']';                                  my $l = $_;
161                                    $l =~ s/<%(.+?)%>/eval "$1"/ge;
162                                    $out .= $l;
163                            } @template;
164    
165                  }                  }
166    
167          } else {          } else {
# Line 158  sub get_results { Line 169  sub get_results {
169          }          }
170    
171          if ($v->{page} == $v->{max_page}) {          if ($v->{page} == $v->{max_page}) {
172                  $out .= next_page('<strong>All results shown</strong>');                  $out .= next_page('<br/><strong>All results shown</strong>');
173          } else {          } else {
174                  $out .= next_page(                  $out .= next_page(
175                          '<strong>Loading results...</strong><br/>',                          '<br/><strong>Loading results...</strong><br/>',
176                          'If you are using the scroll bar, release the mouse to see more results.'                          'If you are using the scroll bar, release the mouse to see more results.'
177                  );                  );
178          }          }
# Line 196  if ($q->path_info() eq '/snippet') { Line 207  if ($q->path_info() eq '/snippet') {
207                  s/<%(.+?)%>/eval "$1"/ge;                  s/<%(.+?)%>/eval "$1"/ge;
208                  print;                  print;
209          }          }
210          close($f);          close($s);
211    
212  }  }

Legend:
Removed from v.20  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26