3 <title> WWW/Z39.50 Gateway Query Form</title>
7 # $Id: query.egw,v 1.35 1996/03/07 12:46:08 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 [lrange $sessionParms 3 end]
32 if {[catch {set setNo $nextSetNo}]} {
36 if {[catch {set oldHost [z390 connect]}]} {
40 set hist($setNo,0,host) $host
41 set hist($setNo,0,idAuthentication) [lindex $targets($host) 3]
45 z390 callback ok-response
46 z390 failback fail-response
47 set thisHost [splitHostSpec $host]
48 if {[string compare $thisHost $oldHost]} {
49 catch {z390 disconnect}
52 if {[catch {z390 connect $thisHost}]} {
53 displayError "Cannot connect to target ${thisHost}" {}
54 html "</body></html>\n"
57 } elseif {$sessionWait == 0} {
58 if {[catch {egw_wait sessionWait 35}]} {
59 displayError "Cannot connect to target ${thisHost}" {}
60 html "</body></html>\n"
64 if {$sessionWait != 1} {
65 displayError "Cannot connect to target ${thisHost}" {}
66 html "</body></html>\n"
72 z390 idAuthentication $hist($setNo,0,idAuthentication)
73 if {[catch {z390 init}]} {
74 displayError "Cannot initialize target ${thisHost}" {}
75 html "</body></html>\n"
78 if {$sessionWait == 0 && [catch {egw_wait sessionWait 60}]} {
79 displayError "Cannot initialize target ${thisHost}" {}
80 html "</body></html>\n"
83 if {$sessionWait != "1"} {
84 displayError "Cannot initialize target ${thisHost}" {}
85 html "</body></html>\n"
88 if {![z390 initResult]} {
89 displayError "Connection rejected by target ${thisHost}" \
90 [z390 userInformationField]
92 html "</body></html>\n"
100 if {[lsearch [z390 options] scan] >= 0} {
101 button-scan-window 1 $setNo
103 button-view-history 0
105 html "<h2>" [lindex $targets($host) 0] "</h2><br>\n"
107 html [lindex $targets($host) 4] "<br>\n"
109 set databases [lindex $targets($host) 1]
111 if {$initSet == ""} {
112 set databaseDefault [lindex $databases 0]
116 set databaseDefault $hist($oSetNo,0,database)
119 html {<form action="http:} $env(SCRIPT_NAME)
120 html / $sessionId {/search.egw/} $setNo + 0 {" method=get>} \n
121 set nodb [llength $databases]
124 html "The chosen target supports searching in "
125 html "several databases. <br>\n"
126 html "Choose the bases you want to search: <br>\n"
129 foreach d $databases {
130 html {<input type="checkbox" name="base" value="} $d
131 if {[lsearch $databaseDefault $d] == -1} {
134 html {" checked> } $d \n
139 html {<input type="checkbox" name="baseall" value="}
140 html [concat $databases] {"> All <br>} \n
143 html "Input your search criteria:<br>\n"
144 set fields [lindex $targets($host) 2]
145 for {set no 1} {$no < 4} {incr no} {
146 html {<select name="menu} $no {">} \n
149 set template [join $hist($oSetNo,form,menu$no)]
151 if {[string length $template] > 0} {
152 html {<option> } $template "\n"
155 set name [lindex $f 0]
156 if {$template == $name} continue
157 html {<option> } $name \n
160 html {<input type="text" name="entry} $no {"}
162 if {$scanLine == $no} {
163 set template [join $scanTerm " "]
164 } elseif {[info exists hist($oSetNo,form,entry$no)]} {
165 set template [join $hist($oSetNo,form,entry$no) " "]
167 if {[string length $template] > 0} {
168 html { value="} $template {"}
171 if {0 && [lsearch [z390 options] scan] >= 0} {
172 html {<input type="checkbox" name="scan} $no {" value="1" scan>}
175 html {<select name="logic} $no {">} \n
178 set template [join $hist($oSetNo,form,logic$no) " "]
180 if {[string length $template] > 0} {
181 html "<option> " $template \n
183 foreach op {And Or {And not}} {
184 if {$template == $op} continue
185 html "<option> " [join $op " "] \n
193 <input type=submit name=submit value="Search">
194 <input type=reset value="Reset">
197 html {Number of records to display in the result set list: }
198 html {<input type="text" name="hits" value="}
200 html $hist($oSetNo,maxPresent)
211 if {[lsearch [z390 options] scan] >= 0} {
212 button-scan-window 1 $setNo
214 button-view-history 0
222 html "<h3>Debug information</h3>\n"
223 html "sessionId: $sessionId <br>\n"
224 html "sessionParms: $sessionParms <br>\n"
225 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
226 html $e {: } $env($e) {<br>} \n
228 html "form: " [egw_form] " <br>\n"
229 html "target: " $host " <br>\n"
230 html "databases: " $databases " <br>\n"
231 html "setNo: " $setNo " <br>\n"
232 html "nextSetNo: " $nextSetNo " <br>\n"
233 html "initSet: " $initSet " <br>\n"
234 html "scanLine: " $scanLine " <br>\n"
235 html "scanTerm: " $scanTerm " <br>\n"