Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
2.9 KiB

  1. #!/usr/bin/perl
  2. #script to provide intranet (librarian) advanced search facility
  3. #modified 9/11/1999 by chris@katipo.co.nz
  4. use strict;
  5. #use DBI;
  6. use C4::Search;
  7. use CGI;
  8. use C4::Output;
  9. my $input = new CGI;
  10. print $input->header;
  11. #print $input->dump;
  12. my $blah;
  13. my %search;
  14. #build hash of users input
  15. my $title=$input->param('title');
  16. $search{'title'}=$title;
  17. my $keyword=$input->param('keyword');
  18. $search{'keyword'}=$keyword;
  19. my $author=$input->param('author');
  20. $search{'author'}=$author;
  21. my $subject=$input->param('subject');
  22. $search{'subject'}=$subject;
  23. my $itemnumber=$input->param('item');
  24. $search{'item'}=$itemnumber;
  25. my $isbn=$input->param('isbn');
  26. $search{'isbn'}=$isbn;
  27. my @results;
  28. my $offset=$input->param('offset');
  29. if ($offset eq ''){
  30. $offset=0;
  31. }
  32. my $num=$input->param('num');
  33. if ($num eq ''){
  34. $num=10;
  35. }
  36. print startpage();
  37. print startmenu();
  38. print mkheadr(1,'Catalogue Search Results');
  39. print center();
  40. my $count;
  41. my @results;
  42. if ($itemnumber ne '' || $isbn ne ''){
  43. ($count,@results)=&CatSearch(\$blah,'precise',\%search,$num,$offset);
  44. } else {
  45. if ($subject ne ''){
  46. ($count,@results)=&CatSearch(\$blah,'subject',\%search,$num,$offset);
  47. } else {
  48. ($count,@results)=&CatSearch(\$blah,'loose',\%search,$num,$offset);
  49. }
  50. }
  51. print "You searched on $title $author $keyword $subject $itemnumber $isbn, $count results found";
  52. my $offset2=$num+$offset;
  53. print "<br> Results $offset to $offset2 displayed";
  54. print mktablehdr;
  55. if ($subject ne ''){
  56. print mktablerow(1,'#cccc99','<b>SUBJECT</b>');
  57. } else {
  58. print mktablerow(2,'#cccc99','<b>TITLE</b>','<b>AUTHOR</b>');
  59. }
  60. my $count2=@results;
  61. my $i=0;
  62. my $colour=1;
  63. while ($i < $count2){
  64. my @stuff=split('\t',$results[$i]);
  65. my $title2=$stuff[1];
  66. $title2=~ s/ /%20/g;
  67. if ($subject eq ''){
  68. $stuff[1]=mklink("/cgi-bin/kumara/detail.pl?bib=$stuff[0]&title=$title2",$stuff[1]);
  69. my $word=$stuff[2];
  70. $word=~ s/ //g;
  71. $word=~ s/\,/\,%20/g;
  72. $word=~ s/\n//g;
  73. my $url="/cgi-bin/kumara/testsearch.pl?author=$word&type=a";
  74. $stuff[2]=mklink($url,$stuff[2]);
  75. } else {
  76. $stuff[1]=mklink("/cgi-bin/kumara/subjectsearch.pl?subject=$stuff[1]",$stuff[1]);
  77. }
  78. if ($colour == 1){
  79. print mktablerow(2,'#ffffcc',$stuff[1],$stuff[2]);
  80. $colour=0;
  81. } else{
  82. print mktablerow(2,'white',$stuff[1],$stuff[2]);
  83. $colour=1;
  84. }
  85. $i++;
  86. }
  87. $offset=$num+$offset;
  88. print mktablerow(2,'#cccc99',' &nbsp; ',' &nbsp; ');
  89. print mktableft();
  90. if ($offset < $count){
  91. my $search="num=$num&offset=$offset";
  92. if ($subject ne ''){
  93. $subject=~ s/ /%20/g;
  94. $search=$search."&subject=$subject";
  95. }
  96. if ($title ne ''){
  97. $title=~ s/ /%20/g;
  98. $search=$search."&title=$title";
  99. }
  100. if ($author ne ''){
  101. $author=~ s/ /%20/g;
  102. $search=$search."&author=$author";
  103. }
  104. my $stuff=mklink("/cgi-bin/kumara/search.pl?$search",'More');
  105. print $stuff;
  106. }
  107. print endcenter();
  108. print endmenu();
  109. print endpage();