3 <title> WWW/Z39.50 Gateway Query Form</title>
7 # $Id: query.egw,v 1.23 1996/01/03 08:59:41 adam Exp $
9 if {[info commands saveState] == ""} {
13 proc fail-response {} {
27 set host [lindex $sessionParms 0]
28 set initSet [lindex $sessionParms 1]
29 set scanLine [lindex $sessionParms 2]
30 set scanTerm [lindex $sessionParms 3]
32 if {[catch {set setNo $nextSetNo}]} {
36 if {[catch {set oldHost [z39 connect]}]} {
40 set hist($setNo,host) $host
41 set hist($setNo,idAuthentication) [lindex $targets($host) 3]
43 if {[catch {z39 failback fail-response}]} {
47 html "<h2>Search in " [lindex $targets($host) 0] "</h2>\n"
49 z39 callback ok-response
50 z39 failback fail-response
51 if {$host != $oldHost} {
52 catch {z39 disconnect}
55 if {[catch {z39 connect $host}]} {
56 displayError "Cannot connect to target ${host}" {}
57 html "</body></html>\n"
60 } elseif {$sessionWait == 0} {
61 if {[catch {zwait sessionWait 35}]} {
62 displayError "Cannot connect to target ${host}" {}
63 html "</body></html>\n"
67 if {$sessionWait != 1} {
68 displayError "Cannot connect to target ${host}" {}
69 html "</body></html>\n"
75 z39 idAuthentication $hist($setNo,idAuthentication)
76 if {[catch {z39 init}]} {
77 displayError "Cannot initialize target ${host}" {}
78 html "</body></html>\n"
81 if {[catch {zwait sessionWait 60}]} {
82 displayError "Cannot initialize target ${host}" {}
83 html "</body></html>\n"
86 if {$sessionWait != "1"} {
87 displayError "Cannot initialize target ${host}" {}
88 htmlr "</body></html>\n"
91 if {![z39 initResult]} {
92 displayError "Connection rejected by target ${host}" \
93 [z39 userInformationField]
95 htmlr "</body></html>"
99 set databases [lindex $targets($host) 1]
101 # if {[catch {set prevHost $hist([expr $setNo - 1],host)}]} {
102 # set databaseDefault [lindex $databases 0]
105 # set oSetNo [expr $setNo - 1]
106 # set databaseDefault $hist($oSetNo,database)
108 if {$initSet == ""} {
109 set databaseDefault [lindex $databases 0]
113 set databaseDefault $hist($oSetNo,database)
116 html {<form action="http:} $env(SCRIPT_NAME)
117 html / $sessionId {/search.egw/} $setNo {" method=post>} \n
118 set nodb [llength $databases]
121 html "The chosen target supports searching in "
122 html "several databases. <br>\n"
123 html "Choose the bases you want to search: <br>\n"
126 foreach d $databases {
127 html {<input type="checkbox" name="base" value="} $d
128 if {[lsearch $databaseDefault $d] == -1} {
131 html {" checked> } $d \n
136 html {<input type="checkbox" name="baseall" value="}
137 html [concat $databases] {"> All <br>} \n
139 html "Input your search criteria:<br>\n"
141 set fields [lindex $targets($host) 2]
142 for {set no 1} {$no < 4} {incr no} {
143 html {<select name="menu} $no {">} \n
145 html {<option> } $hist($oSetNo,form,menu$no) \n
148 set name [lindex $f 0]
150 if {$hist($oSetNo,form,menu$no) == $name} continue
152 html {<option> } $name \n
155 html {<input type="text" name="entry} $no {"}
156 if {$scanLine == $no} {
157 html { value="} $scanTerm {" }
160 html {<input type="checkbox" name="scan} $no {" value="1" scan>}
162 html {<select name="logic} $no {">} \n
164 html "<option> " $hist($oSetNo,form,logic$no) \n
166 foreach op {And Or {And not}} {
168 if {$hist($oSetNo,form,logic$no) == $op} continue
170 html "<option> " $op \n
178 <input type=submit name=submit value="Search">
179 <input type=reset value="Reset">
182 html {Number of records to display in the result set list: }
183 html {<input type="text" name="hits" value="}
185 html $hist($oSetNo,maxPresent)
195 html {<img src="/gif/button-egw.gif" alt="Europagate" border=0></a>}
196 html {<a href="http:} $env(SCRIPT_NAME)
197 html / $sessionId {/targets.egw}
198 html {"><img src="/gif/button-new-target.gif" alt="New Target" }
199 html {border=0 alt="New Target"></a>}
203 This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
204 Last modified 29. september 1995. <br>
205 <em> This and the following pages are under construction
206 and will continue to be so until the end of December 1995.</em>
210 html "<h3>Debug information</h3>\n"
211 html "sessionId: $sessionId <br>\n"
212 html "sessionParms: $sessionParms <br>\n"
213 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
214 html $e {: } $env($e) {<br>} \n
216 html "form: " [wform] " <br>\n"
217 html "target: " $host " <br>\n"
218 html "databases: " $databases " <br>\n"
219 html "setNo: " $setNo " <br>\n"
220 html "nextSetNo: " $nextSetNo " <br>\n"
221 html "initSet: " $initSet " <br>\n"
222 html "scanLine: " $scanLine " <br>\n"
223 html "scanTerm: " $scanTerm " <br>\n"