From 852b4caac48a2542af95c577dab306db1bda56f1 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 9 Nov 1995 15:24:36 +0000 Subject: [PATCH] Readable detailed presentation format as well as raw format. --- www/search.egw | 7 ++- www/showfull.egw | 32 ++++++---- www/z39util.tcl | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 190 insertions(+), 19 deletions(-) diff --git a/www/search.egw b/www/search.egw index 21af854..6687d24 100644 --- a/www/search.egw +++ b/www/search.egw @@ -1,6 +1,6 @@ { -# $Id: search.egw,v 1.11 1995/11/08 16:14:33 adam Exp $ +# $Id: search.egw,v 1.12 1995/11/09 15:24:36 adam Exp $ proc buttons {setNo setMax startPos} { global sessionId @@ -11,7 +11,8 @@ proc buttons {setNo setMax startPos} { if {$setMax < [z39.$setNo resultCount]} { html { Next } "| \n" + html + [expr $setMax + $hist($setNo,maxPresent)] + html {"> Next records } "| \n" } if {$startPos != "" && $startPos != "1"} { html { Prev } "| \n" + html {"> Previous records } "| \n" } html { New target } " | \n" diff --git a/www/showfull.egw b/www/showfull.egw index c2d11ce..efee05e 100644 --- a/www/showfull.egw +++ b/www/showfull.egw @@ -1,8 +1,8 @@ { -# $Id: showfull.egw,v 1.6 1995/11/08 16:14:34 adam Exp $ +# $Id: showfull.egw,v 1.7 1995/11/09 15:24:37 adam Exp $ -proc buttons {setNo no} { +proc buttons {setNo no format} { global sessionId global env global hist @@ -10,17 +10,26 @@ proc buttons {setNo no} { html "

\n" if {$no < [z39.$setNo resultCount]} { html { Next } "| \n" + html / $sessionId {/showfull.egw/} $setNo + [expr $no + 1] + $format + html {"> Next record } "| \n" } if {$no > 1} { html { Prev } "| \n" + html / $sessionId {/showfull.egw/} $setNo + [expr $no - 1] + $format + html {"> Previous record } "| \n" } + + html {Raw format} "| \n" + } else { + html full {">Full format} "| \n" + } + html { Result } "| \n" html { New query } "

\n" + } if {[info commands saveState] == ""} { @@ -42,6 +52,7 @@ proc buttons {setNo no} { set sno [lindex $sessionParms 0] set no [lindex $sessionParms 1] + set format [lindex $sessionParms 2] set setNo $sno @@ -51,11 +62,10 @@ proc buttons {setNo no} { set total [z39.$setNo resultCount] html "

Record \#$no out of $total


\n" - buttons $setNo $no - - z39present $setNo $no $no display-full + buttons $setNo $no $format - buttons $setNo $no + eval {z39present $setNo $no $no display-$format} + buttons $setNo $no $format } diff --git a/www/z39util.tcl b/www/z39util.tcl index 6b56df4..82380f1 100644 --- a/www/z39util.tcl +++ b/www/z39util.tcl @@ -1,5 +1,5 @@ # -# $Id: z39util.tcl,v 1.5 1995/11/08 18:07:23 adam Exp $ +# $Id: z39util.tcl,v 1.6 1995/11/09 15:24:37 adam Exp $ # proc saveState {} { uplevel #0 { @@ -82,13 +82,13 @@ proc display-brief {zset no} { set year [lindex [$zset getMarc $no field 260 * c] 0] } ] } { html { } $title {} - html " ${year} " + html $sessionId {/showfull.egw/} $setNo + $no + full + html {"> } $title {} " ${year} " } html "
\n" } -proc display-full {zset no} { +proc display-raw {zset no} { set type [$zset type $no] if {$type == "SD"} { set err [lindex [$zset diag $no] 1] @@ -103,7 +103,6 @@ proc display-full {zset no} { if {$type != "DB"} { return } - html "

${no}

