<html>
{
-# $Id: search.egw,v 1.26 1996/01/09 16:16:48 adam Exp $
+# $Id: search.egw,v 1.27 1996/01/12 10:03:19 adam Exp $
-proc start-scan {scanNo cache dir} {
+proc start-scan {scanNo cache dir initSet} {
global sessionId
global sessionParms
global sessionWait
html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
html "</head><body>\n"
-
+
+ set databases [lindex $targets($host) 1]
+
+ if {$initSet == ""} {
+ set databaseDefault [lindex $databases 0]
+ set oSetNo 0
+ } else {
+ set oSetNo $initSet
+ set databaseDefault $hist($oSetNo,database)
+ }
+
+ html {<form action="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/search.egw/} $setNo {+1" method=get>} \n
+ set nodb [llength $databases]
+ if {$nodb > 1} {
+ if {$nodb > 2} {
+ html "Databases:<br>\n"
+ }
+ set i 0
+ foreach d $databases {
+ html {<input type="checkbox" name="base" value="} $d
+ if {[lsearch $databaseDefault $d] == -1} {
+ html {"> } $d \n
+ } else {
+ html {" checked> } $d \n
+ }
+ }
+ html "<br>\n"
+ if {$nodb > 2} {
+ html {<input type="checkbox" name="baseall" value="}
+ html [concat $databases] {"> All <br>} \n
+ }
+ html "Input your search criteria:<br>\n"
+ }
+ set fields [lindex $targets($host) 2]
+ set no 1
+ html {<select name="menu} $no {">} \n
+ set template {}
+ if {$oSetNo > 0} {
+ set template [join $hist($oSetNo,form,menu$no)]
+ }
+ if {[string length $template] > 0} {
+ html {<option> } $template \n
+ }
+ foreach f $fields {
+ set name [lindex $f 0]
+ if {$template == $name} continue
+ html {<option> } $name \n
+ }
+ html "</select>\n"
+ html {<input type="text" name="entry} $no {"}
+ html { size=35> }
+ html {<input type=submit name=submit value="Scan">}
+ html "\n"
+ html {</form>}
if {$hist($setNo,$scanNo,scanTerm) == ""} {
- displayError "Empty query" \
- "You must specify at least one search word"
wabort
return
}
if {[z39scan $setNo $scanNo 0 $lines $pos $cache] != "1"} {
return
}
- button-europagate
-
- html {<a href="http:} $env(SCRIPT_NAME)
- html / $sessionId {/search.egw/} $setNo + [expr $scanNo - 1] + b {">}
- if {$useIcons} {
- html {<img src="/egwgif/button-previous-terms.gif" }
- html {alt="Next Terms" border=0></a>}
- } else {
- html {Previous Terms</a> | }
- }
-
- html {<a href="http:} $env(SCRIPT_NAME)
- html / $sessionId {/search.egw/} $setNo + [expr $scanNo + 1] + f {">}
- if {$useIcons} {
- html {<img src="/egwgif/button-next-terms.gif" }
- html {alt="Next Terms" border=0></a>}
- } else {
- html {Next Terms</a> | }
- }
- html {</a>}
- button-new-query 0 $setNo
html "<br><p>\n"
display-scan $setNo $scanNo 0
if {$hist($setNo,maxPresent) == ""} {
set hist($setNo,maxPresent) 30
}
- 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 {}
- html "</body></html>\n"
- wabort
- return
+ set i [lindex $sessionParms 1]
+ if {$i == ""} {
+ for {set j 1} {$j <= 3} {incr j} {
+ if {[wform scan$j] != ""} {
+ set i $j
+ break
+ }
}
}
+ if {$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 {} $setNo
+ html "</body></html>\n"
+ wabort
+ return
+ }
set query [build-query $hist($setNo,host) 3]
if {"x$query" == "x"} {
html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
if {$scanNo == ""} {
set scanNo 1000
}
- start-scan $scanNo 1 $dir
+ start-scan $scanNo 1 $dir $setNo
html "</body></html>\n"
wabort
}