3 <title> WWW/Z39.50 Gateway Query Form</title>
7 # $Id: query.egw,v 1.27 1996/01/12 10:03:17 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 html "<h2>Search in " [lindex $targets($host) 0] "</h2>\n"
48 z39 callback ok-response
49 z39 failback fail-response
50 if {$host != $oldHost} {
51 catch {z39 disconnect}
54 if {[catch {z39 connect $host}]} {
55 displayError "Cannot connect to target ${host}" {}
56 html "</body></html>\n"
59 } elseif {$sessionWait == 0} {
60 if {[catch {zwait sessionWait 35}]} {
61 displayError "Cannot connect to target ${host}" {}
62 html "</body></html>\n"
66 if {$sessionWait != 1} {
67 displayError "Cannot connect to target ${host}" {}
68 html "</body></html>\n"
74 z39 idAuthentication $hist($setNo,idAuthentication)
75 if {[catch {z39 init}]} {
76 displayError "Cannot initialize target ${host}" {}
77 html "</body></html>\n"
80 if {[catch {zwait sessionWait 60}]} {
81 displayError "Cannot initialize target ${host}" {}
82 html "</body></html>\n"
85 if {$sessionWait != "1"} {
86 displayError "Cannot initialize target ${host}" {}
87 htmlr "</body></html>\n"
90 if {![z39 initResult]} {
91 displayError "Connection rejected by target ${host}" \
92 [z39 userInformationField]
94 htmlr "</body></html>"
98 set databases [lindex $targets($host) 1]
100 if {$initSet == ""} {
101 set databaseDefault [lindex $databases 0]
105 set databaseDefault $hist($oSetNo,database)
108 html {<form action="http:} $env(SCRIPT_NAME)
109 html / $sessionId {/search.egw/} $setNo {" method=get>} \n
110 set nodb [llength $databases]
113 html "The chosen target supports searching in "
114 html "several databases. <br>\n"
115 html "Choose the bases you want to search: <br>\n"
118 foreach d $databases {
119 html {<input type="checkbox" name="base" value="} $d
120 if {[lsearch $databaseDefault $d] == -1} {
123 html {" checked> } $d \n
128 html {<input type="checkbox" name="baseall" value="}
129 html [concat $databases] {"> All <br>} \n
131 html "Input your search criteria:<br>\n"
133 set fields [lindex $targets($host) 2]
134 for {set no 1} {$no < 4} {incr no} {
135 html {<select name="menu} $no {">} \n
138 set template [join $hist($oSetNo,form,menu$no)]
140 if {[string length $template] > 0} {
141 html {<option> } $template "\n"
144 set name [lindex $f 0]
145 if {$template == $name} continue
146 html {<option> } $name \n
149 html {<input type="text" name="entry} $no {"}
151 if {$scanLine == $no} {
152 set template [join $scanTerm " "]
153 } elseif {[info exists hist($oSetNo,form,entry$no)]} {
154 set template [join $hist($oSetNo,form,entry$no) " "]
156 if {[string length $template] > 0} {
157 html { value="} $template {"}
160 if {[lsearch [z39 options] scan] >= 0} {
161 html {<input type="checkbox" name="scan} $no {" value="1" scan>}
165 html {<select name="logic} $no {">} \n
168 set template [join $hist($oSetNo,form,logic$no) " "]
170 if {[string length $template] > 0} {
171 html "<option> " $template \n
173 foreach op {And Or {And not}} {
174 if {$template == $op} continue
175 html "<option> " [join $op " "] \n
183 <input type=submit name=submit value="Search">
184 <input type=reset value="Reset">
187 html {Number of records to display in the result set list: }
188 html {<input type="text" name="hits" value="}
190 html $hist($oSetNo,maxPresent)
203 button-view-history 0
211 html "<h3>Debug information</h3>\n"
212 html "sessionId: $sessionId <br>\n"
213 html "sessionParms: $sessionParms <br>\n"
214 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
215 html $e {: } $env($e) {<br>} \n
217 html "form: " [wform] " <br>\n"
218 html "target: " $host " <br>\n"
219 html "databases: " $databases " <br>\n"
220 html "setNo: " $setNo " <br>\n"
221 html "nextSetNo: " $nextSetNo " <br>\n"
222 html "initSet: " $initSet " <br>\n"
223 html "scanLine: " $scanLine " <br>\n"
224 html "scanTerm: " $scanTerm " <br>\n"