X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=www%2Fsearch.egw;h=0feff70ee1a3acb30efa7173faada002d3673cd4;hb=df7b985601de6c729147a6fd6588adba6f905480;hp=bfb64bd266767041c013b2634210a35754c0f41b;hpb=150d836eb46d0dde8fedeb77fc7fd4ef6eafba4f;p=egate.git
diff --git a/www/search.egw b/www/search.egw
index bfb64bd..0feff70 100644
--- a/www/search.egw
+++ b/www/search.egw
@@ -1,250 +1,169 @@
{
-# $Id: search.egw,v 1.7 1995/11/02 16:35:36 adam Exp $
+# $Id: search.egw,v 1.21 1996/01/02 10:52:28 adam Exp $
-proc search-response {sno} {
- global sessionWait
-
- set status [z39.$sno responseStatus]
- if {[lindex $status 0] == "NSD"} {
- z39.$sno nextResultSetPosition 0
- set code [lindex $status 1]
- set msg [lindex $status 2]
- set addinfo [lindex $status 3]
- htmlr {Error} $code {: } $msg {: } $addinfo {
}
- set sessionWait -2
- } else {
- set sessionWait 1
- }
-}
-
-proc ok-response {} {
- global sessionWait
- set sessionWait 1
-}
-
-proc fail-response {} {
+proc perform-scan {} {
+ global sessionId
+ global sessionParms
global sessionWait
- set sessionWait -1
-}
-
-proc display-brief {zset no} {
- global env
global setNo
- global sessionId
+ global hist
+ global targets
+ global nextSetNo
+ global env
- set type [$zset type $no]
- if {$type == "SD"} {
- set err [lindex [$zset diag $no] 1]
- set add [lindex [$zset diag $no] 2]
- if {$add != {}} {
- set add " :${add}"
- }
- htmlr "${no} Error ${err}${add}
"
- return
- }
- if {$type != "DB"} {
- return
- }
- html "${no} "
- set rtype [$zset recordType $no]
- if {$rtype == "SUTRS"} {
- html [join [$zset getSutrs $no]]
- htmlr {
}
- return
- }
- if {![catch {
- set title [lindex [$zset getMarc $no field 245 * a] 0]
- set year [lindex [$zset getMarc $no field 260 * c] 0]
- } ] } {
- html { } $title {}
- html " ${year} "
- }
- htmlr {
}
-}
+ set scanNo 1000
-proc display-full {zset no} {
- set type [$zset type $no]
- if {$type == "SD"} {
- set err [lindex [$zset diag $no] 1]
- set add [lindex [$zset diag $no] 2]
- if {$add != {}} {
- set add " :${add}"
- }
- htmlr "
${no}
"
- htmlr "Error ${err}${add}
"
- return
- }
- if {$type != "DB"} {
- return
- }
- htmlr "
${no}
"
- set rtype [$zset recordType $no]
- if {$rtype == "SUTRS"} {
- htmlr [join [$zset getSutrs $no]]
- return
- }
- if {[catch {set r [$zset getMarc $no line * * *]}]} {
- htmlr "Unknown record type: $rtype"
- return
- }
- foreach line $r {
- set tag [lindex $line 0]
- set indicator [lindex $line 1]
- set fields [lindex $line 2]
- set l [string length $indicator]
- html "$tag "
- if {$l > 0} {
- for {set i 0} {$i < $l} {incr i} {
- if {[string index $tag $i] == " "} {
- html "_"
- } else {
- html [string index $tag $i]
- }
- }
- }
- foreach field $fields {
- set id [lindex $field 0]
- set data [lindex $field 1]
- if {$id != ""} {
- html " \$$id "
- }
- html $data
- }
- htmlr {
}
+ set termPlusAttr [build-scan $hist($setNo,host) 3]
+
+ if {"$termPlusAttr" == ""} {
+ html " WWW/Z39.50 Gateway Scan\n\n"
+ displayError "Empty query" \
+ "You must specify at least one search word"
+ html "\n"
+ wabort
}
-}
+ set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
+ set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
+
+ set host $hist($setNo,host)
-proc display-rec {from to} {
- global setNo
+ html " WWW/Z39.50 Gateway Scan " $host " \n"
+ html "\n"
- while {$from <= $to} {
- display-brief z39.$setNo $from
- incr from
+ if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
+ return
}
-}
-
-proc build-query {} {
- global targets
- global t
+ display-scan $setNo $scanNo 0
- set op {}
- set q {}
- for {set i 1} {$i < 4} {incr i} {
- set term [wform entry$i]
- if {$term != ""} {
- set field [wform menu$i]
- foreach x [lindex $targets($t) 2] {
- if {[lindex $x 0] == $field} {
- set attr [lindex $x 1]
- }
- }
- switch $op {
- And
- { set q "@and $q ${attr} ${term}" }
- Or
- { set q "@or $q ${attr} ${term}" }
- {And not}
- { set q "@not $q ${attr} ${term}" }
- {}
- { set q "${attr} ${term}" }
- }
- set op [wform logic$i]
- }
+ html "
\n"
+ html "Debug information
\n"
+ html "sessionId: $sessionId
\n"
+ html "sessionParms: $sessionParms
\n"
+ foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
+ html $e {: } $env($e) {
} \n
}
- return $q
+ html "form: " [wform] "
\n"
+ html "target: " $host "
\n"
+ html "databases: " $hist($setNo,database) "
\n"
+ html "selected: " [wform base] "
\n"
+ html "setNo: " $setNo "
\n"
+ html "nextSetNo: " $nextSetNo "
\n"
+
+ html "\n"
}
-proc research {setNo oldHost piggy} {
+proc buttons {setNo setMax startPos after} {
+ global sessionId
+ global useIcons
+ global env
global hist
- global sessionWait
- set host $hist($setNo,host)
- if {[catch {z39 failback fail-response}]} {
- ir z39
- }
- if {[catch {set oldHost [z39 connect]}]} {
- set oldHost ""
+ if {!$useIcons && $after && $setMax < [z39.$setNo resultCount]} {
+ html "\n"
+ html "
\n"
+ html {}
+ html "\n"
}
- z39 callback ok-response
- z39 failback fail-response
- if {$oldHost != $host} {
- catch {z39 disconnect}
- html "Connecting to target " $host "
\n"
- set sessionWait 0
- if {[catch {z39 connect $host}]} {
- htmlr "Cannot connect to target ${host}
"
- htmlr "