New function zwait that waits for a variable change - due to i/o events
[egate.git] / www / search.egw
1 <html>
2 {
3 # $Id: search.egw,v 1.3 1995/10/30 17:35:18 adam Exp $
4
5 proc search-response {} {
6     global sessionWait
7     set sessionWait 1
8 }
9
10 proc fail-response {} {
11     global sessionWait
12     set sessionWait -1
13 }
14
15     global sessionWait
16     z39 callback search-response
17     z39 failback fail-response
18     set sessionWait 0
19     ir-set z39.1 z39
20     z39.1 databaseNames [form base]
21     z39.1 search [form entry1]
22     htmlr {<head><title> WWW/Z39.50 Gateway Search } $t { </title>}
23     htmlr {</head><body>}
24     htmlr {sessionId: } $sessionId {<br>}
25     htmlr {sessionParms: } $sessionParms {<br>}
26     htmlr {form: } [form] { <br>}
27     htmlr {databases: } $databases { <br>}
28     zwait sessionWait
29     if {$sessionWait == 1} {
30          set r [z39.1 resultCount]
31          htmlr {<strong> } $r { hits</strong><br>}
32          htmlr {</body></html>}
33     } else {
34         set status [z39.1 searchStatus]
35         set msg [lindex $status 2]
36         set addinfo [lindex $status 3]
37         html {<strong>Search fail: } $msg
38         if ($msg != ""} {
39             html {,} $addinfo
40         }
41         htmlr {</strong><br>}
42     }
43