3 # $Id: search.egw,v 1.17 1995/11/14 16:01:51 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]
91 set host $hist($setNo,host)
92 set databases [lindex $targets($host) 1]
95 if {[wform baseall] != ""} {
96 set hist($setNo,database) $databases
98 set hist($setNo,database) $databases
100 set hist($setNo,database) $b
102 set hist($setNo,maxPresent) [wform hits]
103 if {$hist($setNo,maxPresent) == ""} {
104 set hist($setNo,maxPresent) 30
107 set host $hist($setNo,host)
108 set databases [lindex $targets($host) 1]
110 html "<head><title> WWW/Z39.50 Gateway Search " $host " </title>\n"
111 html "</head><body>\n"
113 set startPos [lindex $sessionParms 1]
114 set endPos [lindex $sessionParms 2]
117 if {$startPos == ""} {
118 if {[z39search $setNo 1 0 B] != "1"} {
121 set r [z39.$setNo resultCount]
122 html "<h2> Search result $r hits</h2>\n"
124 set setOffset [z39.$setNo numberOfRecordsReturned]
125 display-rec 1 $setOffset display-brief 0
127 set setMax [z39.$setNo resultCount]
128 if {$setMax > $hist($setNo,maxPresent)} {
129 set setMax $hist($setNo,maxPresent)
132 if {[z39search $setNo 0 0 B] != "1"} {
135 set r [z39.$setNo resultCount]
136 html "<h2> Search result $r hits</h2>\n"
138 set setOffset $startPos
139 set setMax [z39.$setNo resultCount]
140 if {$setMax > $endPos} {
144 buttons $setNo $setMax $startPos 0
148 z39present $setNo 0 $setOffset $setMax display-brief B
151 buttons $setNo $setMax $startPos 1
156 html "<h3>Debug information</h3>\n"
157 html "sessionId: $sessionId <br>\n"
158 html "sessionParms: $sessionParms <br>\n"
159 foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
160 html $e {: } $env($e) {<br>} \n
162 html "form: " [wform] " <br>\n"
163 html "target: " $host " <br>\n"
164 html "databases: " $hist($setNo,database) " <br>\n"
165 html "selected: " [wform base] " <br>\n"
166 html "query: --" $hist($setNo,query) "-- <br>"
167 html "setNo: " $setNo " <br>\n"
168 html "nextSetNo: " $nextSetNo " <br>\n"