2 # $Id: z39util.tcl,v 1.33 1996/02/21 16:57:39 adam Exp $
6 set f [open "tcl.state.${sessionId}" w]
7 foreach var [info globals] {
8 if {$var == "f"} continue
9 if {$var == "sessionId"} continue
10 if {$var == "errorInfo"} continue
11 if {[catch {set names [array names $var]}]} {
13 puts $f "set ${var} \{$v\}"
16 eval "set v \$${var}(\$n)"
17 puts $f "set ${var}($n) \{$v\}"
21 puts $f "set ${var} \{$v\}"
29 proc search-response {zz} {
32 set status [$zz responseStatus]
33 if {[lindex $status 0] == "NSD"} {
34 $zz nextResultSetPosition 0
35 set code [lindex $status 1]
36 set msg [lindex $status 2]
37 set addinfo [lindex $status 3]
38 displayError "Diagnostic message" \
39 "$msg: $addinfo<br>\n(error code $code)"
46 proc scan-response {zz} {
49 set status [$zz scanStatus]
51 displayError "Scan fail" ""
63 proc fail-response {} {
68 proc display-brief {zset no tno} {
75 set type [$zset type $no]
77 set err [lindex [$zset diag $no] 1]
78 set add [lindex [$zset diag $no] 2]
82 html "${no} Error ${err}${add} <br>\n"
88 set rtype [$zset recordType $no]
89 if {$rtype == "SUTRS"} {
90 html [join [$zset getSutrs $no]]
95 set author [$zset getMarc $no field 100 * a]
96 set corp [$zset getMarc $no field 110 * a]
97 set meet [$zset getMarc $no field 111 * a]
98 set title [$zset getMarc $no field 245 * a]
99 if {[llength $author] == 0} {
100 set cover [$zset getMarc $no field 245 * {[bc]}]
102 set cover [$zset getMarc $no field 245 * b]
104 set location [$zset getMarc $no field 260 * a]
105 set publisher [$zset getMarc $no field 260 * b]
106 set year [$zset getMarc $no field 260 * c]
108 html { <a href="http:} $env(SCRIPT_NAME) /
109 html $sessionId {/showfull.egw/} $setNo + $tno + $no + full {">}
141 set v [join $cover ""]
142 if {[string length $v] > 40} {
144 html [string range $v 0 38] "..."
145 } elseif {[string length $v] > 0} {
154 html { <a href="http:} $env(SCRIPT_NAME) /
155 html $sessionId {/showfull.egw/} $setNo + $tno + $no + full {">}
158 html "Error: " $dispError "\n"
163 proc display-raw {zset no tno} {
164 set type [$zset type $no]
166 set err [lindex [$zset diag $no] 1]
167 set add [lindex [$zset diag $no] 2]
171 html "<h3>${no}</h3>\n"
172 html "Error ${err}${add} <br>\n"
178 set rtype [$zset recordType $no]
179 if {$rtype == "SUTRS"} {
180 html [join [$zset getSutrs $no]] "<br>\n"
183 if {[catch {set r [$zset getMarc $no line * * *]}]} {
184 html "Unknown record type: $rtype <br>\n"
188 set tag [lindex $line 0]
189 set indicator [lindex $line 1]
190 set fields [lindex $line 2]
191 set l [string length $indicator]
194 for {set i 0} {$i < $l} {incr i} {
195 if {[string index $indicator $i] == " "} {
198 html [string index $tag $i]
203 foreach field $fields {
204 set id [lindex $field 0]
205 set data [lindex $field 1]
207 html " <b>\$$id</b> "
215 proc put-marc-contents {cc} {
217 if {[string first :// $cc] > 0} {
218 foreach urltype {gopher http ftp mailto} {
219 if {[string first ${urltype}:// $cc] == 0} {
234 proc dl-marc-field {zset no tag id la lb sep} {
236 set c [$zset getMarc $no field $tag * $id]
241 if {$len > 1 && "x$lb" != "x"} {
242 html "<dt><b>$lb</b>\n<dd>"
244 html "<dt><b>$la</b>\n<dd>"
250 put-marc-contents $cc
256 proc dd-marc-field {zset no tag id start stop} {
258 set c [$zset getMarc $no field $tag * $id]
265 put-marc-contents $cc
272 proc dl-marc-field-rec {zset no tag lead start stop startid sep} {
274 set lines [$zset getMarc $no line $tag * *]
275 foreach line $lines {
276 foreach field [lindex $line 2] {
278 html "<dt><b>$lead</b>"
281 set id [lindex $field 0]
282 if {$id == $startid} {
288 html [lindex $field 1]
291 html [lindex $field 1]
300 proc display-full {zset no tno} {
301 set type [$zset type $no]
303 set err [lindex [$zset diag $no] 1]
304 set add [lindex [$zset diag $no] 2]
308 html "Error ${err}${add} <br>\n"
314 set rtype [$zset recordType $no]
315 if {$rtype == "SUTRS"} {
316 html [join [$zset getSutrs $no]] "<br>\n"
319 if {[catch {set r [$zset getMarc $no line * * *]}]} {
320 html "Unknown record type: $rtype <br>\n"
324 set n [dl-marc-field $zset $no 700 a "Author" "Authors" "<br>\n"]
326 set n [dl-marc-field $zset $no 100 a "Author" "Authors" "<br>\n"]
328 set n [dl-marc-field $zset $no 710 a "Corporate Name" {} ", "]
330 set n [dl-marc-field $zset $no 110 a "Corporate Name" {} ", "]
332 set n [dl-marc-field $zset $no 711 a "Meeting Name" {} ", "]
334 dd-marc-field $zset $no 711 {[bndc]} " " ""
336 set n [dl-marc-field $zset $no 111 a "Meeting Name" {} ", "]
338 dd-marc-field $zset $no 111 {[bndc]} " " " "
341 set n [dl-marc-field $zset $no 245 {a} "Title" {} " "]
343 dd-marc-field $zset $no 245 b "<em>" "</em>"
344 dd-marc-field $zset $no 245 c " " ""
346 dl-marc-field $zset $no 245 {[ab]} "Title" {} " "
348 dl-marc-field $zset $no 520 a "Abstract" {} ", "
349 dl-marc-field $zset $no 072 * "Subject code" "Subject codes" ", "
350 dl-marc-field $zset $no 650 * "Subject" {} ", "
351 dl-marc-field $zset $no 260 * "Publisher" {} " "
352 dl-marc-field $zset $no 300 * "Physical Description" {} " "
354 dl-marc-field-rec $zset $no 500 "Notes" "" "<br>\n" "a" ", "
356 dl-marc-field-rec $zset $no 510 "References" "" "<br>\n" "a" ", "
358 dl-marc-field-rec $zset $no 511 "Participant note" "" "<br>\n" "a" ", "
360 dl-marc-field $zset $no 513 a "Report type" {} ", "
361 dl-marc-field $zset $no 513 b "Period covered" {} ", "
362 dl-marc-field-rec $zset $no 515 "Numbering notes" "" "<br>\n" "a" ", "
363 dl-marc-field-rec $zset $no 516 "Data notes" "" "<br>\n" "a" ", "
364 dl-marc-field-rec $zset $no 518 "Date/time notes" "" "<br>\n" "a" ", "
366 dl-marc-field $zset $no 350 a "Price" {} ", "
367 dl-marc-field $zset $no 362 a "Dates of publication" {} ", "
368 dl-marc-field $zset $no 850 a "Holdings" {} ", "
370 dl-marc-field-rec $zset $no 270 "Contact name" "" "<br>\n" p ", "
372 set n [dl-marc-field $zset $no 270 p "Contact name" {} ", "]
377 dl-marc-field $zset $no 270 a "Street" {} ", "
378 dl-marc-field $zset $no 270 b "City" {} ", "
379 dl-marc-field $zset $no 270 c "State" {} ", "
380 dl-marc-field $zset $no 270 e "Zip code" {} ", "
381 dl-marc-field $zset $no 270 d "Country" {} ", "
382 dl-marc-field $zset $no 270 m "Network address" {} ", "
383 dl-marc-field $zset $no 301 a "Service hours" {} ", "
384 dl-marc-field $zset $no 270 k "Phone" {} ", "
385 dl-marc-field $zset $no 270 l "Fax" {} ", "
387 dl-marc-field $zset $no 270 {[abcedmakl]} "Address" {} "<br>\n"
393 dl-marc-field $zset $no 010 a "LC control number" {} ", "
394 dl-marc-field $zset $no 010 b "NUCMC control number" {} ", "
395 dl-marc-field $zset $no 020 a "ISBN" {} ", "
396 dl-marc-field $zset $no 022 a "ISSN" {} ", "
397 set url [$zset getMarc $no field 856 * u]
398 set sp [$zset getMarc $no field 856 * 3]
399 if {"x$url" != "x"} {
400 html "<dt><b>URL</b>\n"
404 html {<dd><a href="} [join $url] {">} [join $sp] "</a>\n"
406 dl-marc-field $zset $no 037 {[abc]} "Acquisition" {} "<br>\n"
407 dl-marc-field $zset $no 037 {[f6]} "Form of issue" {} "<br>\n"
408 dl-marc-field $zset $no 537 * "Source of data" {} "<br>\n"
409 dl-marc-field $zset $no 538 * "System details" {} "<br>\n"
410 dl-marc-field $zset $no 787 {[rstw6]} "Related information" {} "<br>\n"
411 dl-marc-field $zset $no 001 * "Local control number" {} ", "
416 proc display-rec {from to dfunc tno} {
420 while {$from <= $to} {
421 eval "$dfunc z39${tno}.${setNo} $from $tno"
425 while {$from <= $to} {
426 eval "$dfunc z39.${setNo} $from 0"
432 proc build-scan {t i} {
435 set term [egw_form entry$i]
437 set field [join [egw_form menu$i]]
439 foreach x [lindex $targets($t) 2] {
440 if {[lindex $x 0] == $field} {
441 set attr [lindex $x 1]
444 return [list $term $attr]
449 proc build-query {t ilines} {
454 for {set i 1} {$i <= $ilines} {incr i} {
455 set term [join [egw_form entry$i]]
456 if {[string length $term] > 0} {
457 set field [join [egw_form menu$i]]
458 foreach x [lindex $targets($t) 2] {
459 if {[lindex $x 0] == $field} {
460 set attr [lindex $x 1]
465 { set q "@and $q ${attr} \"${term}\"" }
467 { set q "@or $q ${attr} \"${term}\"" }
469 { set q "@not $q ${attr} \"${term}\"" }
471 { set q "${attr} \"${term}\"" }
473 set op [egw_form logic$i]
479 proc z39scan {setNo scanNo tno scanLines scanPos cache} {
486 set host $hist($setNo,$tno,host)
487 set idAuth $hist($setNo,$tno,idAuthentication)
488 set database $hist($setNo,$tno,database)
489 set scanAttr $hist($setNo,$tno,scanAttr)
490 set scanTerm $hist($setNo,$tno,$scanNo,scanTerm)
493 set host $hist($setNo,host)
494 set idAuth $hist($setNo,idAuthentication)
495 set database $hist($setNo,database)
496 set scanAttr $hist($setNo,scanAttr)
497 set scanTerm $hist($setNo,$scanNo,scanTerm)
499 if {[catch [list $zz failback fail-response]]} {
502 if {[catch [list set oldHost [$zz connect]]]} {
505 set zs $zz.s$scanNo.$setNo
506 $zz callback ok-response
507 $zz failback fail-response
508 set thisHost [splitHostSpec $host]
509 if {[string compare $oldHost $thisHost]} {
510 catch [list $zz disconnect]
513 if {[catch [list $zz connect $thisHost]]} {
514 displayError "Cannot connect to target" $thisHost
516 } elseif {$sessionWait == 0} {
517 if {[catch {egw_wait sessionWait 300}]} {
519 displayError "Cannot connect to target" $thisHost
522 if {$sessionWait != 1} {
523 displayError "Cannot connect to target" $thisHost
527 $zz idAuthentication $idAuth
529 if {[catch {$zz init}]} {
530 displayError "Cannot initialize target" $thisHost
534 if {[catch {egw_wait sessionWait 60}]} {
535 displayError "Cannot initialize target" $thisHost
539 if {$sessionWait != "1"} {
540 displayError "Cannot initialize target" $thisHost
544 if {![$zz initResult]} {
545 set u [$zz userInformationField]
547 displayError "Cannot initialize target $thisHost" $u
551 if {$cache && ![catch [list $zs numberOfTermsRequested 5]]} {
555 eval $zz databaseNames $database
559 $zs numberOfTermsRequested $scanLines
560 $zs preferredPositionInResponse $scanPos
562 $zz callback [list scan-response $zs]
564 egw_log debug "scan: ${scanAttr} ${scanTerm}"
566 $zs scan "${scanAttr} ${scanTerm}"
568 if {[catch {egw_wait sessionWait 60}]} {
569 egw_log debug "timeout/cancel in scan"
570 displayError "Timeout in scan" {}
571 html "</body></html>\n"
575 if {$sessionWait == -1} {
576 displayError "Scan fail" "Connection closed"
577 html "</body></html>\n"
580 if {$sessionWait != 1} {
586 proc display-scan {setNo scanNo tno} {
597 set zs $zz.s$scanNo.$setNo
598 set m [$zs numberOfEntriesReturned]
601 set t [lindex [$zs scanLine 0] 1]
603 set hist($setNo,$tno,[expr $scanNo - 1],scanTerm) $t
605 set hist($setNo,[expr $scanNo - 1],scanTerm) $t
607 set t [lindex [$zs scanLine [expr $m - 1]] 1]
609 set hist($setNo,$tno,[expr $scanNo + 1],scanTerm) $t
611 set hist($setNo,[expr $scanNo + 1],scanTerm) $t
614 html {<table width=500 border=0><tr>}
615 html {<td align=left><b>Scan term</b>}
616 html {<td align=right><b>Hits</b>}
619 for {set i 0} {$i < $m} {incr i} {
620 html {<td align=left>}
622 regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
623 html {<a href="http:} $env(SCRIPT_NAME)
624 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo +
625 html $hist($setNo,scan) + $tterm {">}
627 regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
628 html {<a href="http:} $env(SCRIPT_NAME)
629 html / $sessionId {/search.egw/} $setNo +
630 html hyper + $tterm {">}
632 html [lindex [$zs scanLine $i] 1]
634 html {<td align=right>}
635 html [lindex [$zs scanLine $i] 2]
641 proc z39search {setNo piggy tno elements} {
648 set host $hist($setNo,$tno,host)
649 set idAuth $hist($setNo,$tno,idAuthentication)
650 set database $hist($setNo,$tno,database)
651 set query $hist($setNo,$tno,query)
654 set host $hist($setNo,host)
655 set idAuth $hist($setNo,idAuthentication)
656 set database $hist($setNo,database)
657 set query $hist($setNo,query)
659 if {[catch [list $zz failback fail-response]]} {
662 if {[catch [list set oldHost [$zz connect]]]} {
665 $zz callback ok-response
666 $zz failback fail-response
667 set thisHost [splitHostSpec $host]
668 if {[string compare $oldHost $thisHost]} {
669 catch [list $zz disconnect]
672 if {[catch [list $zz connect $thisHost]]} {
673 displayError "Cannot connect to target" $thisHost
675 } elseif {$sessionWait == 0} {
676 if {[catch {egw_wait sessionWait 300}]} {
678 displayError "Cannot connect to target" $thisHost
681 if {$sessionWait != 1} {
682 displayError "Cannot connect to target" $thisHost
686 $zz idAuthentication $idAuth
688 if {[catch {$zz init}]} {
689 displayError "Cannot initialize target" $thisHost
693 if {[catch {egw_wait sessionWait 60}]} {
694 displayError "Cannot initialize target" $thisHost
698 if {$sessionWait != "1"} {
699 displayError "Cannot initialize target" $thisHost
703 if {![$zz initResult]} {
704 set u [$zz userInformationField]
706 displayError "Cannot initialize target $thisHost" $u
709 } elseif {![catch [list $zz.$setNo smallSetUpperBound 0]]} {
711 if {[info exists hist($setNo,$tno,hits)]} {
715 if {[info exists hist($setNo,hits)]} {
720 ir-set $zz.$setNo $zz
722 if {![lindex $targets($host) 5]} {
725 $zz.$setNo smallSetElementSetNames $elements
726 $zz.$setNo mediumSetElementSetNames $elements
727 $zz.$setNo recordElements $elements
729 egw_log debug "database=$database"
730 eval $zz.$setNo databaseNames $database
732 $zz.$setNo preferredRecordSyntax USMARC
734 $zz callback [list search-response $zz.$setNo]
736 $zz.$setNo largeSetLowerBound 999999
737 $zz.$setNo smallSetUpperBound 0
738 $zz.$setNo mediumSetPresentNumber $hist($setNo,maxPresent)
740 $zz.$setNo largeSetLowerBound 2
741 $zz.$setNo smallSetUpperBound 0
742 $zz.$setNo mediumSetPresentNumber 0
745 egw_log debug "search: $query"
746 $zz.$setNo search $query
748 if {[catch {egw_wait sessionWait 60}]} {
749 egw_log debug "timeout/cancel in search"
750 displayError "Timeout in search" {}
751 html "</body></html>\n"
756 if {$sessionWait == -1} {
757 displayError "Search fail" "Connection closed"
758 html "</body></html>\n"
761 if {$sessionWait != 1} {
764 set hist($setNo,hits) [$zz.$setNo resultCount]
768 proc init-m-response {i} {
772 egw_log debug "init-m-response"
775 if {![z39$i initResult]} {
783 proc connect-m-response {i} {
787 egw_log debug "connect-m-response"
788 z39$i callback [list init-m-response $i]
789 if {[catch {z39$i init}]} {
795 proc fail-m-response {i} {
799 egw_log debug "fail-m-response"
804 proc search-m-response {setNo i start number} {
809 egw_log debug "search-m-response"
810 set status [z39$i.$setNo responseStatus]
811 egw_log debug "search-m-response1"
812 if {[lindex $status 0] == "OK"} {
814 } elseif {[lindex $status 0] == "DBOSD"} {
815 set nor [z39$i.$setNo numberOfRecordsReturned]
817 egw_log debug "search-m-response2"
822 set hist($setNo,$i,hits) [z39$i.$setNo resultCount]
823 egw_log debug "search-m-response3"
824 set hist($setNo,$i,offset) [expr $start + $nor -1]
825 if {[expr $nor + $start] > [z39$i.$setNo resultCount]} {
826 egw_log debug "search-m-response4"
831 egw_log debug "search-m-response5"
832 if {$nor >= $number} {
833 egw_log debug "search-m-response6 nor=$nor number=$number"
838 egw_log debug "search-m-response7"
839 set start [expr $start + $nor]
840 set number [expr $number - $nor]
841 if {[expr $start + $number - 1] > [z39$i.$setNo resultCount]} {
842 set number [expr [z39$i.$setNo resultCount] - $start + 1]
844 z39$i callback [list search-m-response $setNo $i $start $number]
845 egw_log debug "mpresent start=$number number=$number"
846 z39$i.$setNo present $start $number
849 proc z39msearch {setNo elements start number cache} {
856 set not $hist($setNo,0,host)
858 egw_log debug "z39msearch start=$start number=$number elements=$elements"
859 for {set i 1} {$i <= $not} {incr i} {
860 set host $hist($setNo,$i,host)
861 if {[catch [list z39$i failback fail-m-response $i]]} {
864 set oldHost [z39$i connect]
865 set thisHost [splitHostSpec $host]
866 if {[string compare $oldHost $thisHost]} {
867 catch {z39$i disconnect}
869 z39$i callback [list connect-m-response $i]
870 z39$i failback [list fail-m-response $i]
873 for {set i 1} {$i <= $not} {incr i} {
874 set oldHost [z39$i connect]
875 set host $hist($setNo,$i,host)
876 set thisHost [splitHostSpec $host]
877 if {![string compare $oldhost $thisHost]} {
880 egw_log debug "old=$oldHost this=$thisHost"
881 z39$i idAuthentication $hist($setNo,$i,idAuthentication)
882 html "Connecting to target " $thisHost " <br>\n"
884 if {![catch {z39$i connect $thisHost}]} {
889 egw_log debug "Waiting for init response"
890 if {[catch {egw_wait zleft 20}]} {
895 for {set i 1} {$i <= $not} {incr i} {
897 html "host " [splitHostSpec $hist($setNo,$i,host)] ": "
899 egw_log debug "i=$i zstatus=$zstatus($i)"
900 if {$zstatus($i) < 1} {
906 if {[catch [list z39$i.$setNo preferredRecordSyntax USMARC]]} {
910 ir-set z39$i.$setNo z39$i
911 set hist($setNo,$i,offset) 0
912 eval z39$i.$setNo databaseNames $hist($setNo,$i,database)
914 if {![lindex $targets($hist($setNo,$i,host)) 5]} {
917 set thisElements $elements
919 z39$i.$setNo smallSetElementSetNames $thisElements
920 z39$i.$setNo mediumSetElementSetNames $thisElements
921 z39$i.$setNo elementSetNames $thisElements
922 z39$i.$setNo recordElements $thisElements
924 z39$i.$setNo preferredRecordSyntax USMARC
925 z39$i callback [list search-m-response $setNo $i $start $number]
928 z39$i.$setNo largeSetLowerBound 999999
929 z39$i.$setNo smallSetUpperBound 0
930 z39$i.$setNo mediumSetPresentNumber $number
932 z39$i.$setNo largeSetLowerBound 2
933 z39$i.$setNo smallSetUpperBound 0
934 z39$i.$setNo mediumSetPresentNumber 0
938 egw_log debug "setNo=$setNo msearch " $hist($setNo,$i,query)
939 z39$i.$setNo search $hist($setNo,$i,query)
940 } elseif {[z39$i.$setNo resultCount] >= $start} {
941 if {[expr $start + $number - 1] > [z39$i.$setNo resultCount]} {
942 set tnumber [expr [z39$i.$setNo resultCount] - $start + 1]
946 if {![lindex $targets($hist($setNo,$i,host)) 5]} {
949 set thisElements $elements
951 z39$i.$setNo smallSetElementSetNames $thisElements
952 z39$i.$setNo mediumSetElementSetNames $thisElements
953 z39$i.$setNo elementSetNames $thisElements
954 z39$i.$setNo recordElements $thisElements
956 for {set n 0} {$n < $tnumber} {incr n} {
957 if {[z39$i.$setNo recordType [expr $start + $n]] == ""} {
959 egw_log debug "failed on $n"
962 html "no record at #" [expr $start + $n]
963 html " el=-" $thisElements "-"
968 if {$n == $tnumber} {
976 z39$i.$setNo preferredRecordSyntax USMARC
977 z39$i callback [list search-m-response $setNo $i $start $tnumber]
979 egw_log debug "mpresent start=$start number=$tnumber"
980 z39$i.$setNo present $start $tnumber
988 egw_log debug "Waiting for search/present response"
989 if {[catch {egw_wait zleft 60}]} {
993 for {set i 1} {$i <= $not} {incr i} {
994 if {$zstatus($i) != 2} continue
995 set status [z39$i.$setNo responseStatus]
996 if {0 && [lindex $status 0] != "NSD"} {
997 set hist($setNo,$i,offset) [z39$i.$setNo numberOfRecordsReturned]
1002 proc z39present {setNo tno setOffset setMax dfunc elements} {
1009 set host $hist($setNo,$tno,host)
1012 set host $hist($setNo,host)
1015 if {![lindex $targets($host) 5]} {
1019 $zz.$setNo elementSetNames $elements
1020 $zz.$setNo recordElements $elements
1021 set toGet [expr 1 + $setMax - $setOffset]
1023 $zz callback [list search-response $zz.$setNo]
1025 while {$setMax > 0 && $toGet > 0} {
1026 for {set got 0} {$got < $toGet} {incr got} {
1027 if {[$zz.$setNo recordType [expr $setOffset + $got]] == ""} {
1031 if {$got < $toGet} {
1033 $zz.$setNo present $setOffset $toGet
1034 if {[catch {egw_wait sessionWait 300}]} {
1035 egw_log debug "timeout/cancel in present"
1039 if {$sessionWait == "0"} {
1042 if {$sessionWait != "1"} {
1045 set got [$zz.$setNo numberOfRecordsReturned]
1050 display-rec $setOffset [expr $got + $setOffset - 1] $dfunc $tno
1051 set setOffset [expr $got + $setOffset]
1052 set toGet [expr 1 + $setMax - $setOffset]
1057 proc z39history {} {
1065 if {![info exists nextSetNo]} {
1068 html "<h2>History</h2><br>\n"
1070 html {<table width=500 border=1><tr>}
1071 html {<td align=center><b>Target</b>}
1072 html {<td align=center><b>Database</b>}
1073 html {<td align=center><b>Hits</b>}
1074 html {<td align=center><b>Query</b>}
1079 for {set setNo 1} {$setNo < $nextSetNo} {incr setNo} {
1080 if {$hist($setNo,scan) > 0} continue
1081 set host $hist($setNo,host)
1083 html {<td align=left>}
1087 html [lindex $targets($host) 0]
1089 html {<td align=left>} [join $hist($setNo,database)]
1091 if {[llength [lindex $targets($host) 1]] > 1} {
1093 foreach b $hist($setNo,database) {
1100 html {<td align=right>}
1102 if {[info exists hist($setNo,hits)]} {
1103 html { <a href="http:} $env(SCRIPT_NAME)
1104 html / $sessionId {/search.egw/} $setNo + 1
1105 html + $hist($setNo,maxPresent)
1107 html {">} $hist($setNo,hits) {</a>}
1109 html {">Result</a>: } $hist($setNo,hits) { hits.}
1115 html {Search failed.}
1119 html {<td align=left>}
1123 html { <a href="http:} $env(SCRIPT_NAME)
1124 html / $sessionId {/query.egw/} $host + $setNo
1128 html {">Query</a>: }
1131 for {set i 1} {$i <= 3} {incr i} {
1132 if {[string length $hist($setNo,form,entry$i)] > 0} {
1133 html " <b>" [join $op " "] "</b> "
1134 html [join $hist($setNo,form,menu$i)] "="
1135 html $hist($setNo,form,entry$i)
1136 set op $hist($setNo,form,logic$i)
1140 html {</a><tr>} "\n"
1151 proc displayError {msga msgb} {
1152 html "<p><center>\n"
1153 html {<img src="/egwgif/noway.gif" alt="Error">}
1154 html "<h2>" $msga "</h2>\n"
1156 html "<h3>" $msgb "</h3>\n"
1158 html "</center><p>\n"
1161 proc button-europagate {} {
1163 html {<a href="http://europagate.dtv.dk/">}
1165 html {<img src="/egwgif/button-egw.gif" alt="Europagate" border=0></a>}
1167 html {Europagate</a> | }
1171 proc button-define-target {more} {
1176 html {<a href="http:} $env(SCRIPT_NAME)
1177 html / $sessionId {/tform.egw}
1179 html {"><img src="/egwgif/button-define-target.gif" }
1180 html {alt="Define Target" border=0></a>}
1182 html {">Define Target</a>}
1191 proc button-new-target {more} {
1197 html {<a href="http:} $env(SCRIPT_NAME)
1200 html {/mtargets.egw}
1205 html {"><img src="/egwgif/button-new-target.gif" }
1206 html {alt="New Target" border=0></a>}
1208 html {">New Target</a>}
1217 proc button-view-history {more} {
1223 html {<a href="http:} $env(SCRIPT_NAME)
1224 html / $sessionId {/history.egw;}
1225 catch { html "/" $nextSetNo}
1227 html {"><img src="/egwgif/button-view-history.gif" alt="View History" }
1228 html {border=0></a>}
1230 html {">View History</a>}
1239 proc button-new-query {more setNo} {
1246 html {<a href="http:} $env(SCRIPT_NAME)
1249 html {/mquery.egw/} $setNo
1251 html {/query.egw/} $hist($setNo,host) + $setNo
1255 html {<img src="/egwgif/button-new-query.gif" }
1256 html {alt="New Query" border=0></a>}
1258 html {New Query</a>}
1267 proc button-scan-window {more setNo} {
1273 html {<a href="http:} $env(SCRIPT_NAME)
1274 html / $sessionId {/search.egw/} $setNo + {scan} {">}
1276 html {<img src="/egwgif/button-scan-window.gif" }
1277 html {alt="Scan" border=0></a>}
1288 proc maintenance {} {
1289 html {<hr>This page is maintained by }
1290 html {<a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.}
1291 html {Last modified 29. january 1996. <br>}
1292 html {<em> This and the following pages are under construction and }
1293 html {will continue to be so until the end of January 1996.</em>}
1296 proc splitHostSpec {host} {
1297 set i [string last . $host]
1300 return [string range $host 0 $i]
1305 proc mergeHostSpec {host databases} {
1306 return ${host}.[join $databases -]