[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/acqui.simple marcimport.pl,1.6.2.7,1.6.2.8
From: |
Alan Millar |
Subject: |
[Koha-cvs] CVS: koha/acqui.simple marcimport.pl,1.6.2.7,1.6.2.8 |
Date: |
Sun, 02 Jun 2002 08:16:11 -0700 |
Update of /cvsroot/koha/koha/acqui.simple
In directory usw-pr-cvs1:/tmp/cvs-serv7749
Modified Files:
Tag: rel-1-2
marcimport.pl
Log Message:
Clean up z3950 menu
Index: marcimport.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/marcimport.pl,v
retrieving revision 1.6.2.7
retrieving revision 1.6.2.8
diff -C2 -r1.6.2.7 -r1.6.2.8
*** marcimport.pl 1 Jun 2002 06:36:27 -0000 1.6.2.7
--- marcimport.pl 2 Jun 2002 15:16:08 -0000 1.6.2.8
***************
*** 102,105 ****
--- 102,106 ----
my $file=$input->param('file');
+ my $menu = $input->param('menu');
if ($input->param('z3950queue')) {
***************
*** 107,116 ****
}
-
if ($input->param('uploadmarc')) {
AcceptMarcUpload($dbh,$input)
}
-
if ($input->param('insertnewrecord')) {
# Add biblio item, and set up menu for adding item copies
--- 108,115 ----
***************
*** 123,136 ****
- #---------------------------------------
- # Add item copy
if ($input->param('newitem')) {
&AcceptItemCopy($dbh,$input);
} # if newitem
-
- my $menu = $input->param('menu');
if ($file) {
my $sth;
print "<a href=$ENV{'SCRIPT_NAME'}>Main Menu</a><hr>\n";
--- 122,133 ----
if ($input->param('newitem')) {
+ # Add item copy
&AcceptItemCopy($dbh,$input);
} # if newitem
if ($file) {
+ # A MARC file has been specified; process it for review form
my $sth;
print "<a href=$ENV{'SCRIPT_NAME'}>Main Menu</a><hr>\n";
***************
*** 375,379 ****
push @subjects, $subject;
}
! }
$titleinput=$input->textfield(-name=>'title', -default=>$title,
-size=>40);
$marcinput=$input->hidden(-name=>'marc', -default=>$marc);
--- 372,376 ----
push @subjects, $subject;
}
! } # foreach field
$titleinput=$input->textfield(-name=>'title', -default=>$title,
-size=>40);
$marcinput=$input->hidden(-name=>'marc', -default=>$marc);
***************
*** 471,475 ****
$marctext
EOF
! }
} else {
#open (F, "$file");
--- 468,472 ----
$marctext
EOF
! } # foreach record
} else {
#open (F, "$file");
***************
*** 726,730 ****
SWITCH:
{
! if ($menu eq 'z3950') { z3950(); last SWITCH; }
if ($menu eq 'uploadmarc') { uploadmarc(); last SWITCH; }
if ($menu eq 'manual') { manual(); last SWITCH; }
--- 723,727 ----
SWITCH:
{
! if ($menu eq 'z3950') { z3950menu($dbh,$input); last SWITCH; }
if ($menu eq 'uploadmarc') { uploadmarc(); last SWITCH; }
if ($menu eq 'manual') { manual(); last SWITCH; }
***************
*** 733,759 ****
}
! sub z3950 {
! my $sth=$dbh->prepare("select
id,term,type,done,numrecords,length(results),startdate,enddate,servers from
z3950queue order by id desc limit 20");
! $sth->execute;
print "<a href=$ENV{'SCRIPT_NAME'}>Main Menu</a><hr>\n";
print "<table border=0><tr><td valign=top>\n";
print "<h2>Results of Z39.50 searches</h2>\n";
! print "<a href=$ENV{'SCRIPT_NAME'}?menu=z3950>Refresh</a><br>\n<ul>\n";
! while (my ($id, $term, $type, $done, $numrecords, $length, $startdate,
$enddate, $servers) = $sth->fetchrow) {
$type=uc($type);
$term=~s/</</g;
$term=~s/>/>/g;
! my $sti=$dbh->prepare("select id,server,startdate,enddate,numrecords
from z3950results where queryid=$id");
! $sti->execute;
if ($sti->rows) {
! my $processing=0;
! my $realenddate=0;
! my $totalrecords=0;
! while (my ($r_id,$r_server,$r_startdate,$r_enddate,$r_numrecords) =
$sti->fetchrow) {
if ($r_enddate==0) {
$processing=1;
} else {
if ($r_enddate>$realenddate) {
$realenddate=$r_enddate;
--- 730,791 ----
}
+ print endmenu();
+ print endpage();
! sub z3950menu {
! use strict;
! my (
! $dbh,
! $input,
! )address@hidden;
!
! my (
! $sth, $sti,
! $processing,
! $realenddate,
! $totalrecords,
! $elapsed,
! $elapsedtime,
! $resultstatus, $statuscolor,
! $id, $term, $type, $done, $numrecords, $length,
! $startdate, $enddate, $servers
! );
!
print "<a href=$ENV{'SCRIPT_NAME'}>Main Menu</a><hr>\n";
print "<table border=0><tr><td valign=top>\n";
print "<h2>Results of Z39.50 searches</h2>\n";
! print "<a href=$ENV{'SCRIPT_NAME'}?menu=z3950>Refresh</a><br>\n" .
! "<ul>\n";
!
! # Check queued queries
! $sth=$dbh->prepare("select id,term,type,done,
! numrecords,length(results),startdate,enddate,servers
! from z3950queue
! order by id desc
! limit 20 ");
! $sth->execute;
! while ( ($id, $term, $type, $done, $numrecords, $length,
! $startdate, $enddate, $servers) = $sth->fetchrow) {
$type=uc($type);
$term=~s/</</g;
$term=~s/>/>/g;
!
! # See if query produced results
! $sti=$dbh->prepare("select id,server,startdate,enddate,numrecords
! from z3950results
! where queryid=?");
! $sti->execute($id);
if ($sti->rows) {
! $processing=0;
! $realenddate=0;
! $totalrecords=0;
! while (my ($r_id,$r_server,$r_startdate,$r_enddate,$r_numrecords)
! = $sti->fetchrow) {
if ($r_enddate==0) {
+ # It hasn't finished yet
$processing=1;
} else {
+ # It finished, see how long it took.
if ($r_enddate>$realenddate) {
$realenddate=$r_enddate;
***************
*** 762,783 ****
$totalrecords+=$r_numrecords;
! }
if ($processing) {
! my $elapsed=time()-$startdate;
! my $elapsedtime='';
! if ($elapsed>60) {
! $elapsedtime=sprintf "%d minutes",($elapsed/60);
! } else {
! $elapsedtime=sprintf "%d seconds",$elapsed;
! }
! if ($totalrecords) {
! $totalrecords="$totalrecords found.";
! } else {
! $totalrecords='';
! }
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=Z-$id&menu=$menu>$type=$term</a> <font size=-1
color=red>Processing... $totalrecords ($elapsedtime)</font><br>\n";
} else {
! my $elapsed=$realenddate-$startdate;
! my $elapsedtime='';
if ($elapsed>60) {
$elapsedtime=sprintf "%d minutes",($elapsed/60);
--- 794,809 ----
$totalrecords+=$r_numrecords;
! } # while results
!
if ($processing) {
! $elapsed=time()-$startdate;
! $resultstatus="Processing...";
! $statuscolor="red";
} else {
! $elapsed=$realenddate-$startdate;
! $resultstatus="Done.";
! $statuscolor="black";
! }
!
if ($elapsed>60) {
$elapsedtime=sprintf "%d minutes",($elapsed/60);
***************
*** 790,802 ****
$totalrecords='';
}
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=Z-$id&menu=$menu>$type=$term</a> <font
size=-1>Done. $totalrecords ($elapsedtime)</font><br>\n";
! }
} else {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=Z-$id&menu=$menu>$type=$term</a> <font
size=-1>Pending</font><br>\n";
! }
! }
! print "</ul>\n";
! print "</td><td valign=top width=30%>\n";
! my $sth=$dbh->prepare("select id,name,checked from z3950servers order by
rank");
$sth->execute;
my $serverlist='';
--- 816,838 ----
$totalrecords='';
}
! print "<li><a href=$ENV{'SCRIPT_NAME'}?file=Z-$id&menu=$menu>".
! "$type=$term</a>" .
! "<font size=-1 color=$statuscolor>$resultstatus $totalrecords "
.
! "($elapsedtime)</font><br>\n";
} else {
! print "<li><a href=$ENV{'SCRIPT_NAME'}?file=Z-$id&menu=$menu>
! $type=$term</a> <font size=-1>Pending</font><br>\n";
! } # if results done
! } # while queries
! print "</ul> </td>\n";
! # End of query listing
!
! #------------------------------
! # Search input form
! print "<td valign=top width=30%>\n";
!
! my $sth=$dbh->prepare("select id,name,checked
! from z3950servers
! order by rank");
$sth->execute;
my $serverlist='';
***************
*** 815,827 ****
<input type=hidden name=test value=testvalue>
<input type=hidden name=rand value=$rand>
! <table border=1 bgcolor=#dddddd><tr><th bgcolor=#bbbbbb colspan=2>Search
for MARC records</th></tr>
<tr><td>Query Term</td><td><input name=query></td></tr>
- <tr><td colspan=2 align=center><input type=radio name=type value=isbn
checked> ISBN <input type=radio name=type value=lccn> LCCN<br><input
type=radio name=type value=author> Author <input type=radio name=type
value=title> Title <input type=radio name=type
value=keyword> Keyword</td></tr>
- <tr><td colspan=2>
- $serverlist
- </td></tr>
<tr><td colspan=2 align=center>
! <input type=submit>
! </td></tr>
</table>
--- 851,865 ----
<input type=hidden name=test value=testvalue>
<input type=hidden name=rand value=$rand>
! <table border=1 bgcolor=#dddddd>
! <tr><th bgcolor=#bbbbbb colspan=2>Search for MARC records</th></tr>
<tr><td>Query Term</td><td><input name=query></td></tr>
<tr><td colspan=2 align=center>
! <input type=radio name=type value=isbn checked> ISBN
! <input type=radio name=type value=lccn > LCCN<br>
! <input type=radio name=type value=author > Author
! <input type=radio name=type value=title > Title
! <input type=radio name=type value=keyword
> Keyword</td></tr>
! <tr><td colspan=2> $serverlist </td></tr>
! <tr><td colspan=2 align=center> <input type=submit> </td></tr>
</table>
***************
*** 829,833 ****
EOF
print "</td></tr></table>\n";
! }
sub uploadmarc {
--- 867,871 ----
EOF
print "</td></tr></table>\n";
! } # sub z3950
sub uploadmarc {
***************
*** 892,897 ****
}
- print endmenu();
- print endpage();
sub parsemarcdata {
--- 930,933 ----
***************
*** 960,969 ****
}
push (@record, \%field);
! }
push (@records, address@hidden);
$counter++;
}
return @records;
! }
#----------------------------
--- 996,1006 ----
}
push (@record, \%field);
! } # foreach field in record
push (@records, address@hidden);
$counter++;
}
+ print "</pre>" if $debug;
return @records;
! } # sub parsemarcfileformat
#----------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/acqui.simple marcimport.pl,1.6.2.7,1.6.2.8,
Alan Millar <=