Work on search in multiple targets.
[egate.git] / www / msearch.egw
1 <html>
2 {
3 # $Id: msearch.egw,v 1.1 1995/11/07 14:56:58 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     if {[wform menu1] == ""} {
15         set setNo [lindex $sessionParms 0]
16     } else {
17         if {![info exists hist($nextSetNo,0,host)]} {
18             set hist($nextSetNo,0,host) $hist($setNo,0,host)
19             for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
20                 set hist($nextSetNo,$i,host) $hist($setNo,$i,host)
21                 set hist($nextSetNo,$i,database) $hist($setNo,$i,database)
22             }
23         }
24         set setNo $nextSetNo
25         incr nextSetNo
26
27         for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
28             set hist($setNo,$i,query) [build-query $hist($setNo,$i,host)]
29         }
30         set hist($setNo,maxPresent) [wform hits]
31         if {$hist($setNo,maxPresent) == ""} {
32             set hist($setNo,maxPresent) 30
33         }
34     }
35     html "<head><title> WWW/Z39.50 Gateway Search </title>\n"
36     html "</head><body>\n"
37
38     z39msearch $setNo 1
39
40     html "<dl>\n"
41     set not $hist($setNo,0,host)
42     for {set i 1} {$i <= $not} {incr i} {
43         if {$zstatus($i) != 2} continue
44         html "<dt> " $hist($setNo,$i,host) ": "
45         set status [z39$i.$setNo responseStatus]
46         if {[lindex $status 0] == "NSD"} {
47             z39$i.$setNo nextResultSetPosition 0
48             set code [lindex $status 1]
49             set msg [lindex $status 2]
50             set addinfo [lindex $status 3]
51             html "Error\n<dd>NSD$code: $msg: $addinfo"
52         } else {
53             set r [z39$i.$setNo resultCount]
54             html "$r hits\n<dd>\n"
55
56             display-rec 1 $hist($setNo,$i,offset) display-brief z39$i
57         }
58         html "\n"
59     }
60     html "</dl>\n"
61 }
62
63
64 <hr>
65 {
66     html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
67     html / $sessionId {/mtargets.egw"> New target </a>} " | \n"
68     html {<a href="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
69     html / $sessionId {/mquery.egw/} $host + $setNo {"> New query </a>}
70 }
71
72 {
73     html "<hr>\n"
74     html "<h3>Debug information</h3>\n"
75     html "sessionId: $sessionId <br>\n"
76     html "sessionParms: $sessionParms <br>\n"
77     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
78         html $e {: } $env($e) {<br>} \n
79     }
80     html "form: " [wform] " <br>\n"
81     html "target: " $host " <br>\n"
82     html "query: --" $hist($setNo,1,query) "-- <br>"
83     html "setNo: " $setNo " <br>\n"
84     html "nextSetNo: " $nextSetNo " <br>\n"
85 }
86
87 </body>
88 </html>