3 # $Id: search.egw,v 1.15 1995/11/13 15:41:44 adam Exp $
5 proc buttons {setNo setMax startPos after} {
10 if {$after && $setMax < [z39.$setNo resultCount]} {
13 html {<a href="http:} $env(SCRIPT_NAME)
14 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
15 html + [expr $setMax + $hist($setNo,maxPresent)]
16 html {"><img src="/gif/darrw.gif"></a>}
21 if {$setMax < [z39.$setNo resultCount]} {
22 html {<a href="http:} $env(SCRIPT_NAME)
23 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
24 html + [expr $setMax + $hist($setNo,maxPresent)]
25 html {">Next records</a>} " | \n"
27 if {$startPos != "" && $startPos != "1"} {
28 html {<a href="http:} $env(SCRIPT_NAME)
29 html / $sessionId {/search.egw/} $setNo
30 html + [expr $startPos - $hist($setNo,maxPresent)]
31 html + [expr $startPos - 1]
32 html {">Previous records</a>} " | \n"
34 html {<a href="http:} $env(SCRIPT_NAME)
35 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
36 html {">New query</a>} " | \n"
38 html {<a href="http:} $env(SCRIPT_NAME)
39 html / $sessionId {/targets.egw">New target</a>} "<p>\n"
41 if {!$after && $startPos != "" && $startPos != "1"} {
43 html {<a href="http:} $env(SCRIPT_NAME)
44 html / $sessionId {/search.egw/} $setNo
45 html + [expr $startPos - $hist($setNo,maxPresent)]
46 html + [expr $startPos - 1]
47 html {"><img src="/gif/uarrw.gif"></a>}
53 if {[info commands saveState] == ""} {
61 set setNo [lindex $sessionParms 0]
62 if {[wform menu1] != ""} {
63 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
64 set hist($nextSetNo,host) $hist($setNo,host)
66 html "using host " $hist($setNo,host) " <br\n"
69 set hist($setNo,query) [build-query $hist($setNo,host)]
72 set hist($setNo,database) $databases
74 set hist($setNo,database) $b
76 set hist($setNo,maxPresent) [wform hits]
77 if {$hist($setNo,maxPresent) == ""} {
78 set hist($setNo,maxPresent) 30
81 set host $hist($setNo,host)
82 set databases [lindex $targets($host) 1]
84 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
85 html "</head><body>\n"
87 set startPos [lindex $sessionParms 1]
88 set endPos [lindex $sessionParms 2]
91 if {$startPos == ""} {
92 if {[z39search $setNo 1 0 B] != "1"} {
95 set r [z39.$setNo resultCount]
96 html "<h2> Search result $r hits</h2>\n"
98 set setOffset [z39.$setNo numberOfRecordsReturned]
99 display-rec 1 $setOffset display-brief 0
101 set setMax [z39.$setNo resultCount]
102 if {$setMax > $hist($setNo,maxPresent)} {
103 set setMax $hist($setNo,maxPresent)
106 if {[z39search $setNo 0 0 B] != "1"} {
109 set r [z39.$setNo resultCount]
110 html "<h2> Search result $r hits</h2>\n"
112 set setOffset $startPos
113 set setMax [z39.$setNo resultCount]
114 if {$setMax > $endPos} {
118 buttons $setNo $setMax $startPos 0
122 z39present $setNo 0 $setOffset $setMax display-brief B
125 buttons $setNo $setMax $startPos 1
130 html "<h3>Debug information</h3>\n"
131 html "sessionId: $sessionId <br>\n"
132 html "sessionParms: $sessionParms <br>\n"
133 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
134 html $e {: } $env($e) {<br>} \n
136 html "form: " [wform] " <br>\n"
137 html "target: " $host " <br>\n"
138 html "databases: " $hist($setNo,database) " <br>\n"
139 html "selected: " [wform base] " <br>\n"
140 html "query: --" $hist($setNo,query) "-- <br>"
141 html "setNo: " $setNo " <br>\n"
142 html "nextSetNo: " $nextSetNo " <br>\n"