1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.15 1997-11-19 11:22:10 adam
8 # Object identifiers can be accessed in GRS-1 records.
10 # Revision 1.14 1996/04/12 13:45:49 adam
13 # Revision 1.13 1996/04/12 12:25:27 adam
14 # Modified display of GRS-1 records to include headings for standard
17 # Revision 1.12 1996/03/29 16:05:36 adam
18 # Bug fix: GRS records wasn't recognized.
20 # Revision 1.11 1996/01/23 15:24:23 adam
21 # Wrore more comments.
23 # Revision 1.10 1996/01/11 09:31:05 quinn
26 # Revision 1.9 1995/10/17 14:18:10 adam
27 # Minor changes in presentation formats.
29 # Revision 1.8 1995/10/17 10:58:09 adam
30 # More work on presentation formats.
32 # Revision 1.7 1995/10/16 17:01:03 adam
33 # Medium presentation format looks better.
35 # Revision 1.6 1995/09/20 11:37:06 adam
38 # Revision 1.5 1995/06/22 13:16:29 adam
39 # Feature: SUTRS. Setting getSutrs implemented.
40 # Work on display formats.
42 # Revision 1.4 1995/06/14 12:16:42 adam
43 # Minor presentation format changes.
45 # Revision 1.3 1995/06/13 14:39:06 adam
46 # Fix: if {$var != ""} doesn't work if var is a large numerical!
47 # Highlight when line format is used.
49 # Revision 1.2 1995/06/12 15:18:10 adam
50 # Work on presentation formats. These are used in the main window as well
54 proc display-grs-medium {w r i} {
59 set start [$w index insert]
61 for {set j 0} {$j < $i} {incr j} {
62 insertWithTags $w " " marc-tag
65 set ttype [lindex $e 0]
66 set tval [lindex $e 2]
68 insertWithTags $w "$tval " marc-pref
69 } elseif {[info exists tagSet($ttype,$tval)]} {
70 insertWithTags $w "$tagSet($ttype,$tval) " marc-pref
72 insertWithTags $w "($ttype,$tval) " marc-tag
74 if {[lindex $e 3] == "string"} {
75 insertWithTags $w [lindex $e 4] marc-text
76 insertWithTags $w "\n"
77 } elseif {[lindex $e 3] == "subtree"} {
78 insertWithTags $w "\n"
80 insertWithTags $w [lindex $e 4] {}
81 insertWithTags $w " \n" {}
84 $w tag configure indent$i \
85 -lmargin1 [expr $i * 16] \
86 -lmargin2 [expr $i * 16 + 8]
87 $w tag add indent$i $start insert
89 if {[lindex $e 3] == "subtree"} {
90 display-grs-medium $w [lindex $e 4] [expr $i+1]
95 # Procedure display-medium {sno no w hflag}
96 # sno result set number (integer)
97 # no record position (integer)
98 # w text widget in which the record should be displayed
99 # hflag header flag. If true a header showing the record position
100 # should be displayed.
101 # This procedure attempts to display records in a medium-sized format.
102 proc display-medium {sno no w hflag} {
104 insertWithTags $w " $no " marc-head
105 insertWithTags $w "\n"
109 set type [z39.$sno type $no]
111 set err [lindex [z39.$sno diag $no] 1]
112 set add [lindex [z39.$sno diag $no] 2]
116 insertWithTags $w "Error ${err}${add}\n" marc-id
122 set rtype [z39.$sno recordType $no]
123 if {$rtype == "SUTRS"} {
124 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
128 if {$rtype == "GRS-1"} {
129 display-grs-medium $w [z39.$sno getGrs $no] 0
132 if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
133 insertWithTags $w "Unknown record type: $rtype\n" marc-id
137 insertWithTags $w "Title " marc-pref
138 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
139 set i [z39.$sno getMarc $no field 245 * b]
141 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
145 set i [z39.$sno getMarc $no field 700 * a]
147 set i [z39.$sno getMarc $no field 100 * a]
150 if {[llength $i] > 1} {
151 insertWithTags $w "Authors " marc-pref
153 insertWithTags $w "Author " marc-pref
156 insertWithTags $w $x marc-it
160 set i [z39.$sno getMarc $no field 110 * *]
162 insertWithTags $w "Co-Author " marc-pref
164 insertWithTags $w $x marc-text
169 set i [z39.$sno getMarc $no field 650 * *]
172 insertWithTags $w "Keywords " marc-pref
177 insertWithTags $w $x marc-it
182 set i [concat [z39.$sno getMarc $no field 260 * a] \
183 [z39.$sno getMarc $no field 260 * b]]
185 insertWithTags $w "Publisher " marc-pref
187 insertWithTags $w $x marc-text
191 set i [z39.$sno getMarc $no field 020 * a]
193 insertWithTags $w "ISBN " marc-pref
195 insertWithTags $w $x marc-text
199 set i [z39.$sno getMarc $no field 022 * a]
201 insertWithTags $w "ISSN " marc-pref
203 insertWithTags $w $x marc-text
207 set i [z39.$sno getMarc $no field 030 * a]
209 insertWithTags $w "CODEN " marc-pref
211 insertWithTags $w $x marc-text
215 set i [z39.$sno getMarc $no field 015 * a]
217 insertWithTags $w "Ctl number " marc-pref
219 insertWithTags $w $x marc-text
223 set i [z39.$sno getMarc $no field 010 * a]
225 insertWithTags $w "LC number " marc-pref
227 insertWithTags $w $x marc-text
231 set i [z39.$sno getMarc $no field 710 * a]
233 insertWithTags $w "Corporate name " marc-pref
235 insertWithTags $w $x marc-text