3 # $Id: search.egw,v 1.20 1995/12/22 14:21:15 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) [wform menu2]
31 set hist($setNo,form,menu3) [wform menu3]
33 set hist($setNo,form,entry1) [wform entry1]
34 set hist($setNo,form,entry2) [wform entry2]
35 set hist($setNo,form,entry3) [wform entry3]
37 set hist($setNo,form,logic1) [wform logic1]
38 set hist($setNo,form,logic2) [wform logic2]
40 set host $hist($setNo,host)
41 set databases [lindex $targets($host) 1]
44 if {[wform baseall] != ""} {
45 set hist($setNo,database) $databases
47 set hist($setNo,database) $databases
49 set hist($setNo,database) $b
51 set hist($setNo,maxPresent) [wform hits]
52 if {$hist($setNo,maxPresent) == ""} {
53 set hist($setNo,maxPresent) 30
55 set host $hist($setNo,host)
56 set databases [lindex $targets($host) 1]
58 html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
59 html "</head><body>\n"
61 if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
64 display-scan $setNo $scanNo 0
67 html "<h3>Debug information</h3>\n"
68 html "sessionId: $sessionId <br>\n"
69 html "sessionParms: $sessionParms <br>\n"
70 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
71 html $e {: } $env($e) {<br>} \n
73 html "form: " [wform] " <br>\n"
74 html "target: " $host " <br>\n"
75 html "databases: " $hist($setNo,database) " <br>\n"
76 html "selected: " [wform base] " <br>\n"
77 html "setNo: " $setNo " <br>\n"
78 html "nextSetNo: " $nextSetNo " <br>\n"
83 proc buttons {setNo setMax startPos after} {
89 if {!$useIcons && $after && $setMax < [z39.$setNo resultCount]} {
92 html {<a href="http:} $env(SCRIPT_NAME)
93 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
94 html + [expr $setMax + $hist($setNo,maxPresent)]
95 html {"><img src="/gif/darrw.gif"></a>}
101 html {<img src="/gif/button-egw.gif">}
103 if {$setMax < [z39.$setNo resultCount]} {
104 html {<a href="http:} $env(SCRIPT_NAME)
105 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
106 html + [expr $setMax + $hist($setNo,maxPresent)]
108 html {"><img src="/gif/button-next-records.gif" border=0></a>}
110 html {">Next records</a>} " | \n"
113 if {$startPos != "" && $startPos != "1"} {
114 html {<a href="http:} $env(SCRIPT_NAME)
115 html / $sessionId {/search.egw/} $setNo
116 html + [expr $startPos - $hist($setNo,maxPresent)]
117 html + [expr $startPos - 1]
119 html {"><img src="/gif/button-previous-records.gif" border=0></a>}
121 html {">Previous records</a>} " | \n"
124 html {<a href="http:} $env(SCRIPT_NAME)
125 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
127 html {"><img src="/gif/button-new-query.gif" border=0></a>}
129 html {">New query</a>} " | \n"
132 html {<a href="http:} $env(SCRIPT_NAME)
133 html / $sessionId {/targets.egw}
135 html {"><img src="/gif/button-new-target.gif" border=0></a>}
137 html {">New target</a>}
140 if {!$useIcons && !$after && $startPos != "" && $startPos != "1"} {
142 html {<a href="http:} $env(SCRIPT_NAME)
143 html / $sessionId {/search.egw/} $setNo
144 html + [expr $startPos - $hist($setNo,maxPresent)]
145 html + [expr $startPos - 1]
146 html {"><img src="/gif/uarrw.gif"></a>}
147 html "</center><p>\n"
152 if {[info commands saveState] == ""} {
160 set setNo [lindex $sessionParms 0]
162 if {[wform menu1] != ""} {
163 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
164 set hist($nextSetNo,host) $hist($setNo,host)
166 if {$nextSetNo == $setNo} {
170 catch {unset hist($setNo,hits)}
172 if {[wform submit] == "Scan"} {
176 set query [build-query $hist($setNo,host) 3]
177 if {"x$query" == "x"} {
178 html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
179 displayError "Empty query" \
180 "You must specify at least one search word"
181 html "</body></html>\n"
184 set hist($setNo,query) $query
186 set hist($setNo,form,menu1) [wform menu1]
187 set hist($setNo,form,menu2) [wform menu2]
188 set hist($setNo,form,menu3) [wform menu3]
190 set hist($setNo,form,entry1) [wform entry1]
191 set hist($setNo,form,entry2) [wform entry2]
192 set hist($setNo,form,entry3) [wform entry3]
194 set hist($setNo,form,logic1) [wform logic1]
195 set hist($setNo,form,logic2) [wform logic2]
197 set host $hist($setNo,host)
198 set databases [lindex $targets($host) 1]
201 if {[wform baseall] != ""} {
202 set hist($setNo,database) $databases
203 } elseif {$b == ""} {
204 set hist($setNo,database) $databases
206 set hist($setNo,database) $b
208 set hist($setNo,maxPresent) [wform hits]
209 if {$hist($setNo,maxPresent) == ""} {
210 set hist($setNo,maxPresent) 30
213 set host $hist($setNo,host)
214 set databases [lindex $targets($host) 1]
216 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
217 html "</head><body>\n"
219 set startPos [lindex $sessionParms 1]
220 set endPos [lindex $sessionParms 2]
223 if {$startPos == ""} {
224 if {[z39search $setNo 1 0 B] != "1"} {
227 set r [z39.$setNo resultCount]
228 html "<h3> Search result $r hits</h3>\n"
230 set setOffset [z39.$setNo numberOfRecordsReturned]
231 display-rec 1 $setOffset display-brief 0
233 set setMax [z39.$setNo resultCount]
234 if {$setMax > $hist($setNo,maxPresent)} {
235 set setMax $hist($setNo,maxPresent)
238 if {[z39search $setNo 0 0 B] != "1"} {
241 set r [z39.$setNo resultCount]
242 set setOffset $startPos
243 set setMax [z39.$setNo resultCount]
244 if {$setMax > $endPos} {
248 buttons $setNo $setMax $startPos 0
250 html "<h3> Search result $r hits</h3>\n"
254 z39present $setNo 0 $setOffset $setMax display-brief B
257 buttons $setNo $setMax $startPos 1
262 html "<h3>Debug information</h3>\n"
263 html "sessionId: $sessionId <br>\n"
264 html "sessionParms: $sessionParms <br>\n"
265 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
266 html $e {: } $env($e) {<br>} \n
268 html "form: " [wform] " <br>\n"
269 html "target: " $host " <br>\n"
270 html "databases: " $hist($setNo,database) " <br>\n"
271 html "selected: " [wform base] " <br>\n"
272 html "query: --" $hist($setNo,query) "-- <br>"
273 html "setNo: " $setNo " <br>\n"
274 html "nextSetNo: " $nextSetNo " <br>\n"