X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fz39util.tcl;h=9efda0b3fc2c7011e13cf6958e2bb39c291bd288;hb=02d3e042a063e539acce998f74b00a09df000cd0;hp=bfa560845c37b69475f5c6238558e0bec46a798c;hpb=e406f6fe976eeae769f193a9d48938d903c02543;p=egate.git
diff --git a/www/z39util.tcl b/www/z39util.tcl
index bfa5608..9efda0b 100644
--- a/www/z39util.tcl
+++ b/www/z39util.tcl
@@ -1,5 +1,5 @@
#
-# $Id: z39util.tcl,v 1.37 1996/03/08 16:47:08 adam Exp $
+# $Id: z39util.tcl,v 1.38 1996/03/11 17:40:49 adam Exp $
#
proc saveState {} {
uplevel #0 {
@@ -65,7 +65,7 @@ proc fail-response {} {
set sessionWait -1
}
-proc display-brief {zset no setNo targetNo} {
+proc display-medium {zset no setNo targetNo} {
global env
global sessionId
@@ -84,21 +84,131 @@ proc display-brief {zset no setNo targetNo} {
return
}
set rtype [$zset recordType $no]
- if {$rtype == "SUTRS"} {
+ switch $rtype {
+ SUTRS {
+ html { }
+ html [join [$zset getSutrs $no]]
+ html "
\n"
+ return
+ }
+ WAIS {
+ html { }
+ html [join [$zset getWAIS $no headline]]
+ html {}
+ html "
\n"
+ html {Score: } [$zset getWAIS $no score]
+ set lines [$zset getWAIS $no lines]
+ if {$lines > 0} {
+ html {, } $lines { lines}
+ }
+ html "
\n"
+ return
+ }
+ }
+ if {![catch {
+ set author [$zset getMarc $no field 100 * a]
+ set corp [$zset getMarc $no field 110 * a]
+ set meet [$zset getMarc $no field 111 * a]
+ set title [$zset getMarc $no field 245 * a]
+ if {[llength $author] == 0} {
+ set cover [$zset getMarc $no field 245 * {[bc]}]
+ } else {
+ set cover [$zset getMarc $no field 245 * b]
+ }
+ set location [$zset getMarc $no field 260 * a]
+ set publisher [$zset getMarc $no field 260 * b]
+ set year [$zset getMarc $no field 260 * c]
+ } dispError ] } {
html { }
- html [join [$zset getSutrs $no]]
- html "
\n"
- return
- }
- if {$rtype == "WAIS"} {
+ set p 0
+ foreach a $author {
+ if {$p} {
+ html ", "
+ }
+ html $a
+ set p 1
+ }
+ foreach a $corp {
+ if {$p} {
+ html ", "
+ }
+ html $a
+ set p 1
+ }
+ foreach a $meet {
+ if {$p} {
+ html ", "
+ }
+ html $a
+ set p 1
+ }
+ if {$p} {
+ html ": "
+ }
+ set nope 1
+ foreach v $title {
+ html $v
+ set nope 0
+ }
+ set v [join $cover ""]
+ if {[string length $v] > 0} {
+ set nope 0
+ html $v
+ } elseif {$nope} {
+ html "No Title"
+ }
+ html { }
+ } else {
html { }
- html [join [$zset getWAIS $no headline]]
- html {}
- html "
\n"
+ html {No Title}
+ html { }
+ html "Error: " $dispError "\n"
+ }
+ html "
\n"
+}
+
+proc display-brief {zset no setNo targetNo} {
+ global env
+ global sessionId
+
+ set type [$zset type $no]
+ if {$type == "SD"} {
+ set err [lindex [$zset diag $no] 1]
+ set add [lindex [$zset diag $no] 2]
+ if {$add != {}} {
+ set add " :${add}"
+ }
+ html "${no} Error ${err}${add}
\n"
+ return
+ }
+ if {$type != "DB"} {
return
}
+ set rtype [$zset recordType $no]
+ switch $rtype {
+ SUTRS {
+ html { }
+ html [string range [join [$zset getSutrs $no]] 0 70]
+ html "
\n"
+ return
+ }
+ WAIS {
+ html { }
+ html [string range [join [$zset getWAIS $no headline]] 0 70]
+
+ html {}
+ set score [$zset getWAIS $no score]
+ html { Score } $score
+ html "
\n"
+ return
+ }
+ }
if {![catch {
set author [$zset getMarc $no field 100 * a]
set corp [$zset getMarc $no field 110 * a]
@@ -140,11 +250,13 @@ proc display-brief {zset no setNo targetNo} {
if {$p} {
html ": "
}
+ html {
\n"
}
-proc display-raw {zset no tno} {
+proc display-raw {zset no setNo targetNo} {
set type [$zset type $no]
- if {$type == "SD"} {
- set err [lindex [$zset diag $no] 1]
- set add [lindex [$zset diag $no] 2]
- if {$add != {}} {
- set add " :${add}"
+ switch $type {
+ SD {
+ set err [lindex [$zset diag $no] 1]
+ set add [lindex [$zset diag $no] 2]
+ if {$add != {}} {
+ set add " :${add}"
+ }
+ html "
" [join [$zset getWAIS $no text]] "\n\n" - return - } - html {Title: } {} $data(title) "
" - html [join [$zset getSutrs $no]] - html "
\n" [join [$zset getWAIS $no text]] "\n\n" + return + } + if {[info exists data(bytes)]} { + html {Bytes: } $data(bytes) "
" [join [$zset getSutrs $no]] "
\n"
}
+proc score-sort {l r} {
+ return [expr [lindex $r 0] - [lindex $l 0]]
+}
+
proc display-result-set-m-score {setNo} {
global hist
global useIcons
@@ -1181,23 +1350,38 @@ proc display-result-set-m-score {setNo} {
set not $hist($setNo,0,host)
for {set i 1} {$i <= $not} {incr i} {
- if {[lindex $status 0] != "DBOSD"} continue
-
+ if {$zstatus($i) != 2} continue
+ set status [z39$i.$setNo responseStatus]
+ if {[lindex $status 0] != "DBOSD"} continue
if {$hist($setNo,$i,offset) > $hist($setNo,maxPresent)} {
- set nor $hist($setNo,$i,maxPresent)
+ set nor $hist($setNo,maxPresent)
} else {
set nor $hist($setNo,$i,offset)
}
- for {set j 1} {$j < $not} {incr j} {
- if {![string compare [z39$i.$setNo recordType] WAIS]} {
- lappend scoreArray [list \
- [z39$i.$setNo getWAIS $j score] $i $setNo $j]
+ for {set j 1} {$j <= $nor} {incr j} {
+ if {![string compare [z39$i.$setNo recordType $j] WAIS]} {
+ set score [z39$i.$setNo getWAIS $j score]
+ if {$score > 0} {
+ lappend scoreArray [list $score $i $j]
+ }
} else {
- lappend scoreArray [list 0 $i $setNo $j]
+ lappend scoreArray [list 10 $i $j]
}
}
}
- html "score merge
"
+ if {![info exists scoreArray]} {
+ html "