\n" set rtype [$zset recordType $no] if {$rtype == "SUTRS"} { html [join [$zset getSutrs $no]] "
\n" @@ -140,6 +139,164 @@ proc display-full {zset no} { } } +proc put-marc-contents {cc} { + set ref "" + if {[string first :// $cc] > 0} { + foreach urltype {gopher http ftp mailto} { + if {[string first ${urltype}:// $cc] == 0} { + set ref $urltype + break + } + } + } + if {$ref != ""} { + html {} $urltype { reference} + } +} + +proc dl-marc-field {zset no tag id la lb sep} { + set n 0 + set c [$zset getMarc $no field $tag * $id] + set len [llength $c] + if {$len == 0} { + return 0 + } + if {$len > 1 && "x$lb" != "x"} { + html "
$lb\n
" + } else { + html "
$la\n
" + } + foreach cc $c { + if {$n > 0} { + html $sep + } + put-marc-contents $cc + incr n + } + return $n +} + +proc dd-marc-field {zset no tag id start stop} { + set n 0 + set c [$zset getMarc $no field $tag * $id] + set len [llength $c] + if {$len == 0} { + return 0 + } + foreach cc $c { + html $start + put-marc-contents $cc + html $stop + incr n + } + return $n +} + +proc dl-marc-field-rec {zset no tag lead start stop startid sep} { + set n 0 + set lines [$zset getMarc $no line $tag * *] + foreach line $lines { + foreach field [lindex $line 2] { + if {$n == 0} { + html "
$lead" + html "\n
" + } + set id [lindex $field 0] + if {$id == $startid} { + if {$n > 0} { + html $stop + } + html $start + incr n + html [lindex $field 1] + } else { + html $sep + html [lindex $field 1] + } + } + } + if {$n > 0} { + html $stop + } +} + +proc display-full {zset no} { + 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 "Error ${err}${add}
\n" + return + } + if {$type != "DB"} { + return + } + set rtype [$zset recordType $no] + if {$rtype == "SUTRS"} { + html [join [$zset getSutrs $no]] "
\n" + return + } + if {[catch {set r [$zset getMarc $no line * * *]}]} { + html "Unknown record type: $rtype
\n" + return + } + html "
\n" + set n [dl-marc-field $zset $no 700 a "Author" "Authors" "
\n"] + if {$n == 0} { + set n [dl-marc-field $zset $no 100 a "Author" "Authors" "
\n"] + } + set n [dl-marc-field $zset $no 710 a "Corporate Name" {} ", "] + if {$n == 0} { + set n [dl-marc-field $zset $no 710 a "Corporate Name" {} ", "] + } + set n [dl-marc-field $zset $no 245 {a} "Title" {} " "] + if {$n > 0} { + dd-marc-field $zset $no 245 b "" "" + dd-marc-field $zset $no 245 c " " "" + } else { + dl-marc-field $zset $no 245 {[ab]} "Title" {} " " + } + dl-marc-field $zset $no 520 a "Abstract" {} ", " + dl-marc-field $zset $no 072 * "Subject code" "Subject codes" ", " + dl-marc-field $zset $no 650 * "Subject" {} ", " + dl-marc-field $zset $no 260 * "Publisher" {} " " + dl-marc-field $zset $no 300 * "Physical Description" {} " " + + dl-marc-field $zset $no 500 a "Notes" {} ", " + + dl-marc-field-rec $zset $no 510 "References" "" "
\n" "a" ", " + + dl-marc-field $zset $no 350 a "Price" {} ", " + dl-marc-field $zset $no 362 a "Dates of publication" {} ", " + dl-marc-field $zset $no 850 a "Holdings" {} ", " + + dl-marc-field $zset $no 010 a "LC control number" {} ", " + dl-marc-field $zset $no 010 b "NUCMC control number" {} ", " + dl-marc-field $zset $no 020 a "ISBN" {} ", " + dl-marc-field $zset $no 022 a "ISSN" {} ", " + set url [$zset getMarc $no field 856 * u] + set sp [$zset getMarc $no field 856 * 3] + if {"x$url" != "x"} { + html "
URL\n" + if {"x$sp" == "x"} { + set sp reference + } + html {
} [join $sp] "\n" + } + dl-marc-field $zset $no 037 * "Acquisition" {} "
\n" + dl-marc-field $zset $no 787 {[rstw6]} "Related information" {} "
\n" + dl-marc-field $zset $no 001 * "Local control number" {} ", " + html "
\n" +} + + proc display-rec {from to dfunc zz} { global setNo @@ -414,6 +571,9 @@ proc z39present {setNo setOffset setMax dfunc} { break } set got [z39.$setNo numberOfRecordsReturned] + if {$got <= 0} { + break + } } display-rec $setOffset [expr $got + $setOffset - 1] $dfunc z39 set setOffset [expr $got + $setOffset] -- 1.7.10.4