# Sebastian Hammer, Adam Dickmeiss
#
# $Log: client.tcl,v $
-# Revision 1.67 1995-09-20 14:35:19 adam
+# Revision 1.74 1995-10-17 12:18:57 adam
+# Bug fix: when target connection closed, the connection was not
+# properly reestablished.
+#
+# Revision 1.73 1995/10/17 10:58:06 adam
+# More work on presentation formats.
+#
+# Revision 1.72 1995/10/16 17:00:52 adam
+# New setting: elementSetNames.
+# Various client improvements. Medium presentation format looks better.
+#
+# Revision 1.71 1995/10/13 15:35:27 adam
+# Relational operators may be used in search entries - changes
+# in proc index-query.
+#
+# Revision 1.70 1995/10/12 14:46:52 adam
+# Better record popup windows. Next/prev buttons in popup record windows.
+# The record position in the raw format is much more visible.
+#
+# Revision 1.69 1995/09/21 13:42:54 adam
+# Bug fixes.
+#
+# Revision 1.68 1995/09/21 13:11:49 adam
+# Support of dynamic loading.
+# Test script uses load command if necessary.
+#
+# Revision 1.67 1995/09/20 14:35:19 adam
# Minor changes.
#
# Revision 1.66 1995/08/29 15:30:13 adam
set setNoLast 0
set cancelFlag 0
set scanEnable 0
-set fullMarcSeq 0
set displayFormat 1
set popupMarcdf 0
set textWrap word
set recordSyntax None
+set elementSetNames None
set delayRequest {}
set queryTypes {Simple}
}
proc dputs {m} {
+ puts $m
}
proc set-display-format {f} {
proc about-origin {} {
set w .about-origin-w
global libdir
+ global tk_version
if {[winfo exists $w]} {
destroy $w
label $w.top.p.ii -text "Implementation id: $i"
catch {set i [z39 implementationVersion]}
label $w.top.p.iv -text "Implementation version: $i"
+ set i $tk_version
+ label $w.top.p.tk -text "Tk version: $i"
- pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
+ pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.tk -side top -anchor nw
about-origin-logo 1
bottom-buttons $w [list {Close} [list destroy $w] \
}
proc popup-marc {sno no b df} {
- global fullMarcSeq
global displayFormats
global popupMarcdf
if {[z39.$sno type $no] != "DB"} {
return
}
- if {$b} {
- set w .full-marc-$fullMarcSeq
- incr fullMarcSeq
- set df $popupMarcdf
- } else {
- set w .full-marc
- set df $popupMarcdf
+ if {$b == -1} {
+ set b 0
+ while {[winfo exists .full-marc$b]} {
+ incr b
+ }
}
- if {[winfo exists $w]} {
- set new 0
- } else {
-
+ set df $popupMarcdf
+ set w .full-marc$b
+ if {![winfo exists $w]} {
toplevelG $w
wm minsize $w 0 0
$w.top.record tag configure marc-id -foreground black
}
$w.top.record tag configure marc-data -foreground black
- set new 1
- }
- $w.top.record delete 0.0 end
- set recordType [z39.$sno recordType $no]
- wm title $w "$recordType record #$no"
+ $w.top.record tag configure marc-head \
+ -font -Adobe-Times-Medium-R-Normal-*-180-* \
+ -background black -foreground white
+
+ $w.top.record tag configure marc-pref \
+ -font -Adobe-Times-Medium-R-Normal-*-180-* \
+ -foreground blue
+ $w.top.record tag configure marc-text \
+ -font -Adobe-Times-Medium-R-Normal-*-180-* \
+ -foreground black
+ $w.top.record tag configure marc-it \
+ -font -Adobe-Times-Medium-I-Normal-*-180-* \
+ -foreground black
- if {$new} {
- bind $w.top.record <Return> {destroy .full-marc}
-
pack $w.top.s -side right -fill y
pack $w.top.record -expand yes -fill both
- if {$b} {
- bottom-buttons $w [list \
- {Close} [list destroy $w]] 0
- } else {
- bottom-buttons $w [list \
- {Close} [list destroy $w] \
- {Duplicate} [list popup-marc $sno $no 1 0]] 0
- menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
- menu $w.bot.formats.m
- set i 0
- foreach f $displayFormats {
- $w.bot.formats.m add radiobutton -label $f \
- -variable popupMarcdf -value $i \
- -command [list display-$f $sno $no $w.top.record 0]
- incr i
- }
- pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
- -padx 3 -pady 3 -side left
- }
+ bottom-buttons $w [list \
+ {Close} [list destroy $w] \
+ {Prev} {} \
+ {Next} {} \
+ {Duplicate} {}] 0
+ menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m \
+ -relief raised
+ menu $w.bot.formats.m
+ pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
+ -padx 3 -pady 3 -side left
} else {
- set i 0
$w.bot.formats.m delete 0 last
- foreach f $displayFormats {
- $w.bot.formats.m add radiobutton -label $f \
- -variable popupMarcdf -value $i \
- -command [list display-$f $sno $no $w.top.record 0]
- incr i
- }
}
+ set i 0
+ foreach f $displayFormats {
+ $w.bot.formats.m add radiobutton -label $f \
+ -variable popupMarcdf -value $i \
+ -command [list popup-marc $sno $no $b 0]
+ incr i
+ }
+ $w.top.record delete 0.0 end
+ set recordType [z39.$sno recordType $no]
+ wm title $w "$recordType record #$no"
+
+ $w.bot.2 configure -command \
+ [list popup-marc $sno [expr $no-1] $b $df]
+ $w.bot.4 configure -command \
+ [list popup-marc $sno [expr $no+1] $b $df]
+ if {$no == 1} {
+ $w.bot.2 configure -state disabled
+ } else {
+ $w.bot.2 configure -state normal
+ }
+ if {[z39.$sno type [expr $no+1]] != "DB"} {
+ $w.bot.4 configure -state disabled
+ } else {
+ $w.bot.4 configure -state normal
+ }
+ $w.bot.6 configure -command [list popup-marc $sno $no -1 0]
set ffunc [lindex $displayFormats $df]
set ffunc "display-$ffunc"
global cancelFlag
global scanEnable
+ dputs {init-reponse}
if {$cancelFlag} {
close-target
return
global cancelFlag
global delayRequest
global recordSyntax
+ global elementSetNames
set target $hostid
+ if {[z39 connect] == ""} {
+ return
+ }
dputs "search-request"
show-message {}
if {!$bflag && $busy} {
} else {
z39.$setNo preferredRecordSyntax $recordSyntax
}
+ if {$elementSetNames == "None" } {
+ z39.$setNo elementSetNames {}
+ } else {
+ z39.$setNo elementSetNames $elementSetNames
+ }
z39 callback {search-response}
z39.$setNo search $query
show-status Searching 1 0
.data.record delete 0.0 end
}
-proc title-press {y setno} {
- show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
-}
-
proc add-title-lines {setno no offset} {
global displayFormats
global displayFormat
top-down-ok-cancel $w {define-target-action} 1
}
-proc protocol-setup-delete {target} {
+proc protocol-setup-delete {target w} {
global profile
global settingsChanged
set a [alert "Are you sure you want to delete the target \
definition $target ?"]
if {$a} {
- set wno [lindex $profile($target) 12]
- set w .setup-${wno}
destroy $w
unset profile($target)
set settingsChanged 1
}
}
-proc protocol-setup-action {target} {
+proc protocol-setup-action {target w} {
global profile
global csRadioType
global protocolRadioType
global CCLCheck
global ResultSetCheck
- set wno [lindex $profile($target) 12]
- set w .setup-${wno}
-
set b {}
set settingsChanged 1
set len [$w.top.databases.list size]
wm geometry $window +${x}+${y}
}
-proc add-database-action {target} {
+proc add-database-action {target w} {
global profile
- set wno [lindex $profile($target) 12]
- set w .setup-${wno}
-
$w.top.databases.list insert end \
[.database-select.top.database.entry get]
destroy .database-select
}
-proc add-database {target} {
+proc add-database {target wp} {
global profile
set w .database-select
toplevel $w
set oldFocus [focus]
- set wno [lindex $profile($target) 12]
- place-force $w .setup-${wno}
+ place-force $w $wp
top-down-window $w
entry-fields $w.top {database} \
{{Database to add:}} \
- [list add-database-action $target] {destroy .database-select}
+ [list add-database-action $target $wp] {destroy .database-select}
- top-down-ok-cancel $w [list add-database-action $target] 1
+ top-down-ok-cancel $w [list add-database-action $target $wp] 1
focus $oldFocus
}
-proc delete-database {target} {
+proc delete-database {target w} {
global profile
- set wno [lindex $profile($target) 12]
- set w .setup-${wno}
set l {}
foreach i [$w.top.databases.list curselection] {
set b [$w.top.databases.list get $i]
global RPNCheck
global CCLCheck
global ResultSetCheck
-
- set wno [lindex $profile($target) 12]
- set w .setup-${wno}
+
+ set b 0
+ while {[winfo exists .setup-$b]} {
+ incr b
+ }
+ set w .setup-$b
toplevelG $w
maximumRecordSize preferredMessageSize} \
{{Description:} {Host:} {Port:} {Id Authentication:} \
{Maximum Record Size:} {Preferred Message Size:}} \
- [list protocol-setup-action $target] [list destroy $w]
+ [list protocol-setup-action $target $w] [list destroy $w]
foreach sub {description host port idAuthentication \
maximumRecordSize preferredMessageSize} {
dputs $sub
- bind $w.top.$sub.entry <Control-a> [list add-database $target]
- bind $w.top.$sub.entry <Control-d> [list delete-database $target]
+ bind $w.top.$sub.entry <Control-a> [list add-database $target $w]
+ bind $w.top.$sub.entry <Control-d> [list delete-database $target $w]
}
$w.top.description.entry insert 0 [lindex $profile($target) 0]
$w.top.host.entry insert 0 [lindex $profile($target) 1]
pack $w.top.databases -side left -pady 2 -padx 2 -expand yes -fill both
label $w.top.databases.label -text "Databases"
- button $w.top.databases.add -text "Add" \
- -command [list add-database $target]
- button $w.top.databases.delete -text "Delete" \
- -command [list delete-database $target]
+ button $w.top.databases.add -text Add \
+ -command [list add-database $target $w]
+ button $w.top.databases.delete -text Delete \
+ -command [list delete-database $target $w]
if {! [tk4]} {
listbox $w.top.databases.list -geometry 14x6 \
-yscrollcommand "$w.top.databases.scroll set"
-padx 2 -side top -fill x
# Ok-cancel
- bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
- {Delete} [list protocol-setup-delete $target] \
+ bottom-buttons $w [list {Ok} [list protocol-setup-action $target $w] \
+ {Delete} [list protocol-setup-delete $target $w] \
{Cancel} [list destroy $w]] 0
}
global displayFormat
global popupMarcdf
global recordSyntax
-
+ global elementSetNames
+
set windowGeometry(.) [wm geometry .]
if {[catch {set f [open ~/.clientrc.tcl w]}]} {
puts $f "set displayFormat $displayFormat"
puts $f "set popupMarcdf $popupMarcdf"
puts $f "set recordSyntax $recordSyntax"
+ puts $f "set elementSetNames $elementSetNames"
foreach n [array names windowGeometry] {
puts -nonewline $f "set \{windowGeometry($n)\} \{"
puts -nonewline $f $windowGeometry($n)
set completenessTmpValue 0
set useTmpValue 0
+ catch {destroy $w}
+ toplevelG $w
+
+ set n [lindex $attr 0]
+ wm title $w "Index setup $n"
+
+ top-down-window $w
+
set len [llength $attr]
for {set i 1} {$i < $len} {incr i} {
set q [lindex $attr $i]
}
}
}
- if {[winfo exists $w]} {
- destroy $w
- }
- toplevelG $w
-
- set n [lindex $attr 0]
- wm title $w "Index setup $n"
-
- top-down-window $w
frame $w.top.use -relief ridge -border 2
frame $w.top.relation -relief ridge -border 2
listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
scrollbar $w.top.index.scroll -orient vertical -border 1 \
-command [list $w.top.index.list yview]
- bind $w.top.index.list <2> [list query-edit-index $queryNo]
+ bind $w.top.index.list <Double-1> [list query-edit-index $queryNo]
pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
foreach x $queryInfoTmp {
$w.top.index.list insert end [lindex $x 0]
}
+
# Bottom
bottom-buttons $w [list \
- {Ok} [list query-setup-action $queryNo] \
- {Add index} [list query-add-index $queryNo] \
- {Edit index} [list query-edit-index $queryNo] \
- {Delete index} [list query-delete-index $queryNo] \
- {Cancel} [list destroy $w]] 0
+ Ok [list query-setup-action $queryNo] \
+ Add [list query-add-index $queryNo] \
+ Edit [list query-edit-index $queryNo] \
+ Delete [list query-delete-index $queryNo] \
+ Cancel [list destroy $w]] 0
}
proc index-clear {} {
if {$term != ""} {
set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
+ set relation ""
+ set len [string length $term]
+ incr len -1
+
+ if {$len > 1} {
+ if {[string index $term 0] == ">"} {
+ if {[string index $term 1] == "=" } {
+ set term [string trim [string range $term 2 $len]]
+ set relation 4
+ } else {
+ set term [string trim [string range $term 1 $len]]
+ set relation 5
+ }
+ } elseif {[string index $term 0] == "<"} {
+ if {[string index $term 1] == "=" } {
+ set term [string trim [string range $term 2 $len]]
+ set relation 2
+ } elseif {[string index $term 1] == ">"} {
+ set term [string trim [string range $term 2 $len]]
+ set relation 6
+ } else {
+ set term [string trim [string range $term 1 $len]]
+ set relation 1
+ }
+ }
+ }
set len [string length $term]
incr len -1
set left 0
} elseif {$left} {
set term "@attr 5=2 ${term}"
}
+ if {$relation != ""} {
+ set term "@attr 2=${relation} ${term}"
+ }
foreach a $attr {
set term "@attr $a ${term}"
}
.top.options.m add cascade -label "Format" -menu .top.options.m.formats
.top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
.top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
+.top.options.m add cascade -label "Elements" -menu .top.options.m.elements
menu .top.options.m.query
.top.options.m.query add cascade -label "Select" \
.top.options.m.syntax add radiobutton -label "GRS1" \
-value GRS1 -variable recordSyntax
+menu .top.options.m.elements
+.top.options.m.elements add radiobutton -label "Unspecified" \
+ -value None -variable elementSetNames
+.top.options.m.elements add radiobutton -label "Full" \
+ -value F -variable elementSetNames
+.top.options.m.elements add radiobutton -label "Brief" \
+ -value B -variable elementSetNames
+
menubutton .top.help -text "Help" -menu .top.help.m
menu .top.help.m
.data.record tag configure marc-id -foreground black
}
.data.record tag configure marc-data -foreground black
+.data.record tag configure marc-head \
+ -font -Adobe-Times-Medium-R-Normal-*-140-* \
+ -foreground brown -relief raised -borderwidth 1
+.data.record tag configure marc-small-head -foreground brown
+.data.record tag configure marc-pref \
+ -font -Adobe-Times-Medium-R-Normal-*-140-* \
+ -foreground blue
+.data.record tag configure marc-text \
+ -font -Adobe-Times-Medium-R-Normal-*-140-* \
+ -foreground black
+.data.record tag configure marc-it \
+ -font -Adobe-Times-Medium-I-Normal-*-140-* \
+ -foreground black
button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
if {[tk4]} {
pack .bot.a.status .bot.a.set .bot.a.message \
-side left -padx 2 -pady 2 -ipadx 1 -ipady 1
-catch {ir z39}
-#z39 logLevel all
+if {[catch {ir z39}]} {
+ set e [info sharedlibextension]
+ puts -nonewline "Loading irtcl$e ..."
+ load irtcl$e irtcl
+ ir z39
+ puts "ok"
+}
+z39 logLevel all
show-logo 1