Added descriptive text field in target info.
[egate.git] / www / query.egw
1 <html>
2 <head>
3 <title> WWW/Z39.50 Gateway Query Form</title>
4 </head>
5 <body>
6 {
7 # $Id: query.egw,v 1.10 1995/11/08 12:42:17 adam Exp $
8
9     if {[info commands saveState] == ""} {
10         source z39util.tcl
11     }
12
13 proc fail-response {} {
14     global sessionWait
15     set sessionWait -1
16 }
17
18 proc ok-response {} {
19     global sessionWait
20     set sessionWait 1
21 }
22
23     global setNo
24     global nextSetNo
25     global hist
26
27     set host [lindex $sessionParms 0]
28
29     if {[info exists setNo]} {
30         set oldHost $hist($setNo,host)
31     } else {
32         set oldHost ""
33     }
34     if {[catch {set setNo $nextSetNo}]} {
35         set nextSetNo 1
36         set setNo 1
37     }
38     set hist($setNo,host) $host
39     set hist($setNo,idAuthentication) [lindex $targets($host) 3]
40
41     if {[catch {z39 failback fail-response}]} {
42         ir z39
43     }
44
45     html "<h2> Search in " [lindex $targets($host) 0] "</h2>\n"
46
47     z39 callback ok-response
48     z39 failback fail-response
49     if {$host != $oldHost} {
50         catch {z39 disconnect}
51
52         set sessionWait 0
53         if {[catch {z39 connect $host}]} {
54             html "Cannot connect to target ${host} <br>\n" 
55             html "</body></html>\n"
56             wabort
57         } elseif {$sessionWait == 0} {
58             zwait sessionWait
59             if {$sessionWait != 1} {
60                 html "Cannot connect to target ${host} <br>\n"
61                 html "</body></html>\n"
62                 wabort
63             }
64         }
65         set sessionWait 0
66         z39 idAuthentication $hist($setNo,idAuthentication)
67         if {[catch {z39 init}]} {
68             htmlr "Cannot initialize with target ${host} <br>"
69             htmlr "</body></html>"
70             wabort
71         }
72         zwait sessionWait
73         if {$sessionWait != "1"} {
74             htmlr "Cannot initialize with target ${host} <br>"
75             htmlr "</body></html>"
76             wabort
77         }
78     }
79     set databases [lindex $targets($host) 1]
80
81     html {<form action="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
82     html / $sessionId {/search.egw/} $setNo {" method=post>} \n
83     set nodb [llength $databases]
84     if {$nodb > 1} {
85         if {$nodb > 2} {
86             html "The chosen target supports searching in "
87             html "several databases. <br>\n"
88             html "Choose the bases you want to search: <br>\n"
89         }
90         set i 0
91         foreach d $databases {
92             html {<input type="checkbox" name="base" value="} $d 
93             if {[incr i] > 1} {
94                 html {"> } $d \n
95             } else {
96                 html {" checked> } $d \n
97             }
98         }
99         html "<br>\n"
100         if {$nodb > 2} {
101             html {<input type="checkbox" name="base" value="} 
102             html [concat $databases] {"> All <br>} \n
103         }
104     }
105 }
106 <hr>
107 <h3>Input your search criteria: </h3> <br>
108 {
109     set fields [lindex $targets($host) 2]
110     for {set no 1} {$no < 4} {incr no} {
111         html {<select name="menu} $no {">} \n
112         foreach f $fields {
113             html {<option> } [lindex $f 0] \n
114         }
115         html "</select>\n"
116         html {<input type="text" name="entry} $no {" size=30>} \n
117         if {$no < 3} {
118             html {<select name="logic} $no {">} \n
119             html "<option> And\n"
120             html "<option> Or\n"
121             html "<option> And not\n"
122             html "</select>\n"
123         }
124         html "<br>\n"
125     }
126 }
127 <hr><p>
128 Alternatively you can enter your query in
129 <a href="ccl.html"> CCL </a> here: <br>
130 <input type=text name="cclentry" size=52> <br>
131 <hr>
132 <h3> Various technical parameters: </h3> <br>
133 Max hits: <input type="text" name="hits" value="10" size=3>
134 Records are shown in:
135 <select name="format">
136 <option> Long format
137 <option> Medium format
138 <option> Short format
139 <option> Raw MARC
140 </select>
141 <br>
142 <p>
143 <input type="submit" value="Send Query">
144 </form>
145 <hr>
146 This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
147 Last modified 29. september 1995. <br>
148 <em> This and the following pages are under construction
149 and will continue to be so until the end of December 1995.</em>
150 <hr>
151
152 {
153     html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
154     html / $sessionId {/targets.egw"> New target </a>}
155 }
156 {
157     html "<hr>\n"
158     html "<h3>Debug information</h3>\n"
159     html "sessionId: $sessionId <br>\n"
160     html "sessionParms: $sessionParms <br>\n"
161     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
162         html $e {: } $env($e) {<br>} \n
163     }
164     html "form: " [wform] " <br>\n"
165     html "target: " $host " <br>\n"
166     html "databases: " $databases " <br>\n"
167     html "setNo: " $setNo " <br>\n"
168     html "nextSetNo: " $nextSetNo " <br>\n"
169 }
170 </body></html>
171
172