X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fz39util.tcl;h=08398cf3c1d0d42bf14dae2c8bf388a5233477ee;hb=refs%2Fheads%2Forigin;hp=7ee6cf2c705c43424b71ca60930ce9be5986487d;hpb=477f50c9d787630be21ebe9ae137dd5515c71a87;p=egate.git diff --git a/www/z39util.tcl b/www/z39util.tcl index 7ee6cf2..08398cf 100644 --- a/www/z39util.tcl +++ b/www/z39util.tcl @@ -1,5 +1,5 @@ # -# $Id: z39util.tcl,v 1.44 1996/05/15 18:43:38 adam Exp $ +# $Id: z39util.tcl,v 1.50 2001/02/26 14:32:36 adam Exp $ # proc saveState {} { uplevel #0 { @@ -69,9 +69,9 @@ proc display-medium {zset no setNo targetNo} { global env global sessionId - html {
  • } set type [$zset type $no] if {$type == "SD"} { + html {
  • } set err [lindex [$zset diag $no] 1] set add [lindex [$zset diag $no] 2] if {$add != {}} { @@ -83,29 +83,16 @@ proc display-medium {zset no setNo targetNo} { if {$type != "DB"} { return } + html {
  • } set rtype [$zset recordType $no] switch $rtype { SUTRS { - html { } html [join [$zset getSutrs $no]] html "
    \n" return } - WAIS { - html { } - html [join [$zset getWAIS $no headline]] - html {} - html "
    \n" - html {Score: } [$zset getWAIS $no score] - set lines [$zset getWAIS $no lines] - if {$lines > 0} { - html {, } $lines { lines} - } - html "
    \n" - return - } } if {![catch { set author [$zset getMarc $no field 100 * a] @@ -122,7 +109,7 @@ proc display-medium {zset no setNo targetNo} { set year [$zset getMarc $no field 260 * c] set score [$zset getMarc $no field 999 * r] } dispError ] } { - html { } set p 0 foreach a $author { @@ -166,7 +153,7 @@ proc display-medium {zset no setNo targetNo} { html "; Score " $nscore } } else { - html { } html {No Title} html { } @@ -179,9 +166,9 @@ proc display-brief {zset no setNo targetNo} { global env global sessionId - html {
  • } set type [$zset type $no] if {$type == "SD"} { + html {
  • } set err [lindex [$zset diag $no] 1] set add [lindex [$zset diag $no] 2] if {$add != {}} { @@ -193,26 +180,16 @@ proc display-brief {zset no setNo targetNo} { if {$type != "DB"} { return } + html {
  • } set rtype [$zset recordType $no] switch $rtype { SUTRS { - html { } html [string range [join [$zset getSutrs $no]] 0 70] html "
    \n" return } - WAIS { - html { } - html [string range [join [$zset getWAIS $no headline]] 0 70] - - html {} - set score [$zset getWAIS $no score] - html { Score } $score - html "
    \n" - return - } } if {![catch { set author [$zset getMarc $no field 100 * a] @@ -228,7 +205,7 @@ proc display-brief {zset no setNo targetNo} { set publisher [$zset getMarc $no field 260 * b] set year [$zset getMarc $no field 260 * c] } dispError ] } { - html { } set p 0 foreach a $author { @@ -276,7 +253,7 @@ proc display-brief {zset no setNo targetNo} { } html { } } else { - html { } html {No Title} html { } @@ -310,10 +287,6 @@ proc display-raw {zset no setNo targetNo} { html "\n" [join [$zset getSutrs $no]] "\n\n" return } - WAIS { - html "\n" [join [$zset getWAIS $no text]] "\n\n" - return - } } if {[catch {set r [$zset getMarc $no line * * *]}]} { html "Unknown record type: $rtype
    \n" @@ -330,7 +303,7 @@ proc display-raw {zset no setNo targetNo} { if {[string index $indicator $i] == " "} { html "-" } else { - html [string index $tag $i] + html [string index $indicator $i] } } } @@ -530,114 +503,6 @@ proc display-full-marc {zset no setNo targetNo} { html "\n" } -proc display-full-wais {zset no setNo targetNo} { - global env - global hist - global sessionId - - set i 0 - set element junk - htmlToken l [join [$zset getWAIS $no text]] { - if {[string compare [string index $l 0] {<}]} { - if {[info exist data($element)]} { - set data($element) $data($element)$l - } else { - set data($element) $l - } - continue - } - switch -- $l { - { - set element title - } - { - set element dateOfLastModification - } - { - set element controlIdentifier - } - { - set element lastChecked - } - { - set element bytes - } - { - set element linkage - } - { - incr i - } -
  • { - set element "$i,linkage" - } - { - set element "$i,title" - } - { - set element ip - } - default { - set element junk - } - } - } - if {![info exists data(title)] || ![info exists data(linkage)]} { - set nwi 0 - } else { - set nwi 1 - } - html "
    \n" - html {
    Title} - if {$nwi} { - html {
    } $data(title) "" - html {
    URL} - html {
    } $data(linkage) "
    \n" - } else { - html {
    } [join [$zset getWAIS $no headline]] - } - html {
    Score
    } [$zset getWAIS $no score] - set lines [$zset getWAIS $no lines] - if {$lines > 0} { - html {
    Lines
    } $lines "
    \n" - } - if {!$nwi} { - html "
    \n" [join [$zset getWAIS $no text]] "\n
    \n" - return - } - if {[info exists data(bytes)]} { - html {
    Bytes
    } $data(bytes) - } - if {[info exists data(dateOfLastModification)]} { - html {
    Last modified
    } $data(dateOfLastModification) - } - if {[info exists data(lastChecked)]} { - html {
    Last checked
    } $data(lastChecked) "
    \n" - } - if {[info exists data(ip)]} { - html {
    Initial text
    } $data(ip) "
    \n" - } - if {0} { - html {} - html {Similar WAIS record
    } - } - if {[info exists data($i,linkage)]} { - html "
    References\n" - } - for {set i 1} {[info exists data($i,linkage)]} {incr i} { - html {
    } - if {[info exists data($i,title)]} { - html $data($i,title) - } else { - html Untitled - } - html "
    \n" - } - html "\n" -} - proc display-full {zset no setNo targetNo} { set type [$zset type $no] switch $type { @@ -662,10 +527,6 @@ proc display-full {zset no setNo targetNo} { html "
    " [join [$zset getSutrs $no]] "

    \n" return } - WAIS { - display-full-wais $zset $no $setNo $targetNo - return - } } if {[catch {set r [$zset getMarc $no line * * *]}]} { html "Unknown record type: $rtype
    \n" @@ -707,39 +568,29 @@ proc build-query {t ilines} { for {set i 1} {$i <= $ilines} {incr i} { set term [join [egw_form entry$i]] if {[string length $term] == 0} continue - if {![string compare [lindex $targets($t) 1] WAIS]} { - if {[string length $q] == 0} { - set q $term - } else { - set q "$term $q" - } - set op [egw_form logic$i] - continue - } else { - set field [join [egw_form menu$i]] - catch {unset attr} - foreach x [lindex $targets($t) 2] { - if {![string compare [lindex $x 0] $field]} { - set attr [lindex $x 1] - } - } - if {![info exists attr]} { - egw_log debug "attr failed for $t" - set attr [lindex [lindex [lindex $targets($t) 2] 0] 1] - } - egw_log debug "op=${op}" - switch $op { - And - { set q "@and $q ${attr} \"${term}\""; egw_log debug AND } - Or - { set q "@or $q ${attr} \"${term}\""; egw_log debug OR } - {} - { set q "${attr} \"${term}\""; egw_log debug NOPE } - default - { set q "@not $q ${attr} \"${term}\""; egw_log debug ANDNOT } + set field [join [egw_form menu$i]] + catch {unset attr} + foreach x [lindex $targets($t) 2] { + if {![string compare [lindex $x 0] $field]} { + set attr [lindex $x 1] } - set op [egw_form logic$i] } + if {![info exists attr]} { + egw_log debug "attr failed for $t" + set attr [lindex [lindex [lindex $targets($t) 2] 0] 1] + } + egw_log debug "op=${op}" + switch $op { + And + { set q "@and $q ${attr} \"${term}\""; egw_log debug AND } + Or + { set q "@or $q ${attr} \"${term}\""; egw_log debug OR } + {} + { set q "${attr} \"${term}\""; egw_log debug NOPE } + default + { set q "@not $q ${attr} \"${term}\""; egw_log debug ANDNOT } + } + set op [egw_form logic$i] } return $q } @@ -875,12 +726,12 @@ proc display-scan {setNo scanNo tno} { html {} if {0} { regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm - html {} } else { regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm - html {} } @@ -959,13 +810,9 @@ proc z39search {setNo piggy tno elements} { } } - if {![string compare [lindex $targets($host) 1] WAIS]} { - wais-set $zz.$setNo $zz - } else { - ir-set $zz.$setNo $zz - $zz.$setNo preferredRecordSyntax [lindex $targets($host) 1] - egw_log debug "set syntax to [lindex $targets($host) 1]" - } + ir-set $zz.$setNo $zz + $zz.$setNo preferredRecordSyntax [lindex $targets($host) 1] + egw_log debug "set syntax to [lindex $targets($host) 1]" if {![lindex $targets($host) 5]} { set elements {} } @@ -1127,7 +974,6 @@ proc z39msearch {setNo elements start number cache} { } egw_log debug "old=$oldHost this=$thisHost" z39$i idAuthentication $hist($setNo,$i,idAuthentication) - html "Connecting to target " $thisHost "
    \n" set zstatus($i) -1 if {![catch {z39$i connect $thisHost}]} { incr zleft @@ -1170,13 +1016,9 @@ proc z39msearch {setNo elements start number cache} { html "ok
    \n" } - if {![string compare [lindex $targets($host) 1] WAIS]} { - wais-set z39$i.$setNo z39$i - } else { - ir-set z39$i.$setNo z39$i - z39$i.$setNo preferredRecordSyntax [lindex $targets($host) 1] - egw_log debug "set syntax to [lindex $targets($host) 1]" - } + ir-set z39$i.$setNo z39$i + z39$i.$setNo preferredRecordSyntax [lindex $targets($host) 1] + egw_log debug "set syntax to [lindex $targets($host) 1]" set hist($setNo,$i,offset) 0 eval z39$i.$setNo databaseNames $hist($setNo,$i,database) @@ -1348,7 +1190,7 @@ proc buttons-result-set-s {setNo targetNo setMax startPos after} { if {!$useIcons} { html "\n | " } - html {
    \n
    NSD$code: $msg: $addinfo" } else { - html {
    } html "

    " [lindex $targets($hist($setNo,$i,host)) 0] ": " @@ -1618,7 +1458,7 @@ proc z39history {} { html {} } if {[info exists hist($setNo,$i,hits)]} { - html { } $hist($setNo,$i,hits) {} @@ -1634,7 +1474,7 @@ proc z39history {} { } else { html "
    \n" } - html { } @@ -1689,6 +1529,19 @@ proc button-main {} { } } +proc button-feedback {} { + global useIcons + + html {} + if {$useIcons} { + html {User Feedback} + } else { + html "\n | " + html {User Feedback} + } +} + proc button-define-target {} { global useIcons global env @@ -1697,7 +1550,7 @@ proc button-define-target {} { if {!$useIcons} { html "\n | " } - html {} if {$useIcons} { @@ -1778,7 +1631,7 @@ proc button-result-set {setNo tno} { if {!$useIcons} { html "\n | " } - html { 0} { html {/msearch.egw/} $setNo } else { @@ -1803,7 +1656,7 @@ proc button-scan-window {setNo} { html "\n | " } set targetNo 0 - html {} if {$useIcons} { html {This page is maintained by } - html { Peter Wad Hansen .} - html {Last modified March 15, 1996.
    } + html { Nobody .} + html {Last modified x x x.
    } } proc splitHostSpec {host} { @@ -1847,21 +1700,12 @@ proc mkAssoc {assoc host} { global targets if {[catch {$assoc failback fail-response}]} { - if {![string compare [lindex $targets($host) 1] WAIS]} { - wais $assoc - } else { - ir $assoc - $assoc maximumRecordSize 1000000 - } + ir $assoc + $assoc maximumRecordSize 1000000 } else { - if {![string compare [lindex $targets($host) 1] WAIS]} { - if {[$assoc comstack] == "wais"} return - wais $assoc - } else { - if {[$assoc comstack] == "tcpip"} return - ir $assoc - $assoc maximumRecordSize 1000000 - } + if {[$assoc comstack] == "tcpip"} return + ir $assoc + $assoc maximumRecordSize 1000000 } }