<html>
{
-# $Id: search.egw,v 1.21 1996/01/02 10:52:28 adam Exp $
+# $Id: search.egw,v 1.22 1996/01/03 08:59:43 adam Exp $
-proc perform-scan {} {
+proc start-scan {scanNo cache dir} {
global sessionId
global sessionParms
global sessionWait
global nextSetNo
global env
- set scanNo 1000
-
- set termPlusAttr [build-scan $hist($setNo,host) 3]
+ set host $hist($setNo,host)
- if {"$termPlusAttr" == ""} {
- html "<head><title> WWW/Z39.50 Gateway Scan</title>\n<body>\n"
+ html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
+ html "</head><body>\n"
+
+ if {$hist($setNo,$scanNo,scanTerm) == ""} {
displayError "Empty query" \
- "You must specify at least one search word"
+ "You must specify at least one search word"
html "</body></html>\n"
wabort
+ return
}
- set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
- set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
-
- set host $hist($setNo,host)
-
- html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
- html "</head><body>\n"
-
- if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
+ if {$dir == "b"} {
+ set lines 20
+ set pos 20
+ } elseif {$dir == "f"} {
+ set lines 20
+ set pos 1
+ } else {
+ set lines 20
+ set pos 10
+ }
+ if {[z39scan $setNo $scanNo 0 $lines $pos $cache] != "1"} {
return
}
+ html {<a href="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/search.egw/} $setNo + [expr $scanNo - 1] + b
+ html {">Backward</a>} "\n"
+
+ html {<a href="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/search.egw/} $setNo + [expr $scanNo + 1] + f
+ html {">Forward</a><br>}
+
display-scan $setNo $scanNo 0
+ html {<a href="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/search.egw/} $setNo + [expr $scanNo - 1] + b
+ html {">Backward</a>} "\n"
+
+ html {<a href="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/search.egw/} $setNo + [expr $scanNo + 1] + f
+ html {">Forward</a><br>}
+
html "<hr>\n"
html "<h3>Debug information</h3>\n"
html "sessionId: $sessionId <br>\n"
set setNo [lindex $sessionParms 0]
- if {[wform menu1] != ""} {
+ if {[wform] != ""} {
set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
set hist($nextSetNo,host) $hist($setNo,host)
if {$hist($setNo,maxPresent) == ""} {
set hist($setNo,maxPresent) 30
}
-
- if {[wform submit] == "Scan"} {
- perform-scan
- wabort
+ for {set i 1} {$i <= 3} {incr i} {
+ if {[wform scan$i] != ""} {
+ set scanNo 1000
+ set hist($setNo,scan) $i
+ set termPlusAttr [build-scan $hist($setNo,host) $i]
+ set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
+ set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
+ start-scan $scanNo 0 {}
+ wabort
+ return
+ }
}
+ set hist($setNo,scan) 0
set query [build-query $hist($setNo,host) 3]
if {"x$query" == "x"} {
html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
wabort
}
set hist($setNo,query) $query
+ } else {
+ if {$hist($setNo,scan) > 0} {
+ set scanNo [lindex $sessionParms 1]
+ set dir [lindex $sessionParms 2]
+ if {$scanNo == ""} {
+ set scanNo 1000
+ }
+ start-scan $scanNo 1 $dir
+ wabort
+ }
}
set host $hist($setNo,host)