koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/admin z3950servers.pl,1.6,1.7


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/admin z3950servers.pl,1.6,1.7
Date: Tue, 29 Apr 2003 09:49:08 -0700

Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv3884/admin

Modified Files:
        z3950servers.pl 
Log Message:
really proud of this commit :-)
z3950 search and import seems to works fine.
Let me explain how :
* a "search z3950" button is added in the addbiblio template.
* when clicked, a popup appears and z3950/search.pl is called
* z3950/search.pl calls addz3950search in the DB
* the z3950 daemon retrieve the records and stores them in z3950results AND in 
marc_breeding table.
* as long as there as searches pending, the popup auto refresh every 2 seconds, 
and says how many searches are pending.
* when the user clicks on a z3950 result => the parent popup is called with the 
requested biblio, and auto-filled

Note :
* character encoding support : (It's a nightmare...) In the z3950servers table, 
a "encoding" column has been added. You can put "UNIMARC" or "USMARC" in this 
column. Depending on this, the char_decode in C4::Biblio.pm replaces 
marc-char-encode by an iso 8859-1 encoding. Note that in the breeding import 
this value has been added too, for a better support.
* the marc_breeding and z3950* tables have been modified : they have an 
encoding column and the random z3950 number is stored too for convenience => 
it's the key I use to list only requested biblios in the popup.


Index: z3950servers.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/z3950servers.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** z3950servers.pl     5 Apr 2003 03:35:09 -0000       1.6
--- z3950servers.pl     29 Apr 2003 16:48:29 -0000      1.7
***************
*** 36,40 ****
        my @data=split(' ',$searchstring);
        my address@hidden;
!       my $query="Select host,port,db,userid,password,name,id,checked,rank 
from z3950servers where (name like \"$data[0]\%\") order by rank,name";
        my $sth=$dbh->prepare($query);
        $sth->execute;
--- 36,40 ----
        my @data=split(' ',$searchstring);
        my address@hidden;
!       my $query="Select 
host,port,db,userid,password,name,id,checked,rank,syntax from z3950servers 
where (name like \"$data[0]\%\") order by rank,name";
        my $sth=$dbh->prepare($query);
        $sth->execute;
***************
*** 53,57 ****
  my $input = new CGI;
  my $searchfield=$input->param('searchfield');
! my $reqsel="select host,port,db,userid,password,name,id,checked,rank from 
z3950servers where (name = '$searchfield') order by rank,name";
  my $reqdel="delete from z3950servers where name='$searchfield'";
  my $offset=$input->param('offset');
--- 53,57 ----
  my $input = new CGI;
  my $searchfield=$input->param('searchfield');
! my $reqsel="select host,port,db,userid,password,name,id,checked,rank,syntax 
from z3950servers where (name = '$searchfield') order by rank,name";
  my $reqdel="delete from z3950servers where name='$searchfield'";
  my $offset=$input->param('offset');
***************
*** 83,87 ****
        if ($searchfield) {
                my $dbh = C4::Context->dbh;
!               my $sth=$dbh->prepare("select 
host,port,db,userid,password,name,id,checked,rank from z3950servers where (name 
= '$searchfield') order by rank,name");
                $sth->execute;
                $data=$sth->fetchrow_hashref;
--- 83,87 ----
        if ($searchfield) {
                my $dbh = C4::Context->dbh;
!               my $sth=$dbh->prepare("select 
host,port,db,userid,password,name,id,checked,rank,syntax from z3950servers 
where (name = '$searchfield') order by rank,name");
                $sth->execute;
                $data=$sth->fetchrow_hashref;
***************
*** 105,109 ****
        $sth->execute($input->param('searchfield'));
        if ($sth->rows) {
!               $sth=$dbh->prepare("update z3950servers set host=?, port=?, 
db=?, userid=?, password=?, name=?, checked=?, rank=? where name=?");
                $sth->execute($input->param('host'),
                      $input->param('port'),
--- 105,109 ----
        $sth->execute($input->param('searchfield'));
        if ($sth->rows) {
!               $sth=$dbh->prepare("update z3950servers set host=?, port=?, 
db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=? where name=?");
                $sth->execute($input->param('host'),
                      $input->param('port'),
***************
*** 114,121 ****
                      $input->param('checked'),
                      $input->param('rank'),
!                     $input->param('searchfield')
                      );
        } else {
!               $sth=$dbh->prepare("insert into z3950servers 
(host,port,db,userid,password,name,checked,rank) values (?, ?, ?, ?, ?, ?, ?, 
?)");
                $sth->execute($input->param('host'),
                      $input->param('port'),
--- 114,122 ----
                      $input->param('checked'),
                      $input->param('rank'),
!                        $input->param('syntax'),
!                     $input->param('searchfield'),
                      );
        } else {
!               $sth=$dbh->prepare("insert into z3950servers 
(host,port,db,userid,password,name,checked,rank,syntax) values (?, ?, ?, ?, ?, 
?, ?, ?,?)");
                $sth->execute($input->param('host'),
                      $input->param('port'),
***************
*** 126,129 ****
--- 127,131 ----
                      $input->param('checked'),
                      $input->param('rank'),
+                        $input->param('syntax'),
                      );
        }
***************
*** 179,182 ****
--- 181,185 ----
                        checked => $results->[$i]{'checked'},
                        rank => $results->[$i]{'rank'},
+                       syntax => $results->[$i]{'syntax'},
                        toggle => $toggle);
                push @loop, \%row;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]