3 # $Id: search.egw,v 1.14 1995/11/10 14:47:32 adam Exp $
5 proc buttons {setNo setMax startPos} {
11 if {$setMax < [z39.$setNo resultCount]} {
12 html {<a href="http:} $env(SCRIPT_NAME)
13 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
14 html + [expr $setMax + $hist($setNo,maxPresent)]
15 html {">Next records</a>} " | \n"
17 if {$startPos != "" && $startPos != "1"} {
18 html {<a href="http:} $env(SCRIPT_NAME)
19 html / $sessionId {/search.egw/} $setNo
20 if {[expr $startPos - $hist($setNo,maxPresent)] > 1} {
21 html + [expr $startPos - $hist($setNo,maxPresent)]
22 html + [expr $startPos - 1]
24 html {">Previous records</a>} " | \n"
26 html {<a href="http:} $env(SCRIPT_NAME)
27 html / $sessionId {/targets.egw">New target</a>} " | \n"
28 html {<a href="http:} $env(SCRIPT_NAME)
29 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
30 html {">New query</a>} "\n<p>\n"
33 if {[info commands saveState] == ""} {
41 set setNo [lindex $sessionParms 0]
42 if {[wform menu1] != ""} {
43 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
44 set hist($nextSetNo,host) $hist($setNo,host)
46 html "using host " $hist($setNo,host) " <br\n"
49 set hist($setNo,query) [build-query $hist($setNo,host)]
52 set hist($setNo,database) $databases
54 set hist($setNo,database) $b
56 set hist($setNo,maxPresent) [wform hits]
57 if {$hist($setNo,maxPresent) == ""} {
58 set hist($setNo,maxPresent) 30
61 set host $hist($setNo,host)
62 set databases [lindex $targets($host) 1]
64 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
65 html "</head><body>\n"
67 set startPos [lindex $sessionParms 1]
68 set endPos [lindex $sessionParms 2]
71 if {$startPos == ""} {
72 if {[z39search $setNo 1 0] != "1"} {
75 set r [z39.$setNo resultCount]
76 html "<h2> Search result $r hits</h2>\n"
78 set setOffset [z39.$setNo numberOfRecordsReturned]
79 display-rec 1 $setOffset display-brief 0
81 set setMax [z39.$setNo resultCount]
82 if {$setMax > $hist($setNo,maxPresent)} {
83 set setMax $hist($setNo,maxPresent)
86 if {[z39search $setNo 0 0] != "1"} {
89 set r [z39.$setNo resultCount]
90 html "<h2> Search result $r hits</h2>\n"
92 set setOffset $startPos
93 set setMax [z39.$setNo resultCount]
94 if {$setMax > $endPos} {
98 buttons $setNo $setMax $startPos
102 z39present $setNo 0 $setOffset $setMax display-brief
105 buttons $setNo $setMax $startPos
110 html "<h3>Debug information</h3>\n"
111 html "sessionId: $sessionId <br>\n"
112 html "sessionParms: $sessionParms <br>\n"
113 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
114 html $e {: } $env($e) {<br>} \n
116 html "form: " [wform] " <br>\n"
117 html "target: " $host " <br>\n"
118 html "databases: " $hist($setNo,database) " <br>\n"
119 html "selected: " [wform base] " <br>\n"
120 html "query: --" $hist($setNo,query) "-- <br>"
121 html "setNo: " $setNo " <br>\n"
122 html "nextSetNo: " $nextSetNo " <br>\n"