1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.2 1999-03-17 09:24:11 perhans
8 # Explain now also finds Gils attributes.
9 # Support for search with Gils attributes added.
11 # The medium format extended and cleaned up (kommas between termes).
12 # Lots of minor but fixes.
14 # Revision 1.1 1998/09/30 10:53:54 perhans
15 # New client with better Explain support and nice icons.
17 proc display-grs-line {w r i} {
22 set ttype [lindex $e 0]
23 set tval [lindex $e 2]
24 if {$ttype == 2 && $tval == 1} {
25 if {[lindex $e 3] == "subtree"} {
28 if {[lindex $e 0] == 1 && [lindex $e 2] == 19} {
33 if {[lindex $e 3] == "string"} {
34 set head [lindex $e 4]
39 insertWithTags $w $head marc-text
40 insertWithTags $w "\n"
42 $w tag configure indent$i -lmargin1 [expr $i * 10] \
43 -lmargin2 [expr $i * 10 + 5]
44 $w tag add indent$i $start insert
48 # Procedure display-line {sno no w hflag}
49 # sno result set number (integer)
50 # no record position (integer)
51 # w text widget in which the record should be displayed.
52 # hflag header flag. If true a header showing the record position
53 # should be displayed.
54 # This procedure attempts to display records in a line-per-line format.
55 proc display-line {sno no w hflag} {
56 set type [z39.$sno type $no]
58 $w tag bind r$no <Any-Enter> \
59 [list $w tag configure r$no -background black -foreground white]
60 $w tag bind r$no <Any-Leave> \
61 [list $w tag configure r$no -background {} -foreground {}]
66 set nostr [format "%5d " $no]
67 insertWithTags $w $nostr marc-small-head
70 set rtype [z39.$sno recordType $no]
71 if {$rtype == "SUTRS"} {
72 insertWithTags $w [join [z39.$sno getSutrs $no]]
73 } elseif {$rtype == "GRS-1"} {
74 display-grs-line $w [z39.$sno getGrs $no] 0
77 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
78 set year [lindex [z39.$sno getMarc $no field 260 * c] 0]
79 insertWithTags $w "$title" marc-text
80 insertWithTags $w "$year\n" marc-it
82 insertWithTags $w "Unknown record type: $rtype\n" marc-id
85 } elseif {$type == "SD"} {
86 set err [lindex [z39.$sno diag $no] 1]
87 set add [lindex [z39.$sno diag $no] 2]
91 insertWithTags $w "Error ${err}${add}\n" marc-id