/[nn.old]/trunk/search/nn2-search.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

Contents of /trunk/search/nn2-search.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 58 - (show annotations)
Mon Feb 11 11:41:18 2002 UTC (18 years, 4 months ago) by dpavlin
File MIME type: application/octet-stream
File size: 1950 byte(s)
Unable to calculate annotation data on binary file contents.
broj nadjenih zakona

1 #!/usr/bin/perl -w
2
3 use strict;
4 use CGI qw/:standard -no_xhtml/;
5 use DBI;
6 use Text::Query;
7 use CGI::Carp qw(fatalsToBrowser);
8
9 my $url="http://www.nn.hr/CijeliBrojS.asp?god=%d&br=%d&mid=%d#%d";
10
11 my %labels = ('Simple'=>'jednostavnim', 'Advanced'=>'naprednim');
12
13 my $hits=0;
14
15 print header(-charset=>'iso-8859-2'),start_html(-title=>'NN pretrazivanje',-lang=>'hr'),start_form;
16 print "Traži zakon: ",textfield('search')," sa ";
17 print popup_menu(-name=>'type',-values=>[ keys %labels ],-labels=>\%labels);
18 print submit(-value=>'pretraživanjem');
19 print end_form,hr;
20
21 if (param('search') && param('type')) {
22 my $question;
23 my ($query) = Text::Query->new('blurk', # param('search'),
24 -parse => 'Text::Query::Parse'.param('type') || 'Advanced',
25 -build => 'Text::Query::BuildSQLPg',
26 -fields_searched => 'title_czs',
27 -select => 'select br,god,aname,nr,title from nn where __WHERE__ order by god desc,br desc,nr asc'
28 );
29
30 $query->prepare(param('search'));
31
32 # print "--",$query->matchstring();
33
34 my $dbh = DBI->connect("DBI:Pg:dbname=nn","dpavlin","") || die $DBI::errstr;
35 my $sth=$dbh->prepare($query->matchstring()) || die $dbh->errstr();
36 $sth->execute() || die $dbh->errstr();
37 while (my $row = $sth->fetchrow_hashref()) {
38 print br,"<tt><a href=\"",sprintf($url,$row->{god},$row->{br},$row->{nr},$row->{aname}),"\">NN",$row->{god},"/",$row->{br},"</a> ",$row->{nr},"</tt> ",$row->{title},"\n";
39 $hits++;
40 }
41 if ($hits > 0) {
42 print p,hr,"Nađeno je $hits zakona...";
43 } else {
44 print p,"Nije nađen niti jedan zakon...";
45 }
46 } else {
47 print p('U jednostavnom pretraživanju pretraživač pronalazi sve zakone u kojima se pojavljuje <b>bilo koja</b> od tih riječi. Da bi našli sve zakone u kojima se pojavljuju <b>sve upisane riječi</b>, upišite ispred svake riječi znak plus (+). Npr: <tt>+zakon +kava</tt>',br,'Ako ispred riječi upišete minus (-) neće se prikazivati zakoni koji imaju takvu riječ. Npr. <tt>+kava +zakon -dopunama</tt>');
48 }

Properties

Name Value
cvs2svn:cvs-rev 1.5
svn:executable *
svn:mime-type application/octet-stream

  ViewVC Help
Powered by ViewVC 1.1.26