Bug fixes and select on FIFOs in wcgi - doesn't really work!
[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.8 1995/11/02 16:35:36 adam Exp $
8 proc fail-response {} {
9     global sessionWait
10     set sessionWait -1
11 }
12
13 proc ok-response {} {
14     global sessionWait
15     set sessionWait 1
16 }
17
18     global setNo
19     global nextSetNo
20     global hist
21
22     set host [lindex $sessionParms 0]
23
24     if {[info exists setNo]} {
25         set oldHost $hist($setNo,host)
26     } else {
27         set oldHost ""
28     }
29     if {[catch {set setNo $nextSetNo}]} {
30         set nextSetNo 1
31         set setNo 1
32     }
33     set hist($setNo,host) $host
34
35     if {[catch {z39 failback fail-response}]} {
36         ir z39
37     }
38     z39 callback ok-response
39     z39 failback fail-response
40     if {$host != $oldHost} {
41         catch {z39 disconnect}
42
43         html "Connecting to target " $host " <br>\n"
44         set sessionWait 0
45         if {[catch {z39 connect $host}]} {
46             html "Cannot connect to target ${host} <br>\n" 
47             html "</body></html>\n"
48             wabort
49         } elseif {$sessionWait == 0} {
50             zwait sessionWait
51             if {$sessionWait != 1} {
52                 html "Cannot connect to target ${host} <br>\n"
53                 html "</body></html>\n"
54                 wabort
55             }
56         }
57         set sessionWait 0
58         z39 init
59         zwait sessionWait
60         if {$sessionWait != "1"} {
61             htmlr "Cannot initialize with target ${host} <br>"
62             htmlr "</body></html>"
63             wabort
64         }
65     }
66     set databases [lindex $targets($host) 1]
67
68     html "<h2> Search in databases </h2>\n"
69     html {<form action="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
70     html / $sessionId {/search.egw/} $setNo {" method=post>} \n
71     set nodb [llength $databases]
72     if {$nodb > 1} {
73         if {$nodb > 2} {
74             html "The chosen target supports searching in "
75             html "several databases. <br>\n"
76             html "Choose the bases you want to search: <br>\n"
77         }
78         set i 0
79         foreach d $databases {
80             html {<input type="checkbox" name="base" value="} $d 
81             if {[incr i] > 1} {
82                 html {"> } $d \n
83             } else {
84                 html {" checked> } $d \n
85             }
86         }
87         html "<br>\n"
88         if {$nodb > 2} {
89             html {<input type="checkbox" name="base" value="} 
90             html [concat $databases] {"> All <br>} \n
91         }
92     }
93 }
94 <hr>
95 <strong>Input your search criteria: </strong> <br>
96 {
97     set fields [lindex $targets($host) 2]
98     for {set no 1} {$no < 4} {incr no} {
99         html {<select name="menu} $no {">} \n
100         foreach f $fields {
101             html {<option> } [lindex $f 0] \n
102         }
103         html "</select>\n"
104         html {<input type="text" name="entry} $no {" size=30>} \n
105         if {$no < 3} {
106             html {<select name="logic} $no {">} \n
107             html "<option> And\n"
108             html "<option> Or\n"
109             html "<option> And not\n"
110             html "</select>\n"
111         }
112         html "<br>\n"
113     }
114 }
115 <hr><p>
116 Alternatively you can enter your query in
117 <a href="ccl.html"> CCL </a> here: <br>
118 <input type=text name="cclentry" size=52> <br>
119 <hr>
120 <strong> Various technical parameters: </strong> <br>
121 Max hits: <input type="text" name="hits" value="10" size=3>
122 Records are shown in:
123 <select name="format">
124 <option> Long format
125 <option> Medium format
126 <option> Short format
127 <option> Raw MARC
128 </select>
129 <br>
130 <p>
131 <input type="submit" value="Send Query">
132 </form>
133 <hr>
134 This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
135 Last modified 29. september 1995. <br>
136 <em> This and the following pages are under construction
137 and will continue to be so until the end of December 1995.</em>
138 <hr>
139
140 {
141     html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
142     html / $sessionId {/targets.egw"> New target </a>}
143 }
144 {
145     html "<hr>\n"
146     html "<strong>Debug information</strong><br>\n"
147     html "sessionId: $sessionId <br>\n"
148     html "sessionParms: $sessionParms <br>\n"
149     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
150         html $e {: } $env($e) {<br>} \n
151     }
152     html "form: " [wform] " <br>\n"
153     html "target: " $host " <br>\n"
154     html "databases: " $databases " <br>\n"
155     html "setNo: " $setNo " <br>\n"
156     html "nextSetNo: " $nextSetNo " <br>\n"
157 }
158 </body></html>
159
160