Feature: SUTRS. Setting getSutrs implemented.
[ir-tcl-moved-to-github.git] / formats / medium.tcl
1 # IR toolkit for tcl/tk
2 # (c) Index Data 1995
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
5 #
6 # $Log: medium.tcl,v $
7 # Revision 1.5  1995-06-22 13:16:29  adam
8 # Feature: SUTRS. Setting getSutrs implemented.
9 # Work on display formats.
10 #
11 # Revision 1.4  1995/06/14  12:16:42  adam
12 # Minor presentation format changes.
13 #
14 # Revision 1.3  1995/06/13  14:39:06  adam
15 # Fix: if {$var != ""} doesn't work if var is a large numerical!
16 # Highlight when line format is used.
17 #
18 # Revision 1.2  1995/06/12  15:18:10  adam
19 # Work on presentation formats. These are used in the main window as well
20 # as popup windows.
21 #
22 #
23
24 proc display-medium {sno no w hflag} {
25     if {$hflag} {
26         insertWithTags $w "\n$no\n" marc-data
27     } else {
28         $w delete 0.0 end
29     }
30     set type [z39.$sno type $no]
31     if {$type == "SD"} {
32         set err [lindex [z39.$sno diag $no] 1]
33         set add [lindex [z39.$sno diag $no] 2]
34         if {$add != {}} {
35             set add " :${add}"
36         }
37         insertWithTags $w "Error ${err}${add}\n" marc-id
38         return
39     }
40     if {$type != "DB"} {
41         return
42     }
43     set rtype [z39.$sno recordType $no]
44     if {$rtype == "SUTRS"} {
45         insertWithTags $w [join [z39.$sno getSutrs $no]] {}
46         $w insert end "\n"
47         return
48     } 
49     if {[catch {set i [z39.$sno getMarc $no field 245 * a]}]} {
50         insertWithTags $w "Unknown record type: $rtype\n" marc-id
51         return
52     }
53     if {"x$i" != "x"} {
54         insertWithTags $w "Title:      " marc-tag
55         insertWithTags $w [string trimright [lindex $i 0] /] marc-data
56         set i [z39.$sno getMarc $no field 245 * b]
57         if {"x$i" != "x"} {
58             insertWithTags $w [string trimright [lindex $i 0] /] marc-data
59         }
60         $w insert end "\n"
61     }
62     set i [z39.$sno getMarc $no field 700 * a]
63     if {"x$i" == "x"} {
64         set i [z39.$sno getMarc $no field 100 * a]
65     }
66     if {"x$i" != "x"} {
67         if {[llength $i] > 1} {
68             insertWithTags $w "Authors:    " marc-tag
69         } else {
70             insertWithTags $w "Author:     " marc-tag
71         }
72         foreach x $i {
73             insertWithTags $w $x marc-data
74         }
75         $w insert end "\n"
76     }
77     set i [z39.$sno getMarc $no field 110 * *]
78     if {"x$i" != "x"} {
79         insertWithTags $w "Co-Author:  " marc-tag
80         foreach x $i {
81             insertWithTags $w $x marc-data
82         }
83         $w insert end "\n"
84     }
85
86     set i [z39.$sno getMarc $no field 650 * *]
87     if {"x$i" != "x"} {
88         set n 0
89         insertWithTags $w "Keywords:   " marc-tag
90         foreach x $i {
91             if {$n > 0} {
92                 $w insert end ", "
93             }
94             insertWithTags $w $x marc-data
95             incr n
96         }
97         $w insert end "\n"
98     }
99     set i [concat [z39.$sno getMarc $no field 260 * a] \
100             [z39.$sno getMarc $no field 260 * b]]
101     if {"x$i" != "x"} {
102         insertWithTags $w "Publisher:  " marc-tag
103         foreach x $i {
104             insertWithTags $w $x marc-data
105         }
106         $w insert end "\n"
107     }
108     set i [z39.$sno getMarc $no field 020 * a]
109     if {"x$i" != "x"} {
110         insertWithTags $w "ISBN:       " marc-tag
111         foreach x $i {
112             insertWithTags $w $x marc-data
113         }
114         $w insert end "\n"
115     }
116     set i [z39.$sno getMarc $no field 022 * a]
117     if {"x$i" != "x"} {
118         insertWithTags $w "ISSN:       " marc-tag
119         foreach x $i {
120             insertWithTags $w $x marc-data
121         }
122         $w insert end "\n"
123     }
124     set i [z39.$sno getMarc $no field 030 * a]
125     if {"x$i" != "x"} {
126         insertWithTags $w "CODEN:      " marc-tag
127         foreach x $i {
128             insertWithTags $w $x marc-data
129         }
130         $w insert end "\n"
131     }
132     set i [z39.$sno getMarc $no field 015 * a]
133     if {"x$i" != "x"} {
134         insertWithTags $w "Ctl number: " marc-tag
135         foreach x $i {
136             insertWithTags $w $x marc-data
137         }
138         $w insert end "\n"
139     }
140     set i [z39.$sno getMarc $no field 010 * a]
141     if {"x$i" != "x"} {
142         insertWithTags $w "LC number:  " marc-tag
143         foreach x $i {
144             insertWithTags $w $x marc-data
145         }
146         $w insert end "\n"
147     }
148 }