</head>
<body>
{
-# $Id: query.egw,v 1.22 1996/01/02 15:34:08 adam Exp $
+# $Id: query.egw,v 1.23 1996/01/03 08:59:41 adam Exp $
if {[info commands saveState] == ""} {
source z39util.tcl
global hist
set host [lindex $sessionParms 0]
+ set initSet [lindex $sessionParms 1]
+ set scanLine [lindex $sessionParms 2]
+ set scanTerm [lindex $sessionParms 3]
if {[catch {set setNo $nextSetNo}]} {
set nextSetNo 1
}
set databases [lindex $targets($host) 1]
- if {[catch {set prevHost $hist([expr $setNo - 1],host)}]} {
+# if {[catch {set prevHost $hist([expr $setNo - 1],host)}]} {
+# set databaseDefault [lindex $databases 0]
+# set oSetNo 0
+# } else {
+# set oSetNo [expr $setNo - 1]
+# set databaseDefault $hist($oSetNo,database)
+# }
+ if {$initSet == ""} {
set databaseDefault [lindex $databases 0]
set oSetNo 0
} else {
- set oSetNo [expr $setNo - 1]
+ set oSetNo $initSet
set databaseDefault $hist($oSetNo,database)
}
+
html {<form action="http:} $env(SCRIPT_NAME)
html / $sessionId {/search.egw/} $setNo {" method=post>} \n
set nodb [llength $databases]
}
html "</select>\n"
html {<input type="text" name="entry} $no {"}
+ if {$scanLine == $no} {
+ html { value="} $scanTerm {" }
+ }
html { size=35>} \n
- html {<input type="checkbox" name="scan" value="} $no {" scan>}
+ html {<input type="checkbox" name="scan} $no {" value="1" scan>}
if {$no < 3} {
html {<select name="logic} $no {">} \n
if {$oSetNo > 0} {
html "databases: " $databases " <br>\n"
html "setNo: " $setNo " <br>\n"
html "nextSetNo: " $nextSetNo " <br>\n"
+ html "initSet: " $initSet " <br>\n"
+ html "scanLine: " $scanLine " <br>\n"
+ html "scanTerm: " $scanTerm " <br>\n"
}
</body></html>
<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)
#
-# $Id: z39util.tcl,v 1.15 1996/01/02 10:52:32 adam Exp $
+# $Id: z39util.tcl,v 1.16 1996/01/03 08:59:45 adam Exp $
#
proc saveState {} {
uplevel #0 {
}
}
-proc build-scan {t ilines} {
+proc build-scan {t i} {
global targets
- for {set i 1} {$i <= $ilines} {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]
- }
+ 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]
}
- return [list $term $attr]
}
+ return [list $term $attr]
}
return ""
}
return $q
}
-proc z39scan {setNo scanNo tno scanLines scanPos} {
+proc z39scan {setNo scanNo tno scanLines scanPos cache} {
global hist
global sessionWait
global targets
return 0
}
} else {
- if {![catch [list $zs numberOfTermsRequested 5]]} {
+ if {$cache && ![catch [list $zs numberOfTermsRequested 5]]} {
return 1
}
}
proc display-scan {setNo scanNo tno} {
global hist
global targets
+ global env
+ global sessionId
if {$tno > 0} {
set zz z39$tno
}
set zs $zz.s$scanNo.$setNo
set m [$zs numberOfEntriesReturned]
-
- html "<dl>\n"
+
+ if {$m > 0} {
+ set t [lindex [$zs scanLine 0] 1]
+ if {$tno > 0} {
+ set hist($setNo,$tno,[expr $scanNo - 1],scanTerm) $t
+ } else {
+ set hist($setNo,[expr $scanNo - 1],scanTerm) $t
+ }
+ set t [lindex [$zs scanLine [expr $m - 1]] 1]
+ if {$tno > 0} {
+ set hist($setNo,$tno,[expr $scanNo + 1],scanTerm) $t
+ } else {
+ set hist($setNo,[expr $scanNo + 1],scanTerm) $t
+ }
+ }
for {set i 0} {$i < $m} {incr i} {
- html "<dt>"
+ html {<a href="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo +
+ html $hist($setNo,scan) + [lindex [$zs scanLine $i] 1] {">}
html [lindex [$zs scanLine $i] 1]
- html ": "
+ html {</a>: <em>}
html [lindex [$zs scanLine $i] 2]
- html "\n"
+ html "</em><br>\n"
}
- html "</dl>\n"
}
proc z39search {setNo piggy tno elements} {