Browse Source

Working on web interface

master
chris 25 years ago
parent
commit
758e5403d5
  1. 10
      C4/Output.pm
  2. 20
      C4/Search.pm

10
C4/Output.pm

@ -11,7 +11,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow);
@EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow &mklink);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -85,6 +85,12 @@ sub endpage{
my $string="</body></html>\n";
return($string);
}
sub mklink {
my ($url,$text)=@_;
my $string="<a href=$url>$text</a>";
return ($string);
}
END { } # module clean-up code here (global destructor)

20
C4/Search.pm

@ -80,14 +80,14 @@ sub CatSearch {
last SWITCH;
};
if ($type eq 'a') {
$query="Select * from biblio,catalogueentry
$query="Select count(*) from biblio,catalogueentry
where (catalogueentry.catalogueentry = biblio.author)
and (catalogueentry.catalogueentry like '%$searchstring%')
and (entrytype like '$type%')";
last SWITCH;
};
if ($type eq 't') {
$query="Select * from biblio,catalogueentry
$query="Select count(*) from biblio,catalogueentry
where (catalogueentry.catalogueentry = biblio.title)
and (catalogueentry.catalogueentry like '%$searchstring%')
and (entrytype like '$type%')";
@ -106,23 +106,31 @@ sub CatSearch {
'%$searchstring%' and entrytype like '%$type%'";
last SWITCH;
}
$query=$query." order by catalogueentry.catalogueentry limit $num,$offset";
# print "$query\n";
print "$query\n";
my $sth=$dbh->prepare($query);
$sth->execute;
my $count=$sth->fetchrow_hashref;
$sth->finish;
$query=~ s/count\(\*\)/\*/g;
$query=$query." order by catalogueentry.catalogueentry limit $num,$offset";
$sth=$dbh->prepare($query);
$sth->execute;
my $i=0;
my @results;
while (my $data=$sth->fetchrow_hashref){
# print "$data->{'catalogueentry'}
# $data->{'biblionumber'} \n";
# $results[$i]=ItemInfo($env,$data->{'biblionumber'});
$results[$i]="$data->{'biblionumber'}\t<a href=/cgi-bin/stuff>$data->{'catalogueentry'}</a>";
$results[$i]="$data->{'biblionumber'}\t$data->{'title'}\t
$data->{'author'}";
$i++;
}
$sth->execute;
$sth->finish;
$dbh->disconnect;
return(@results);
return($count->{'count'},@results);
}
sub ItemInfo {

Loading…
Cancel
Save