3 # $Id: search.egw,v 1.12 1995/11/09 15:24:36 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>} "<p>\n"
33 if {[info commands saveState] == ""} {
41 if {[wform menu1] == ""} {
42 set setNo [lindex $sessionParms 0]
44 if {![info exists hist($nextSetNo,host)]} {
45 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
46 set hist($nextSetNo,host) $hist($setNo,host)
49 html "using host " $hist($setNo,host) " <br\n"
52 set hist($setNo,query) [build-query $hist($setNo,host)]
55 set hist($setNo,database) $databases
57 set hist($setNo,database) $b
59 set hist($setNo,maxPresent) [wform hits]
60 if {$hist($setNo,maxPresent) == ""} {
61 set hist($setNo,maxPresent) 30
64 set host $hist($setNo,host)
65 set databases [lindex $targets($host) 1]
67 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
68 html "</head><body>\n"
70 set startPos [lindex $sessionParms 1]
71 set endPos [lindex $sessionParms 2]
74 if {$startPos == ""} {
75 if {[z39search $setNo 1] != "1"} {
78 set r [z39.$setNo resultCount]
79 html "<h2> Search result $r hits</h2>\n"
81 set setOffset [z39.$setNo numberOfRecordsReturned]
82 display-rec 1 $setOffset display-brief z39
84 set setMax [z39.$setNo resultCount]
85 if {$setMax > $hist($setNo,maxPresent)} {
86 set setMax $hist($setNo,maxPresent)
89 if {[z39search $setNo 0] != "1"} {
92 set r [z39.$setNo resultCount]
93 html "<h2> Search result $r hits</h2>\n"
95 set setOffset $startPos
96 set setMax [z39.$setNo resultCount]
97 if {$setMax > $endPos} {
101 buttons $setNo $setMax $startPos
105 z39present $setNo $setOffset $setMax display-brief
108 buttons $setNo $setMax $startPos
113 html "<h3>Debug information</h3>\n"
114 html "sessionId: $sessionId <br>\n"
115 html "sessionParms: $sessionParms <br>\n"
116 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
117 html $e {: } $env($e) {<br>} \n
119 html "form: " [wform] " <br>\n"
120 html "target: " $host " <br>\n"
121 html "databases: " $hist($setNo,database) " <br>\n"
122 html "selected: " [wform base] " <br>\n"
123 html "query: --" $hist($setNo,query) "-- <br>"
124 html "setNo: " $setNo " <br>\n"
125 html "nextSetNo: " $nextSetNo " <br>\n"