From dc10992979c1ce21d0970f53055835ecf0af07e1 Mon Sep 17 00:00:00 2001 From: "Per M. Hansen" Date: Wed, 30 Dec 1998 14:06:38 +0000 Subject: [PATCH] Explain now finds the GILS attributes. --- client2/bib-1.tcl | 2 + client2/client.tcl | 470 +++++++++++++++++++++++++++------------------------ client2/explain.tcl | 15 +- client2/irtdb.tcl | 113 +++++-------- 4 files changed, 298 insertions(+), 302 deletions(-) diff --git a/client2/bib-1.tcl b/client2/bib-1.tcl index 62409a8..87adb56 100644 --- a/client2/bib-1.tcl +++ b/client2/bib-1.tcl @@ -1,3 +1,4 @@ +set bib1(0) {None} set bib1(1) {Personal name} set bib1(2) {Corporate name} set bib1(3) {Conference name} @@ -90,6 +91,7 @@ set bib1(1025) {Music-key} set bib1(1026) {Related-periodical} set bib1(1027) {Report-no.} set bib1(1028) {Stock-no.} +set bib1(1029) {None} set bib1(1030) {Thematic-no.} set bib1(1031) {Material-type} set bib1(1032) {Doc-id} diff --git a/client2/client.tcl b/client2/client.tcl index 583f5d7..03cfdd4 100644 --- a/client2/client.tcl +++ b/client2/client.tcl @@ -1,14 +1,12 @@ wm title . "IrTcl Client" -#wm iconname . "IrTcl Client" - # Procedure irmenu proc irmenu {w} { - menu $w -tearoff off + menu $w -tearoff off } proc debug-window {} { - set w .debug-window + set w .debug-window toplevel $w wm title $w "Debug Window" @@ -17,7 +15,7 @@ proc debug-window {} { frame $w.bot -relief raised -border 1 pack $w.top -side top -fill both -expand yes pack $w.bot -fill both - scrollbar $w.top.s -command [list $w.top.t yview] + scrollbar $w.top.s -command [list $w.top.t yview] text $w.top.t -width 60 -height 10 -wrap word -relief flat -borderwidth 0 \ -font fixed -yscroll [list $w.top.s set] pack $w.top.s -side right -fill y @@ -31,7 +29,7 @@ debug-window # n menu entry number (0 is first entry) # Enables menu entry proc configure-enable-e {w n} { - $w entryconfigure $n -state normal + $w entryconfigure $n -state normal } # Procedure configure-disable-e {w n} @@ -39,7 +37,7 @@ proc configure-enable-e {w n} { # n menu entry number (0 is first entry) # Disables menu entry proc configure-disable-e {w n} { - $w entryconfigure $n -state disabled + $w entryconfigure $n -state disabled } set noFocus [list -takefocus 0] @@ -145,29 +143,29 @@ set font(ss,bold) {Helvetica 8 bold} # Override the Tk error handler function. if {1} { proc tkerror err { - global font - set w .tkerrorw - - if {[winfo exists $w]} { - destroy $w - } - toplevel $w - wm title $w "Error" - - place-force $w . - top-down-window $w - - label $w.top.b -bitmap error - message $w.top.t -aspect 300 -text "Error: $err" -font $font(b,bold) - pack $w.top.b $w.top.t -side left -padx 10 -pady 10 - - bottom-buttons $w [list {Close} [list destroy $w]] 1 + global font + set w .tkerrorw + + if {[winfo exists $w]} { + destroy $w + } + toplevel $w + wm title $w "Error" + + place-force $w . + top-down-window $w + + label $w.top.b -bitmap error + message $w.top.t -aspect 300 -text "Error: $err" -font $font(b,bold) + pack $w.top.b $w.top.t -side left -padx 10 -pady 10 + + bottom-buttons $w [list {Close} [list destroy $w]] 1 } } # Read tag set file (if present) if {[file readable [file join $libdir tagsets.tcl]]} { - source [file join $libdir tagsets.tcl] + source [file join $libdir tagsets.tcl] } # Read the global target configuration file. @@ -194,24 +192,24 @@ set queryAutoOld $queryAuto foreach target [array names profile] { set timedef [clock seconds] if {[string first , $target] == -1} { - if {![info exists profile($target,port)]} { - foreach n [array names profile Default,*] { - set profile($target,[string range $n 8 end]) $profile($n) - } - set profile($target,description) [lindex $profile($target) 0] - set profile($target,host) [lindex $profile($target) 1] - set profile($target,port) [lindex $profile($target) 2] - set profile($target,authentication) [lindex $profile($target) 3] - set profile($target,maximumRecordSize) \ - [lindex $profile($target) 4] - set profile($target,preferredMessageSize) \ - [lindex $profile($target) 5] - set profile($target,comstack) [lindex $profile($target) 6] - set profile($target,databases) [lindex $profile($target) 7] - set profile($target,timeDefine) $timedef - set profile($target,windowNumber) 1 - } - unset profile($target) + if {![info exists profile($target,port)]} { + foreach n [array names profile Default,*] { + set profile($target,[string range $n 8 end]) $profile($n) + } + set profile($target,description) [lindex $profile($target) 0] + set profile($target,host) [lindex $profile($target) 1] + set profile($target,port) [lindex $profile($target) 2] + set profile($target,authentication) [lindex $profile($target) 3] + set profile($target,maximumRecordSize) \ + [lindex $profile($target) 4] + set profile($target,preferredMessageSize) \ + [lindex $profile($target) 5] + set profile($target,comstack) [lindex $profile($target) 6] + set profile($target,databases) [lindex $profile($target) 7] + set profile($target,timeDefine) $timedef + set profile($target,windowNumber) 1 + } + unset profile($target) } } @@ -239,7 +237,7 @@ proc read-formats {} { cd [file join $libdir formats] set formats [glob {*.[tT][cC][lL]}] foreach f $formats { - if {[file readable $f]} { + if {[file readable $f]} { source $f set l [string length $f] set f [string tolower [string range $f 0 [expr $l - 5]]] @@ -292,8 +290,8 @@ proc apduDump {} { top-down-window $w text $w.top.t -font fixed -width 60 -height 12 -wrap word \ - -relief flat -borderwidth 0 \ - -yscrollcommand [list $w.top.s set] -background grey85 + -relief flat -borderwidth 0 \ + -yscrollcommand [list $w.top.s set] -background grey85 scrollbar $w.top.s -command [list $w.top.t yview] pack $w.top.s -side right -fill y pack $w.top.t -expand yes -fill both @@ -429,7 +427,7 @@ proc bottom-buttons {w buttonList g} { frame $w.bot.$i -relief sunken -border 1 pack $w.bot.$i -side left -expand yes -padx 2 -pady 2 button $w.bot.$i.ok -text [lindex $buttonList $i] \ - -command [lindex $buttonList [expr $i + 1]] + -command [lindex $buttonList [expr $i + 1]] pack $w.bot.$i.ok -expand yes -padx 2 -pady 2 -side left incr i 2 @@ -472,7 +470,7 @@ proc show-target {target base} { return } if {![string length $base]} { - .bot.a.target configure -text "$target" + .bot.a.target configure -text "$target" } else { .bot.a.target configure -text "$target - $base" } @@ -741,7 +739,7 @@ proc popup-marc {sno no b df} { $w.top.record tag configure marc-id -foreground red $w.top.record tag configure marc-data -foreground black $w.top.record tag configure marc-head -font $font(n,bold) \ - -background black -foreground white + -background black -foreground white $w.top.record tag configure marc-pref -font $font(n,normal) -foreground blue $w.top.record tag configure marc-text -font $font(n,normal) -foreground black $w.top.record tag configure marc-it -font $font(n,normal) -foreground black @@ -763,7 +761,7 @@ proc popup-marc {sno no b df} { 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] + -command [list popup-marc $sno $no $b 0] incr i } $w.top.record delete 0.0 end @@ -822,7 +820,7 @@ proc delete-target-hotlist {target} { set i 0 foreach e $hotTargets { if {$target == [lindex $e 0]} { - set hotTargets [lreplace $hotTargets $i $i] + set hotTargets [lreplace $hotTargets $i $i] } incr i } @@ -888,7 +886,7 @@ proc define-target-action {} { } } foreach n [array names profile Default,*] { - set profile($target,[string range $n 8 end]) $profile($n) + set profile($target,[string range $n 8 end]) $profile($n) } incr profile(Default,windowNumber) @@ -912,7 +910,7 @@ proc fail-response {target} { } close-target # tkerror "$m ($c)" - bgerror "$m ($c)" + bgerror "$m ($c)" } # Procedure connect-response {target base} @@ -1094,7 +1092,7 @@ proc init-response {target base} { # tkerror "Connection rejected by target: $u" bgerror "Connection rejected by target: $u" } else { - z39 failback [list explain-crash $target $base] + z39 failback [list explain-crash $target $base] explain-check $target [list ready-response $base] $base } } @@ -1124,12 +1122,12 @@ proc ready-response {base target} { z39 failback [list fail-response $target] if {[string length $base]} { - set profile($target,timeLastInit) [clock seconds] - set settingsChanged 1 + set profile($target,timeLastInit) [clock seconds] + set settingsChanged 1 - z39 databaseNames $base - cascade-dblist $target $base - show-target $target $base + z39 databaseNames $base + cascade-dblist $target $base + show-target $target $base } if {[lsearch [z39 options] scan] >= 0} { set scanEnable 1 @@ -1145,7 +1143,7 @@ proc ready-response {base target} { } set data [string trim $profile($target,welcomeMessage)] if {[string length $data]} { - .data.record insert end "Welcome Message:\n$data\n\n" + .data.record insert end "Welcome Message:\n$data\n\n" } set data [string trim $profile($target,recentNews)] if {[string length $data]} { @@ -1159,19 +1157,24 @@ proc ready-response {base target} { #proc ready-response-actions {target base} #This procedure take care of all the actions that should start if connect is succesfull. proc ready-response-actions {target base} { - global profile queryAuto -# changeQueryButtons $target $base - configureOptionsSyntax $target $base - if {[info exists profile($target,AttributeDetails,$base,Bib1Use)] && $queryAuto == 1} { - changeQueryButtons $target $base - change-queryInfo $target $base - query-select 2 - .top.options.m.query.slist entryconfigure 2 -state normal -# listbuttonx - } else { - query-select 0 - .top.options.m.query.slist entryconfigure 2 -state disabled - } + global profile queryAuto attributeTypeSelected + configureOptionsSyntax $target $base + if {[info exists profile($target,AttributeDetails,$base,Bib1Use)] && $queryAuto == 1} { + changeQueryButtons $target $base + change-queryInfo $target $base + query-select 2 + .top.options.m.query.slist entryconfigure 2 -state normal + } else { + query-select 0 + .top.options.m.query.slist entryconfigure 2 -state disabled + } + if {[info exists attributeTypeSelected]} { + global attribute[set attributeTypeSelected] + set attribute$attributeTypeSelected 1 + } else { + global attributeBib1 + set attributeBib1 1 + } } # Procedure search-request @@ -1218,9 +1221,9 @@ proc search-request {bflag} { dputs "setName=default" } if {$profile($target,queryRPN)} { - z39.$setNo queryType rpn + z39.$setNo queryType rpn } elseif {$profile($target,queryCCL)} { - z39.$setNo queryType ccl + z39.$setNo queryType ccl } dputs Setting dputs $recordSyntax @@ -1263,7 +1266,7 @@ proc scan-request {} { set w .scan-window global profile hostid scanView scanTerm curIndexEntry queryButtonsFind \ - queryInfoFind cancelFlag delayRequest + queryInfoFind cancelFlag delayRequest dputs "scan-request" if {$cancelFlag} { @@ -1615,7 +1618,7 @@ proc present-more {number} { if {$setNo == 0} { dputs "setNo=$setNo" - return + return } set setOffset [z39.$setNo nextResultSetPosition] dputs "setOffest=${setOffset}" @@ -1867,7 +1870,7 @@ proc add-database {target wp} { top-down-window $w frame $w.top.database pack $w.top.database -side top -anchor e -pady 2 - entry-fields $w.top {database} {{Database to add:}} \ + entry-fields $w.top {database} {{Database to add:}} \ [list add-database-action $target $wp] {destroy .database-select} top-down-ok-cancel $w [list add-database-action $target $wp] 1 @@ -1935,17 +1938,17 @@ proc advanced-setup {target b} { [list advanced-setup-action $target $b] [list destroy $w] $w.top.largeSetLowerBound.entry configure -textvariable \ - profileS($target,largeSetLowerBound) + profileS($target,largeSetLowerBound) $w.top.smallSetUpperBound.entry configure -textvariable \ - profileS($target,smallSetUpperBound) + profileS($target,smallSetUpperBound) $w.top.mediumSetPresentNumber.entry configure -textvariable \ - profileS($target,mediumSetPresentNumber) + profileS($target,mediumSetPresentNumber) $w.top.presentChunk.entry configure -textvariable \ - profileS($target,presentChunk) + profileS($target,presentChunk) $w.top.maximumRecordSize.entry configure -textvariable \ - profileS($target,maximumRecordSize) + profileS($target,maximumRecordSize) $w.top.preferredMessageSize.entry configure -textvariable \ - profileS($target,preferredMessageSize) + profileS($target,preferredMessageSize) bottom-buttons $w [list {Ok} [list advanced-setup-action $target $b] \ {Cancel} [list destroy $w]] 0 @@ -2031,10 +2034,10 @@ proc cascade-dblist {target base} { set w .top.service.m.dblist $w delete 0 200 if {[info exists profile($target,databases)]} { - foreach db $profile($target,databases) { - $w add command -label $db \ - -command [list cascade-dblist-select $target $db] - } + foreach db $profile($target,databases) { + $w add command -label $db \ + -command [list cascade-dblist-select $target $db] + } } } @@ -2050,38 +2053,38 @@ proc cascade-target-list {} { } .top.target.m.clist delete 0 last foreach nn [lsort [array names profile *,host]] { - if {[string length $profile($nn)]} { - set ll [expr {[string length $nn] - 6}] - set n [string range $nn 0 $ll] - - set nl $profile($n,windowNumber) - if {[info exists profile($n,databases)]} { - set ndb [llength $profile($n,databases)] - } else { - set ndb 0 - } - if {$ndb > 1} { - .top.target.m.clist add cascade -label $n \ - -menu .top.target.m.clist.$nl - irmenu .top.target.m.clist.$nl - foreach b $profile($n,databases) { - .top.target.m.clist.$nl add command -label $b \ - -command [list reopen-target $n $b] - } - } elseif {$ndb == 1} { - .top.target.m.clist add command -label $n -command \ - [list reopen-target $n [lindex $profile($n,databases) 0]] - } else { - .top.target.m.clist add command -label $n -command \ - [list reopen-target $n {}] - } - } + if {[string length $profile($nn)]} { + set ll [expr {[string length $nn] - 6}] + set n [string range $nn 0 $ll] + + set nl $profile($n,windowNumber) + if {[info exists profile($n,databases)]} { + set ndb [llength $profile($n,databases)] + } else { + set ndb 0 + } + if {$ndb > 1} { + .top.target.m.clist add cascade -label $n \ + -menu .top.target.m.clist.$nl + irmenu .top.target.m.clist.$nl + foreach b $profile($n,databases) { + .top.target.m.clist.$nl add command -label $b \ + -command [list reopen-target $n $b] + } + } elseif {$ndb == 1} { + .top.target.m.clist add command -label $n -command \ + [list reopen-target $n [lindex $profile($n,databases) 0]] + } else { + .top.target.m.clist add command -label $n -command \ + [list reopen-target $n {}] + } + } } .top.target.m.slist delete 0 last foreach nn [lsort [array names profile *,host]] { - set ll [expr {[string length $nn] - 6}] - set n [string range $nn 0 $ll] - .top.target.m.slist add command -label $n -command [list protocol-setup $n] + set ll [expr {[string length $nn] - 6}] + set n [string range $nn 0 $ll] + .top.target.m.slist add command -label $n -command [list protocol-setup $n] } } @@ -2094,12 +2097,12 @@ proc query-select {i} { global queryButtonsFind queryInfoFind queryButtons queryInfo queryAuto queryAutoOld hostid currentDb profile if {$queryAutoOld == 1 && $queryAuto == 0} { - set queryAutoOld $queryAuto - return + set queryAutoOld $queryAuto + return } if {$queryAutoOld == 0 && $queryAuto == 1 && [info exists profile($hostid,AttributeDetails,$currentDb,Bib1Use)] == 0} { - set queryAutoOld $queryAuto - return + set queryAutoOld $queryAuto + return } set queryInfoFind [lindex $queryInfo $i] set queryButtonsFind [lindex $queryButtons $i] @@ -2170,42 +2173,49 @@ proc query-delete {queryNo} { label $w.top.warning -bitmap warning message $w.top.quest -text "Are you sure you want to delete the \ - query type $n ?" -aspect 300 + query type $n ?" -aspect 300 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \ - {Cancel} [list destroy $w]] 1 + {Cancel} [list destroy $w]] 1 } # Procedure cascade-query-list # Updates the entries below Options|Query to list all query types. proc cascade-query-list {} { - global queryTypes hostid queryAuto + global queryTypes hostid queryAuto attributeTypes set w .top.options.m.query set i 0 $w.clist delete 0 last foreach n $queryTypes { - if {$n == "Auto"} { - $w.clist add check -label $n -variable queryAuto -command [list query-select $i] + if {$n == "Auto"} { + $w.clist add check -label $n -variable queryAuto -command [list query-select $i] } else { - $w.clist add command -label $n -command [list query-select $i] + $w.clist add command -label $n -command [list query-select $i] } incr i } set i 0 $w.slist delete 0 last foreach n $queryTypes { - if {$n == "Auto"} { - if {$hostid == "Default"} { - $w.slist add command -label $n -state disabled -command [list query-setup $i] - } else { - $w.slist add command -label $n -command [list query-setup $i] - } + if {$n == "Auto"} { + if {$hostid == "Default"} { + $w.slist add command -label $n -state disabled -command [list query-setup $i] + } else { + $w.slist add command -label $n -command [list query-setup $i] + } } else { - $w.slist add command -label $n -command [list query-setup $i] + $w.slist add command -label $n -command [list query-setup $i] } incr i } set i 0 + $w.tlist delete 0 last + foreach n $attributeTypes { + global attribute$n + $w.tlist add check -label $n -variable attribute$n -command [list attribute-select $i] + incr i + } + set i 0 $w.dlist delete 0 last foreach n $queryTypes { $w.dlist add command -label $n -command [list query-delete $i] @@ -2220,7 +2230,7 @@ proc cascade-query-list {} { # saved. proc save-geometry {} { global windowGeometry hotTargets textWrap displayFormat popupMarcdf \ - recordSyntax elementSetNames hostid + recordSyntax elementSetNames hostid set windowGeometry(.) [wm geometry .] @@ -2250,7 +2260,7 @@ proc save-geometry {} { # is normally kept in the directory /usr/local/lib/irtcl. # All query types and target defintion profiles are saved. proc save-settings {} { - global profile libdir settingsChanged queryTypes queryButtons queryInfo queryAuto + global profile libdir settingsChanged queryTypes queryButtons queryInfo queryAuto attributeTypes attributeTypeSelected if {[file writable [file join $libdir irtdb.tcl]]} { set f [open [file join $libdir irtdb.tcl] w] @@ -2261,6 +2271,8 @@ proc save-settings {} { foreach n [lsort [array names profile]] { puts $f "set [list profile($n)] [list $profile($n)]" } + puts $f "set attributeTypes [list $attributeTypes]" + puts $f "set attributeTypeSelected [list $attributeTypeSelected]" puts $f "set queryTypes [list $queryTypes]" puts $f "set queryButtons [list $queryButtons]" puts $f "set queryInfo [list $queryInfo]" @@ -2337,26 +2349,26 @@ proc listbuttonaction {w name h user i} { # user user argument to the $handle function # Makes an extended listbutton. proc listbuttonx {button no names handle user} { - set width 10 - foreach name $names { - set buttonName [lindex $name 0] - if {[string length $buttonName] > $width} { - set width [string length $buttonName] - } - } + set width 10 + foreach name $names { + set buttonName [lindex $name 0] + if {[string length $buttonName] > $width} { + set width [string length $buttonName] + } + } if {[winfo exists $button]} { $button configure -width $width -text [lindex [lindex $names $no] 0] ${button}.m delete 0 last } else { menubutton $button -text [lindex [lindex $names $no] 0] \ - -width $width -menu ${button}.m -relief raised -border 1 + -width $width -menu ${button}.m -relief raised -border 1 irmenu ${button}.m ${button}.m configure -tearoff off } set i 0 foreach name $names { ${button}.m add command -label [lindex $name 0] \ - -command [list listbuttonaction ${button} $name $handle $user $i] + -command [list listbuttonaction ${button} $name $handle $user $i] incr i } } @@ -2494,12 +2506,12 @@ proc query-add-index {queryNo} { # the user commits the query setup changes by pressing button "Ok". proc query-setup-action {queryNo} { global queryButtons queryInfo queryButtonsTmp queryInfoTmp queryButtonsFind \ - queryInfoFind settingsChanged hostid currentDb profile + queryInfoFind settingsChanged hostid currentDb profile set settingsChanged 1 set queryInfo [lreplace $queryInfo $queryNo $queryNo $queryInfoTmp] set queryButtons [lreplace $queryButtons $queryNo $queryNo $queryButtonsTmp] if {[info exists profile($hostid,AttributeDetails,$currentDb,Bib1Use)]} { - set profile($hostid,queryButtons,$currentDb) $queryButtonsTmp + set profile($hostid,queryButtons,$currentDb) $queryButtonsTmp } set queryInfoFind $queryInfoTmp set queryButtonsFind $queryButtonsTmp @@ -2507,24 +2519,36 @@ proc query-setup-action {queryNo} { index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index } +#This procedure handles selection of what attribute set the user wants to use for searching. +#queryNo index in the attributeTypes list (also the menu item number in Query|Type). +proc attribute-select {queryNo} { + global attributeTypes attributeTypeSelected + set attributeTypeSelected [lindex $attributeTypes $queryNo] + foreach type $attributeTypes { + global attribute[set type] + set attribute$type 0 + } + set attribute[lindex $attributeTypes $queryNo] 1 +} + #proc changeQueryButtons {target base} -#target target name -#base database name +#target target name +#base database name #Substitutes the third element (the Auto element) in queryButtons with #profile(target,queryButtons,base). The third element in queryInfo is also substituted with #profile(target,AttributeDetails,base,Bib1Use) proc changeQueryButtons {target base} { - source bib-1.tcl - global profile queryButtons queryInfo - if {[info exists profile($target,queryButtons,$base)]} { - set queryButtons [lreplace $queryButtons 2 2 $profile($target,queryButtons,$base)] - foreach tag $profile($target,AttributeDetails,$base,Bib1Use) { - if {$tag < 1037} { - lappend tempList [list $bib1($tag) 1=$tag] - } - } - set queryInfo [lreplace $queryInfo 2 2 $tempList] - } + source bib-1.tcl + global profile queryButtons queryInfo + if {[info exists profile($target,queryButtons,$base)]} { + set queryButtons [lreplace $queryButtons 2 2 $profile($target,queryButtons,$base)] + foreach tag $profile($target,AttributeDetails,$base,Bib1Use) { + if {$tag < 1037} { + lappend tempList [list $bib1($tag) 1=$tag] + } + } + set queryInfo [lreplace $queryInfo 2 2 $tempList] + } } # Procedure activate-e-index {value no i} @@ -2586,6 +2610,8 @@ proc update-attr {} { # is 0 the current selection of the listbox is read and the global # $useTmpValue is set to the current use-value. proc use-attr {init} { + global useTmpValue + source bib-1.tcl set attr { {None} 0 {Personal name} 1 @@ -2688,18 +2714,19 @@ proc use-attr {init} { {Anywhere} 1035 } set w .index-setup - global useTmpValue - set l [llength $attr] if {$init} { set s 0 set lno 0 - for {set i 0} {$i < $l} {incr i} { - $w.top.use.list insert end [lindex $attr $i] + for {set i 0} {$i < 1037} {incr i} { + $w.top.use.list insert end $bib1($i) incr i - if {$useTmpValue == [lindex $attr $i]} { + if {$useTmpValue == $bib1($i)} { set s $lno } + if {$i == 63} { + set i 1000 + } incr lno } $w.top.use.list selection clear 0 end @@ -2712,7 +2739,7 @@ proc use-attr {init} { } else { set lno [lindex [$w.top.use.list curselection] 0] set i [expr {$lno+$lno+1}] - set useTmpValue [lindex $attr $i] + set useTmpValue $bib1($i) dputs "useTmpValue=$useTmpValue" } } @@ -2727,7 +2754,7 @@ proc index-setup-action {oldAttr queryNo indexNo} { set attr [lindex $oldAttr 0] global useTmpValue relationTmpValue structureTmpValue truncationTmpValue \ - completenessTmpValue positionTmpValue queryInfoTmp + completenessTmpValue positionTmpValue queryInfoTmp use-attr 0 @@ -2767,7 +2794,7 @@ proc index-setup {attr queryNo indexNo} { set w .index-setup global relationTmpValue structureTmpValue truncationTmpValue \ - completenessTmpValue positionTmpValue useTmpValue + completenessTmpValue positionTmpValue useTmpValue set relationTmpValue 0 set truncationTmpValue 0 set structureTmpValue 0 @@ -2821,7 +2848,7 @@ proc index-setup {attr queryNo indexNo} { pack $w.top.use -side left -pady 6 -padx 6 -fill y label $w.top.use.label -text "Use" - listbox $w.top.use.list -width 26 -yscrollcommand "$w.top.use.scroll set" + listbox $w.top.use.list -width 26 -yscrollcommand "$w.top.use.scroll set" scrollbar $w.top.use.scroll -orient vertical -border 1 pack $w.top.use.label -side top -fill x -padx 2 -pady 2 pack $w.top.use.list -side left -fill both -expand yes -padx 2 -pady 2 @@ -2867,8 +2894,8 @@ proc index-setup {attr queryNo indexNo} { # Ok-cancel bottom-buttons $w [list \ - {Ok} [list index-setup-action $attr $queryNo $indexNo] \ - {Cancel} [list destroy $w]] 0 + {Ok} [list index-setup-action $attr $queryNo $indexNo] \ + {Cancel} [list destroy $w]] 0 } @@ -2990,7 +3017,7 @@ proc index-clear {} { # left truncation; (?) on right-side indicates right-truncation; (?) # on both sides indicates both-left-and-right truncation. proc index-query {} { - global queryButtonsFind queryInfoFind + global queryButtonsFind queryInfoFind attributeTypeSelected set i 0 set qs {} @@ -3040,17 +3067,17 @@ proc index-query {} { } set term "\{${term}\}" if {$right && $left} { - set term "@attr 5=3 ${term}" + set term "@attrset $attributeTypeSelected @attr 5=3 ${term}" } elseif {$right} { - set term "@attr 5=1 ${term}" + set term "@attrset $attributeTypeSelected @attr 5=1 ${term}" } elseif {$left} { - set term "@attr 5=2 ${term}" + set term "@attrset $attributeTypeSelected @attr 5=2 ${term}" } if {$relation != ""} { - set term "@attr 2=${relation} ${term}" + set term "@attrset $attributeTypeSelected @attr 2=${relation} ${term}" } foreach a $attr { - set term "@attr $a ${term}" + set term "@attrset $attributeTypeSelected @attr $a ${term}" } if {$qs != ""} { set qs "@and ${qs} ${term}" @@ -3095,7 +3122,7 @@ proc index-lines {w realOp buttonInfo queryInfo handle} { if {! [winfo exists $w.$i.e]} { entry $w.$i.e -width 32 -relief sunken -border 1 bind $w.$i.e [list index-focus-in $w $i] - bind $w.$i.e [list $w.$i configure -background white] + bind $w.$i.e [list $w.$i configure -background white] pack $w.$i.l -side left pack $w.$i.e -side left -fill x -expand yes pack $w.$i -side top -fill x -padx 2 -pady 2 @@ -3125,43 +3152,43 @@ proc index-lines {w realOp buttonInfo queryInfo handle} { set j $k } if {$i >= 0} { - bind $w.$i.e "focus $w.0.e" + bind $w.$i.e "focus $w.0.e" focus $w.0.e } } #Procedure configureOptionsSyntax {target base} -#target target name -#base database name +#target target name +#base database name #Changes the Options|Syntax menu acording to the information obtained via explain. proc configureOptionsSyntax {target base} { - global profile syntaxList recordSyntax - set activate 0 - set i -1 - set w .top.options.m.syntax - if {[info exists profile($target,RecordSyntaxes,$base)]} { - foreach syntax $syntaxList { - incr i - if {$syntax == "sep"} {continue} - if {[lsearch $profile($target,RecordSyntaxes,$base) $syntax] != -1} { - configure-enable-e $w $i - if {$activate == 0} { - $w invoke $i - set recordSyntax $syntax - set activate 1 - } - } else { - configure-disable-e $w $i - } - } - } else { - foreach syntax $syntaxList { - incr i - if {$syntax == "sep"} {continue} - configure-enable-e $w $i - } - $w invoke 0 - } + global profile syntaxList recordSyntax + set activate 0 + set i -1 + set w .top.options.m.syntax + if {[info exists profile($target,RecordSyntaxes,$base)]} { + foreach syntax $syntaxList { + incr i + if {$syntax == "sep"} {continue} + if {[lsearch $profile($target,RecordSyntaxes,$base) $syntax] != -1} { + configure-enable-e $w $i + if {$activate == 0} { + $w invoke $i + set recordSyntax $syntax + set activate 1 + } + } else { + configure-disable-e $w $i + } + } + } else { + foreach syntax $syntaxList { + incr i + if {$syntax == "sep"} {continue} + configure-enable-e $w $i + } + $w invoke 0 + } } # Init: The geometry information for the main window is set - either @@ -3246,11 +3273,13 @@ irmenu .top.options.m # Init: Definition of the Options|Query menu. irmenu .top.options.m.query .top.options.m.query add cascade -label Select -menu .top.options.m.query.clist +.top.options.m.query add cascade -label Type -menu .top.options.m.query.tlist .top.options.m.query add cascade -label Edit -menu .top.options.m.query.slist .top.options.m.query add command -label New -command {query-new} .top.options.m.query add cascade -label Delete -menu .top.options.m.query.dlist irmenu .top.options.m.query.slist +irmenu .top.options.m.query.tlist irmenu .top.options.m.query.clist irmenu .top.options.m.query.dlist cascade-query-list @@ -3275,16 +3304,16 @@ irmenu .top.options.m.wrap # Init: Definition of the Options|Syntax menu. proc initOptionsSyntax {} { - global syntaxList recordSyntax - set w .top.options.m.syntax - irmenu $w - foreach syntax $syntaxList { - if {$syntax == "sep"} { - $w add separator - } else { - $w add radiobutton -label $syntax -value $syntax -variable recordSyntax - } - } + global syntaxList recordSyntax + set w .top.options.m.syntax + irmenu $w + foreach syntax $syntaxList { + if {$syntax == "sep"} { + $w add separator + } else { + $w add radiobutton -label $syntax -value $syntax -variable recordSyntax + } + } } initOptionsSyntax @@ -3292,8 +3321,7 @@ initOptionsSyntax irmenu .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 Full -value F -variable elementSetNames .top.options.m.elements add radiobutton -label Brief -value B -variable elementSetNames # Init: Definition of Help menu. @@ -3322,7 +3350,7 @@ pack .mid.search .mid.scan .mid.present .mid.clear -side left -fill y -pady 1 # Init: Define record area in main window. text .data.record -font fixed -height 2 -width 20 -wrap none -borderwidth 0 \ - -relief flat -yscrollcommand [list .data.scroll set] -wrap $textWrap + -relief flat -yscrollcommand [list .data.scroll set] -wrap $textWrap scrollbar .data.scroll -command [list .data.record yview] .data.record configure -takefocus 0 .data.scroll configure -takefocus 0 diff --git a/client2/explain.tcl b/client2/explain.tcl index 21bcfed..30f113a 100644 --- a/client2/explain.tcl +++ b/client2/explain.tcl @@ -1,6 +1,7 @@ #Procedure get-attributeDetails #If the target supports explain the Attribute Details are extracted here. -#The number 1.2.840.10003.3.1 is Bib1, 1.2.840.10003.3.2 is Explain and 1.2.840.10003.3.5 is Gils. +#The number 1.2.840.10003.3.1 is Bib1, 1.2.840.10003.3.2 is Explain and +#1.2.840.10003.3.5 is Gils. proc get-attributeDetails {target base} { global profile set index 1 @@ -18,18 +19,17 @@ proc get-attributeDetails {target base} { foreach attributeType [lindex $tagset 1] { if {[lindex [lindex $attributeType 0] 1] == 1} { foreach attributeValues [lrange [lindex $attributeType 2] 1 end] { - lappend profile($target,AttributeDetails,$db,Bib1Use) [lindex [lindex [lindex $attributeValues 0] 1] 1] + lappend profile($target,AttributeDetails,$db,Bib1Use) \ + [lindex [lindex [lindex $attributeValues 0] 1] 1] } } } } elseif {[lindex [lindex $tagset 0] 1] == "1.2.840.10003.3.5"} { -# .debug-window.top.t insert end Gils\n foreach attributeType [lindex $tagset 1] { -# .debug-window.top.t insert end [lindex $tagset 1] if {[lindex [lindex $attributeType 0] 1] == 1} { foreach attributeValues [lrange [lindex $attributeType 2] 1 end] { - lappend profile($target,AttributeDetails,$db,Gils) [lindex [lindex [lindex $attributeValues 0] 1] 1] -# .debug-window.top.t insert end [lindex [lindex [lindex $attributeValues 0] 1] 1]\n + lappend profile($target,AttributeDetails,$db,Gils) \ + [lindex [lindex [lindex $attributeValues 0] 1] 1] } } } @@ -57,8 +57,7 @@ proc change-queryInfo {target base} { # Procedure explain-search -# Issue search request with explain-attribute set and specific -# category. +# Issue search request with explain-attribute set and specific category. proc explain-search-request {target zz category finish response fresponse} { z39 callback [list explain-search-response $target $zz $category $finish \ $response $fresponse] diff --git a/client2/irtdb.tcl b/client2/irtdb.tcl index ccd46b8..b4f7260 100644 --- a/client2/irtdb.tcl +++ b/client2/irtdb.tcl @@ -23,7 +23,7 @@ set profile(BIBSYS,smallSetUpperBound) 0 set profile(BIBSYS,targetInfoName) {} set profile(BIBSYS,timeDefine) 878567355 set profile(BIBSYS,timeLastExplain) {} -set profile(BIBSYS,timeLastInit) 908265242 +set profile(BIBSYS,timeLastInit) 908447189 set profile(BIBSYS,welcomeMessage) {} set profile(BIBSYS,windowNumber) 3 set profile(Bagel:210,AttributeDetails,gils,Bib1Use) {1012 1019 1007 62 1005 4} @@ -56,8 +56,8 @@ set profile(Bagel:210,recentNews) {} set profile(Bagel:210,smallSetUpperBound) 0 set profile(Bagel:210,targetInfoName) Zebra set profile(Bagel:210,timeDefine) {} -set profile(Bagel:210,timeLastExplain) 908206139 -set profile(Bagel:210,timeLastInit) 908206139 +set profile(Bagel:210,timeLastExplain) 913116790 +set profile(Bagel:210,timeLastInit) 913116790 set profile(Bagel:210,welcomeMessage) {} set profile(Bagel:210,windowNumber) 1 set {profile(Bell Laboratories Library Network,authentication)} {} @@ -86,7 +86,7 @@ set {profile(Bell Laboratories Library Network,timeDefine)} 878567355 set {profile(Bell Laboratories Library Network,timeLastExplain)} 907838464 set {profile(Bell Laboratories Library Network,timeLastInit)} 907838464 set {profile(Bell Laboratories Library Network,welcomeMessage)} {Salutations - this is Lucent Technologies experimental Z39.50 server. No guarentees, but free and unlimited access!} -set {profile(Bell Laboratories Library Network,windowNumber)} 15 +set {profile(Bell Laboratories Library Network,windowNumber)} 14 set {profile(Bibliothèque Nationale du Québec,authentication)} {} set {profile(Bibliothèque Nationale du Québec,comstack)} tcpip set {profile(Bibliothèque Nationale du Québec,databases)} IRIS @@ -197,7 +197,7 @@ set profile(Default,timeDefine) {} set profile(Default,timeLastExplain) {} set profile(Default,timeLastInit) {} set profile(Default,welcomeMessage) {} -set profile(Default,windowNumber) 19 +set profile(Default,windowNumber) 18 set profile(LOC,authentication) {} set profile(LOC,comstack) tcpip set profile(LOC,databases) {BOOKS NAMES AUTH MAPS MUSIC BIB SERIALS SUBJECTS} @@ -228,7 +228,7 @@ set profile(LOC,timeDefine) 878567355 set profile(LOC,timeLastExplain) {} set profile(LOC,timeLastInit) 907942726 set profile(LOC,welcomeMessage) {} -set profile(LOC,windowNumber) 12 +set profile(LOC,windowNumber) 11 set {profile(OCLC FirstSearch,authentication)} {} set {profile(OCLC FirstSearch,comstack)} tcpip set {profile(OCLC FirstSearch,databases)} {AGRICOLA MEDLINE} @@ -259,7 +259,7 @@ set {profile(OCLC FirstSearch,timeDefine)} {} set {profile(OCLC FirstSearch,timeLastExplain)} {} set {profile(OCLC FirstSearch,timeLastInit)} 907164654 set {profile(OCLC FirstSearch,welcomeMessage)} {} -set {profile(OCLC FirstSearch,windowNumber)} 14 +set {profile(OCLC FirstSearch,windowNumber)} 12 set profile(Penn,authentication) {} set profile(Penn,comstack) tcpip set profile(Penn,databases) CATALOG @@ -290,7 +290,7 @@ set profile(Penn,timeDefine) 878567355 set profile(Penn,timeLastExplain) {} set profile(Penn,timeLastInit) 902483000 set profile(Penn,welcomeMessage) {} -set profile(Penn,windowNumber) 18 +set profile(Penn,windowNumber) 17 set {profile(Steiermrkische Landesbibliothek,authentication)} {} set {profile(Steiermrkische Landesbibliothek,comstack)} tcpip set {profile(Steiermrkische Landesbibliothek,databases)} {lbopac miopac} @@ -350,6 +350,34 @@ set {profile(University of Crete,timeLastExplain)} {} set {profile(University of Crete,timeLastInit)} 907077673 set {profile(University of Crete,welcomeMessage)} {} set {profile(University of Crete,windowNumber)} 5 +set {profile(Z39.50 Implementors Workshop mailing list,authentication)} {} +set {profile(Z39.50 Implementors Workshop mailing list,comstack)} tcpip +set {profile(Z39.50 Implementors Workshop mailing list,databases)} ziw +set {profile(Z39.50 Implementors Workshop mailing list,description)} {} +set {profile(Z39.50 Implementors Workshop mailing list,host)} z3950.mds.rmit.edu.au +set {profile(Z39.50 Implementors Workshop mailing list,idAuthentication)} {} +set {profile(Z39.50 Implementors Workshop mailing list,largeSetLowerBound)} 2 +set {profile(Z39.50 Implementors Workshop mailing list,maxResultSets)} {} +set {profile(Z39.50 Implementors Workshop mailing list,maxResultSize)} {} +set {profile(Z39.50 Implementors Workshop mailing list,maxTerms)} {} +set {profile(Z39.50 Implementors Workshop mailing list,maximumRecordSize)} 50000 +set {profile(Z39.50 Implementors Workshop mailing list,mediumSetPresentNumber)} 0 +set {profile(Z39.50 Implementors Workshop mailing list,multipleDatabases)} 0 +set {profile(Z39.50 Implementors Workshop mailing list,namedResultSets)} 1 +set {profile(Z39.50 Implementors Workshop mailing list,port)} 210 +set {profile(Z39.50 Implementors Workshop mailing list,preferredMessageSize)} 30000 +set {profile(Z39.50 Implementors Workshop mailing list,presentChunk)} 4 +set {profile(Z39.50 Implementors Workshop mailing list,protocol)} Z39 +set {profile(Z39.50 Implementors Workshop mailing list,queryCCL)} 0 +set {profile(Z39.50 Implementors Workshop mailing list,queryRPN)} 1 +set {profile(Z39.50 Implementors Workshop mailing list,recentNews)} {} +set {profile(Z39.50 Implementors Workshop mailing list,smallSetUpperBound)} 0 +set {profile(Z39.50 Implementors Workshop mailing list,targetInfoName)} {} +set {profile(Z39.50 Implementors Workshop mailing list,timeDefine)} {} +set {profile(Z39.50 Implementors Workshop mailing list,timeLastExplain)} {} +set {profile(Z39.50 Implementors Workshop mailing list,timeLastInit)} {} +set {profile(Z39.50 Implementors Workshop mailing list,welcomeMessage)} {} +set {profile(Z39.50 Implementors Workshop mailing list,windowNumber)} 13 set profile(arcatarget,authentication) {} set profile(arcatarget,comstack) tcpip set profile(arcatarget,databases) {IEI-books IR-Explain-1} @@ -408,7 +436,7 @@ set profile(author,timeDefine) 878567355 set profile(author,timeLastExplain) {} set profile(author,timeLastInit) 887288138 set profile(author,welcomeMessage) {} -set profile(author,windowNumber) 17 +set profile(author,windowNumber) 16 set profile(dranet,authentication) {} set profile(dranet,comstack) tcpip set profile(dranet,databases) drewdb @@ -462,71 +490,10 @@ set profile(libris,queryRPN) 1 set profile(libris,recentNews) {} set profile(libris,smallSetUpperBound) 0 set profile(libris,targetInfoName) {} -set profile(libris,timeDefine) 878567355 -set profile(libris,timeLastExplain) {} -set profile(libris,timeLastInit) 887285394 -set profile(libris,welcomeMessage) {} set profile(libris,windowNumber) 7 -set profile(madison,authentication) {} -set profile(madison,comstack) tcpip -set profile(madison,databases) madison -set profile(madison,description) {University of Wisconsin-Madison} -set profile(madison,host) z3950.adp.wisc.edu -set profile(madison,largeSetLowerBound) 2 -set profile(madison,maxResultSets) {} -set profile(madison,maxResultSize) {} -set profile(madison,maxTerms) {} -set profile(madison,maximumRecordSize) 16384 -set profile(madison,mediumSetPresentNumber) 0 -set profile(madison,multipleDatabases) 0 -set profile(madison,namedResultSets) 1 -set profile(madison,port) 210 -set profile(madison,preferredMessageSize) 8192 -set profile(madison,presentChunk) 4 -set profile(madison,protocol) Z39 -set profile(madison,queryCCL) 0 -set profile(madison,queryRPN) 1 -set profile(madison,recentNews) {} -set profile(madison,smallSetUpperBound) 0 -set profile(madison,targetInfoName) {} -set profile(madison,timeDefine) 878567355 -set profile(madison,timeLastExplain) {} -set profile(madison,timeLastInit) 887289602 -set profile(madison,welcomeMessage) {} -set profile(madison,windowNumber) 11 -set profile(ztest9999,authentication) {} -set profile(ztest9999,comstack) tcpip -set profile(ztest9999,databases) {dranet.dra.com IR-Explain-1 gils marc} -set profile(ztest9999,description) {YAZ server on localhost} -set profile(ztest9999,descripton) Z_TDBS.ztdb_description -set profile(ztest9999,host) bagel.indexdata.dk -set profile(ztest9999,idAuthentication) {} -set profile(ztest9999,largeSetLowerBound) 2 -set profile(ztest9999,maxResultSets) {} -set profile(ztest9999,maxResultSize) {} -set profile(ztest9999,maxTerms) {} -set profile(ztest9999,maximumRecordSize) 50000 -set profile(ztest9999,mediumSetPresentNumber) 0 -set profile(ztest9999,multipleDatabases) 1 -set profile(ztest9999,namedResultSets) 1 -set profile(ztest9999,port) 210 -set profile(ztest9999,preferredMessageSize) 30000 -set profile(ztest9999,presentChunk) 4 -set profile(ztest9999,protocol) Z39 -set profile(ztest9999,queryCCL) 0 -set profile(ztest9999,queryRPN) 1 -set profile(ztest9999,recentNews) {} -set profile(ztest9999,smallSetUpperBound) 0 -set profile(ztest9999,targetInfoName) Zebra -set profile(ztest9999,targetMaxResultSets) {} -set profile(ztest9999,targetMaxResultSize) {} -set profile(ztest9999,targetMaxTerms) {} -set profile(ztest9999,timeDefine) 878567355 -set profile(ztest9999,timeLastExplain) 902228978 -set profile(ztest9999,timeLastInit) 902228978 -set profile(ztest9999,welcomeMessage) {} -set profile(ztest9999,windowNumber) 13 +set attributeTypes {Bib1 Gils} +set attributeTypeSelected Gils set queryTypes {Simple Phrase Auto} set queryButtons {{{I 3} {I 0} {I 0}} {{I 0} {I 1} {I 0}} {{I 4} {I 5} {I 3}}} -set queryInfo {{{Title {1=4}} {Author {1=1}} {Subject {1=21}} {Any {1=1016}} {Query 1=1016 2=102} {Title-rank 1=4 2=102} {Date/time 1=1012} {Title-regular 1=4 2=3 4=2 5=102} {Ranked 1=1016 2=102 3=3 4=1 6=1}} {{Title 1=4 4=1 6=2} {Author 1=1003 4=1 6=2} {ISBN 1=7} {ISSN 1=8} {Year 1=30 4=4 6=2} {Any {}}} {{{Date/time last mod.} 1=1012} {Record-source 1=1019} {Identifier--standard 1=1007} {Abstract 1=62} {{Author, corporate} 1=1005} {Title 1=4}}} +set queryInfo {{{Title {1=4}} {Author {1=1}} {Subject {1=21}} {Any {1=1016}} {Query 1=1016 2=102} {Title-rank 1=4 2=102} {Date/time 1=1012} {Title-regular 1=4 2=3 4=2 5=102} {Ranked 1=1016 2=102 3=3 4=1 6=1} {per {}}} {{Title 1=4 4=1 6=2} {Author 1=1003 4=1 6=2} {ISBN 1=7} {ISSN 1=8} {Year 1=30 4=4 6=2} {Any {}}} {{{Date/time last mod.} 1=1012} {Record-source 1=1019} {Identifier--standard 1=1007} {Abstract 1=62} {{Author, corporate} 1=1005} {Title 1=4}}} set queryAuto 1 -- 1.7.10.4