3 # $Id: search.egw,v 1.19 1995/12/21 15:49:52 adam Exp $
17 set termPlusAttr [build-scan $hist($setNo,host) 3]
19 if {"$termPlusAttr" == ""} {
20 html "<head><title> WWW/Z39.50 Gateway Scan</title>\n<body>\n"
21 displayError "Empty query" \
22 "You must specify at least one search word"
23 html "</body></html>\n"
26 set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
27 set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
29 set hist($setNo,form,menu1) [wform menu1]
30 set hist($setNo,form,menu2) ""
31 set hist($setNo,form,menu3) ""
33 set hist($setNo,form,entry1) [wform entry1]
34 set hist($setNo,form,entry2) ""
35 set hist($setNo,form,entry3) ""
37 set hist($setNo,form,logic1) ""
38 set hist($setNo,form,logic2) ""
42 set host $hist($setNo,host)
43 set databases [lindex $targets($host) 1]
46 if {[wform baseall] != ""} {
47 set hist($setNo,database) $databases
49 set hist($setNo,database) $databases
51 set hist($setNo,database) $b
53 set hist($setNo,maxPresent) [wform hits]
54 if {$hist($setNo,maxPresent) == ""} {
55 set hist($setNo,maxPresent) 30
57 set host $hist($setNo,host)
58 set databases [lindex $targets($host) 1]
60 html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
61 html "</head><body>\n"
63 if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
66 display-scan $setNo $scanNo 0
69 html "<h3>Debug information</h3>\n"
70 html "sessionId: $sessionId <br>\n"
71 html "sessionParms: $sessionParms <br>\n"
72 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
73 html $e {: } $env($e) {<br>} \n
75 html "form: " [wform] " <br>\n"
76 html "target: " $host " <br>\n"
77 html "databases: " $hist($setNo,database) " <br>\n"
78 html "selected: " [wform base] " <br>\n"
79 html "setNo: " $setNo " <br>\n"
80 html "nextSetNo: " $nextSetNo " <br>\n"
85 proc buttons {setNo setMax startPos after} {
91 if {!$useIcons && $after && $setMax < [z39.$setNo resultCount]} {
94 html {<a href="http:} $env(SCRIPT_NAME)
95 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
96 html + [expr $setMax + $hist($setNo,maxPresent)]
97 html {"><img src="/gif/darrw.gif"></a>}
103 html {<img src="/gif/button-egw.gif">}
105 if {$setMax < [z39.$setNo resultCount]} {
106 html {<a href="http:} $env(SCRIPT_NAME)
107 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
108 html + [expr $setMax + $hist($setNo,maxPresent)]
110 html {"><img src="/gif/button-next-records.gif" border=0></a>}
112 html {">Next records</a>} " | \n"
115 if {$startPos != "" && $startPos != "1"} {
116 html {<a href="http:} $env(SCRIPT_NAME)
117 html / $sessionId {/search.egw/} $setNo
118 html + [expr $startPos - $hist($setNo,maxPresent)]
119 html + [expr $startPos - 1]
121 html {"><img src="/gif/button-previous-records.gif" border=0></a>}
123 html {">Previous records</a>} " | \n"
126 html {<a href="http:} $env(SCRIPT_NAME)
127 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
129 html {"><img src="/gif/button-new-query.gif" border=0></a>}
131 html {">New query</a>} " | \n"
134 html {<a href="http:} $env(SCRIPT_NAME)
135 html / $sessionId {/targets.egw}
137 html {"><img src="/gif/button-new-target.gif" border=0></a>}
139 html {">New target</a>}
142 if {!$useIcons && !$after && $startPos != "" && $startPos != "1"} {
144 html {<a href="http:} $env(SCRIPT_NAME)
145 html / $sessionId {/search.egw/} $setNo
146 html + [expr $startPos - $hist($setNo,maxPresent)]
147 html + [expr $startPos - 1]
148 html {"><img src="/gif/uarrw.gif"></a>}
149 html "</center><p>\n"
154 if {[info commands saveState] == ""} {
162 set setNo [lindex $sessionParms 0]
163 if {[wform menu1] != ""} {
164 if {[wform submit] == "Scan"} {
168 set query [build-query $hist($setNo,host) 3]
169 if {"x$query" == "x"} {
170 html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
171 displayError "Empty query" \
172 "You must specify at least one search word"
173 html "</body></html>\n"
176 set hist($setNo,query) $query
178 set hist($setNo,form,menu1) [wform menu1]
179 set hist($setNo,form,menu2) [wform menu2]
180 set hist($setNo,form,menu3) [wform menu3]
182 set hist($setNo,form,entry1) [wform entry1]
183 set hist($setNo,form,entry2) [wform entry2]
184 set hist($setNo,form,entry3) [wform entry3]
186 set hist($setNo,form,logic1) [wform logic1]
187 set hist($setNo,form,logic2) [wform logic2]
191 set host $hist($setNo,host)
192 set databases [lindex $targets($host) 1]
195 if {[wform baseall] != ""} {
196 set hist($setNo,database) $databases
197 } elseif {$b == ""} {
198 set hist($setNo,database) $databases
200 set hist($setNo,database) $b
202 set hist($setNo,maxPresent) [wform hits]
203 if {$hist($setNo,maxPresent) == ""} {
204 set hist($setNo,maxPresent) 30
207 set host $hist($setNo,host)
208 set databases [lindex $targets($host) 1]
210 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
211 html "</head><body>\n"
213 set startPos [lindex $sessionParms 1]
214 set endPos [lindex $sessionParms 2]
217 if {$startPos == ""} {
218 if {[z39search $setNo 1 0 B] != "1"} {
221 set r [z39.$setNo resultCount]
222 html "<h3> Search result $r hits</h3>\n"
224 set setOffset [z39.$setNo numberOfRecordsReturned]
225 display-rec 1 $setOffset display-brief 0
227 set setMax [z39.$setNo resultCount]
228 if {$setMax > $hist($setNo,maxPresent)} {
229 set setMax $hist($setNo,maxPresent)
232 if {[z39search $setNo 0 0 B] != "1"} {
235 set r [z39.$setNo resultCount]
236 set setOffset $startPos
237 set setMax [z39.$setNo resultCount]
238 if {$setMax > $endPos} {
242 buttons $setNo $setMax $startPos 0
244 html "<h3> Search result $r hits</h3>\n"
248 z39present $setNo 0 $setOffset $setMax display-brief B
251 buttons $setNo $setMax $startPos 1
256 html "<h3>Debug information</h3>\n"
257 html "sessionId: $sessionId <br>\n"
258 html "sessionParms: $sessionParms <br>\n"
259 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
260 html $e {: } $env($e) {<br>} \n
262 html "form: " [wform] " <br>\n"
263 html "target: " $host " <br>\n"
264 html "databases: " $hist($setNo,database) " <br>\n"
265 html "selected: " [wform base] " <br>\n"
266 html "query: --" $hist($setNo,query) "-- <br>"
267 html "setNo: " $setNo " <br>\n"
268 html "nextSetNo: " $nextSetNo " <br>\n"