Major revision. Single-target result set can be reached from the
[egate.git] / www / msearch.egw
1 <html>
2 {
3 # $Id: msearch.egw,v 1.20 1996/03/13 14:07:29 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,scan) 0
49
50         set hist($setNo,form,menu1) [egw_form menu1]
51         set hist($setNo,form,menu2) [egw_form menu2]
52         set hist($setNo,form,menu3) [egw_form menu3]
53
54         set hist($setNo,form,entry1) [egw_form entry1]
55         set hist($setNo,form,entry2) [egw_form entry2]
56         set hist($setNo,form,entry3) [egw_form entry3]
57
58         set hist($setNo,form,logic1) [egw_form logic1]
59         set hist($setNo,form,logic2) [egw_form logic2]
60         set hist($setNo,form,logic3) {}
61         
62         set hist($setNo,maxPresent) [egw_form hits]
63         if {$hist($setNo,maxPresent) == ""} {
64             set hist($setNo,maxPresent) 20
65         }
66         set hist($setNo,format) [egw_form format]
67         if {![string length $hist($setNo,format)]} {
68             set hist($setNo,format) brief
69         }
70         set hist($setNo,sort) [egw_form sort]
71         if {![string length $hist($setNo,sort)]} {
72             set hist($setNo,sort) server
73         }
74     }
75
76     set useIcons 1
77     button-main
78     button-new-query $setNo
79     button-view-history
80     button-new-target
81
82     html "<br>\n"
83     z39msearch $setNo B 1 $hist($setNo,maxPresent) 1
84
85     display-result-set-m $setNo
86
87     set useIcons 0
88     button-main
89     button-new-query $setNo
90     button-view-history
91     button-new-target
92 }
93
94 {
95     if {!$debug} return
96     html "<hr>\n"
97     html "<h3>Debug information</h3>\n"
98     html "sessionId: $sessionId <br>\n"
99     html "sessionParms: $sessionParms <br>\n"
100     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
101         html $e {: } $env($e) {<br>} \n
102     }
103     html "form: " [egw_form] " <br>\n"
104     html "query: --" $hist($setNo,1,query) "-- <br>\n"
105     html "database: " $hist($setNo,1,database) "<br>\n"
106     html "sort: " $hist($setNo,sort) "<br>\n"
107     html "format: " $hist($setNo,format) "<br>\n"
108     html "setNo: " $setNo " <br>\n"
109     html "nextSetNo: " $nextSetNo " <br>\n"
110 }
111
112 </body>
113 </html>