3 <title> WWW/Z39.50 Gateway Query Form</title>
7 # $Id: query.egw,v 1.16 1995/11/13 18:17:47 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> Search in " [lindex $targets($host) 0] "</h2>\n"
46 z39 callback ok-response
47 z39 failback fail-response
48 if {$host != $oldHost} {
49 catch {z39 disconnect}
52 if {[catch {z39 connect $host}]} {
53 displayError "Cannot connect to target ${host}" {}
54 html "</body></html>\n"
57 } elseif {$sessionWait == 0} {
58 if {[catch {zwait sessionWait 30}]} {
59 displayError "Cannot connect to target ${host}" {}
60 html "</body></html>\n"
64 if {$sessionWait != 1} {
65 displayError "Cannot connect to target ${host}" {}
66 html "</body></html>\n"
72 z39 idAuthentication $hist($setNo,idAuthentication)
73 if {[catch {z39 init}]} {
74 displayError "Cannot initialize target ${host}" {}
75 html "</body></html>\n"
78 if {[catch {zwait sessionWait 60}]} {
79 displayError "Cannot initialize target ${host}" {}
80 html "</body></html>\n"
83 if {$sessionWait != "1"} {
84 displayError "Cannot initialize target ${host}" {}
85 htmlr "</body></html>\n"
88 if {![z39 initResult]} {
89 displayError "Connection rejected by target ${host}" \
90 [z39 userInformationField]
92 htmlr "</body></html>"
96 set databases [lindex $targets($host) 1]
98 if {$setNo > 1 && $hist([expr $setNo - 1],host) == $host} {
99 set oSetNo [expr $setNo - 1]
100 set databaseDefault $hist($oSetNo,database)
102 set databaseDefault [lindex $databases 0]
106 html {<form action="http:} $env(SCRIPT_NAME)
107 html / $sessionId {/search.egw/} $setNo {" method=post>} \n
108 set nodb [llength $databases]
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"
116 foreach d $databases {
117 html {<input type="checkbox" name="base" value="} $d
118 if {[lsearch $databaseDefault $d] == -1} {
121 html {" checked> } $d \n
126 html {<input type="checkbox" name="base" value="}
127 html [concat $databases] {"> All <br>} \n
132 <h3>Input your search criteria: </h3> <br>
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 Alternatively you can enter your query in
168 <a href="http://www.dtv.dk/ccl.html"> CCL </a> here: <br>
169 <input type=text name="cclentry" size=52> <br>
171 <input type=submit value="Search"><input type=reset value="Reset">
172 <h3> Various technical parameters: </h3> <br>
174 html {Max hits: <input type="text" name="hits" value="}
176 html $hist($oSetNo,maxPresent)
182 Records are shown in:
183 <select name="format">
185 <option> Medium format
186 <option> Short format
193 This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
194 Last modified 29. september 1995. <br>
195 <em> This and the following pages are under construction
196 and will continue to be so until the end of December 1995.</em>
200 html {<a href="http:} $env(SCRIPT_NAME)
201 html / $sessionId {/targets.egw"> New target </a>}
205 html "<h3>Debug information</h3>\n"
206 html "sessionId: $sessionId <br>\n"
207 html "sessionParms: $sessionParms <br>\n"
208 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
209 html $e {: } $env($e) {<br>} \n
211 html "form: " [wform] " <br>\n"
212 html "target: " $host " <br>\n"
213 html "databases: " $databases " <br>\n"
214 html "setNo: " $setNo " <br>\n"
215 html "nextSetNo: " $nextSetNo " <br>\n"