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