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