<html>
{
-# $Id: search.egw,v 1.29 1996/01/12 13:39:22 adam Exp $
+# $Id: search.egw,v 1.31 1996/01/26 15:50:08 adam Exp $
proc start-scan {scanNo cache dir initSet} {
global sessionId
set host $hist($setNo,host)
- html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
+ html "<head><title> WWW/Z39.50 Gateway Scan " [splitHostSpec $host]
+ html " </title>\n"
html "</head><body>\n"
+ set useIcons 1
+ button-europagate
+
+ 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 {$hist($setNo,$scanNo,scanTerm) != ""} {
+ if {[z39scan $setNo $scanNo 0 $lines $pos $cache] != "1"} {
+ button-new-query 0 $setNo
+ egw_log debug "z39_scan failed"
+ return
+ }
+ 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
+
set databases [lindex $targets($host) 1]
if {$initSet == ""} {
html {<input type="checkbox" name="baseall" value="}
html [concat $databases] {"> All <br>} \n
}
- html "Input your search criteria:<br>\n"
}
+ html "Input your scan 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)]
+ egw_log debug "template=$template"
}
if {[string length $template] > 0} {
html {<option> } $template \n
html "\n"
html {</form><br>}
- button-europagate
-
+ set useIcons 0
if {$hist($setNo,$scanNo,scanTerm) == ""} {
- button-new-query 0 $setNo
- wabort
- return
- }
- 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"} {
+ button-europagate
+ button-new-query 0 $setNo
return
}
- 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 "<p>\n"
display-scan $setNo $scanNo 0
html "<p>\n"
foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
html $e {: } $env($e) {<br>} \n
}
- html "form: " [wform] " <br>\n"
+ html "form: " [egw_form] " <br>\n"
html "target: " $host " <br>\n"
html "databases: " $hist($setNo,database) " <br>\n"
- html "selected: " [wform base] " <br>\n"
+ html "selected: " [egw_form base] " <br>\n"
html "setNo: " $setNo " <br>\n"
html "nextSetNo: " $nextSetNo " <br>\n"
}
html "<p>\n"
button-europagate
- if {$setMax < [z39.$setNo resultCount]} {
+ if {$setMax > 0 && $setMax < [z39.$setNo resultCount]} {
html {<a href="http:} $env(SCRIPT_NAME)
html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
html + [expr $setMax + $hist($setNo,maxPresent)]
html {">Next Records</a>} " | \n"
}
}
- if {$startPos != "" && $startPos != "1"} {
+ if {$setMax > 0 && $startPos != "" && $startPos != "1"} {
html {<a href="http:} $env(SCRIPT_NAME)
html / $sessionId {/search.egw/} $setNo
html + [expr $startPos - $hist($setNo,maxPresent)]
global hist
set setNo [lindex $sessionParms 0]
+ set startPos [lindex $sessionParms 1]
+ set endPos [lindex $sessionParms 2]
- if {[wform] != ""} {
+ if {[egw_form] != ""} {
set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
set hist($nextSetNo,host) $hist($setNo,host)
}
set hist($setNo,scan) 0
- set hist($setNo,form,menu1) [wform menu1]
- set hist($setNo,form,menu2) [wform menu2]
- set hist($setNo,form,menu3) [wform menu3]
+ set hist($setNo,form,menu1) [egw_form menu1]
+ set hist($setNo,form,menu2) [egw_form menu2]
+ set hist($setNo,form,menu3) [egw_form menu3]
- set hist($setNo,form,entry1) [wform entry1]
- set hist($setNo,form,entry2) [wform entry2]
- set hist($setNo,form,entry3) [wform entry3]
+ set hist($setNo,form,entry1) [egw_form entry1]
+ set hist($setNo,form,entry2) [egw_form entry2]
+ set hist($setNo,form,entry3) [egw_form entry3]
- set hist($setNo,form,logic1) [wform logic1]
- set hist($setNo,form,logic2) [wform logic2]
+ set hist($setNo,form,logic1) [egw_form logic1]
+ set hist($setNo,form,logic2) [egw_form logic2]
set hist($setNo,form,logic3) {}
set host $hist($setNo,host)
set databases [lindex $targets($host) 1]
- set b [wform base]
- if {[wform baseall] != ""} {
+ set b [egw_form base]
+ if {[egw_form baseall] != ""} {
set hist($setNo,database) $databases
} elseif {$b == ""} {
set hist($setNo,database) $databases
} else {
set hist($setNo,database) $b
}
- set hist($setNo,maxPresent) [wform hits]
+ set hist($setNo,maxPresent) [egw_form hits]
if {$hist($setNo,maxPresent) == ""} {
set hist($setNo,maxPresent) 30
}
set i [lindex $sessionParms 1]
if {$i == ""} {
for {set j 1} {$j <= 3} {incr j} {
- if {[wform scan$j] != ""} {
+ if {[egw_form scan$j] != ""} {
set i $j
break
}
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 {} {}
+ start-scan $scanNo 0 {} $setNo
html "</body></html>\n"
- wabort
+ egw_abort
return
}
set query [build-query $hist($setNo,host) 3]
displayError "Empty query" \
"You must specify at least one search word"
html "</body></html>\n"
- wabort
+ egw_abort
}
set hist($setNo,query) $query
- } else {
- if {[lindex $sessionParms 1] == "scan"} {
- set scanNo 1000
- set hist($setNo,$scanNo,scanTerm) {}
- start-scan $scanNo 0 {} {}
- html "</body></html>\n"
- wabort
+ } elseif {[lindex $sessionParms 1] == "hyper"} {
+ egw_log debug "hyper search"
+ set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
+ set hist($nextSetNo,host) $hist($setNo,host)
+ set hist($nextSetNo,database) $hist($setNo,database)
+
+ if {$nextSetNo == $setNo} {
+ set setNo $nextSetNo
+ incr nextSetNo
+ } else {
+ catch {unset hist($setNo,hits)}
}
+ set hist($setNo,scan) 0
+ set hist($setNo,query) \
+ "$hist($setNo,scanAttr) \"[lindex $sessionParms 2]\""
+ egw_log debug "hyper databases: $hist($setNo,database)"
+ set hist($setNo,form,entry1) [lindex $sessionParms 2]
+ set startPos ""
+ } elseif {[lindex $sessionParms 1] == "scan"} {
+ egw_log debug "star scan"
+ set scanNo 1000
+ set hist($setNo,$scanNo,scanTerm) {}
+ start-scan $scanNo 0 {} {}
+ html "</body></html>\n"
+ egw_abort
+ } else {
if {![info exists hist($setNo,scan)]} return
if {$hist($setNo,scan) > 0} {
set scanNo [lindex $sessionParms 1]
}
start-scan $scanNo 1 $dir $setNo
html "</body></html>\n"
- wabort
+ egw_abort
}
}
set host $hist($setNo,host)
- html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
+ html "<head><title> WWW/Z39.50 Gateway Search " [splitHostSpec $host]
+ html " </title>\n"
html "</head><body>\n"
- set startPos [lindex $sessionParms 1]
- set endPos [lindex $sessionParms 2]
set setMax 0
set setOffset 0
+ set useIcons 1
if {$startPos == ""} {
if {[z39search $setNo 1 0 B] != "1"} {
return
}
set r [z39.$setNo resultCount]
+
+ set setMax [z39.$setNo resultCount]
+ if {$setMax > $hist($setNo,maxPresent)} {
+ set setMax $hist($setNo,maxPresent)
+ }
+ buttons $setNo $setMax $startPos 0
+
set setOffset [z39.$setNo numberOfRecordsReturned]
if {$setOffset > 0} {
html {<h3> Records 1-} $setOffset " out of $r</h3>\n"
} else {
html "<h3> No hits</h3>\n"
}
- wflush
+ egw_flush
html "<ul>\n"
display-rec 1 $setOffset display-brief 0
incr setOffset
- set setMax [z39.$setNo resultCount]
- if {$setMax > $hist($setNo,maxPresent)} {
- set setMax $hist($setNo,maxPresent)
- }
+
} else {
if {[z39search $setNo 0 0 B] != "1"} {
return
if {$setMax > $endPos} {
set setMax $endPos
}
- if {$setMax > 0} {
- buttons $setNo $setMax $startPos 0
- }
+ buttons $setNo $setMax $startPos 0
if {$setMax > 0} {
html {<h3> Records } $startPos {-} $setMax " out of $r</h3>\n"
} else {
html "<h3> No hits</h3>\n"
}
- wflush
+ egw_flush
html "<ul>\n"
}
if {$setMax > 0} {
z39present $setNo 0 $setOffset $setMax display-brief B
}
html "</ul>\n"
+ set useIcons 0
buttons $setNo $setMax $startPos 1
}
foreach n [array names env] {
html "env($n) = " $env($n) " <br>\n"
}
- html "form: " [wform] " <br>\n"
+ html "form: " [egw_form] " <br>\n"
html "target: " $host " <br>\n"
html "databases: " $hist($setNo,database) " <br>\n"
- html "selected: " [wform base] " <br>\n"
+ html "selected: " [egw_form base] " <br>\n"
html "query: --" $hist($setNo,query) "-- <br>"
html "setNo: " $setNo " <br>\n"
html "nextSetNo: " $nextSetNo " <br>\n"