/[swish]/trunk/html/swish.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 /trunk/html/swish.cgi

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

revision 59 by dpavlin, Mon Jan 26 08:08:41 2004 UTC revision 75 by dpavlin, Sat Apr 17 18:34:45 2004 UTC
# Line 20  my $config=XMLin(undef, Line 20  my $config=XMLin(undef,
20    
21  my $from_utf8 = Text::Iconv->new('UTF8', $config->{charset});  my $from_utf8 = Text::Iconv->new('UTF8', $config->{charset});
22  sub x {  sub x {
23            return if (! defined $_[0]);
24          return $from_utf8->convert($_[0]);          return $from_utf8->convert($_[0]);
25  }  }
26    
# Line 71  print STDERR "##: $_->{limit}",x($_->{co Line 72  print STDERR "##: $_->{limit}",x($_->{co
72          $path_label{$_->{limit}} = x($_->{content});          $path_label{$_->{limit}} = x($_->{content});
73  }  }
74    
75  my @properties = split(/\s+/,x($config->{properties}));  my @properties = split(/\s+/,x($config->{properties})) if ($config->{properties});
76    
77  if ($config->{charset}) {  if ($config->{charset}) {
78          print header(-charset=>x($config->{charset}));          print header(-charset=>x($config->{charset}));
# Line 258  if (param('search')) { Line 259  if (param('search')) {
259                          }                          }
260                  }                  }
261    
262                    my $title = e($result->Property("swishtitle")) || 'untitled';
263                    my $rank = $result->Property("swishrank");
264                    my $host = $result->Property("swishdocpath");
265                    $host = "http://".virtual_host().x($config->{url}).$result->Property("swishdocpath") if ($config->{url});
266                  print $tr_pre,$i,". ";                  print $tr_pre,$i,". ";
267                  if ($config->{url}) {                  # print collection name which is not link
268                          printf($hit_fmt, "http://".virtual_host().x($config->{url}).$result->Property("swishdocpath"),                  if ($title =~ s/^(.+? :: )//) {
269                                  e($result->Property("swishtitle")) || 'untitled',                          print $1;
                                 $result->Property("swishrank"),  
                                 @arr);  
                 } else {  
                         printf($hit_fmt, $result->Property("swishdocpath"),  
                                 e($result->Property("swishtitle")) || 'untitled',  
                                 $result->Property("swishrank"),  
                                 @arr);  
270                  }                  }
271                    printf($hit_fmt, $host, $title || 'untitled', $rank, @arr);
272                  print $tr_post;                  print $tr_post;
273    
274          }          }
# Line 279  if (param('search')) { Line 278  if (param('search')) {
278    
279          my $nav_fmt=qq{ <a href="%s">%s</a> };          my $nav_fmt=qq{ <a href="%s">%s</a> };
280    
281            if ($pager->current_page() > $pager->first_page) {
282                    param('page', $pager->current_page - 1);
283                    $nav_html .= sprintf($nav_fmt,url(-relative=>1, -query=>1),'&lt;&lt;');
284            }
285    
286          if ($pager->previous_set) {          if ($pager->previous_set) {
287                  param('page', $pager->previous_set);                  param('page', $pager->previous_set);
288                  $nav_html .= sprintf($nav_fmt,url(-relative=>1, -query=>1),'&lt;&lt;');                  $nav_html .= sprintf($nav_fmt,url(-relative=>1, -query=>1),'..');
289          }          }
290    
291    
292          foreach my $p (@{$pager->pages_in_set()}) {          foreach my $p (@{$pager->pages_in_set()}) {
293                    next if ($p < 0);
294  #       for (my $p=$pager->previous_set; $p <= $pager->next_set; $p++) {  #       for (my $p=$pager->previous_set; $p <= $pager->next_set; $p++) {
295                  if($p == $pager->current_page()) {                  if($p == $pager->current_page()) {
296                          $nav_html .= "<b>$p</b> ";                          $nav_html .= "<b>$p</b> ";
# Line 297  if (param('search')) { Line 302  if (param('search')) {
302    
303          if ($pager->next_set) {          if ($pager->next_set) {
304                  param('page', $pager->next_set);                  param('page', $pager->next_set);
305                    $nav_html .= sprintf($nav_fmt,url(-relative=>1, -query=>1),'..');
306            }
307    
308            if ($pager->current_page() < $pager->last_page) {
309                    param('page', $pager->current_page + 1);
310                  $nav_html .= sprintf($nav_fmt,url(-relative=>1, -query=>1),'&gt;&gt;');                  $nav_html .= sprintf($nav_fmt,url(-relative=>1, -query=>1),'&gt;&gt;');
311          }          }
312    

Legend:
Removed from v.59  
changed lines
  Added in v.75

  ViewVC Help
Powered by ViewVC 1.1.26