</head>
<body>
{
-# $Id: mquery.egw,v 1.5 1995/11/13 15:41:41 adam Exp $
+# $Id: mquery.egw,v 1.6 1995/12/21 15:49:51 adam Exp $
if {[info commands saveState] == ""} {
source z39util.tcl
}
set hist($setNo,0,host) $i
}
-<hr>
-<h3>Input your search criteria: </h3> <br>
+<h2>Input your search criteria: </h2><br>
{
set fields [lindex $targets($host) 2]
for {set no 1} {$no < 4} {incr no} {
html {<option> } [lindex $f 0] \n
}
html "</select>\n"
- html {<input type="text" name="entry} $no {" size=30>} \n
+ html {<input type="text" name="entry} $no {" size=35>} \n
if {$no < 3} {
html {<select name="logic} $no {">} \n
html "<option> And\n"
html "<br>\n"
}
}
-<h3> Various technical parameters: </h3> <br>
-Max hits: <input type="text" name="hits" value="10" size=3>
-Records are shown in:
-<select name="format">
-<option> Long format
-<option> Medium format
-<option> Short format
-<option> Raw MARC
-</select>
-<br>
-<p>
<input type=submit value="Search"><input type=reset value="Reset">
+<br>
+{
+ html {Number of records to display in the result set list: }
+ html {<input type="text" name="hits" value="}
+ html 10
+ html {" size=3>}
+}
</form>
+{
+ global useIcons
+ if {$useIcons} {
+ html {<img src="/gif/button-egw.gif">}
+ }
+ html {<a href="http:} $env(SCRIPT_NAME)
+ html / $sessionId {/mtargets.egw}
+ if {$useIcons} {
+ html {"><img src="/gif/button-new-target.gif" border=0></a>}
+ } else {
+ html {"> New target </a>}
+ }
+}
<hr>
This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
Last modified 29. september 1995. <br>
<em> This and the following pages are under construction
and will continue to be so until the end of December 1995.</em>
-<hr>
-
-{
- html {<a href="http:} $env(SCRIPT_NAME)
- html / $sessionId {/mtargets.egw"> New target </a>}
-}
{
html "<hr>\n"
html "<h3>Debug information</h3>\n"
<html>
{
-# $Id: msearch.egw,v 1.5 1995/11/13 15:41:42 adam Exp $
+# $Id: msearch.egw,v 1.6 1995/12/21 15:49:51 adam Exp $
if {[info commands saveState] == ""} {
source z39util.tcl
incr nextSetNo
for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} {
- set hist($setNo,$i,query) [build-query $hist($setNo,$i,host)]
+ set hist($setNo,$i,query) [build-query $hist($setNo,$i,host)] 3
}
set hist($setNo,maxPresent) [wform hits]
if {$hist($setNo,maxPresent) == ""} {
set not $hist($setNo,0,host)
for {set i 1} {$i <= $not} {incr i} {
if {$zstatus($i) != 2} continue
- html "<dt> " [lindex $targets($hist($setNo,$i,host)) 0] ": "
+ html "<dt><h3>" [lindex $targets($hist($setNo,$i,host)) 0] ": "
set status [z39$i.$setNo responseStatus]
if {[lindex $status 0] == "NSD"} {
z39$i.$setNo nextResultSetPosition 0
set code [lindex $status 1]
set msg [lindex $status 2]
set addinfo [lindex $status 3]
- html "Error\n<dd>NSD$code: $msg: $addinfo"
+ html "Error</h3>\n<dd>NSD$code: $msg: $addinfo"
} else {
set r [z39$i.$setNo resultCount]
- html "$r hits\n<dd>\n"
+ html "$r hits</h3>\n<dd>\n"
display-rec 1 $hist($setNo,$i,offset) display-brief $i
}
html "</dl>\n"
}
-
-<hr>
{
+ global useIcons
+
+ if {$useIcons} {
+ html {<img src="/gif/button-egw.gif">}
+ }
html {<a href="http:} $env(SCRIPT_NAME)
- html / $sessionId {/mtargets.egw"> New target </a>} " | \n"
+ html / $sessionId {/mtargets.egw}
+ if {$useIcons} {
+ html {"><img src="/gif/button-new-target.gif" border=0></a>}
+ } else {
+ html {"> New target </a>} " | \n"
+ }
html {<a href="http:} $env(SCRIPT_NAME)
- html / $sessionId {/mquery.egw/} $host + $setNo {"> New query </a>}
+ html / $sessionId {/mquery.egw/} $host + $setNo
+ if {$useIcons} {
+ html {"><img src="/gif/button-new-query.gif" border=0></a>}
+ } else {
+ html {"> New query </a>}
+ }
}
{
<html>
{
-# $Id: mtargets.egw,v 1.6 1995/11/10 14:47:31 adam Exp $
+# $Id: mtargets.egw,v 1.7 1995/12/21 15:49:51 adam Exp $
set setNo 1
source /usr/local/etc/httpd/conf/ztargets.conf
if {[info commands saveState] == ""} {
<title>Europagate, WWW/Z39.50 Gateway</title>
</head>
<body>
-<h1>Search in multiple targets</h1>
-<hr>
-<h3>Choose one or more Z39.50 targets:</h3>
+
+<center>
+<img src="/gif/button-egw.gif" Alt="EUROPAGATE">
+</center>
+<h2>Choose one or more Z39.50 targets</h2>
{
html {<form action="http:} $env(SCRIPT_NAME)
html / $sessionId {/mquery.egw/} $setNo {" method=post><br>} \n
</head>
<body>
{
-# $Id: query.egw,v 1.19 1995/12/20 16:31:31 adam Exp $
+# $Id: query.egw,v 1.20 1995/12/21 15:49:52 adam Exp $
if {[info commands saveState] == ""} {
source z39util.tcl
ir z39
}
- html {<h2><img src="/gif/button-egw.gif" border=0 align=middle>}
- html " Search in " [lindex $targets($host) 0] "</h2>\n"
+ html "<h2>Search in " [lindex $targets($host) 0] "</h2>\n"
z39 callback ok-response
z39 failback fail-response
z39 disconnect
wabort
} elseif {$sessionWait == 0} {
- if {[catch {zwait sessionWait 30}]} {
+ if {[catch {zwait sessionWait 35}]} {
displayError "Cannot connect to target ${host}" {}
html "</body></html>\n"
z39 disconnect
}
set databases [lindex $targets($host) 1]
- if {$setNo > 1 && $hist([expr $setNo - 1],host) == $host} {
- set oSetNo [expr $setNo - 1]
- set databaseDefault $hist($oSetNo,database)
- } else {
+ if {[catch {set prevHost $hist([expr $setNo - 1],host)}]} {
set databaseDefault [lindex $databases 0]
set oSetNo 0
+ } else {
+ set oSetNo [expr $setNo - 1]
+ set databaseDefault $hist($oSetNo,database)
}
-
html {<form action="http:} $env(SCRIPT_NAME)
html / $sessionId {/search.egw/} $setNo {" method=post>} \n
set nodb [llength $databases]
}
html "</select>\n"
html {<input type="text" name="entry} $no {"}
- html { size=30>} \n
+ html { size=35>} \n
if {$no < 3} {
html {<select name="logic} $no {">} \n
if {$oSetNo > 0} {
}
}
-<input type=submit value="Search"><input type=reset value="Reset">
+<input type=submit name=submit value="Search">
+<input type=submit name=submit value="Scan">
+<input type=reset value="Reset">
<br>
{
html {Number of records to display in the result set list: }
}
html {" size=3>}
}
-<br>
-<p>
</form>
+<p>
{
html {<img src="/gif/button-egw.gif" border=0></a>}
<html>
{
-# $Id: search.egw,v 1.18 1995/12/20 16:31:31 adam Exp $
+# $Id: search.egw,v 1.19 1995/12/21 15:49:52 adam Exp $
+
+proc perform-scan {} {
+ global sessionId
+ global sessionParms
+ global sessionWait
+ global setNo
+ global hist
+ global targets
+ global nextSetNo
+ global env
+
+ set scanNo 1000
+
+ set termPlusAttr [build-scan $hist($setNo,host) 3]
+
+ if {"$termPlusAttr" == ""} {
+ html "<head><title> WWW/Z39.50 Gateway Scan</title>\n<body>\n"
+ displayError "Empty query" \
+ "You must specify at least one search word"
+ html "</body></html>\n"
+ wabort
+ }
+ set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
+ set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
+
+ set hist($setNo,form,menu1) [wform menu1]
+ set hist($setNo,form,menu2) ""
+ set hist($setNo,form,menu3) ""
+
+ set hist($setNo,form,entry1) [wform entry1]
+ set hist($setNo,form,entry2) ""
+ set hist($setNo,form,entry3) ""
+
+ set hist($setNo,form,logic1) ""
+ set hist($setNo,form,logic2) ""
+
+ incr nextSetNo
+
+ set host $hist($setNo,host)
+ set databases [lindex $targets($host) 1]
+
+ set b [wform base]
+ if {[wform baseall] != ""} {
+ set hist($setNo,database) $databases
+ } elseif {$b == ""} {
+ set hist($setNo,database) $databases
+ } else {
+ set hist($setNo,database) $b
+ }
+ set hist($setNo,maxPresent) [wform hits]
+ if {$hist($setNo,maxPresent) == ""} {
+ set hist($setNo,maxPresent) 30
+ }
+ set host $hist($setNo,host)
+ set databases [lindex $targets($host) 1]
+
+ html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
+ html "</head><body>\n"
+
+ if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
+ return
+ }
+ display-scan $setNo $scanNo 0
+
+ html "<hr>\n"
+ html "<h3>Debug information</h3>\n"
+ html "sessionId: $sessionId <br>\n"
+ html "sessionParms: $sessionParms <br>\n"
+ foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
+ html $e {: } $env($e) {<br>} \n
+ }
+ html "form: " [wform] " <br>\n"
+ html "target: " $host " <br>\n"
+ html "databases: " $hist($setNo,database) " <br>\n"
+ html "selected: " [wform base] " <br>\n"
+ html "setNo: " $setNo " <br>\n"
+ html "nextSetNo: " $nextSetNo " <br>\n"
+
+ html "</body>\n"
+}
proc buttons {setNo setMax startPos after} {
global sessionId
set setNo [lindex $sessionParms 0]
if {[wform menu1] != ""} {
- set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
- set hist($nextSetNo,host) $hist($setNo,host)
- set setNo $nextSetNo
-
- set query [build-query $hist($setNo,host)]
+ if {[wform submit] == "Scan"} {
+ perform-scan
+ wabort
+ }
+ set query [build-query $hist($setNo,host) 3]
if {"x$query" == "x"} {
html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
displayError "Empty query" \
return
}
set r [z39.$setNo resultCount]
- html "<h2> Search result $r hits</h2>\n"
+ html "<h3> Search result $r hits</h3>\n"
wflush
set setOffset [z39.$setNo numberOfRecordsReturned]
display-rec 1 $setOffset display-brief 0
return
}
set r [z39.$setNo resultCount]
- html "<h2> Search result $r hits</h2>\n"
- wflush
set setOffset $startPos
set setMax [z39.$setNo resultCount]
if {$setMax > $endPos} {
if {$setMax > 0} {
buttons $setNo $setMax $startPos 0
}
+ html "<h3> Search result $r hits</h3>\n"
+ wflush
}
if {$setMax > 0} {
z39present $setNo 0 $setOffset $setMax display-brief B
<html>
{
-# $Id: showfull.egw,v 1.12 1995/12/20 16:31:32 adam Exp $
+# $Id: showfull.egw,v 1.13 1995/12/21 15:49:52 adam Exp $
proc buttons {setNo tno no format count host after} {
global sessionId
if {[z39search $setNo 0 $tno F] != "1"} {
return
}
+
set count [$zz.$setNo resultCount]
- html "<h2>Record \#$no out of $count </h2><br>\n"
buttons $setNo $tno $no $format $count $host 0
+ html "<h3>Record \#$no out of $count </h3><br>\n"
+
eval {z39present $setNo $tno $no $no display-$format F}
buttons $setNo $tno $no $format $count $host 1
}
<html>
{
-# $Id: targets.egw,v 1.8 1995/12/20 16:31:32 adam Exp $
+# $Id: targets.egw,v 1.9 1995/12/21 15:49:53 adam Exp $
source /usr/local/etc/httpd/conf/ztargets.conf
if {[info commands saveState] == ""} {
source z39util.tcl
<title> Europagate, WWW/Z39.50 Gateway </title>
</head>
<body>
-<h3>
-<img src="/gif/button-egw.gif" Alt="Welcome to EUROPAGATE" align=middle>
- Choose a Z39.50 target: </h3>
+<center>
+<img src="/gif/button-egw.gif" Alt="EUROPAGATE">
+</center>
+
+<h2>Choose Z39.50 target</h2>
<dl>
{
foreach t [array names targets] {
#
-# $Id: z39util.tcl,v 1.12 1995/12/20 16:31:34 adam Exp $
+# $Id: z39util.tcl,v 1.13 1995/12/21 15:49:53 adam Exp $
#
proc saveState {} {
uplevel #0 {
}
}
+proc scan-response {zz} {
+ global sessionWait
+
+ set status [$zz scanStatus]
+ if {$status == 6} {
+ displayError "Scan fail" ""
+ set sessionWait -2
+ } else {
+ set sessionWait 1
+ }
+}
+
proc ok-response {} {
global sessionWait
set sessionWait 1
}
}
-proc build-query {t} {
+proc build-scan {t ilines} {
+ global targets
+
+ for {set i 1} {$i <= $ilines} {incr i} {
+ set term [wform entry$i]
+ if {$term != ""} {
+ set field [wform menu$i]
+ foreach x [lindex $targets($t) 2] {
+ if {[lindex $x 0] == $field} {
+ set attr [lindex $x 1]
+ }
+ }
+ return [list $term $attr]
+ }
+ }
+ return ""
+}
+
+proc build-query {t ilines} {
global targets
set op {}
set q {}
- for {set i 1} {$i < 4} {incr i} {
+ for {set i 1} {$i <= $ilines} {incr i} {
set term [wform entry$i]
if {$term != ""} {
set field [wform menu$i]
return $q
}
+proc z39scan {setNo scanNo tno scanLines scanPos} {
+ global hist
+ global sessionWait
+ global targets
+
+ if {$tno > 0} {
+ set zz z39$tno
+ set host $hist($setNo,$tno,host)
+ set idAuth $hist($setNo,$tno,idAuthentication)
+ set database $hist($setNo,$tno,database)
+ set scanAttr $hist($setNo,$tno,scanAttr)
+ set scanTerm $hist($setNo,$tno,$scanNo,scanTerm)
+ } else {
+ set zz z39
+ set host $hist($setNo,host)
+ set idAuth $hist($setNo,idAuthentication)
+ set database $hist($setNo,database)
+ set scanAttr $hist($setNo,scanAttr)
+ set scanTerm $hist($setNo,$scanNo,scanTerm)
+ }
+ if {[catch [list $zz failback fail-response]]} {
+ ir $zz
+ }
+ if {[catch [list set oldHost [$zz connect]]]} {
+ set oldHost ""
+ }
+ set zs $zz.s$scanNo.$setNo
+ $zz callback ok-response
+ $zz failback fail-response
+ if {$oldHost != $host} {
+ catch [list $zz disconnect]
+
+ set sessionWait 0
+ if {[catch [list $zz connect $host]]} {
+ displayError "Cannot connect to target" $host
+ return 0
+ } elseif {$sessionWait == 0} {
+ if {[catch {zwait sessionWait 300}]} {
+ $zz disconnect
+ displayError "Cannot connect to target" $host
+ return 0
+ }
+ if {$sessionWait != 1} {
+ displayError "Cannot connect to target" $host
+ return 0
+ }
+ }
+ $zz idAuthentication $idAuth
+ set sessionWait 0
+ if {[catch {$zz init}]} {
+ displayError "Cannot initialize target" $host
+ $zz disconnect
+ return 0
+ }
+ if {[catch {zwait sessionWait 60}]} {
+ displayError "Cannot initialize target" $host
+ $zz disconnect
+ return 0
+ }
+ if {$sessionWait != "1"} {
+ displayError "Cannot initialize target" $host
+ $zz disconnect
+ return 0
+ }
+ if {![$zz initResult]} {
+ set u [$zz userInformationField]
+ $zz disconnect
+ displayError "Cannot initialize target $host" $u
+ return 0
+ }
+ } else {
+ if {![catch [list $zs numberOfTermsRequested 5]]} {
+ return 1
+ }
+ }
+ eval $zz databaseNames $database
+
+ ir-scan $zs $zz
+
+ $zs numberOfTermsRequested $scanLines
+ $zs preferredPositionInResponse $scanPos
+
+ $zz callback [list scan-response $zs]
+
+ set sessionWait 0
+ $zs scan "${scanAttr} ${scanTerm}"
+
+ if {[catch {zwait sessionWait 600}]} {
+ wlog debug "timeout/cancel in scan"
+ displayError "Timeout in scan" {}
+ html "</body></html>\n"
+ $zz disconnect
+ return 0
+ }
+ if {$sessionWait == -1} {
+ displayError "Scan fail" "Connection closed"
+ html "</body></html>\n"
+ $zz disconnect
+ }
+ if {$sessionWait != 1} {
+ return 0
+ }
+ return 1
+}
+
+proc display-scan {setNo scanNo tno} {
+ global hist
+ global targets
+
+ if {$tno > 0} {
+ set zz z39$tno
+ } else {
+ set zz z39
+ }
+ set zs $zz.s$scanNo.$setNo
+ set m [$zs numberOfEntriesReturned]
+
+ html "<dl>\n"
+ for {set i 0} {$i < $m} {incr i} {
+ html "<dt>"
+ html [lindex [$zs scanLine $i] 1]
+ html ": "
+ html [lindex [$zs scanLine $i] 2]
+ html "\n"
+ }
+ html "</dl>\n"
+}
+
proc z39search {setNo piggy tno elements} {
global hist
global sessionWait