3 <title> WWW/Z39.50 Gateway Query Form</title>
7 # $Id: query.egw,v 1.19 1995/12/20 16:31:31 adam Exp $
9 if {[info commands saveState] == ""} {
13 proc fail-response {} {
27 set host [lindex $sessionParms 0]
29 if {[catch {set setNo $nextSetNo}]} {
33 if {[catch {set oldHost [z39 connect]}]} {
37 set hist($setNo,host) $host
38 set hist($setNo,idAuthentication) [lindex $targets($host) 3]
40 if {[catch {z39 failback fail-response}]} {
44 html {<h2><img src="/gif/button-egw.gif" border=0 align=middle>}
45 html " Search in " [lindex $targets($host) 0] "</h2>\n"
47 z39 callback ok-response
48 z39 failback fail-response
49 if {$host != $oldHost} {
50 catch {z39 disconnect}
53 if {[catch {z39 connect $host}]} {
54 displayError "Cannot connect to target ${host}" {}
55 html "</body></html>\n"
58 } elseif {$sessionWait == 0} {
59 if {[catch {zwait sessionWait 30}]} {
60 displayError "Cannot connect to target ${host}" {}
61 html "</body></html>\n"
65 if {$sessionWait != 1} {
66 displayError "Cannot connect to target ${host}" {}
67 html "</body></html>\n"
73 z39 idAuthentication $hist($setNo,idAuthentication)
74 if {[catch {z39 init}]} {
75 displayError "Cannot initialize target ${host}" {}
76 html "</body></html>\n"
79 if {[catch {zwait sessionWait 60}]} {
80 displayError "Cannot initialize target ${host}" {}
81 html "</body></html>\n"
84 if {$sessionWait != "1"} {
85 displayError "Cannot initialize target ${host}" {}
86 htmlr "</body></html>\n"
89 if {![z39 initResult]} {
90 displayError "Connection rejected by target ${host}" \
91 [z39 userInformationField]
93 htmlr "</body></html>"
97 set databases [lindex $targets($host) 1]
99 if {$setNo > 1 && $hist([expr $setNo - 1],host) == $host} {
100 set oSetNo [expr $setNo - 1]
101 set databaseDefault $hist($oSetNo,database)
103 set databaseDefault [lindex $databases 0]
107 html {<form action="http:} $env(SCRIPT_NAME)
108 html / $sessionId {/search.egw/} $setNo {" method=post>} \n
109 set nodb [llength $databases]
112 html "The chosen target supports searching in "
113 html "several databases. <br>\n"
114 html "Choose the bases you want to search: <br>\n"
117 foreach d $databases {
118 html {<input type="checkbox" name="base" value="} $d
119 if {[lsearch $databaseDefault $d] == -1} {
122 html {" checked> } $d \n
127 html {<input type="checkbox" name="baseall" value="}
128 html [concat $databases] {"> All <br>} \n
130 html "Input your search criteria:<br>\n"
134 set fields [lindex $targets($host) 2]
135 for {set no 1} {$no < 4} {incr no} {
136 html {<select name="menu} $no {">} \n
138 html {<option> } $hist($oSetNo,form,menu$no) \n
141 set name [lindex $f 0]
143 if {$hist($oSetNo,form,menu$no) == $name} continue
145 html {<option> } $name \n
148 html {<input type="text" name="entry} $no {"}
151 html {<select name="logic} $no {">} \n
153 html "<option> " $hist($oSetNo,form,logic$no) \n
155 foreach op {And Or {And not}} {
157 if {$hist($oSetNo,form,logic$no) == $op} continue
159 html "<option> " $op \n
167 <input type=submit value="Search"><input type=reset value="Reset">
170 html {Number of records to display in the result set list: }
171 html {<input type="text" name="hits" value="}
173 html $hist($oSetNo,maxPresent)
184 html {<img src="/gif/button-egw.gif" border=0></a>}
185 html {<a href="http:} $env(SCRIPT_NAME)
186 html / $sessionId {/targets.egw}
187 html {"><img src="/gif/button-new-target.gif" border=0></a>}
191 This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
192 Last modified 29. september 1995. <br>
193 <em> This and the following pages are under construction
194 and will continue to be so until the end of December 1995.</em>
198 html "<h3>Debug information</h3>\n"
199 html "sessionId: $sessionId <br>\n"
200 html "sessionParms: $sessionParms <br>\n"
201 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
202 html $e {: } $env($e) {<br>} \n
204 html "form: " [wform] " <br>\n"
205 html "target: " $host " <br>\n"
206 html "databases: " $databases " <br>\n"
207 html "setNo: " $setNo " <br>\n"
208 html "nextSetNo: " $nextSetNo " <br>\n"