+ html "<br>\n"
+ }
+}
+
+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 {">} $cc {</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-marc {zset no setNo targetNo} {
+ global env
+ global hist
+ global sessionId
+
+ 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 110 a "Corporate Name" {} ", "]
+ }
+ set n [dl-marc-field $zset $no 711 a "Meeting Name" {} ", "]
+ if {$n > 0} {
+ dd-marc-field $zset $no 711 {[bndc]} " " ""
+ } else {
+ set n [dl-marc-field $zset $no 111 a "Meeting Name" {} ", "]
+ if {$n > 0} {
+ dd-marc-field $zset $no 111 {[bndc]} " " " "
+ }
+ }
+ 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-rec $zset $no 500 "Notes" "" "<br>\n" "a" ", "
+
+ dl-marc-field-rec $zset $no 510 "References" "" "<br>\n" "a" ", "
+
+ dl-marc-field-rec $zset $no 511 "Participant note" "" "<br>\n" "a" ", "
+
+ dl-marc-field $zset $no 513 a "Report type" {} ", "
+ dl-marc-field $zset $no 513 b "Period covered" {} ", "
+ dl-marc-field-rec $zset $no 515 "Numbering notes" "" "<br>\n" "a" ", "
+ dl-marc-field-rec $zset $no 516 "Data notes" "" "<br>\n" "a" ", "
+ dl-marc-field-rec $zset $no 518 "Date/time notes" "" "<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-rec $zset $no 270 "Contact name" "" "<br>\n" p ", "
+ if {0} {
+ set n [dl-marc-field $zset $no 270 p "Contact name" {} ", "]
+ if {$n > 0} {
+ html "\n<dl>\n"
+
+ if {0} {
+ dl-marc-field $zset $no 270 a "Street" {} ", "
+ dl-marc-field $zset $no 270 b "City" {} ", "
+ dl-marc-field $zset $no 270 c "State" {} ", "
+ dl-marc-field $zset $no 270 e "Zip code" {} ", "
+ dl-marc-field $zset $no 270 d "Country" {} ", "
+ dl-marc-field $zset $no 270 m "Network address" {} ", "
+ dl-marc-field $zset $no 301 a "Service hours" {} ", "
+ dl-marc-field $zset $no 270 k "Phone" {} ", "
+ dl-marc-field $zset $no 270 l "Fax" {} ", "
+ } else {
+ dl-marc-field $zset $no 270 {[abcedmakl]} "Address" {} "<br>\n"
+ }
+
+ html "\n</dl>\n"
+ }
+ }
+ 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 $url
+ }
+ html {<dd><a href="} [join $url] {">} [join $sp] "</a>\n"
+ }
+ dl-marc-field $zset $no 037 {[abc]} "Acquisition" {} "<br>\n"
+ dl-marc-field $zset $no 037 {[f6]} "Form of issue" {} "<br>\n"
+ dl-marc-field $zset $no 537 * "Source of data" {} "<br>\n"
+ dl-marc-field $zset $no 538 * "System details" {} "<br>\n"
+ dl-marc-field $zset $no 787 {[rstw6]} "Related information" {} "<br>\n"
+ dl-marc-field $zset $no 999 r "Score" {} ", "
+ dl-marc-field $zset $no 001 * "Local control number" {} ", "
+ html "</dl>\n"
+}
+
+proc display-full-wais {zset no setNo targetNo} {
+ global env
+ global hist
+ global sessionId
+
+ set i 0
+ set element junk
+ htmlToken l [join [$zset getWAIS $no text]] {
+ if {[string compare [string index $l 0] {<}]} {
+ if {[info exist data($element)]} {
+ set data($element) $data($element)$l
+ } else {
+ set data($element) $l
+ }
+ continue
+ }
+ switch -- $l {
+ <ti> {
+ set element title
+ }
+ <dm> {
+ set element dateOfLastModification
+ }
+ <ci> {
+ set element controlIdentifier
+ }
+ <lc> {
+ set element lastChecked
+ }
+ <by> {
+ set element bytes
+ }
+ <avli> {
+ set element linkage
+ }
+ <cr> {
+ incr i
+ }
+ <li> {
+ set element "$i,linkage"
+ }
+ <cp> {
+ set element "$i,title"
+ }
+ <ip> {
+ set element ip
+ }
+ default {
+ set element junk
+ }
+ }
+ }
+ if {![info exists data(title)] || ![info exists data(linkage)]} {
+ set nwi 0
+ } else {
+ set nwi 1
+ }
+ html "<dl>\n"
+ html {<dt><b>Title</b>}
+ if {$nwi} {
+ html {<dd><a href="} $data(linkage) {">} $data(title) "</a>"
+ html {<dt><b>URL</b>}
+ html {<dd>} $data(linkage) "<br>\n"
+ } else {
+ html {<dd>} [join [$zset getWAIS $no headline]]
+ }
+ html {<dt><b>Score</b><dd>} [$zset getWAIS $no score]
+ set lines [$zset getWAIS $no lines]
+ if {$lines > 0} {
+ html {<dt><b>Lines</b><dd>} $lines "<br>\n"
+ }
+ if {!$nwi} {
+ html "</dl><pre>\n" [join [$zset getWAIS $no text]] "\n</pre>\n"
+ return
+ }
+ if {[info exists data(bytes)]} {
+ html {<dt><b>Bytes</b><dd>} $data(bytes)
+ }
+ if {[info exists data(dateOfLastModification)]} {
+ html {<dt><b>Last modified</b><dd>} $data(dateOfLastModification)
+ }
+ if {[info exists data(lastChecked)]} {
+ html {<dt><b>Last checked</b><dd>} $data(lastChecked) "<br>\n"
+ }
+ if {[info exists data(ip)]} {
+ html {<dt><b>Initial text</b><dd>} $data(ip) "<br>\n"
+ }
+ if {0} {
+ html {<a href="} $env(SCRIPT_NAME) / $sessionId {/sameas.egw/}
+ html $setNo + $targetNo + 1 + $hist($setNo,maxPresent) +
+ html [egw_enc [$zset getWAIS $no documentID]] {">}
+ html {Similar WAIS record</a><br>}
+ }
+ if {[info exists data($i,linkage)]} {
+ html "<dt><b>References</b>\n"
+ }
+ for {set i 1} {[info exists data($i,linkage)]} {incr i} {
+ html {<dd><a href="} $data($i,linkage) {">}
+ if {[info exists data($i,title)]} {
+ html $data($i,title)
+ } else {
+ html Untitled
+ }
+ html "</a><br>\n"
+ }
+ html "</dl>\n"
+}
+
+proc display-full {zset no setNo targetNo} {
+ set type [$zset type $no]
+ switch $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
+ }
+ DB {
+ }
+ default {
+ return
+ }
+ }
+ set rtype [$zset recordType $no]
+ switch $rtype {
+ SUTRS {
+ html "<pre>" [join [$zset getSutrs $no]] "</pre><br>\n"
+ return
+ }
+ WAIS {
+ display-full-wais $zset $no $setNo $targetNo
+ return
+ }