3 # $Id: search.egw,v 1.16 1995/11/13 18:17:48 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"
68 set query [build-query $hist($setNo,host)]
69 if {"x$query" == "x"} {
70 html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
71 displayError "Empty query" \
72 "You must specify at least one search word"
73 html "</body></html>\n"
76 set hist($setNo,query) $query
78 set hist($setNo,form,menu1) [wform menu1]
79 set hist($setNo,form,menu2) [wform menu2]
80 set hist($setNo,form,menu3) [wform menu3]
82 set hist($setNo,form,entry1) [wform entry1]
83 set hist($setNo,form,entry2) [wform entry2]
84 set hist($setNo,form,entry3) [wform entry3]
86 set hist($setNo,form,logic1) [wform logic1]
87 set hist($setNo,form,logic2) [wform logic2]
92 set hist($setNo,database) $databases
94 set hist($setNo,database) $b
96 set hist($setNo,maxPresent) [wform hits]
97 if {$hist($setNo,maxPresent) == ""} {
98 set hist($setNo,maxPresent) 30
101 set host $hist($setNo,host)
102 set databases [lindex $targets($host) 1]
104 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
105 html "</head><body>\n"
107 set startPos [lindex $sessionParms 1]
108 set endPos [lindex $sessionParms 2]
111 if {$startPos == ""} {
112 if {[z39search $setNo 1 0 B] != "1"} {
115 set r [z39.$setNo resultCount]
116 html "<h2> Search result $r hits</h2>\n"
118 set setOffset [z39.$setNo numberOfRecordsReturned]
119 display-rec 1 $setOffset display-brief 0
121 set setMax [z39.$setNo resultCount]
122 if {$setMax > $hist($setNo,maxPresent)} {
123 set setMax $hist($setNo,maxPresent)
126 if {[z39search $setNo 0 0 B] != "1"} {
129 set r [z39.$setNo resultCount]
130 html "<h2> Search result $r hits</h2>\n"
132 set setOffset $startPos
133 set setMax [z39.$setNo resultCount]
134 if {$setMax > $endPos} {
138 buttons $setNo $setMax $startPos 0
142 z39present $setNo 0 $setOffset $setMax display-brief B
145 buttons $setNo $setMax $startPos 1
150 html "<h3>Debug information</h3>\n"
151 html "sessionId: $sessionId <br>\n"
152 html "sessionParms: $sessionParms <br>\n"
153 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
154 html $e {: } $env($e) {<br>} \n
156 html "form: " [wform] " <br>\n"
157 html "target: " $host " <br>\n"
158 html "databases: " $hist($setNo,database) " <br>\n"
159 html "selected: " [wform base] " <br>\n"
160 html "query: --" $hist($setNo,query) "-- <br>"
161 html "setNo: " $setNo " <br>\n"
162 html "nextSetNo: " $nextSetNo " <br>\n"