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