3 # $Id: search.egw,v 1.11 1995/11/08 16:14:33 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)] {"> Next </a>} "| \n"
16 if {$startPos != "" && $startPos != "1"} {
17 html {<a href="http:} $env(SCRIPT_NAME)
18 html / $sessionId {/search.egw/} $setNo
19 if {[expr $startPos - $hist($setNo,maxPresent)] > 1} {
20 html + [expr $startPos - $hist($setNo,maxPresent)]
21 html + [expr $startPos - 1]
23 html {"> Prev </a>} "| \n"
25 html {<a href="http:} $env(SCRIPT_NAME)
26 html / $sessionId {/targets.egw"> New target </a>} " | \n"
27 html {<a href="http:} $env(SCRIPT_NAME)
28 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
29 html {"> New query </a>} "<p>\n"
32 if {[info commands saveState] == ""} {
40 if {[wform menu1] == ""} {
41 set setNo [lindex $sessionParms 0]
43 if {![info exists hist($nextSetNo,host)]} {
44 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
45 set hist($nextSetNo,host) $hist($setNo,host)
48 html "using host " $hist($setNo,host) " <br\n"
51 set hist($setNo,query) [build-query $hist($setNo,host)]
54 set hist($setNo,database) $databases
56 set hist($setNo,database) $b
58 set hist($setNo,maxPresent) [wform hits]
59 if {$hist($setNo,maxPresent) == ""} {
60 set hist($setNo,maxPresent) 30
63 set host $hist($setNo,host)
64 set databases [lindex $targets($host) 1]
66 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
67 html "</head><body>\n"
69 set startPos [lindex $sessionParms 1]
70 set endPos [lindex $sessionParms 2]
73 if {$startPos == ""} {
74 if {[z39search $setNo 1] != "1"} {
77 set r [z39.$setNo resultCount]
78 html "<h2> Search result $r hits</h2>\n"
80 set setOffset [z39.$setNo numberOfRecordsReturned]
81 display-rec 1 $setOffset display-brief z39
83 set setMax [z39.$setNo resultCount]
84 if {$setMax > $hist($setNo,maxPresent)} {
85 set setMax $hist($setNo,maxPresent)
88 if {[z39search $setNo 0] != "1"} {
91 set r [z39.$setNo resultCount]
92 html "<h2> Search result $r hits</h2>\n"
94 set setOffset $startPos
95 set setMax [z39.$setNo resultCount]
96 if {$setMax > $endPos} {
100 buttons $setNo $setMax $startPos
104 z39present $setNo $setOffset $setMax display-brief
107 buttons $setNo $setMax $startPos
112 html "<h3>Debug information</h3>\n"
113 html "sessionId: $sessionId <br>\n"
114 html "sessionParms: $sessionParms <br>\n"
115 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
116 html $e {: } $env($e) {<br>} \n
118 html "form: " [wform] " <br>\n"
119 html "target: " $host " <br>\n"
120 html "databases: " $hist($setNo,database) " <br>\n"
121 html "selected: " [wform base] " <br>\n"
122 html "query: --" $hist($setNo,query) "-- <br>"
123 html "setNo: " $setNo " <br>\n"
124 html "nextSetNo: " $nextSetNo " <br>\n"