3 <title> WWW/Z39.50 Gateway Query Form</title>
7 # $Id: query.egw,v 1.33 1996/02/21 16:57:38 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 [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 z39 callback ok-response
48 z39 failback fail-response
49 set thisHost [splitHostSpec $host]
50 if {[string compare $thisHost $oldHost]} {
51 catch {z39 disconnect}
54 if {[catch {z39 connect $thisHost}]} {
55 displayError "Cannot connect to target ${thisHost}" {}
56 html "</body></html>\n"
59 } elseif {$sessionWait == 0} {
60 if {[catch {egw_wait sessionWait 35}]} {
61 displayError "Cannot connect to target ${thisHost}" {}
62 html "</body></html>\n"
66 if {$sessionWait != 1} {
67 displayError "Cannot connect to target ${thisHost}" {}
68 html "</body></html>\n"
74 z39 idAuthentication $hist($setNo,idAuthentication)
75 if {[catch {z39 init}]} {
76 displayError "Cannot initialize target ${thisHost}" {}
77 html "</body></html>\n"
80 if {[catch {egw_wait sessionWait 60}]} {
81 displayError "Cannot initialize target ${thisHost}" {}
82 html "</body></html>\n"
85 if {$sessionWait != "1"} {
86 displayError "Cannot initialize target ${thisHost}" {}
87 html "</body></html>\n"
90 if {![z39 initResult]} {
91 displayError "Connection rejected by target ${thisHost}" \
92 [z39 userInformationField]
94 html "</body></html>\n"
102 if {[lsearch [z39 options] scan] >= 0} {
103 button-scan-window 1 $setNo
105 button-view-history 0
107 html "<h2>" [lindex $targets($host) 0] "</h2><br>\n"
109 html [lindex $targets($host) 4] "<br>\n"
111 set databases [lindex $targets($host) 1]
113 if {$initSet == ""} {
114 set databaseDefault [lindex $databases 0]
118 set databaseDefault $hist($oSetNo,database)
121 html {<form action="http:} $env(SCRIPT_NAME)
122 html / $sessionId {/search.egw/} $setNo {" method=get>} \n
123 set nodb [llength $databases]
126 html "The chosen target supports searching in "
127 html "several databases. <br>\n"
128 html "Choose the bases you want to search: <br>\n"
131 foreach d $databases {
132 html {<input type="checkbox" name="base" value="} $d
133 if {[lsearch $databaseDefault $d] == -1} {
136 html {" checked> } $d \n
141 html {<input type="checkbox" name="baseall" value="}
142 html [concat $databases] {"> All <br>} \n
145 html "Input your search criteria:<br>\n"
146 set fields [lindex $targets($host) 2]
147 for {set no 1} {$no < 4} {incr no} {
148 html {<select name="menu} $no {">} \n
151 set template [join $hist($oSetNo,form,menu$no)]
153 if {[string length $template] > 0} {
154 html {<option> } $template "\n"
157 set name [lindex $f 0]
158 if {$template == $name} continue
159 html {<option> } $name \n
162 html {<input type="text" name="entry} $no {"}
164 if {$scanLine == $no} {
165 set template [join $scanTerm " "]
166 } elseif {[info exists hist($oSetNo,form,entry$no)]} {
167 set template [join $hist($oSetNo,form,entry$no) " "]
169 if {[string length $template] > 0} {
170 html { value="} $template {"}
173 if {0 && [lsearch [z39 options] scan] >= 0} {
174 html {<input type="checkbox" name="scan} $no {" value="1" scan>}
177 html {<select name="logic} $no {">} \n
180 set template [join $hist($oSetNo,form,logic$no) " "]
182 if {[string length $template] > 0} {
183 html "<option> " $template \n
185 foreach op {And Or {And not}} {
186 if {$template == $op} continue
187 html "<option> " [join $op " "] \n
195 <input type=submit name=submit value="Search">
196 <input type=reset value="Reset">
199 html {Number of records to display in the result set list: }
200 html {<input type="text" name="hits" value="}
202 html $hist($oSetNo,maxPresent)
213 if {[lsearch [z39 options] scan] >= 0} {
214 button-scan-window 1 $setNo
216 button-view-history 0
224 html "<h3>Debug information</h3>\n"
225 html "sessionId: $sessionId <br>\n"
226 html "sessionParms: $sessionParms <br>\n"
227 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
228 html $e {: } $env($e) {<br>} \n
230 html "form: " [egw_form] " <br>\n"
231 html "target: " $host " <br>\n"
232 html "databases: " $databases " <br>\n"
233 html "setNo: " $setNo " <br>\n"
234 html "nextSetNo: " $nextSetNo " <br>\n"
235 html "initSet: " $initSet " <br>\n"
236 html "scanLine: " $scanLine " <br>\n"
237 html "scanTerm: " $scanTerm " <br>\n"