3 # $Id: search.egw,v 1.21 1996/01/02 10:52:28 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 host $hist($setNo,host)
31 html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
32 html "</head><body>\n"
34 if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
37 display-scan $setNo $scanNo 0
40 html "<h3>Debug information</h3>\n"
41 html "sessionId: $sessionId <br>\n"
42 html "sessionParms: $sessionParms <br>\n"
43 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
44 html $e {: } $env($e) {<br>} \n
46 html "form: " [wform] " <br>\n"
47 html "target: " $host " <br>\n"
48 html "databases: " $hist($setNo,database) " <br>\n"
49 html "selected: " [wform base] " <br>\n"
50 html "setNo: " $setNo " <br>\n"
51 html "nextSetNo: " $nextSetNo " <br>\n"
56 proc buttons {setNo setMax startPos after} {
62 if {!$useIcons && $after && $setMax < [z39.$setNo resultCount]} {
65 html {<a href="http:} $env(SCRIPT_NAME)
66 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
67 html + [expr $setMax + $hist($setNo,maxPresent)]
68 html {"><img src="/gif/darrw.gif"></a>}
74 html {<img src="/gif/button-egw.gif" alt="Europagate" border=0>}
76 if {$setMax < [z39.$setNo resultCount]} {
77 html {<a href="http:} $env(SCRIPT_NAME)
78 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
79 html + [expr $setMax + $hist($setNo,maxPresent)]
81 html {"><img src="/gif/button-next-records.gif" alt="Next Records"}
84 html {">Next Records</a>} " | \n"
87 if {$startPos != "" && $startPos != "1"} {
88 html {<a href="http:} $env(SCRIPT_NAME)
89 html / $sessionId {/search.egw/} $setNo
90 html + [expr $startPos - $hist($setNo,maxPresent)]
91 html + [expr $startPos - 1]
93 html {"><img src="/gif/button-previous-records.gif" }
94 html {alt="Previous Records" border=0></a>}
96 html {">Previous Records</a>} " | \n"
99 html {<a href="http:} $env(SCRIPT_NAME)
100 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
102 html {"><img src="/gif/button-new-query.gif" }
103 html {alt="New Query" border=0></a>}
105 html {">New Query</a>} " | \n"
108 html {<a href="http:} $env(SCRIPT_NAME)
109 html / $sessionId {/targets.egw}
111 html {"><img src="/gif/button-new-target.gif" }
112 html {alt="New Target" border=0></a>}
114 html {">New Target</a>}
117 if {!$useIcons && !$after && $startPos != "" && $startPos != "1"} {
119 html {<a href="http:} $env(SCRIPT_NAME)
120 html / $sessionId {/search.egw/} $setNo
121 html + [expr $startPos - $hist($setNo,maxPresent)]
122 html + [expr $startPos - 1]
123 html {"><img src="/gif/uarrw.gif"></a>}
124 html "</center><p>\n"
129 if {[info commands saveState] == ""} {
137 set setNo [lindex $sessionParms 0]
139 if {[wform menu1] != ""} {
140 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
141 set hist($nextSetNo,host) $hist($setNo,host)
143 if {$nextSetNo == $setNo} {
147 catch {unset hist($setNo,hits)}
149 set hist($setNo,form,menu1) [wform menu1]
150 set hist($setNo,form,menu2) [wform menu2]
151 set hist($setNo,form,menu3) [wform menu3]
153 set hist($setNo,form,entry1) [wform entry1]
154 set hist($setNo,form,entry2) [wform entry2]
155 set hist($setNo,form,entry3) [wform entry3]
157 set hist($setNo,form,logic1) [wform logic1]
158 set hist($setNo,form,logic2) [wform logic2]
160 set host $hist($setNo,host)
161 set databases [lindex $targets($host) 1]
164 if {[wform baseall] != ""} {
165 set hist($setNo,database) $databases
166 } elseif {$b == ""} {
167 set hist($setNo,database) $databases
169 set hist($setNo,database) $b
171 set hist($setNo,maxPresent) [wform hits]
172 if {$hist($setNo,maxPresent) == ""} {
173 set hist($setNo,maxPresent) 30
176 if {[wform submit] == "Scan"} {
180 set query [build-query $hist($setNo,host) 3]
181 if {"x$query" == "x"} {
182 html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
183 displayError "Empty query" \
184 "You must specify at least one search word"
185 html "</body></html>\n"
188 set hist($setNo,query) $query
190 set host $hist($setNo,host)
192 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
193 html "</head><body>\n"
195 set startPos [lindex $sessionParms 1]
196 set endPos [lindex $sessionParms 2]
199 if {$startPos == ""} {
200 if {[z39search $setNo 1 0 B] != "1"} {
203 set r [z39.$setNo resultCount]
204 html "<h3> Search result $r hits</h3>\n"
206 set setOffset [z39.$setNo numberOfRecordsReturned]
207 display-rec 1 $setOffset display-brief 0
209 set setMax [z39.$setNo resultCount]
210 if {$setMax > $hist($setNo,maxPresent)} {
211 set setMax $hist($setNo,maxPresent)
214 if {[z39search $setNo 0 0 B] != "1"} {
217 set r [z39.$setNo resultCount]
218 set setOffset $startPos
219 set setMax [z39.$setNo resultCount]
220 if {$setMax > $endPos} {
224 buttons $setNo $setMax $startPos 0
226 html "<h3> Search result $r hits</h3>\n"
230 z39present $setNo 0 $setOffset $setMax display-brief B
233 buttons $setNo $setMax $startPos 1
238 html "<h3>Debug information</h3>\n"
239 html "sessionId: $sessionId <br>\n"
240 html "sessionParms: $sessionParms <br>\n"
241 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
242 html $e {: } $env($e) {<br>} \n
244 html "form: " [wform] " <br>\n"
245 html "target: " $host " <br>\n"
246 html "databases: " $hist($setNo,database) " <br>\n"
247 html "selected: " [wform base] " <br>\n"
248 html "query: --" $hist($setNo,query) "-- <br>"
249 html "setNo: " $setNo " <br>\n"
250 html "nextSetNo: " $nextSetNo " <br>\n"