Work on WAIS protocol.
[egate.git] / www / msearch.egw
1 <html>
2 {
3 # $Id: msearch.egw,v 1.19 1996/03/12 16:30:26 adam Exp $
4
5     if {[info commands saveState] == ""} {
6         source z39util.tcl
7     }
8     global sessionWait
9     global nextSetNo
10     global setNo
11     global hist
12     global zstatus
13
14     html "<head><title> WWW/Z39.50 Gateway Search </title>\n"
15     html "</head><body>\n"
16
17     set setNo [lindex $sessionParms 0]
18
19     if {[llength [egw_form]] > 0} {
20         if {[string length [egw_form host]] > 0} {
21             set hist($setNo,0,host) [llength [egw_form host]]
22             set i 1
23             foreach t [egw_form host] {
24                 set hist($setNo,$i,host) $t
25                 set hist($setNo,$i,database) [splitDatabaseSpec $t]
26                 set hist($setNo,$i,idAuthentication) {}
27                 incr i
28             }
29         }
30         if {![info exists hist($setNo,0,host)]} {
31             displayError {No servers selected} {}
32             egw_abort
33         }
34         set hist($nextSetNo,0,host) $hist($setNo,0,host)
35         for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
36             set hist($nextSetNo,$i,host) $hist($setNo,$i,host)
37             set hist($nextSetNo,$i,database) $hist($setNo,$i,database)
38             set hist($nextSetNo,$i,idAuthentication) \
39                 $hist($setNo,$i,idAuthentication) 
40         }
41         set setNo $nextSetNo
42         incr nextSetNo
43
44         for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
45             set hist($setNo,$i,query) [build-query $hist($setNo,$i,host) 3]
46         }
47
48         set hist($setNo,form,menu1) [egw_form menu1]
49         set hist($setNo,form,menu2) [egw_form menu2]
50         set hist($setNo,form,menu3) [egw_form menu3]
51
52         set hist($setNo,form,entry1) [egw_form entry1]
53         set hist($setNo,form,entry2) [egw_form entry2]
54         set hist($setNo,form,entry3) [egw_form entry3]
55
56         set hist($setNo,form,logic1) [egw_form logic1]
57         set hist($setNo,form,logic2) [egw_form logic2]
58         set hist($setNo,form,logic3) {}
59         
60         set hist($setNo,maxPresent) [egw_form hits]
61         if {$hist($setNo,maxPresent) == ""} {
62             set hist($setNo,maxPresent) 20
63         }
64         set hist($setNo,format) [egw_form format]
65         if {![string length $hist($setNo,format)]} {
66             set hist($setNo,format) brief
67         }
68         set hist($setNo,sort) [egw_form sort]
69         if {![string length $hist($setNo,sort)]} {
70             set hist($setNo,sort) server
71         }
72     }
73
74     set useIcons 1
75     button-main
76     button-new-query 1 $setNo
77     button-new-target 0
78
79     html "<br>\n"
80     z39msearch $setNo B 1 $hist($setNo,maxPresent) 1
81
82     display-result-set-m $setNo
83
84     set useIcons 0
85     button-main
86     button-new-query 1 $setNo
87     button-new-target 0
88 }
89
90 {
91     if {!$debug} return
92     html "<hr>\n"
93     html "<h3>Debug information</h3>\n"
94     html "sessionId: $sessionId <br>\n"
95     html "sessionParms: $sessionParms <br>\n"
96     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
97         html $e {: } $env($e) {<br>} \n
98     }
99     html "form: " [egw_form] " <br>\n"
100     html "query: --" $hist($setNo,1,query) "-- <br>\n"
101     html "database: " $hist($setNo,1,database) "<br>\n"
102     html "sort: " $hist($setNo,sort) "<br>\n"
103     html "format: " $hist($setNo,format) "<br>\n"
104     html "setNo: " $setNo " <br>\n"
105     html "nextSetNo: " $nextSetNo " <br>\n"
106 }
107
108 </body>
109 </html>