X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;ds=sidebyside;f=client.tcl;h=45358ed4de74d3cc34a0bb22b9dc77ce0090541d;hb=9383cb8df2d54110ea5ebbd1269e9dd37abf6cf7;hp=64b31fe5c9ed305091b2d14625f9050b4ae384a0;hpb=9a44ae2e43538cf4261de65afba17a4e34a0cd26;p=ir-tcl-moved-to-github.git diff --git a/client.tcl b/client.tcl index 64b31fe..45358ed 100644 --- a/client.tcl +++ b/client.tcl @@ -1,6 +1,16 @@ # # $Log: client.tcl,v $ -# Revision 1.20 1995-04-21 16:31:57 adam +# Revision 1.23 1995-05-29 10:33:41 adam +# README and rename of startup script. +# +# Revision 1.22 1995/05/26 11:44:09 adam +# Bugs fixed. More work on MARC utilities and queries. Test +# client is up-to-date again. +# +# Revision 1.21 1995/05/11 15:34:46 adam +# Scan request changed a bit. This version works with RLG. +# +# Revision 1.20 1995/04/21 16:31:57 adam # New radiobutton: protocol (z39v2/SR). # # Revision 1.19 1995/04/18 16:11:50 adam @@ -76,12 +86,13 @@ set setNo 0 set queryTypes {Simple} set queryButtons { { {I 0} {I 1} {I 2} } } -set queryInfo { { {Title ti} {Author au} {Subject sh} {Any any} } } +set queryInfo { { {Title {1=4}} {Author {1=1}} \ + {Subject {1=21}} {Any {1=1016}} } } -wm minsize . 300 250 +wm minsize . 350 250 -if {[file readable "~/.tk-c"]} { - source "~/.tk-c" +if {[file readable "clientrc.tcl"]} { + source "clientrc.tcl" } set queryButtonsFind [lindex $queryButtons 0] @@ -91,7 +102,8 @@ proc top-down-window {w} { frame $w.top -relief raised -border 1 frame $w.bot -relief raised -border 1 - pack $w.top $w.bot -side top -fill both -expand yes + pack $w.top -side top -fill both -expand yes + pack $w.bot -fill both } proc top-down-ok-cancel {w ok-action g} { @@ -212,7 +224,7 @@ proc show-full-marc {no} { } incr no - set r [z39.$setNo recordMarc $no line * * *] + set r [z39.$setNo getMarc $no list * * *] $w.top.record tag configure marc-tag -foreground blue $w.top.record tag configure marc-data -foreground black @@ -327,7 +339,7 @@ proc open-target {target base} { z39 disconnect z39 comstack [lindex $profile($target) 6] - # z39 idAuthentication [lindex $profile($target) 3] + z39 idAuthentication [lindex $profile($target) 3] z39 maximumRecordSize [lindex $profile($target) 4] z39 preferredMessageSize [lindex $profile($target) 5] puts -nonewline "maximumRecordSize=" @@ -367,7 +379,7 @@ proc load-set-action {} { global setNo incr setNo - ir-set z39.$setNo + ir-set z39.$setNo z39 set fname [.load-set.top.filename.entry get] destroy .load-set @@ -418,6 +430,11 @@ proc init-response {} { .top.search configure -state normal .mid.search configure -state normal .mid.scan configure -state normal + if {![z39 initResult]} { + set u [z39 userInformationField] + close-target + tkerror "Connection rejected by target: $u" + } } proc search-request {} { @@ -432,19 +449,20 @@ proc search-request {} { return } incr setNo - ir-set z39.$setNo - + ir-set z39.$setNo z39 - if {[lindex $profile($target) 10] != ""} { + if {[lindex $profile($target) 10] == 1} { z39.$setNo setName $setNo + puts "setName=${setNo}" } else { z39.$setNo setName Default + puts "setName=Default" } - if {[lindex $profile($target) 8] != ""} { - z39 query rpn + if {[lindex $profile($target) 8] == 1} { + z39.$setNo queryType rpn } - if {[lindex $profile($target) 9] != ""} { - z39 query ccl + if {[lindex $profile($target) 9] == 1} { + z39.$setNo queryType ccl } z39 callback {search-response} z39.$setNo search $query @@ -480,7 +498,8 @@ proc scan-request {} { top-down-ok-cancelx $w [list {Close} [list destroy $w]] 0 } - z39.scan scan 0 + z39.scan numberOfTermsRequested 100 + z39.scan scan "@attr 1=4 0" show-status {Scan} 1 } @@ -559,8 +578,8 @@ proc init-title-lines {} { proc add-title-lines {setno no offset} { for {set i 0} {$i < $no} {incr i} { set o [expr $i + $offset] - set title [lindex [z39.$setno recordMarc $o field 245 * a] 0] - set year [lindex [z39.$setno recordMarc $o field 260 * c] 0] + set title [lindex [z39.$setno getMarc $o field 245 * a] 0] + set year [lindex [z39.$setno getMarc $o field 260 * c] 0] set nostr [format "%5d" $o] .data.list insert end "$nostr $title - $year" } @@ -1316,13 +1335,16 @@ proc index-query {} { set term [string trim [.lines.$i.e get]] if {$term != ""} { set attr [lindex [lindex $queryInfoFind [lindex $b 1]] 1] - if {$qs != ""} { - set qs "${qs} and " + + set term "\{${term}\}" + foreach a $attr { + set term "@attr $a ${term}" } - if {$attr != ""} { - set qs "${qs}${attr}=" + if {$qs != ""} { + set qs "@and ${qs} ${term}" + } else { + set qs $term } - set qs "${qs}(${term})" } incr i }