/[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 8 by dpavlin, Sun Mar 16 21:06:43 2003 UTC revision 16 by dpavlin, Sun Mar 16 21:44:42 2003 UTC
# Line 24  use Data::Dumper; Line 24  use Data::Dumper;
24    
25  my $spelling_alt;  my $spelling_alt;
26  # FIX: doesn't work very well  # FIX: doesn't work very well
27  if ($config->{affix}) {  if ($config->{findaffix}) {
28          $spelling_alt = new Lingua::Spelling::Alternative;          $spelling_alt = new Lingua::Spelling::Alternative;
29          $spelling_alt->load_findaffix($config->{affix});          $spelling_alt->load_findaffix($config->{affix});
30  }  }
31    if ($config->{affix}) {
32            $spelling_alt = new Lingua::Spelling::Alternative;
33            $spelling_alt->load_affix($config->{affix});
34    }
35    
36  my $hits=0;  my $hits=0;
37  my $max_hits=$config->{max_hits};  my $max_hits=$config->{max_hits};
# Line 37  foreach (@{$config->{labels}->{label}}) Line 41  foreach (@{$config->{labels}->{label}})
41          $labels{$_->{value}} = $from_utf8->convert($_->{content});          $labels{$_->{value}} = $from_utf8->convert($_->{content});
42  }  }
43    
44  print header(-charset=>$CHARSET),start_html(-title=>'Pretrazivanje',-lang=>'hr'),start_form;  if ($config->{charset}) {
45  print "Potraži ",popup_menu(-name=>'max_hits',-values=>[ sort keys %labels ],-labels=>\%labels,-default=>$max_hits)," dokumenata sa riječima: ",textfield('search');          print header(-charset=>$config->{charset});
46  print submit(-value=>'prikaži');  } else {
47  print checkbox(-name=>'no_affix', -checked=>0, -label=>'ne koristi variranje oblika riječi');          print header;
48    }
49    print start_html(-title=>$config->{title}),start_form;
50    print $config->{text}->{search};
51    print popup_menu(-name=>'max_hits',-values=>[ sort keys %labels ],-labels=>\%labels,-default=>$max_hits);
52    print $config->{text}->{documents};
53    print textfield('search');
54    print submit(-value=> $config->{text}->{submit});
55    print checkbox(-name=>'no_affix', -checked=>0, -label=>$config->{text}->{no_spell}) if ($spelling_alt);
56  print end_form,hr;  print end_form,hr;
57    
58  if (param('search')) {  if (param('search')) {
# Line 90  if (param('search')) { Line 102  if (param('search')) {
102                  results  => sub {                  results  => sub {
103                          my ($sh,$hit) = @_;                          my ($sh,$hit) = @_;
104    
105                          print "<a href=\"",$hit->swishdocpath,"\">",$hit->swishtitle,"</a> [",$hit->swishrank,"]<br>\n";                          printf ("<a href=\"%s\">%s</a> [%s]<br>\n","http://".virtual_host().$config->{url}.$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank);
106    
107  #                       print $_[1]->as_string,"<br>\n";  #                       print $_[1]->as_string,"<br>\n";
108  #                       my @fields = $hit->field_names;  #                       my @fields = $hit->field_names;
# Line 105  if (param('search')) { Line 117  if (param('search')) {
117          $hits = $sh->query($s);          $hits = $sh->query($s);
118    
119          if ($hits > 0) {          if ($hits > 0) {
120                  print p,hr,"Prikazujem $hits dokumenata (maks. ",param('max_hits') || $max_hits,")... <small>($s)</small>";                  print p,hr;
121                    printf ($config->{text}->{hits},$hits,param('max_hits') || $max_hits,$s);
122          } else {          } else {
123                  print p,"Nije nađen niti jedan dokument... <small>($s, ",$sh->errstr,")</small>";                  print p;
124                    printf ($config->{text}->{no_hits},$s,$sh->errstr);
125          }          }
126  } else {  } else {
127          print p('Kod pretraživanja pretraživač pronalazi sve dokumente u kojima se pojavljuju <b>sve upisanje riječi</b>.',br,'Ako ispred riječi upišete minus (-) neće se prikazivati dokumenti koji imaju takvu riječ. Npr. <tt>+mreza -novak</tt>');          print p($config->{text}->{footer});
128  }  }

Legend:
Removed from v.8  
changed lines
  Added in v.16

  ViewVC Help
Powered by ViewVC 1.1.26