1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.13 1996-04-12 12:25:27 adam
8 # Modified display of GRS-1 records to include headings for standard
11 # Revision 1.12 1996/03/29 16:05:36 adam
12 # Bug fix: GRS records wasn't recognized.
14 # Revision 1.11 1996/01/23 15:24:23 adam
15 # Wrore more comments.
17 # Revision 1.10 1996/01/11 09:31:05 quinn
20 # Revision 1.9 1995/10/17 14:18:10 adam
21 # Minor changes in presentation formats.
23 # Revision 1.8 1995/10/17 10:58:09 adam
24 # More work on presentation formats.
26 # Revision 1.7 1995/10/16 17:01:03 adam
27 # Medium presentation format looks better.
29 # Revision 1.6 1995/09/20 11:37:06 adam
32 # Revision 1.5 1995/06/22 13:16:29 adam
33 # Feature: SUTRS. Setting getSutrs implemented.
34 # Work on display formats.
36 # Revision 1.4 1995/06/14 12:16:42 adam
37 # Minor presentation format changes.
39 # Revision 1.3 1995/06/13 14:39:06 adam
40 # Fix: if {$var != ""} doesn't work if var is a large numerical!
41 # Highlight when line format is used.
43 # Revision 1.2 1995/06/12 15:18:10 adam
44 # Work on presentation formats. These are used in the main window as well
48 proc display-grs-medium {w r i} {
52 set start [$w index insert]
56 for {set j 0} {$j < $i} {incr j} {
57 insertWithTags $w " " marc-tag
60 set ttype [lindex $e 0]
61 set tval [lindex $e 2]
62 if {[info exists tagSet($ttype,$tval)]} {
63 insertWithTags $w "$tagSet($ttype,$tval) " marc-pref
65 insertWithTags $w "$tval " marc-pref
67 if {[lindex $e 3] == "string"} {
68 insertWithTags $w [lindex $e 4] marc-text
69 insertWithTags $w "\n"
70 } elseif {[lindex $e 3] == "subtree"} {
71 insertWithTags $w "\n"
72 display-grs-medium $w [lindex $e 4] [expr $i+1]
74 insertWithTags $w [lindex $e 4] {}
75 insertWithTags $w " ?\n" {}
79 $w tag configure indent$i \
80 -lmargin1 [expr $i * 10] \
81 -lmargin2 [expr $i * 10 + 5]
82 $w tag add indent$i $start insert
86 # Procedure display-medium {sno no w hflag}
87 # sno result set number (integer)
88 # no record position (integer)
89 # w text widget in which the record should be displayed
90 # hflag header flag. If true a header showing the record position
91 # should be displayed.
92 # This procedure attempts to display records in a medium-sized format.
93 proc display-medium {sno no w hflag} {
95 insertWithTags $w " $no " marc-head
96 insertWithTags $w "\n"
100 set type [z39.$sno type $no]
102 set err [lindex [z39.$sno diag $no] 1]
103 set add [lindex [z39.$sno diag $no] 2]
107 insertWithTags $w "Error ${err}${add}\n" marc-id
113 set rtype [z39.$sno recordType $no]
115 if {$rtype == "SUTRS"} {
116 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
120 if {$rtype == "GRS-1"} {
121 display-grs-medium $w [z39.$sno getGrs $no] 0
124 if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
125 insertWithTags $w "Unknown record type: $rtype\n" marc-id
129 insertWithTags $w "Title " marc-pref
130 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
131 set i [z39.$sno getMarc $no field 245 * b]
133 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
137 set i [z39.$sno getMarc $no field 700 * a]
139 set i [z39.$sno getMarc $no field 100 * a]
142 if {[llength $i] > 1} {
143 insertWithTags $w "Authors " marc-pref
145 insertWithTags $w "Author " marc-pref
148 insertWithTags $w $x marc-it
152 set i [z39.$sno getMarc $no field 110 * *]
154 insertWithTags $w "Co-Author " marc-pref
156 insertWithTags $w $x marc-text
161 set i [z39.$sno getMarc $no field 650 * *]
164 insertWithTags $w "Keywords " marc-pref
169 insertWithTags $w $x marc-it
174 set i [concat [z39.$sno getMarc $no field 260 * a] \
175 [z39.$sno getMarc $no field 260 * b]]
177 insertWithTags $w "Publisher " marc-pref
179 insertWithTags $w $x marc-text
183 set i [z39.$sno getMarc $no field 020 * a]
185 insertWithTags $w "ISBN " marc-pref
187 insertWithTags $w $x marc-text
191 set i [z39.$sno getMarc $no field 022 * a]
193 insertWithTags $w "ISSN " marc-pref
195 insertWithTags $w $x marc-text
199 set i [z39.$sno getMarc $no field 030 * a]
201 insertWithTags $w "CODEN " marc-pref
203 insertWithTags $w $x marc-text
207 set i [z39.$sno getMarc $no field 015 * a]
209 insertWithTags $w "Ctl number " marc-pref
211 insertWithTags $w $x marc-text
215 set i [z39.$sno getMarc $no field 010 * a]
217 insertWithTags $w "LC number " marc-pref
219 insertWithTags $w $x marc-text
223 set i [z39.$sno getMarc $no field 710 * a]
225 insertWithTags $w "Corporate name " marc-pref
227 insertWithTags $w $x marc-text