1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.12 1996-03-29 16:05:36 adam
8 # Bug fix: GRS records wasn't recognized.
10 # Revision 1.11 1996/01/23 15:24:23 adam
11 # Wrore more comments.
13 # Revision 1.10 1996/01/11 09:31:05 quinn
16 # Revision 1.9 1995/10/17 14:18:10 adam
17 # Minor changes in presentation formats.
19 # Revision 1.8 1995/10/17 10:58:09 adam
20 # More work on presentation formats.
22 # Revision 1.7 1995/10/16 17:01:03 adam
23 # Medium presentation format looks better.
25 # Revision 1.6 1995/09/20 11:37:06 adam
28 # Revision 1.5 1995/06/22 13:16:29 adam
29 # Feature: SUTRS. Setting getSutrs implemented.
30 # Work on display formats.
32 # Revision 1.4 1995/06/14 12:16:42 adam
33 # Minor presentation format changes.
35 # Revision 1.3 1995/06/13 14:39:06 adam
36 # Fix: if {$var != ""} doesn't work if var is a large numerical!
37 # Highlight when line format is used.
39 # Revision 1.2 1995/06/12 15:18:10 adam
40 # Work on presentation formats. These are used in the main window as well
44 proc display-grs-medium {w r i} {
48 for {set j 0} {$j < $i} {incr j} {
49 insertWithTags $w " " marc-tag
51 set ttype [lindex $e 0]
52 set tval [lindex $e 2]
53 if {[info exists tagSet($ttype,$tval)]} {
54 insertWithTags $w "$tagSet($ttype,$tval) " marc-tag
56 insertWithTags $w "$tval " marc-tag
58 if {[lindex $e 3] == "string"} {
59 insertWithTags $w [lindex $e 4] {}
60 insertWithTags $w "\n"
61 } elseif {[lindex $e 3] == "subtree"} {
62 insertWithTags $w "\n"
63 display-grs-medium $w [lindex $e 4] [expr $i+1]
65 insertWithTags $w [lindex $e 4] {}
66 insertWithTags $w " ?\n" {}
71 # Procedure display-medium {sno no w hflag}
72 # sno result set number (integer)
73 # no record position (integer)
74 # w text widget in which the record should be displayed
75 # hflag header flag. If true a header showing the record position
76 # should be displayed.
77 # This procedure attempts to display records in a medium-sized format.
78 proc display-medium {sno no w hflag} {
80 insertWithTags $w " $no " marc-head
81 insertWithTags $w "\n"
85 set type [z39.$sno type $no]
87 set err [lindex [z39.$sno diag $no] 1]
88 set add [lindex [z39.$sno diag $no] 2]
92 insertWithTags $w "Error ${err}${add}\n" marc-id
98 set rtype [z39.$sno recordType $no]
100 if {$rtype == "SUTRS"} {
101 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
105 if {$rtype == "GRS-1"} {
106 display-grs-medium $w [z39.$sno getGrs $no] 0
109 if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
110 insertWithTags $w "Unknown record type: $rtype\n" marc-id
114 insertWithTags $w "Title " marc-pref
115 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
116 set i [z39.$sno getMarc $no field 245 * b]
118 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
122 set i [z39.$sno getMarc $no field 700 * a]
124 set i [z39.$sno getMarc $no field 100 * a]
127 if {[llength $i] > 1} {
128 insertWithTags $w "Authors " marc-pref
130 insertWithTags $w "Author " marc-pref
133 insertWithTags $w $x marc-it
137 set i [z39.$sno getMarc $no field 110 * *]
139 insertWithTags $w "Co-Author " marc-pref
141 insertWithTags $w $x marc-text
146 set i [z39.$sno getMarc $no field 650 * *]
149 insertWithTags $w "Keywords " marc-pref
154 insertWithTags $w $x marc-it
159 set i [concat [z39.$sno getMarc $no field 260 * a] \
160 [z39.$sno getMarc $no field 260 * b]]
162 insertWithTags $w "Publisher " marc-pref
164 insertWithTags $w $x marc-text
168 set i [z39.$sno getMarc $no field 020 * a]
170 insertWithTags $w "ISBN " marc-pref
172 insertWithTags $w $x marc-text
176 set i [z39.$sno getMarc $no field 022 * a]
178 insertWithTags $w "ISSN " marc-pref
180 insertWithTags $w $x marc-text
184 set i [z39.$sno getMarc $no field 030 * a]
186 insertWithTags $w "CODEN " marc-pref
188 insertWithTags $w $x marc-text
192 set i [z39.$sno getMarc $no field 015 * a]
194 insertWithTags $w "Ctl number " marc-pref
196 insertWithTags $w $x marc-text
200 set i [z39.$sno getMarc $no field 010 * a]
202 insertWithTags $w "LC number " marc-pref
204 insertWithTags $w $x marc-text
208 set i [z39.$sno getMarc $no field 710 * a]
210 insertWithTags $w "Corporate name " marc-pref
212 insertWithTags $w $x marc-text