Lots of changes. They aren't visible though.
[egate.git] / www / msearch.egw
1 <html>
2 {
3 # $Id: msearch.egw,v 1.16 1996/03/07 12:46:08 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 {[egw_form menu1] != ""} {
20         set hist($nextSetNo,0,host) $hist($setNo,0,host)
21         for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
22             set hist($nextSetNo,$i,host) $hist($setNo,$i,host)
23             set hist($nextSetNo,$i,database) $hist($setNo,$i,database)
24             set hist($nextSetNo,$i,idAuthentication) \
25                 $hist($setNo,$i,idAuthentication) 
26         }
27         set setNo $nextSetNo
28         incr nextSetNo
29
30         for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
31             set hist($setNo,$i,query) [build-query $hist($setNo,$i,host) 3]
32         }
33         set hist($setNo,maxPresent) [egw_form hits]
34         if {$hist($setNo,maxPresent) == ""} {
35             set hist($setNo,maxPresent) 20
36         }
37     }
38
39     set useIcons 1
40     button-europagate
41     button-new-query 1 $setNo
42     button-new-target 0
43
44     html "<br>\n"
45     z39msearch $setNo B 1 $hist($setNo,maxPresent) 1
46
47     html "<dl>\n"
48     set not $hist($setNo,0,host)
49     for {set i 1} {$i <= $not} {incr i} {
50         if {$zstatus($i) != 2} continue
51         html "<dt><h3>" [lindex $targets($hist($setNo,$i,host)) 0] ": "
52         set status [z39$i.$setNo responseStatus]
53         if {[lindex $status 0] == "NSD"} {
54             z39$i.$setNo nextResultSetPosition 0
55             set code [lindex $status 1]
56             set msg [lindex $status 2]
57             set addinfo [lindex $status 3]
58             html "Error</h3>\n<dd>NSD$code: $msg: $addinfo"
59         } else {
60             set r [z39$i.$setNo resultCount]
61             html "$r hits</h3>\n<dd>\n<ul>\n"
62
63             if {$hist($setNo,$i,offset) > $hist($setNo,maxPresent)} {
64                 display-rec 1 $hist($setNo,maxPresent) display-brief $setNo $i
65             } else {
66                 display-rec 1 $hist($setNo,$i,offset) display-brief $setNo $i
67             }
68             html "</ul>"
69         }
70         html "\n"
71     }
72     html "</dl>\n"
73
74     set useIcons 0
75     button-europagate
76     button-new-query 1 $setNo
77     button-new-target 0
78 }
79
80 {
81     if {!$debug} return
82     html "<hr>\n"
83     html "<h3>Debug information</h3>\n"
84     html "sessionId: $sessionId <br>\n"
85     html "sessionParms: $sessionParms <br>\n"
86     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
87         html $e {: } $env($e) {<br>} \n
88     }
89     html "form: " [egw_form] " <br>\n"
90     html "target: " $host " <br>\n"
91     html "query: --" $hist($setNo,1,query) "-- <br>\n"
92     html "database: " $hist($setNo,1,database) "<br>\n"
93     html "setNo: " $setNo " <br>\n"
94     html "nextSetNo: " $nextSetNo " <br>\n"
95 }
96
97 </body>
98 </html>