X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=www%2Fz39util.tcl;h=ba0b55eae59549aac99bd00ce82b2a3b8343a6cc;hb=a61ad0378b93e99e362a1d92c33d701dbf103eba;hp=bfa560845c37b69475f5c6238558e0bec46a798c;hpb=e406f6fe976eeae769f193a9d48938d903c02543;p=egate.git
diff --git a/www/z39util.tcl b/www/z39util.tcl
index bfa5608..ba0b55e 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.40 1996/03/13 14:07:32 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,136 @@ 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]
+ set score [$zset getMarc $no field 999 * r]
+ } 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 { }
+ if {[scan $score %d nscore]} {
+ html "; Score " $nscore
+ }
+ } 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
+
+ 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 {
" [join [$zset getSutrs $no]] "
\n"
- button-europagate
+ button-main
if {$setMax > 0 && $setMax < [$zz.$setNo resultCount]} {
+ if {!$useIcons} {
+ html "\n | "
+ }
html {}
+ html {">
\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 +1366,51 @@ 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 {$hist($setNo,$i,offset) > $hist($setNo,maxPresent)} {
- set nor $hist($setNo,$i,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]
+ if {$zstatus($i) != 2} continue
+ set status [z39$i.$setNo responseStatus]
+ if {[lindex $status 0] != "DBOSD"} continue
+ set nor $hist($setNo,$i,offset)
+ 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]
+ } elseif {![string compare [z39$i.$setNo recordType $j] USmarc]} {
+ set score [z39$i.$setNo getMarc $j field 999 * r]
+ if {[scan $score %d score] != 1} {
+ set score 10
+ }
} else {
- lappend scoreArray [list 0 $i $setNo $j]
+ set score 10
+ }
+ if {$score > 0} {
+ lappend scoreArray [list $score $i $j]
}
}
}
- html "score merge
"
+ if {![info exists scoreArray]} {
+ html "
\n"
}
-proc button-europagate {} {
+proc button-main {} {
global useIcons
html {}
if {$useIcons} {
html {}
} else {
- html {Europagate | }
+ html {Europagate}
}
}
-proc button-define-target {more} {
+proc button-define-target {} {
global useIcons
global env
global sessionId
+ if {!$useIcons} {
+ html "\n | "
+ }
html {}
} else {
html {">Define Target}
- if {$more} {
- html " | \n"
- } else {
- html "\n"
- }
}
}
-proc button-new-target {more} {
+proc button-new-target {} {
global useIcons
global env
global sessionId
- global mMode
+ global scriptTarget
- html {
}
} else {
html {">New Target}
- if {$more} {
- html " | \n"
- } else {
- html "\n"
- }
}
}
-proc button-view-history {more} {
+proc button-view-history {} {
global useIcons
global env
global sessionId
global nextSetNo
+ if {!$useIcons} {
+ html "\n | "
+ }
html {}
} else {
html {">View History}
- if {$more} {
- html " | \n"
- } else {
- html "\n"
- }
}
}
-proc button-new-query {more setNo} {
+proc button-new-query {setNo} {
global useIcons
global env
global sessionId
global hist
- global mMode
+ global scriptQuery
- html {}
+ html {}
+
if {$useIcons} {
html {
}
} else {
html {New Query}
- if {$more} {
- html " | \n"
- } else {
- html "\n"
- }
}
}
-proc button-scan-window {more setNo} {
+proc button-result-set {setNo tno} {
global useIcons
global env
global sessionId
global hist
+ if {!$useIcons} {
+ html "\n | "
+ }
+ html {
}
+ } else {
+ html {">Result Set}
+ }
+}
+
+proc button-scan-window {setNo} {
+ global useIcons
+ global env
+ global sessionId
+ global hist
+
+ if {!$useIcons} {
+ html "\n | "
+ }
set targetNo 0
html {}
@@ -1540,11 +1778,6 @@ proc button-scan-window {more setNo} {
html {alt="Scan" border=0>}
} else {
html {Scan}
- if {$more} {
- html " | \n"
- } else {
- html "\n"
- }
}
}
@@ -1577,7 +1810,7 @@ proc splitDatabaseSpec {host} {
}
proc mergeHostSpec {host databases} {
- return ${host}.[join $databases -]
+ return ${host}/[join $databases -]
}
proc mkAssoc {assoc host} {
@@ -1598,4 +1831,47 @@ proc mkAssoc {assoc host} {
ir $assoc
}
}
+}
+
+proc serverList {headlineProc targetProc} {
+ global targets
+ global groupsDescription
+
+ proc targetsCmp {l r} {
+ global targets
+ return [string compare [string tolower [lindex $targets($l) 0]] \
+ [string tolower [lindex $targets($r) 0]]]
+ }
+ proc groupCmp {l r} {
+ global groupsOrder
+ if {[catch {set lo $groupsOrder($l)}]} {
+ set lo 10
+ }
+ if {[catch {set ro $groupsOrder($r)}]} {
+ set ro 10
+ }
+ return [expr $lo - $ro]
+ }
+
+ foreach tt [array names targets] {
+ lappend groupsTmp([lindex $targets($tt) 6]) $tt
+ }
+ set gts [lsort -command groupCmp [array names groupsTmp]]
+ foreach gt $gts {
+ if {[info exists groupsDescription($gt)]} {
+ eval $headlineProc [list $groupsDescription($gt)]
+ } else {
+ eval $headlineProc $gt
+ }
+ set tn [lsort -command targetsCmp $groupsTmp($gt)]
+ foreach t $tn {
+ eval $targetProc $t
+ }
+ }
+
+ rename targetsCmp {}
+}
+
+if {[info exists utilExtension]} {
+ source $utilExtension
}
\ No newline at end of file