Temporary remove of ccl entry.
[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.18 1995/11/14 16:31:36 adam Exp $
8
9     if {[info commands saveState] == ""} {
10         source z39util.tcl
11     }
12
13 proc fail-response {} {
14     global sessionWait
15     set sessionWait -1
16 }
17
18 proc ok-response {} {
19     global sessionWait
20     set sessionWait 1
21 }
22
23     global setNo
24     global nextSetNo
25     global hist
26
27     set host [lindex $sessionParms 0]
28
29     if {[catch {set setNo $nextSetNo}]} {
30         set nextSetNo 1
31         set setNo 1
32     }
33     if {[catch {set oldHost [z39 connect]}]} {
34         set oldHost ""
35     }
36
37     set hist($setNo,host) $host
38     set hist($setNo,idAuthentication) [lindex $targets($host) 3]
39
40     if {[catch {z39 failback fail-response}]} {
41         ir z39
42     }
43
44     html "<h2> Search in " [lindex $targets($host) 0] "</h2>\n"
45
46     z39 callback ok-response
47     z39 failback fail-response
48     if {$host != $oldHost} {
49         catch {z39 disconnect}
50
51         set sessionWait 0
52         if {[catch {z39 connect $host}]} {
53             displayError "Cannot connect to target ${host}" {}
54             html "</body></html>\n"
55             z39 disconnect
56             wabort
57         } elseif {$sessionWait == 0} {
58             if {[catch {zwait sessionWait 30}]} {
59                 displayError "Cannot connect to target ${host}" {}
60                 html "</body></html>\n"
61                 z39 disconnect
62                 wabort
63             }
64             if {$sessionWait != 1} {
65                 displayError "Cannot connect to target ${host}" {}
66                 html "</body></html>\n"
67                 z39 disconnect
68                 wabort
69             }
70         }
71         set sessionWait 0
72         z39 idAuthentication $hist($setNo,idAuthentication)
73         if {[catch {z39 init}]} {
74             displayError "Cannot initialize target ${host}" {}
75             html "</body></html>\n"
76             wabort
77         }
78         if {[catch {zwait sessionWait 60}]} {
79             displayError "Cannot initialize target ${host}" {}
80             html "</body></html>\n"
81             wabort
82         }       
83         if {$sessionWait != "1"} {
84             displayError "Cannot initialize target ${host}" {}
85             htmlr "</body></html>\n"
86             wabort
87         }
88         if {![z39 initResult]} {
89             displayError "Connection rejected by target ${host}" \
90                  [z39 userInformationField]
91             z39 disconnect
92             htmlr "</body></html>"
93             wabort
94         }
95     }
96     set databases [lindex $targets($host) 1]
97
98     if {$setNo > 1 && $hist([expr $setNo - 1],host) == $host} {
99         set oSetNo [expr $setNo - 1]
100         set databaseDefault $hist($oSetNo,database)
101     } else {
102         set databaseDefault [lindex $databases 0]
103         set oSetNo 0
104     }
105
106     html {<form action="http:} $env(SCRIPT_NAME)
107     html / $sessionId {/search.egw/} $setNo {" method=post>} \n
108     set nodb [llength $databases]
109     if {$nodb > 1} {
110         if {$nodb > 2} {
111             html "The chosen target supports searching in "
112             html "several databases. <br>\n"
113             html "Choose the bases you want to search: <br>\n"
114         }
115         set i 0
116         foreach d $databases {
117             html {<input type="checkbox" name="base" value="} $d 
118             if {[lsearch $databaseDefault $d] == -1} {
119                 html {"> } $d \n
120             } else {
121                 html {" checked> } $d \n
122             }
123         }
124         html "<br>\n"
125         if {$nodb > 2} {
126             html {<input type="checkbox" name="baseall" value="} 
127             html [concat $databases] {"> All <br>} \n
128         }
129     }
130 }
131 <hr>
132 <h3>Input your search criteria: </h3> <br>
133 {
134     set fields [lindex $targets($host) 2]
135     for {set no 1} {$no < 4} {incr no} {
136         html {<select name="menu} $no {">} \n
137         if {$oSetNo > 0} {
138             html {<option> } $hist($oSetNo,form,menu$no) \n
139         }
140         foreach f $fields {
141             set name [lindex $f 0]
142             if {$oSetNo > 0} {
143                 if {$hist($oSetNo,form,menu$no) == $name} continue
144             }
145             html {<option> } $name \n
146         }
147         html "</select>\n"
148         html {<input type="text" name="entry} $no {"}
149         html { size=30>} \n
150         if {$no < 3} {
151             html {<select name="logic} $no {">} \n
152             if {$oSetNo > 0} {
153                 html "<option> " $hist($oSetNo,form,logic$no) \n
154             }
155             foreach op {And Or {And not}} {
156                 if {$oSetNo > 0} {
157                     if {$hist($oSetNo,form,logic$no) == $op} continue
158                 }
159                 html "<option> " $op \n
160             }
161             html "</select>\n"
162         }
163         html "<br>\n"
164     }
165 }
166
167 {
168     if {0} {
169     html {<hr><p>Alternatively you can enter your query in }
170     html {<a href="http://www.dtv.dk/ccl.html"> CCL </a> here: <br>}
171     html {<input type=text name="cclentry" size=52> <br>}
172     html "<hr>\n"
173     }
174 }
175 <input type=submit value="Search"><input type=reset value="Reset">
176 <h3> Various technical parameters: </h3> <br>
177 {
178     html {Max hits: <input type="text" name="hits" value="}
179     if {$oSetNo > 0} {
180         html $hist($oSetNo,maxPresent)
181     } else {
182         html 20
183     }
184     html {" size=3>}
185 }
186 Records are shown in:
187 <select name="format">
188 <option> Long format
189 <option> Medium format
190 <option> Short format
191 <option> Raw MARC
192 </select>
193 <br>
194 <p>
195 </form>
196 <hr>
197 This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
198 Last modified 29. september 1995. <br>
199 <em> This and the following pages are under construction
200 and will continue to be so until the end of December 1995.</em>
201 <hr>
202
203 {
204     html {<a href="http:} $env(SCRIPT_NAME)
205     html / $sessionId {/targets.egw"> New target </a>}
206 }
207 {
208     html "<hr>\n"
209     html "<h3>Debug information</h3>\n"
210     html "sessionId: $sessionId <br>\n"
211     html "sessionParms: $sessionParms <br>\n"
212     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
213         html $e {: } $env($e) {<br>} \n
214     }
215     html "form: " [wform] " <br>\n"
216     html "target: " $host " <br>\n"
217     html "databases: " $databases " <br>\n"
218     html "setNo: " $setNo " <br>\n"
219     html "nextSetNo: " $nextSetNo " <br>\n"
220 }
221 </body></html>
222
223