/[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 54 - (show annotations)
Tue Feb 5 13:59:25 2002 UTC (18 years, 5 months ago) by dpavlin
File MIME type: application/octet-stream
File size: 1809 byte(s)
Unable to calculate annotation data on binary file contents.
errors to browser

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 print header(-charset=>'iso-8859-2'),start_html(-title=>'NN pretrazivanje',-lang=>'hr'),start_form;
14 print "Traži zakon: ",textfield('search')," sa ";
15 print popup_menu(-name=>'type',-values=>[ keys %labels ],-labels=>\%labels);
16 print submit(-value=>'pretraživanjem');
17 print end_form,hr;
18
19 if (param('search') && param('type')) {
20 my $question;
21 my ($query) = Text::Query->new('blurk', # param('search'),
22 -parse => 'Text::Query::Parse'.param('type') || 'Advanced',
23 -build => 'Text::Query::BuildSQLPg',
24 -fields_searched => 'title_czs',
25 -select => 'select br,god,aname,nr,title from nn where __WHERE__ order by god desc,br desc,nr asc'
26 );
27
28 $query->prepare(param('search'));
29
30 # print "--",$query->matchstring();
31
32 my $dbh = DBI->connect("DBI:Pg:dbname=nn","dpavlin","") || die $DBI::errstr;
33 my $sth=$dbh->prepare($query->matchstring()) || die $dbh->errstr();
34 $sth->execute() || die $dbh->errstr();
35 while (my $row = $sth->fetchrow_hashref()) {
36 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";
37 }
38 } else {
39 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>');
40 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26