3 # $Id: search.egw,v 1.18 1995/12/20 16:31:31 adam Exp $
5 proc buttons {setNo setMax startPos after} {
11 if {!$useIcons && $after && $setMax < [z39.$setNo resultCount]} {
14 html {<a href="http:} $env(SCRIPT_NAME)
15 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
16 html + [expr $setMax + $hist($setNo,maxPresent)]
17 html {"><img src="/gif/darrw.gif"></a>}
23 html {<img src="/gif/button-egw.gif">}
25 if {$setMax < [z39.$setNo resultCount]} {
26 html {<a href="http:} $env(SCRIPT_NAME)
27 html / $sessionId {/search.egw/} $setNo + [expr $setMax + 1]
28 html + [expr $setMax + $hist($setNo,maxPresent)]
30 html {"><img src="/gif/button-next-records.gif" border=0></a>}
32 html {">Next records</a>} " | \n"
35 if {$startPos != "" && $startPos != "1"} {
36 html {<a href="http:} $env(SCRIPT_NAME)
37 html / $sessionId {/search.egw/} $setNo
38 html + [expr $startPos - $hist($setNo,maxPresent)]
39 html + [expr $startPos - 1]
41 html {"><img src="/gif/button-previous-records.gif" border=0></a>}
43 html {">Previous records</a>} " | \n"
46 html {<a href="http:} $env(SCRIPT_NAME)
47 html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo
49 html {"><img src="/gif/button-new-query.gif" border=0></a>}
51 html {">New query</a>} " | \n"
54 html {<a href="http:} $env(SCRIPT_NAME)
55 html / $sessionId {/targets.egw}
57 html {"><img src="/gif/button-new-target.gif" border=0></a>}
59 html {">New target</a>}
62 if {!$useIcons && !$after && $startPos != "" && $startPos != "1"} {
64 html {<a href="http:} $env(SCRIPT_NAME)
65 html / $sessionId {/search.egw/} $setNo
66 html + [expr $startPos - $hist($setNo,maxPresent)]
67 html + [expr $startPos - 1]
68 html {"><img src="/gif/uarrw.gif"></a>}
74 if {[info commands saveState] == ""} {
82 set setNo [lindex $sessionParms 0]
83 if {[wform menu1] != ""} {
84 set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
85 set hist($nextSetNo,host) $hist($setNo,host)
88 set query [build-query $hist($setNo,host)]
89 if {"x$query" == "x"} {
90 html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
91 displayError "Empty query" \
92 "You must specify at least one search word"
93 html "</body></html>\n"
96 set hist($setNo,query) $query
98 set hist($setNo,form,menu1) [wform menu1]
99 set hist($setNo,form,menu2) [wform menu2]
100 set hist($setNo,form,menu3) [wform menu3]
102 set hist($setNo,form,entry1) [wform entry1]
103 set hist($setNo,form,entry2) [wform entry2]
104 set hist($setNo,form,entry3) [wform entry3]
106 set hist($setNo,form,logic1) [wform logic1]
107 set hist($setNo,form,logic2) [wform logic2]
111 set host $hist($setNo,host)
112 set databases [lindex $targets($host) 1]
115 if {[wform baseall] != ""} {
116 set hist($setNo,database) $databases
117 } elseif {$b == ""} {
118 set hist($setNo,database) $databases
120 set hist($setNo,database) $b
122 set hist($setNo,maxPresent) [wform hits]
123 if {$hist($setNo,maxPresent) == ""} {
124 set hist($setNo,maxPresent) 30
127 set host $hist($setNo,host)
128 set databases [lindex $targets($host) 1]
130 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
131 html "</head><body>\n"
133 set startPos [lindex $sessionParms 1]
134 set endPos [lindex $sessionParms 2]
137 if {$startPos == ""} {
138 if {[z39search $setNo 1 0 B] != "1"} {
141 set r [z39.$setNo resultCount]
142 html "<h2> Search result $r hits</h2>\n"
144 set setOffset [z39.$setNo numberOfRecordsReturned]
145 display-rec 1 $setOffset display-brief 0
147 set setMax [z39.$setNo resultCount]
148 if {$setMax > $hist($setNo,maxPresent)} {
149 set setMax $hist($setNo,maxPresent)
152 if {[z39search $setNo 0 0 B] != "1"} {
155 set r [z39.$setNo resultCount]
156 html "<h2> Search result $r hits</h2>\n"
158 set setOffset $startPos
159 set setMax [z39.$setNo resultCount]
160 if {$setMax > $endPos} {
164 buttons $setNo $setMax $startPos 0
168 z39present $setNo 0 $setOffset $setMax display-brief B
171 buttons $setNo $setMax $startPos 1
176 html "<h3>Debug information</h3>\n"
177 html "sessionId: $sessionId <br>\n"
178 html "sessionParms: $sessionParms <br>\n"
179 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
180 html $e {: } $env($e) {<br>} \n
182 html "form: " [wform] " <br>\n"
183 html "target: " $host " <br>\n"
184 html "databases: " $hist($setNo,database) " <br>\n"
185 html "selected: " [wform base] " <br>\n"
186 html "query: --" $hist($setNo,query) "-- <br>"
187 html "setNo: " $setNo " <br>\n"
188 html "nextSetNo: " $nextSetNo " <br>\n"