1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.11 1996-01-23 15:24:23 adam
10 # Revision 1.10 1996/01/11 09:31:05 quinn
13 # Revision 1.9 1995/10/17 14:18:10 adam
14 # Minor changes in presentation formats.
16 # Revision 1.8 1995/10/17 10:58:09 adam
17 # More work on presentation formats.
19 # Revision 1.7 1995/10/16 17:01:03 adam
20 # Medium presentation format looks better.
22 # Revision 1.6 1995/09/20 11:37:06 adam
25 # Revision 1.5 1995/06/22 13:16:29 adam
26 # Feature: SUTRS. Setting getSutrs implemented.
27 # Work on display formats.
29 # Revision 1.4 1995/06/14 12:16:42 adam
30 # Minor presentation format changes.
32 # Revision 1.3 1995/06/13 14:39:06 adam
33 # Fix: if {$var != ""} doesn't work if var is a large numerical!
34 # Highlight when line format is used.
36 # Revision 1.2 1995/06/12 15:18:10 adam
37 # Work on presentation formats. These are used in the main window as well
41 proc display-grs-medium {w r i} {
43 for {set j 0} {$j < $i} {incr j} {
44 insertWithTags $w " " marc-tag
46 insertWithTags $w "([lindex $e 0]:[lindex $e 2]) " marc-tag
47 if {[lindex $e 3] == "string"} {
48 insertWithTags $w [lindex $e 4] {}
49 insertWithTags $w "\n"
50 } elseif {[lindex $e 3] == "subtree"} {
51 insertWithTags $w "\n"
52 display-grs-medium $w [lindex $e 4] [expr $i+1]
54 insertWithTags $w [lindex $e 4] {}
55 insertWithTags $w " ?\n" {}
60 # Procedure display-medium {sno no w hflag}
61 # sno result set number (integer)
62 # no record position (integer)
63 # w text widget in which the record should be displayed
64 # hflag header flag. If true a header showing the record position
65 # should be displayed.
66 # This procedure attempts to display records in a medium-sized format.
67 proc display-medium {sno no w hflag} {
69 insertWithTags $w " $no " marc-head
70 insertWithTags $w "\n"
74 set type [z39.$sno type $no]
76 set err [lindex [z39.$sno diag $no] 1]
77 set add [lindex [z39.$sno diag $no] 2]
81 insertWithTags $w "Error ${err}${add}\n" marc-id
87 set rtype [z39.$sno recordType $no]
88 if {$rtype == "SUTRS"} {
89 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
93 if {$rtype == "GRS1"} {
94 display-grs-medium $w [z39.$sno getGrs $no] 0
97 if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
98 insertWithTags $w "Unknown record type: $rtype\n" marc-id
102 insertWithTags $w "Title " marc-pref
103 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
104 set i [z39.$sno getMarc $no field 245 * b]
106 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
110 set i [z39.$sno getMarc $no field 700 * a]
112 set i [z39.$sno getMarc $no field 100 * a]
115 if {[llength $i] > 1} {
116 insertWithTags $w "Authors " marc-pref
118 insertWithTags $w "Author " marc-pref
121 insertWithTags $w $x marc-it
125 set i [z39.$sno getMarc $no field 110 * *]
127 insertWithTags $w "Co-Author " marc-pref
129 insertWithTags $w $x marc-text
134 set i [z39.$sno getMarc $no field 650 * *]
137 insertWithTags $w "Keywords " marc-pref
142 insertWithTags $w $x marc-it
147 set i [concat [z39.$sno getMarc $no field 260 * a] \
148 [z39.$sno getMarc $no field 260 * b]]
150 insertWithTags $w "Publisher " marc-pref
152 insertWithTags $w $x marc-text
156 set i [z39.$sno getMarc $no field 020 * a]
158 insertWithTags $w "ISBN " marc-pref
160 insertWithTags $w $x marc-text
164 set i [z39.$sno getMarc $no field 022 * a]
166 insertWithTags $w "ISSN " marc-pref
168 insertWithTags $w $x marc-text
172 set i [z39.$sno getMarc $no field 030 * a]
174 insertWithTags $w "CODEN " marc-pref
176 insertWithTags $w $x marc-text
180 set i [z39.$sno getMarc $no field 015 * a]
182 insertWithTags $w "Ctl number " marc-pref
184 insertWithTags $w $x marc-text
188 set i [z39.$sno getMarc $no field 010 * a]
190 insertWithTags $w "LC number " marc-pref
192 insertWithTags $w $x marc-text
196 set i [z39.$sno getMarc $no field 710 * a]
198 insertWithTags $w "Corporate name " marc-pref
200 insertWithTags $w $x marc-text