1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.1 1998-09-30 10:53:54 perhans
8 # New client with better Explain support and nice icons.
10 # Revision 1.15 1997/11/19 11:22:10 adam
11 # Object identifiers can be accessed in GRS-1 records.
13 # Revision 1.14 1996/04/12 13:45:49 adam
16 # Revision 1.13 1996/04/12 12:25:27 adam
17 # Modified display of GRS-1 records to include headings for standard
20 # Revision 1.12 1996/03/29 16:05:36 adam
21 # Bug fix: GRS records wasn't recognized.
23 # Revision 1.11 1996/01/23 15:24:23 adam
24 # Wrore more comments.
26 # Revision 1.10 1996/01/11 09:31:05 quinn
29 # Revision 1.9 1995/10/17 14:18:10 adam
30 # Minor changes in presentation formats.
32 # Revision 1.8 1995/10/17 10:58:09 adam
33 # More work on presentation formats.
35 # Revision 1.7 1995/10/16 17:01:03 adam
36 # Medium presentation format looks better.
38 # Revision 1.6 1995/09/20 11:37:06 adam
41 # Revision 1.5 1995/06/22 13:16:29 adam
42 # Feature: SUTRS. Setting getSutrs implemented.
43 # Work on display formats.
45 # Revision 1.4 1995/06/14 12:16:42 adam
46 # Minor presentation format changes.
48 # Revision 1.3 1995/06/13 14:39:06 adam
49 # Fix: if {$var != ""} doesn't work if var is a large numerical!
50 # Highlight when line format is used.
52 # Revision 1.2 1995/06/12 15:18:10 adam
53 # Work on presentation formats. These are used in the main window as well
57 proc display-grs-medium {w r i} {
62 set start [$w index insert]
64 for {set j 0} {$j < $i} {incr j} {
65 insertWithTags $w " " marc-tag
68 set ttype [lindex $e 0]
69 set tval [lindex $e 2]
71 insertWithTags $w "$tval " marc-pref
72 } elseif {[info exists tagSet($ttype,$tval)]} {
73 insertWithTags $w "$tagSet($ttype,$tval) " marc-pref
75 insertWithTags $w "($ttype,$tval) " marc-tag
77 if {[lindex $e 3] == "string"} {
78 insertWithTags $w [lindex $e 4] marc-text
79 insertWithTags $w "\n"
80 } elseif {[lindex $e 3] == "subtree"} {
81 insertWithTags $w "\n"
83 insertWithTags $w [lindex $e 4] {}
84 insertWithTags $w " \n" {}
87 $w tag configure indent$i \
88 -lmargin1 [expr $i * 16] \
89 -lmargin2 [expr $i * 16 + 8]
90 $w tag add indent$i $start insert
92 if {[lindex $e 3] == "subtree"} {
93 display-grs-medium $w [lindex $e 4] [expr $i+1]
98 # Procedure display-medium {sno no w hflag}
99 # sno result set number (integer)
100 # no record position (integer)
101 # w text widget in which the record should be displayed
102 # hflag header flag. If true a header showing the record position
103 # should be displayed.
104 # This procedure attempts to display records in a medium-sized format.
105 proc display-medium {sno no w hflag} {
107 insertWithTags $w " $no " marc-head
108 insertWithTags $w "\n"
112 set type [z39.$sno type $no]
114 set err [lindex [z39.$sno diag $no] 1]
115 set add [lindex [z39.$sno diag $no] 2]
119 insertWithTags $w "Error ${err}${add}\n" marc-id
125 set rtype [z39.$sno recordType $no]
126 if {$rtype == "SUTRS"} {
127 insertWithTags $w [join [z39.$sno getSutrs $no]] {}
131 if {$rtype == "GRS-1"} {
132 display-grs-medium $w [z39.$sno getGrs $no] 0
135 if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
136 insertWithTags $w "Unknown record type: $rtype\n" marc-id
140 insertWithTags $w "Title " marc-pref
141 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
142 set i [z39.$sno getMarc $no field 245 * b]
144 insertWithTags $w [string trimright [lindex $i 0] /] marc-text
148 set i [z39.$sno getMarc $no field 700 * a]
150 set i [z39.$sno getMarc $no field 100 * a]
153 if {[llength $i] > 1} {
154 insertWithTags $w "Authors " marc-pref
156 insertWithTags $w "Author " marc-pref
159 insertWithTags $w $x marc-it
163 set i [z39.$sno getMarc $no field 110 * *]
165 insertWithTags $w "Co-Author " marc-pref
167 insertWithTags $w $x marc-text
172 set i [z39.$sno getMarc $no field 650 * *]
175 insertWithTags $w "Keywords " marc-pref
180 insertWithTags $w $x marc-it
185 set i [concat [z39.$sno getMarc $no field 260 * a] \
186 [z39.$sno getMarc $no field 260 * b]]
188 insertWithTags $w "Publisher " marc-pref
190 insertWithTags $w $x marc-text
194 set i [z39.$sno getMarc $no field 020 * a]
196 insertWithTags $w "ISBN " marc-pref
198 insertWithTags $w $x marc-text
202 set i [z39.$sno getMarc $no field 022 * a]
204 insertWithTags $w "ISSN " marc-pref
206 insertWithTags $w $x marc-text
210 set i [z39.$sno getMarc $no field 030 * a]
212 insertWithTags $w "CODEN " marc-pref
214 insertWithTags $w $x marc-text
218 set i [z39.$sno getMarc $no field 015 * a]
220 insertWithTags $w "Ctl number " marc-pref
222 insertWithTags $w $x marc-text
226 set i [z39.$sno getMarc $no field 010 * a]
228 insertWithTags $w "LC number " marc-pref
230 insertWithTags $w $x marc-text
234 set i [z39.$sno getMarc $no field 710 * a]
236 insertWithTags $w "Corporate name " marc-pref
238 insertWithTags $w $x marc-text