Add z39.50 search form distinct from MARC editor
authorRyan Higgins <rch@liblime.com>
Tue, 18 Mar 2008 00:16:37 +0000 (19:16 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 18 Mar 2008 00:25:48 +0000 (19:25 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>

cataloguing/z3950_search.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl

index b0edd77..6eef8d4 100755 (executable)
@@ -41,6 +41,8 @@ my $author        = $input->param('author');
 my $isbn          = $input->param('isbn');
 my $issn          = $input->param('issn');
 my $lccn          = $input->param('lccn');
+my $subject= $input->param('subject');
+my $dewey = $input->param('dewey');
 my $random        = $input->param('random');
 my $op            = $input->param('op');
 my $noconnection;
@@ -104,29 +106,42 @@ else {
     my @oConnection;
     my @oResult;
     my $s = 0;
-
-    if ( $isbn || $issn ) {
-        $attr = '1=7';
-        $term = $isbn if ($isbn);
-        $term = $issn if ($issn);
-    }
-    elsif ($lccn) {
-        $attr = '1=9';
-        $term = $lccn;
+    my $query;
+    my $nterms;
+    if ($isbn || $issn) {
+        $term=$isbn if ($isbn);
+        $term=$issn if ($issn);
+        $query .= " \@attr 1=7 \"$term\" ";
+        $nterms++;
     }
-    elsif ($title) {
-        $attr = '1=4 ';
+    if ($title) {
         utf8::decode($title);
-        $term = $title;
+        $query .= " \@attr 1=4 \"$title\" ";
+        $nterms++;
     }
-    elsif ($author) {
-        $attr = '1=1003';
+    if ($author) {
         utf8::decode($author);
-        $term = $author;
+        $query .= " \@attr 1=1003 \"$author\" ";
+        $nterms++;
+    }
+    if ($dewey) {
+        $query .= " \@attr 1=16 \"$dewey\" ";
+        $nterms++;
     }
+    if ($subject) {
+        utf8::decode($subject);
+        $query .= " \@attr 1=21 \"$subject\" ";
+        $nterms++;
+    }
+       if ($lccn) {    
+        $query .= " \@attr 1=9 $lccn ";
+        $nterms++;
+    }
+for my $i (1..$nterms-1) {
+    $query = "\@and " . $query;
+}
+warn "query ".$query  if $DEBUG;
 
-    my $query = "\@attr $attr \"$term\"";
-    warn "query " . $query if $DEBUG;
     foreach my $servid (@id) {
         my $sth = $dbh->prepare("select * from z3950servers where id=?");
         $sth->execute($servid);
index d8b2dfa..69facff 100644 (file)
 <style type="text/css">body {margin: 1em; }</style>
 </head>
 <body>
-
-    <h2>Search for:</h2>
-    <!-- TMPL_IF NAME="title"--><p><strong>Title:</strong> <!-- TMPL_VAR NAME="title"--></p><!-- /TMPL_IF -->
-    <!-- TMPL_IF NAME="author"--><p><strong>Author:</strong> <!-- TMPL_VAR NAME="author"--></p><!-- /TMPL_IF -->
-    <!-- TMPL_IF NAME="isbn"--><p><strong>ISBN:</strong> <!-- TMPL_VAR NAME="isbn"--></p><!-- /TMPL_IF -->
-    <!-- TMPL_IF NAME="issn"--><p><strong>ISSN:</strong> <!-- TMPL_VAR NAME="issn"--></p><!-- /TMPL_IF -->
-    <!-- TMPL_IF NAME="lccn"--><p><strong>LCCN:</strong> <!-- TMPL_VAR NAME="lccn"--></p><!-- /TMPL_IF -->
-    
+<h2>Search Z39.50 Targets:</h2>
 <!-- TMPL_IF name="opsearch" -->
-    
+<div class="formfields">
     <form method="post" action="z3950_search.pl" name="f">
-    <fieldset class="rows"> 
+    <input type="hidden" name="op" id="op" value="do_search" />
+    <!-- <fieldset class="rows"> 
        <legend>Search these servers:</legend>
-       <input type="hidden" name="op" id="op" value="do_search" />
-    <input type="hidden" name="title" value="<!-- TMPL_VAR NAME="title" -->" />
-    <input type="hidden" name="author" value="<!-- TMPL_VAR NAME="author" -->" />
-    <input type="hidden" name="isbn" value="<!-- TMPL_VAR NAME="isbn" -->" />
-    <input type="hidden" name="issn" value="<!-- TMPL_VAR NAME="issn" -->" />
-    <input type="hidden" name="lccn" value="<!-- TMPL_VAR NAME="lccn" -->" />
-    <input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
+-->
+<table>
+<caption>Search points</caption>
+       <tr>
+               <td> <label for="title">Title</label> <input type="text" id="title"  name="title" value="<!-- TMPL_VAR NAME="title" -->" /></td>
+               <td> <label for="author">Author</label> <input type="text" name="author" value="<!-- TMPL_VAR NAME="author" -->" /></td></tr>
+       <tr> 
+               <td> <label for=isbn"">ISBN/ISSN</label> <input type="text" name="isbn" value="<!-- TMPL_VAR NAME="isbn" -->" /></td>
+                       <!--  <label for="Keyword">Keyword</label> <input type="text" name="keyword" value="" /> -->
+               <td>  <label for="subject">Subject Heading</label> <input type="text" name="subject heading" value="" /></td></tr>
+       <tr> 
+               <td> <label for="lccall">LC Call Number</label> <input type="text" name="lccall" value="" /></td>
+               <td> <label for="dewey">Dewey</label> <input type="text" name="dewey" value="" /></td></tr>
+</table>
+
     <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
-    <ol>
+    <input type="hidden" name="frameworkcode" value="<!-- TMPL_VAR NAME="frameworkcode" -->" />
+</div>
+<h2>Search targets:</h2>
     <!-- TMPL_LOOP name="serverloop" -->
-        <li class="radio">
+        <p> 
             <!-- TMPL_IF name="checked" -->
-                <input type="checkbox" name="id" id="<!-- TMPL_VAR NAME="id" -->id" value="<!-- TMPL_VAR NAME="id" -->" checked="checked" />
+                <input type="checkbox" name="id" id="z3950_<!-- TMPL_VAR NAME="id" -->" value="<!-- TMPL_VAR NAME="id" -->" checked="checked" />
             <!-- TMPL_ELSE -->
-                <input type="checkbox" name="id" id="<!-- TMPL_VAR NAME="id" -->id" value="<!-- TMPL_VAR NAME="id" -->" />
+                <input type="checkbox" name="id" id="z3950_<!-- TMPL_VAR NAME="id" -->" value="<!-- TMPL_VAR NAME="id" -->" />
             <!-- /TMPL_IF -->
-        <label for="<!-- TMPL_VAR NAME="id" -->id"><!-- TMPL_VAR NAME="name" --></label>
-        </li>
-    <!-- /TMPL_LOOP --></ol></fieldset>
-    <fieldset class="action"><input type="submit" class="submit" value="Submit" onclick="cursor :'wait'" /></fieldset>
+            <label for="z3950_<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name" --> [<!-- TMPL_VAR NAME="host" -->]</label>  
+
+        </p>
+    <!-- /TMPL_LOOP -->
+    <input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/>
     </form>
 <!-- TMPL_ELSE -->
     <h2>Results</h2>