X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fz39util.tcl;h=7903fd4773e40b20457945f2129371a2cdc866e1;hb=84081f9782ee28f9236b0974891f1d6b865992be;hp=ca41b996fb5c25c49afe78562da19d1fe5e3d1b7;hpb=fa0ddb755d3a836e4e13cc05a6ba3eb6b0010958;p=egate.git
diff --git a/www/z39util.tcl b/www/z39util.tcl
index ca41b99..7903fd4 100644
--- a/www/z39util.tcl
+++ b/www/z39util.tcl
@@ -1,5 +1,5 @@
#
-# $Id: z39util.tcl,v 1.24 1996/01/24 14:14:20 adam Exp $
+# $Id: z39util.tcl,v 1.25 1996/01/24 16:59:29 adam Exp $
#
proc saveState {} {
uplevel #0 {
@@ -130,7 +130,8 @@ proc display-brief {zset no tno} {
if {$p} {
html ": "
}
- html {}
+ html { }
set nope 1
foreach v $title {
html $v
@@ -139,23 +140,22 @@ proc display-brief {zset no tno} {
if {$nope} {
html {No title}
}
- html { }
+ html { }
foreach v $cover {
html $v
}
- html {
}
- foreach v $location {
- html " $v"
- }
- foreach v $publisher {
- html " $v"
- }
- foreach v $year {
- html " $v"
+ if {0} {
+ html {
}
+ foreach v $location {
+ html " $v"
+ }
+ foreach v $publisher {
+ html " $v"
+ }
+ foreach v $year {
+ html " $v"
+ }
}
- html { -- }
- html "view full"
}
html "
\n"
}
@@ -462,13 +462,13 @@ proc build-query {t ilines} {
}
switch $op {
And
- { set q "@and $q ${attr} ${term}" }
+ { set q "@and $q ${attr} \"${term}\"" }
Or
- { set q "@or $q ${attr} ${term}" }
+ { set q "@or $q ${attr} \"${term}\"" }
{And not}
- { set q "@not $q ${attr} ${term}" }
+ { set q "@not $q ${attr} \"${term}\"" }
{}
- { set q "${attr} ${term}" }
+ { set q "${attr} \"${term}\"" }
}
set op [egw_form logic$i]
}
@@ -505,45 +505,46 @@ proc z39scan {setNo scanNo tno scanLines scanPos cache} {
set zs $zz.s$scanNo.$setNo
$zz callback ok-response
$zz failback fail-response
- if {$oldHost != $host} {
+ set thisHost [splitHostSpec $host]
+ if {$oldHost != $thisHost} {
catch [list $zz disconnect]
set sessionWait 0
- if {[catch [list $zz connect $host]]} {
- displayError "Cannot connect to target" $host
+ if {[catch [list $zz connect $thisHost]]} {
+ displayError "Cannot connect to target" $thisHost
return 0
} elseif {$sessionWait == 0} {
if {[catch {egw_wait sessionWait 300}]} {
$zz disconnect
- displayError "Cannot connect to target" $host
+ displayError "Cannot connect to target" $thisHost
return 0
}
if {$sessionWait != 1} {
- displayError "Cannot connect to target" $host
+ displayError "Cannot connect to target" $thisHost
return 0
}
}
$zz idAuthentication $idAuth
set sessionWait 0
if {[catch {$zz init}]} {
- displayError "Cannot initialize target" $host
+ displayError "Cannot initialize target" $thisHost
$zz disconnect
return 0
}
if {[catch {egw_wait sessionWait 60}]} {
- displayError "Cannot initialize target" $host
+ displayError "Cannot initialize target" $thisHost
$zz disconnect
return 0
}
if {$sessionWait != "1"} {
- displayError "Cannot initialize target" $host
+ displayError "Cannot initialize target" $thisHost
$zz disconnect
return 0
}
if {![$zz initResult]} {
set u [$zz userInformationField]
$zz disconnect
- displayError "Cannot initialize target $host" $u
+ displayError "Cannot initialize target $thisHost" $u
return 0
}
} else {
@@ -647,45 +648,46 @@ proc z39search {setNo piggy tno elements} {
}
$zz callback ok-response
$zz failback fail-response
- if {$oldHost != $host} {
+ set thisHost [splitHostSpec $host]
+ if {$oldHost != $thisHost} {
catch [list $zz disconnect]
set sessionWait 0
- if {[catch [list $zz connect $host]]} {
- displayError "Cannot connect to target" $host
+ if {[catch [list $zz connect $thisHost]]} {
+ displayError "Cannot connect to target" $thisHost
return 0
} elseif {$sessionWait == 0} {
if {[catch {egw_wait sessionWait 300}]} {
$zz disconnect
- displayError "Cannot connect to target" $host
+ displayError "Cannot connect to target" $thisHost
return 0
}
if {$sessionWait != 1} {
- displayError "Cannot connect to target" $host
+ displayError "Cannot connect to target" $thisHost
return 0
}
}
$zz idAuthentication $idAuth
set sessionWait 0
if {[catch {$zz init}]} {
- displayError "Cannot initialize target" $host
+ displayError "Cannot initialize target" $thisHost
$zz disconnect
return 0
}
if {[catch {egw_wait sessionWait 60}]} {
- displayError "Cannot initialize target" $host
+ displayError "Cannot initialize target" $thisHost
$zz disconnect
return 0
}
if {$sessionWait != "1"} {
- displayError "Cannot initialize target" $host
+ displayError "Cannot initialize target" $thisHost
$zz disconnect
return 0
}
if {![$zz initResult]} {
set u [$zz userInformationField]
$zz disconnect
- displayError "Cannot initialize target $host" $u
+ displayError "Cannot initialize target $thisHost" $u
return 0
}
} else {
@@ -720,6 +722,7 @@ proc z39search {setNo piggy tno elements} {
$zz.$setNo mediumSetPresentNumber 0
}
set sessionWait 0
+ egw_log debug "search: $query"
$zz.$setNo search $query
if {[catch {egw_wait sessionWait 600}]} {
@@ -797,7 +800,8 @@ proc z39msearch {setNo piggy elements} {
if {[catch {set oldHost [z39$i connect]}]} {
set oldHost ""
}
- if {$oldHost != $host} {
+ set thisHost [splitHostSpec $host]
+ if {$oldHost != $thisHost} {
catch {z39$i disconnect}
}
z39$i callback [list connect-m-response $i]
@@ -807,14 +811,15 @@ proc z39msearch {setNo piggy elements} {
for {set i 1} {$i <= $not} {incr i} {
set oldHost [z39$i connect]
set host $hist($setNo,$i,host)
- if {$oldHost == $host} {
+ set thisHost [splitHostSpec $host]
+ if {$oldHost == $thisHost} {
set zstatus($i) 1
continue
}
z39$i idAuthentication $hist($setNo,$i,idAuthentication)
- html "Connecting to target " $host "
\n"
+ html "Connecting to target " $thisHost "
\n"
set zstatus($i) -1
- if {![catch {z39$i connect $host}]} {
+ if {![catch {z39$i connect $thisHost}]} {
incr zleft
}
}
@@ -826,7 +831,7 @@ proc z39msearch {setNo piggy elements} {
}
set zleft 0
for {set i 1} {$i <= $not} {incr i} {
- html "host " $hist($setNo,$i,host) ": "
+ html "host " [splitHostSpec $hist($setNo,$i,host)] ": "
if {$zstatus($i) >= 1} {
html "ok
\n"
ir-set z39$i.$setNo z39$i
@@ -1109,3 +1114,16 @@ proc maintenance {} {
html { This and the following pages are under construction and }
html {will continue to be so until the end of January 1996.}
}
+
+proc splitHostSpec {host} {
+ set i [string last . $host]
+ if {$i > 1} {
+ incr i -1
+ return [string range $host 0 $i]
+ }
+ return $host
+}
+
+proc mergeHostSpec {host databases} {
+ return ${host}.[join $databases -]
+}