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