1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.14 1996-04-12 13:45:49 adam
10 # Revision 1.13 1996/04/12 12:25:27 adam
11 # Modified display of GRS-1 records to include headings for standard
14 # Revision 1.12 1996/03/29 16:05:36 adam
15 # Bug fix: GRS records wasn't recognized.
17 # Revision 1.11 1996/01/23 15:24:23 adam
18 # Wrore more comments.
20 # Revision 1.10 1996/01/11 09:31:05 quinn
23 # Revision 1.9 1995/10/17 14:18:10 adam
24 # Minor changes in presentation formats.
26 # Revision 1.8 1995/10/17 10:58:09 adam
27 # More work on presentation formats.
29 # Revision 1.7 1995/10/16 17:01:03 adam
30 # Medium presentation format looks better.
32 # Revision 1.6 1995/09/20 11:37:06 adam
35 # Revision 1.5 1995/06/22 13:16:29 adam
36 # Feature: SUTRS. Setting getSutrs implemented.
37 # Work on display formats.
39 # Revision 1.4 1995/06/14 12:16:42 adam
40 # Minor presentation format changes.
42 # Revision 1.3 1995/06/13 14:39:06 adam
43 # Fix: if {$var != ""} doesn't work if var is a large numerical!
44 # Highlight when line format is used.
46 # Revision 1.2 1995/06/12 15:18:10 adam
47 # Work on presentation formats. These are used in the main window as well
51 proc display-grs-medium {w r i} {
56 set start [$w index insert]
58 for {set j 0} {$j < $i} {incr j} {
59 insertWithTags $w " " marc-tag
62 set ttype [lindex $e 0]
63 set tval [lindex $e 2]
65 insertWithTags $w "$tval " marc-pref
66 } elseif {[info exists tagSet($ttype,$tval)]} {
67 insertWithTags $w "$tagSet($ttype,$tval) " marc-pref
69 insertWithTags $w "($ttype,$tval) " marc-tag
71 if {[lindex $e 3] == "string"} {
72 insertWithTags $w [lindex $e 4] marc-text
73 insertWithTags $w "\n"
74 } elseif {[lindex $e 3] == "subtree"} {
75 insertWithTags $w "\n"
77 insertWithTags $w [lindex $e 4] {}
78 insertWithTags $w " ?\n" {}
81 $w tag configure indent$i \
82 -lmargin1 [expr $i * 16] \
83 -lmargin2 [expr $i * 16 + 8]
84 $w tag add indent$i $start insert
86 if {[lindex $e 3] == "subtree"} {
87 display-grs-medium $w [lindex $e 4] [expr $i+1]
92 # Procedure display-medium {sno no w hflag}
93 # sno result set number (integer)
94 # no record position (integer)
95 # w text widget in which the record should be displayed
96 # hflag header flag. If true a header showing the record position
97 # should be displayed.
98 # This procedure attempts to display records in a medium-sized format.
99 proc display-medium {sno no w hflag} {
101 insertWithTags $w " $no " marc-head
102 insertWithTags $w "\n"
106 set type [z39.$sno type $no]
108 set err [lindex [z39.$sno diag $no] 1]
109 set add [lindex [z39.$sno diag $no] 2]
113 insertWithTags $w "Error ${err}${add}\n" marc-id
119 set rtype [z39.$sno recordType $no]
120 if {$rtype == "SUTRS"} {
121 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
125 if {$rtype == "GRS-1"} {
126 display-grs-medium $w [z39.$sno getGrs $no] 0
129 if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
130 insertWithTags $w "Unknown record type: $rtype\n" marc-id
134 insertWithTags $w "Title " marc-pref
135 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
136 set i [z39.$sno getMarc $no field 245 * b]
138 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
142 set i [z39.$sno getMarc $no field 700 * a]
144 set i [z39.$sno getMarc $no field 100 * a]
147 if {[llength $i] > 1} {
148 insertWithTags $w "Authors " marc-pref
150 insertWithTags $w "Author " marc-pref
153 insertWithTags $w $x marc-it
157 set i [z39.$sno getMarc $no field 110 * *]
159 insertWithTags $w "Co-Author " marc-pref
161 insertWithTags $w $x marc-text
166 set i [z39.$sno getMarc $no field 650 * *]
169 insertWithTags $w "Keywords " marc-pref
174 insertWithTags $w $x marc-it
179 set i [concat [z39.$sno getMarc $no field 260 * a] \
180 [z39.$sno getMarc $no field 260 * b]]
182 insertWithTags $w "Publisher " marc-pref
184 insertWithTags $w $x marc-text
188 set i [z39.$sno getMarc $no field 020 * a]
190 insertWithTags $w "ISBN " marc-pref
192 insertWithTags $w $x marc-text
196 set i [z39.$sno getMarc $no field 022 * a]
198 insertWithTags $w "ISSN " marc-pref
200 insertWithTags $w $x marc-text
204 set i [z39.$sno getMarc $no field 030 * a]
206 insertWithTags $w "CODEN " marc-pref
208 insertWithTags $w $x marc-text
212 set i [z39.$sno getMarc $no field 015 * a]
214 insertWithTags $w "Ctl number " marc-pref
216 insertWithTags $w $x marc-text
220 set i [z39.$sno getMarc $no field 010 * a]
222 insertWithTags $w "LC number " marc-pref
224 insertWithTags $w $x marc-text
228 set i [z39.$sno getMarc $no field 710 * a]
230 insertWithTags $w "Corporate name " marc-pref
232 insertWithTags $w $x marc-text