3 # $Id: search.egw,v 1.8 1995/11/06 17:44:21 adam Exp $
5 if {[info commands saveState] == ""} {
13 set oldHost $hist($setNo,host)
15 if {[wform menu1] == ""} {
16 set setNo [lindex $sessionParms 0]
18 if {![info exists hist($nextSetNo,host)]} {
19 set hist($nextSetNo,host) $oldHost
22 html "using host " $hist($setNo,host) " <br\n"
25 set hist($setNo,query) [build-query]
28 set hist($setNo,database) $databases
30 set hist($setNo,database) $b
32 set hist($setNo,maxPresent) [wform hits]
33 if {$hist($setNo,maxPresent) == ""} {
34 set hist($setNo,maxPresent) 30
37 set host $hist($setNo,host)
38 set databases [lindex $targets($host) 1]
40 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
41 html "</head><body>\n"
43 set startPos [lindex $sessionParms 1]
44 set endPos [lindex $sessionParms 2]
47 if {$startPos == ""} {
48 if {[z39search $setNo 1] != "1"} {
51 set r [z39.$setNo resultCount]
52 html "<h2> Search result $r hits</h2>\n"
54 set setOffset [z39.$setNo numberOfRecordsReturned]
55 display-rec 1 $setOffset display-brief
57 set setMax [z39.$setNo resultCount]
58 if {$setMax > $hist($setNo,maxPresent)} {
59 set setMax $hist($setNo,maxPresent)
62 if {[z39search $setNo 0] != "1"} {
65 set r [z39.$setNo resultCount]
66 html "<h2> Search result $r hits</h2>\n"
68 set setOffset $startPos
69 set setMax [z39.$setNo resultCount]
70 if {$setMax > $endPos} {
75 z39present $setNo $setOffset $setMax display-brief
82 if {$setMax < [z39.$setNo resultCount]} {
83 html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
84 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
85 html + [expr $setMax + $hist($setNo,maxPresent)] {"> Next </a>} "| \n"
87 if {$startPos != "" && $startPos != "1"} {
88 html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
89 html / $sessionId {/search.egw/} $setNo
90 if {[expr $startPos - $hist($setNo,maxPresent)] > 1} {
91 html + [expr $startPos - $hist($setNo,maxPresent)]
92 html + [expr $startPos - 1]
94 html {"> Prev </a>} "| \n"
96 html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
97 html / $sessionId {/targets.egw"> New target </a>} " | \n"
98 html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
99 html / $sessionId {/query.egw/} $host + $setNo {"> New query </a>}
104 html "<h3>Debug information</h3>\n"
105 html "sessionId: $sessionId <br>\n"
106 html "sessionParms: $sessionParms <br>\n"
107 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
108 html $e {: } $env($e) {<br>} \n
110 html "form: " [wform] " <br>\n"
111 html "target: " $host " <br>\n"
112 html "databases: " $hist($setNo,database) " <br>\n"
113 html "selected: " [wform base] " <br>\n"
114 html "query: --" $hist($setNo,query) "-- <br>"
115 html "setNo: " $setNo " <br>\n"
116 html "nextSetNo: " $nextSetNo " <br>\n"