New function zwait that waits for a variable change - due to i/o events
[egate.git] / www / query.egw
1 <html>
2 <head>
3 <title> WWW/Z39.50 Gateway Query Form</title>
4 </head>
5 <body>
6 {
7 # $Id: query.egw,v 1.4 1995/10/30 17:35:17 adam Exp $
8 proc fail-response {} {
9     global sessionWait
10     set sessionWait -1
11 }
12
13 proc init-response {} {
14     global sessionWait
15     set sessionWait 1
16 }
17
18     set t $sessionParms
19     set databases [lindex $targets($t) 1]
20     set sessionWait 0
21     ir z39
22     z39 failback fail-response
23     if {[catch {z39 connect $t}]} {
24         htmlr "Cannot connect to target $t <br>"
25         htmlr "</body></html>"
26         return
27     }        
28     z39 callback init-response
29     z39 init
30     zwait sessionWait
31     if {$sessionWait == -1} {
32         htmlr "Cannot initialize with target $t <br>"
33         htmlr "</body></html>"
34         return
35     }
36     htmlr {
37         <h2> Search in databases </h2>
38         <h1> <blink> Not Functional Yet </blink> </h1>
39     }
40     html {<form action="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
41     htmlr / $sessionId {/search.egw" method=post>}
42     set nodb [llength $databases]
43     if {$nodb > 1} {
44         if {$nodb > 2} {
45             html {The chosen target supports searching in }
46             htmlr {several databases. <br>}
47             htmlr {Choose the bases you want to search: <br>}
48         }
49         set i 0
50         foreach d $databases {
51             html {<input type="checkbox" name="base" value="} $d 
52             if {[incr i] > 1} {
53                 htmlr {"> } $d
54             } else {
55                 htmlr {" checked> } $d
56             }
57         }
58         htmlr {<br>}
59         if {$nodb > 2} {
60             html {<input type="checkbox" name="base" value="} 
61             htmlr [concat $databases] {"> All <br>}
62         }
63     }
64     htmlr {<hr>}
65     htmlr {<strong>Input your search criteria: </strong> <br>}
66     set fields [lindex $targets($t) 2]
67     for {set no 1} {$no < 4} {incr no} {
68         htmlr {<select name="menu} $no {">}
69         foreach f $fields {
70             htmlr {<option> } [lindex $f 0]
71         }
72         htmlr </select>
73         htmlr {<input type="text" name="entry} $no {" size=30>}
74         if {$no < 3} {
75             htmlr {<select name="logic} $no {">}
76             htmlr {<option> And}
77             htmlr {<option> Or}
78             htmlr {<option> And not}
79             htmlr {</select>}
80         }
81         htmlr <br>
82     }
83     html {<hr><p>
84      Alternatively you can enter your query
85      in <a href="ccl.html"> CCL </a> here: <br>
86      <input type=text name="cclentry" size=60> <br>
87      <hr>
88      <strong> Various technical parameters: </strong> <br>
89       Max hits: <input type="text" name="hits" value="50" size=3>
90       Records are shown in:
91      <select name="format">
92      <option> Long format
93      <option> Medium format
94      <option> Short format
95      <option> Raw MARC
96      </select>
97      <br>
98      <p>
99      <input type="submit" value="Send Query">
100      </form>
101      <hr>
102      This page is maintained by
103       <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
104      Last modified 29. september 1995. <br>
105      <em> This and the following pages are under construction
106      and will continue to be so until the end of December 1995.</em>
107      <hr>
108     }
109     htmlr {sessionId: } $sessionId { <br>}
110     htmlr {sessionParms: } $sessionParms { <br>}
111     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
112         htmlr $e {: } $env($e) {<br>}
113     }
114     htmlr {form: } [form] {<br>}
115     htmlr {target: } $t { <br>}
116     htmlr {databases: } $databases { <br>}
117     htmlr {</body></html>}
118 }