+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 {<a href="}
+ }
+ html $cc
+ if {$ref != ""} {
+ html {">} $urltype { reference</a>}
+ }
+}
+
+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 "<dt><b>$lb</b>\n<dd>"
+ } else {
+ html "<dt><b>$la</b>\n<dd>"
+ }
+ 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 "<dt><b>$lead</b>"
+ html "\n<dd>"
+ }
+ 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} <br>\n"
+ return
+ }
+ if {$type != "DB"} {
+ return
+ }
+ set rtype [$zset recordType $no]
+ if {$rtype == "SUTRS"} {
+ html [join [$zset getSutrs $no]] "<br>\n"
+ return
+ }
+ if {[catch {set r [$zset getMarc $no line * * *]}]} {
+ html "Unknown record type: $rtype <br>\n"
+ return
+ }
+ html "<dl>\n"
+ set n [dl-marc-field $zset $no 700 a "Author" "Authors" "<br>\n"]
+ if {$n == 0} {
+ set n [dl-marc-field $zset $no 100 a "Author" "Authors" "<br>\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 "<em>" "</em>"
+ 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" "" "<br>\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 "<dt><b>URL</b>\n"
+ if {"x$sp" == "x"} {
+ set sp reference
+ }
+ html {<dd><a href="} $url {">} [join $sp] "</a>\n"
+ }
+ dl-marc-field $zset $no 037 * "Acquisition" {} "<br>\n"
+ dl-marc-field $zset $no 787 {[rstw6]} "Related information" {} "<br>\n"
+ dl-marc-field $zset $no 001 * "Local control number" {} ", "
+ html "</dl>\n"
+}
+
+