Major revision. Single-target result set can be reached from the
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 13 Mar 1996 14:07:28 +0000 (14:07 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 13 Mar 1996 14:07:28 +0000 (14:07 +0000)
multiple-targets result set. History incorporated in multiple-targets --
it doesn't look good though.

14 files changed:
www/egwindex.html
www/history.egw
www/mquery.egw
www/msearch.egw
www/mtargets.egw
www/nwi.egw
www/query.egw
www/search.egw
www/showfull.egw
www/targets.egw
www/tdefine.egw
www/tform.egw
www/z39util.tcl
www/ztargets.conf

index 33b94d0..5ec6763 100644 (file)
@@ -3,7 +3,7 @@
 <title>Europagate WWW index</title>
 </head>
 <body>
-<h2>Europagate WWW index, $Id: egwindex.html,v 1.11 1996/03/11 17:40:47 adam Exp $</h2>
+<h2>Europagate WWW index, $Id: egwindex.html,v 1.12 1996/03/13 14:07:28 adam Exp $</h2>
 <p>
 <ul>
 <li>
     <a href="http:/cgi-bin/egwcgi/egwwais/mtargets.egw/1+1">
       multiple wais/z39.50 targets with debug and html3</a>
 <li>
-    <a href="http:/cgi-bin/egwcgi/egwwais/nwi.egw/1+1">
+    <a href="http:/cgi-bin/egwcgi/egwwais/nwi.egw">
       NWI/test</a>
+<li>
+    <a href="http:/cgi-bin/egwcgi/egwwais/nwi.egw/1+1">
+      NWI/test with debug</a>
 </ul>
 </body>
 </html>
index fe8e872..4c18e79 100644 (file)
@@ -4,7 +4,7 @@
 </head>
 <body>
 {
-# $Id: history.egw,v 1.6 1996/03/12 16:30:26 adam Exp $
+# $Id: history.egw,v 1.7 1996/03/13 14:07:29 adam Exp $
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
 
     set useIcons 1
     button-main
-    button-new-target 0
+    button-new-target
 
     z39history
 
     set useIcons 0
     button-main
-    button-new-target 0
+    button-new-target
 }
 {
     catch maintenance
index fa2c809..364a8cd 100644 (file)
@@ -4,7 +4,7 @@
 </head>
 <body>
 {
-# $Id: mquery.egw,v 1.14 1996/03/12 16:30:26 adam Exp $
+# $Id: mquery.egw,v 1.15 1996/03/13 14:07:29 adam Exp $
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
@@ -22,7 +22,7 @@
 
     set useIcons 1
     button-main
-    button-new-target 0
+    button-new-target
 
     html {<form action="http:} $env(SCRIPT_NAME)
     html / $sessionId {/msearch.egw/} $setNo {" method=get>} \n
         lappend hist($setNo,$i,database) $base
     }
     set oSetNo [lindex $sessionParms 0]
-    if {$i == 0 && [info exists hist($oSetNo,0,host)]} {
+    if {$oSetNo < 0} {
+        set oSetNo 0
+    }
+    if {$i == 0 && $oSetNo && [info exists hist($oSetNo,0,host)]} {
         for {set i 1} {$i <= $hist($oSetNo,0,host)} {incr i} {
             set hist($setNo,$i,host) $hist($oSetNo,$i,host)
             set hist($setNo,$i,idAuthentication) \
         html "<h2>No targets specified</h2></body></html>"
         egw_abort 1
     }
+
+    set curSort server
+    set curFormat brief    
+    if {$oSetNo} {
+        set curSort $hist($oSetNo,sort)
+        set curFormat $hist($oSetNo,format)
+    }
+
     set hist($setNo,0,host) $i
 
-    html "Input your search criteria:<br>\n"
+    html "<b>Fill-in this search form:</b><br>\n"
     set fields [lindex $targets($host) 2]
     for {set no 1} {$no < 4} {incr no} {
+
         html {<select name="menu} $no {">} \n
+        set template {}
+        if {$oSetNo} {
+            set template [join $hist($oSetNo,form,menu$no)]
+        }
+        if {[string length $template] > 0} {
+            html {<option> } $template "\n"
+        }
         foreach f $fields {
-            html {<option> } [lindex $f 0] \n
+            set name [lindex $f 0]
+            if {$template == $name} continue
+            html {<option> } $name \n
         }
         html "</select>\n"
-        html {<input type="text" name="entry} $no {" size=35>} \n
+
+        html {<input type="text" name="entry} $no {" size=35 value="}
+
+        if {$oSetNo} {
+            if {[info exists hist($oSetNo,form,entry$no)]} {
+                html [join $hist($oSetNo,form,entry$no) " "]
+            }
+        }
+        html {">} \n
         if {$no < 3} {
             html {<select name="logic} $no {">} \n
-            html "<option> And\n"
-            html "<option> Or\n"
-            html "<option> And not\n"
+            set template {}
+            if {$oSetNo} {
+                set template [join $hist($oSetNo,form,logic$no) " "]
+            }
+            if {[string length $template] > 0} {
+                html "<option> " $template \n
+            }
+            foreach op {And Or {And not}} {
+                if {$template == $op} continue
+                html "<option> " [join $op " "] \n
+            }
             html "</select>\n"
         }
         html "<br>\n"
     }
+
     html {<input type=submit value="Search"><input type=reset value="Reset">}
     html "<br>\n"
-    html {Display each record in <select name="format">}
-    html "<option>brief\n"
-    html "<option>medium\n"
+
+    html {<b>Display each record in <select name="format">}
+    if {![string compare $curFormat brief]} {
+        html "<option>brief\n"
+        html "<option>medium\n"
+    } else {
+        html "<option>medium\n"
+        html "<option>brief\n"
+    }
     html "</select> notation"
     html { and sort by <select name="sort">}
-    html "<option>score\n"
-    html "<option>server\n"
-    html "</select><br>\n"
+    if {![string compare $curSort score]} {
+        html "<option>score\n"
+        html "<option>server\n"
+    } else {
+        html "<option>server\n"
+        html "<option>score\n"
+    }
+    html "</select></b><br>\n"
 
     set useIcons 0
     button-main
-    button-new-target 0
+    button-new-target
 }
 {
     catch maintenance
index 6959878..ef43804 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 {
-# $Id: msearch.egw,v 1.19 1996/03/12 16:30:26 adam Exp $
+# $Id: msearch.egw,v 1.20 1996/03/13 14:07:29 adam Exp $
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
@@ -45,6 +45,8 @@
             set hist($setNo,$i,query) [build-query $hist($setNo,$i,host) 3]
         }
 
+        set hist($setNo,scan) 0
+
         set hist($setNo,form,menu1) [egw_form menu1]
         set hist($setNo,form,menu2) [egw_form menu2]
         set hist($setNo,form,menu3) [egw_form menu3]
@@ -73,8 +75,9 @@
 
     set useIcons 1
     button-main
-    button-new-query 1 $setNo
-    button-new-target 0
+    button-new-query $setNo
+    button-view-history
+    button-new-target
 
     html "<br>\n"
     z39msearch $setNo B 1 $hist($setNo,maxPresent) 1
@@ -83,8 +86,9 @@
 
     set useIcons 0
     button-main
-    button-new-query 1 $setNo
-    button-new-target 0
+    button-new-query $setNo
+    button-view-history
+    button-new-target
 }
 
 {
index 4ac743e..e3bb9dd 100644 (file)
@@ -1,13 +1,11 @@
 <html>
 {
-# $Id: mtargets.egw,v 1.18 1996/03/12 16:30:27 adam Exp $
+# $Id: mtargets.egw,v 1.19 1996/03/13 14:07:30 adam Exp $
     set setNo 1
     source ztargets.conf
     if {[info commands saveState] == ""} {
         source z39util.tcl
     }
-    set mMode 1
-
     if {![info exists debug]} {
         if {[lindex $sessionParms 1] == "1"} {
             set debug 1
 
     set useIcons 1
     button-main
-    button-define-target 0
+    button-define-target
 
     html "<h2>Choose one or more targets</h2>\n"
     html {<form action="http:} $env(SCRIPT_NAME)
-    html / $sessionId {/mquery.egw/} $setNo {" method=get><br>} \n
+    html / $sessionId / $scriptQuery {;/} -1 {" method=get><br>} \n
     html "<dl>\n"
 
-    proc targetsCmp {l r} {
-        global targets
-        return [string compare [string tolower [lindex $targets($l) 0]] \
-                               [string tolower [lindex $targets($r) 0]]]
+    proc headlineC {h} {
+        html {<dt><h2>} $h \n {</h2>}
     }
-    set tt [array names targets]
-    set tn [lsort -command targetsCmp $tt]
-    foreach t $tn {
-        html {<dt>} [ lindex $targets($t) 0]
-        html {<dd>}
+    proc targetC {t} {
+        global targets
+        html {<dt><b>} [ lindex $targets($t) 0]
+        html {</b>: }
         set databases [splitDatabaseSpec $t]
         
         set desc [lindex $targets($t) 4]
-        if {$desc != ""} {
+        if {[string length $desc] > 0} {
             html "$desc<br>\n"
         }
+        html {<dd>}
         foreach d $databases {
             html {<input type="checkbox" name="target"}
             html { value="} $t + $d {"> } $d 
         }
-        html "<br>\n"
+        html "<br><br>\n"
     }
+    serverList headlineC targetC
+
     html "</dl>\n"
     html {<input type="submit" value="Select"></form>} \n
 
     html "<p>\n"
     set useIcons 0
     button-main
-    button-define-target 0
+    button-define-target
 }
 
 {
index ef66aec..a42ac74 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 {
-# $Id: nwi.egw,v 1.2 1996/03/12 16:30:27 adam Exp $
+# $Id: nwi.egw,v 1.3 1996/03/13 14:07:30 adam Exp $
     source ztargets.conf
 
     set scriptQuery nwi.egw
@@ -10,8 +10,6 @@
     if {[info commands saveState] == ""} {
         source z39util.tcl
     }
-    set mMode 1
-
     if {![info exists debug]} {
         if {[lindex $sessionParms 1] == "1"} {
             set debug 1
     set useIcons 1
     button-main
 
-    set initSet [lindex $sessionParms 0]
     set curSort score
     set curFormat brief
     set curEntry {}
+
+    set initSet 0
     catch {
-        if {$initSet > 0} {
+        set initSet [lindex $sessionParms 0]
+        if {$initSet < 0} {
+            set initSet 0
+        }
+        if {$initSet} {
             for {set i 1} {$i <= $hist($initSet,0,host)} {incr i} {
                 lappend curTargets $hist($initSet,$i,host)
             }
index 5c5e033..f17cc58 100644 (file)
@@ -4,7 +4,7 @@
 </head>
 <body>
 {
-# $Id: query.egw,v 1.37 1996/03/12 16:30:27 adam Exp $
+# $Id: query.egw,v 1.38 1996/03/13 14:07:30 adam Exp $
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
@@ -96,11 +96,11 @@ proc ok-response {} {
 
     set useIcons 1
     button-main
-    button-new-target 1
+    button-new-target
     if {[lsearch [z390 options] scan] >= 0} {
-        button-scan-window 1 $setNo
+        button-scan-window $setNo
     }
-    button-view-history 0 
+    button-view-history
 
     html "<h2>" [lindex $targets($host) 0] "</h2><br>\n"
 
@@ -139,7 +139,7 @@ proc ok-response {} {
             html [concat $databases] {"> All <br>} \n
         }
     }
-    html "Input your search criteria:<br>\n"
+    html "<b>Fill-in this search form:</b><br>\n"
     set fields [lindex $targets($host) 2]
     for {set no 1} {$no < 4} {incr no} {
         html {<select name="menu} $no {">} \n
@@ -206,11 +206,11 @@ proc ok-response {} {
 
     set useIcons 0
     button-main
-    button-new-target 1
+    button-new-target
     if {[lsearch [z390 options] scan] >= 0} {
-        button-scan-window 1 $setNo
+        button-scan-window $setNo
     }
-    button-view-history 0 
+    button-view-history
 }
 
 {
index 3e66629..fd25d08 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 {
-# $Id: search.egw,v 1.37 1996/03/12 16:30:28 adam Exp $
+# $Id: search.egw,v 1.38 1996/03/13 14:07:31 adam Exp $
 
 proc start-scan {scanNo targetNo cache dir initSet} {
     global sessionId
@@ -35,7 +35,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
     }
     if {$hist($setNo,$scanNo,scanTerm) != ""} {
         if {[z39scan $setNo $scanNo 0 $lines $pos $cache] != "1"} {
-            button-new-query 0 $setNo
+            button-new-query $setNo
             egw_log debug "z39_scan failed"
             return
         }
@@ -60,7 +60,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
         }
         html {</a>}
     }
-    button-new-query 0 $setNo
+    button-new-query $setNo
 
     set databases [splitDatabaseSpec $host]
 
@@ -121,7 +121,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
     set useIcons 0
     if {$hist($setNo,$scanNo,scanTerm) == ""} {
         button-main
-        button-new-query 0 $setNo        
+        button-new-query $setNo        
         return
     }
 
@@ -151,7 +151,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
         html {Next Terms</a> | }
     }
     html {</a>}
-    button-new-query 0 $setNo
+    button-new-query $setNo
 
     if {!$debug} return
     html "<hr>\n"
@@ -162,7 +162,6 @@ proc start-scan {scanNo targetNo cache dir initSet} {
         html $e {: } $env($e) {<br>} \n
     }
     html "form: " [egw_form] " <br>\n"
-    html "target: " $host " <br>\n"
     html "databases: " $hist($setNo,$targetNo,database) " <br>\n"
     html "selected: " [egw_form base] " <br>\n"
     html "setNo: " $setNo " <br>\n"
@@ -192,7 +191,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
             set setNo $nextSetNo
             incr nextSetNo
         } else {
-            catch {unset hist($setNo,hits)}
+            catch {unset hist($setNo,$targetNo,hits)}
         }
         set hist($setNo,scan) 0
 
@@ -214,11 +213,11 @@ proc start-scan {scanNo targetNo cache dir initSet} {
 
         set b [egw_form base]
        if {[egw_form baseall] != ""} {
-           set hist($setNo,0,database) $databases
+           set hist($setNo,$targetNo,database) $databases
         } elseif {$b == ""} {
-            set hist($setNo,0,database) $databases
+            set hist($setNo,$targetNo,database) $databases
         } else {
-            set hist($setNo,0,database) $b
+            set hist($setNo,$targetNo,database) $b
         }
         set hist($setNo,maxPresent) [egw_form hits]
         if {$hist($setNo,maxPresent) == ""} {
@@ -228,7 +227,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
         set hist($setNo,sort) server
 
         set i [lindex $sessionParms 2]
-        if {$i == ""} {
+        if {[string length $i] == 0} {
             for {set j 1} {$j <= 3} {incr j} {
                 if {[egw_form scan$j] != ""} {
                     set i $j
@@ -236,7 +235,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
                 }
             }
         }
-        if {$i != ""} {
+        if {[string length $i] != 0} {
             set scanNo 1000
             set hist($setNo,scan) $i
             set termPlusAttr [build-scan $hist($setNo,0,host) $i]
@@ -248,7 +247,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
             return
         }
         set query [build-query $hist($setNo,0,host) 3]
-        if {"x$query" == "x"} {
+        if {[string length $query] == 0} {
             html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
             displayError "Empty query" \
                 "You must specify at least one search word"
@@ -269,7 +268,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
             set setNo $nextSetNo
             incr nextSetNo
         } else {
-            catch {unset hist($setNo,hits)}
+            catch {unset hist($setNo,$targetNo,hits)}
         }
         set hist($setNo,scan) 0
         set hist($setNo,$targetNo,query) \
@@ -316,7 +315,6 @@ proc start-scan {scanNo targetNo cache dir initSet} {
         html "env($n) = " $env($n) " <br>\n"
     }
     html "form: " [egw_form] " <br>\n"
-    html "target: " $host " <br>\n"
     html "databases: " $hist($setNo,$targetNo,database) " <br>\n"
     html "selected: " [egw_form base] " <br>\n"
     html "query: --" $hist($setNo,$targetNo,query) "-- <br>"
index 194e2a8..8b33a18 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 {
-# $Id: showfull.egw,v 1.22 1996/03/12 16:30:28 adam Exp $
+# $Id: showfull.egw,v 1.23 1996/03/13 14:07:31 adam Exp $
 
 proc buttons {setNo tno no format count host after} {
     global sessionId
@@ -62,25 +62,9 @@ proc buttons {setNo tno no format count host after} {
         }
     }
 
-    if {!$useIcons} {
-        html "\n | "
-    }
-    html {<a href="http:} $env(SCRIPT_NAME) / $sessionId 
-    if {$tno > 0} {
-        html {/msearch.egw/} $setNo
-    } else {
-        html {/search.egw/} $setNo + $tno
-    }
-    html + 1 + $hist($setNo,maxPresent)
-    if {$useIcons} {
-        html {"><img src="/egwgif/button-result-set.gif" }
-       html {alt="Result Set" border=0></a>}
-    } else {
-        html {">Result Set</a>}
-    }
-
-    button-new-query 1 $setNo
-    button-new-target 0
+    button-result-set $setNo $tno
+    button-new-query $setNo
+    button-new-target
     html "<p>\n"
 }
 
index b597347..04b5ec0 100644 (file)
@@ -1,12 +1,10 @@
 <html>
 {
-# $Id: targets.egw,v 1.22 1996/03/12 16:30:29 adam Exp $
+# $Id: targets.egw,v 1.23 1996/03/13 14:07:31 adam Exp $
     source ztargets.conf
     if {[info commands saveState] == ""} {
         source z39util.tcl
     }
-    set mMode 0
-
     if {![info exists debug]} {
         if {[lindex $sessionParms 1] == "1"} {
             set debug 1
@@ -39,9 +37,9 @@
 
     button-main
     if {[info exists nextSetNo]} {
-        button-view-history 1
+        button-view-history
     }
-    button-define-target 0
+    button-define-target
     html "<h2>Choose a target</h2><br>\n"
     html "<dl>\n"
 
@@ -65,9 +63,9 @@
     set useIcons 0
     button-main 
     if {[info exists nextSetNo]} {
-        button-view-history 1
+        button-view-history
     }
-    button-define-target 0
+    button-define-target
 }
 {
     catch maintenance
index 268f9f8..ca5f862 100644 (file)
@@ -4,15 +4,15 @@
 </head>
 <body>
 {
-# $Id: tdefine.egw,v 1.4 1996/03/12 16:30:29 adam Exp $
+# $Id: tdefine.egw,v 1.5 1996/03/13 14:07:31 adam Exp $
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
     }
     set useIcons 1
     button-main
-    button-define-target 1
-    button-new-target 0
+    button-define-target
+    button-new-target
 
     html "<h2>Target definition response</h2><br>\n"
 
@@ -82,8 +82,8 @@
     html "<p>\n"
     set useIcons 0
     button-main
-    button-define-target 1
-    button-new-target 0
+    button-define-target
+    button-new-target
 }
 {
     global debug
index 14b34e3..ce34990 100644 (file)
@@ -4,14 +4,14 @@
 </head>
 <body>
 {
-# $Id: tform.egw,v 1.4 1996/03/12 16:30:29 adam Exp $
+# $Id: tform.egw,v 1.5 1996/03/13 14:07:32 adam Exp $
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
     }
     set useIcons 1
     button-main
-    button-new-target 0
+    button-new-target
 
     html "<h2>Target definition form</h2><br>\n"
     html {<form action="http:} $env(SCRIPT_NAME)
@@ -64,6 +64,6 @@
 
     set useIcons 0
     button-main
-    button-new-target 0
+    button-new-target
 }
 </body></html>
\ No newline at end of file
index e50db2b..ba0b55e 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: z39util.tcl,v 1.39 1996/03/12 16:30:30 adam Exp $
+# $Id: z39util.tcl,v 1.40 1996/03/13 14:07:32 adam Exp $
 #
 proc saveState {} {
     uplevel #0 {
@@ -120,6 +120,7 @@ proc display-medium {zset no setNo targetNo} {
        set location [$zset getMarc $no field 260 * a] 
        set publisher [$zset getMarc $no field 260 * b]
         set year [$zset getMarc $no field 260 * c]
+        set score [$zset getMarc $no field 999 * r]
     } dispError ] } {
         html { <a href="http:} $env(SCRIPT_NAME) /
         html $sessionId {/showfull.egw/} $setNo + $targetNo + $no + full {">}
@@ -161,6 +162,9 @@ proc display-medium {zset no setNo targetNo} {
             html "No Title"
         }
         html {</a> }
+        if {[scan $score %d nscore]} {
+            html "; Score " $nscore
+        }
     } else {
         html { <a href="http:} $env(SCRIPT_NAME) /
         html $sessionId {/showfull.egw/} $setNo + $targetNo + $no + full {">}
@@ -521,6 +525,7 @@ proc display-full-marc {zset no setNo targetNo} {
     dl-marc-field $zset $no 537 * "Source of data" {} "<br>\n"
     dl-marc-field $zset $no 538 * "System details" {} "<br>\n"
     dl-marc-field $zset $no 787 {[rstw6]} "Related information" {} "<br>\n"
+    dl-marc-field $zset $no 999 r "Score" {} ", "
     dl-marc-field $zset $no 001 * "Local control number" {} ", "
     html "</dl>\n"
 }
@@ -610,7 +615,7 @@ proc display-full-wais {zset no setNo targetNo} {
         html {<dt><b>Last checked</b><dd>} $data(lastChecked) "<br>\n"
     }
     if {[info exists data(ip)]} {
-        html {<dt><b>Initial text</b><dd>} $data(ip) "</dl><br>\n"
+        html {<dt><b>Initial text</b><dd>} $data(ip) "<br>\n"
     }
     if {0} {
         html {<a href="} $env(SCRIPT_NAME) / $sessionId {/sameas.egw/}
@@ -618,7 +623,9 @@ proc display-full-wais {zset no setNo targetNo} {
         html [egw_enc [$zset getWAIS $no documentID]] {">}
         html {Similar WAIS record</a><br>}
     }
-    html "<dt><b>References</b>\n"
+    if {[info exists data($i,linkage)]} {
+        html "<dt><b>References</b>\n"
+    }
     for {set i 1} {[info exists data($i,linkage)]} {incr i} {
         html {<dd><a href="} $data($i,linkage) {">}
         if {[info exists data($i,title)]} {
@@ -868,7 +875,7 @@ proc display-scan {setNo scanNo tno} {
         if {0} {
             regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
             html {<a href="http:} $env(SCRIPT_NAME)
-            html / $sessionId / $scriptQuery / $setNo + $hist($setNo,host) +
+            html / $sessionId / $scriptQuery {;/} $setNo + $hist($setNo,host) +
             html $hist($setNo,scan) +  $tterm {">}
         } else {
             regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
@@ -946,14 +953,8 @@ proc z39search {setNo piggy tno elements} {
             return 0
         }
     } elseif {![catch  [list $zz.$setNo smallSetUpperBound 0]]} {
-        if {$tno > 0} {
-            if {[info exists hist($setNo,$tno,hits)]} {
-                return 1
-            }
-        } else {
-            if {[info exists hist($setNo,hits)]} {
-                return 1
-            }
+        if {[info exists hist($setNo,$tno,hits)]} {
+            return 1
         }
     }
     
@@ -1009,7 +1010,7 @@ proc z39search {setNo piggy tno elements} {
     if {$sessionWait != 1} {
        return 0
     }
-    set hist($setNo,hits) [$zz.$setNo resultCount]
+    set hist($setNo,$tno,hits) [$zz.$setNo resultCount]
     return 1
 }
 
@@ -1343,9 +1344,12 @@ proc buttons-result-set-s {setNo targetNo setMax startPos after} {
             html {">Previous Records</a>} 
         }
     }
-    button-new-query 1 $setNo
-    button-new-target 1
-    button-view-history 0
+    if {$targetNo > 0} {
+        button-result-set $setNo $targetNo
+    }
+    button-new-query $setNo
+    button-new-target
+    button-view-history
 
     html "<p>\n"
 }
@@ -1365,35 +1369,48 @@ proc display-result-set-m-score {setNo} {
         if {$zstatus($i) != 2} continue
         set status [z39$i.$setNo responseStatus]
         if {[lindex $status 0] != "DBOSD"} continue        
-        if {$hist($setNo,$i,offset) > $hist($setNo,maxPresent)} {
-            set nor $hist($setNo,maxPresent)
-        } else {
-            set nor $hist($setNo,$i,offset)
-        }
+        set nor $hist($setNo,$i,offset)
         for {set j 1} {$j <= $nor} {incr j} {
             if {![string compare [z39$i.$setNo recordType $j] WAIS]} {
                 set score [z39$i.$setNo getWAIS $j score]
-                if {$score > 0} {
-                    lappend scoreArray [list $score $i $j]
+            } elseif {![string compare [z39$i.$setNo recordType $j] USmarc]} {
+                set score [z39$i.$setNo getMarc $j field 999 * r]
+                if {[scan $score %d score] != 1} {
+                    set score 10
                 }
             } else {
-                lappend scoreArray [list 10 $i $j]
+                set score 10
+            }
+            if {$score > 0} {
+                lappend scoreArray [list $score $i $j]
             }
         }
     }
     if {![info exists scoreArray]} {
         html "<br><h3>Search produced no result</h3><br>\n"
-        return
+    } else {
+        html "<ul>\n"
+        set scoreSorted [lsort -command score-sort $scoreArray]
+        foreach r $scoreSorted {
+            set i [lindex $r 1]
+            set j [lindex $r 2]
+            display-$hist($setNo,format) z39$i.$setNo $j $setNo $i
+        }
+        html "<br></ul>\n"
     }
-    set scoreSorted [lsort -command score-sort $scoreArray]
-
-    html "<ul>\n"
-    foreach r $scoreSorted {
-        set i [lindex $r 1]
-        set j [lindex $r 2]
-        display-$hist($setNo,format) z39$i.$setNo $j $setNo $i
+    for {set i 1} {$i <= $not} {incr i} {
+        if {$zstatus($i) != 2} continue
+        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 {<dt>} [lindex $targets($hist($setNo,$i,host)) 0] 
+            html "<dd>Error: $msg: $addinfo (code $code)<br>\n"
+        }
     }
-    html "</ul><br>\n"
+    html "\n<br>"
 }
 
 proc display-result-set-m-server {setNo} {
@@ -1401,20 +1418,26 @@ proc display-result-set-m-server {setNo} {
     global useIcons
     global zstatus
     global targets
+    global env
+    global sessionId
 
     set not $hist($setNo,0,host)
     html "<dl>\n"
     for {set i 1} {$i <= $not} {incr i} {
         if {$zstatus($i) != 2} continue
-        html "<dt><h3>" [lindex $targets($hist($setNo,$i,host)) 0] ": "
         set status [z39$i.$setNo responseStatus]
         if {[lindex $status 0] == "NSD"} {
+            html "<dt><h3>" [lindex $targets($hist($setNo,$i,host)) 0] ": "
             z39$i.$setNo nextResultSetPosition 0
             set code [lindex $status 1]
             set msg [lindex $status 2]
             set addinfo [lindex $status 3]
             html "Error</h3>\n<dd>NSD$code: $msg: $addinfo"
         } else {
+            html {<dt><a href="http:} $env(SCRIPT_NAME)
+            html / $sessionId {/search.egw/} $setNo + $i + 1
+            html + $hist($setNo,maxPresent) {">}
+            html "<h3>" [lindex $targets($hist($setNo,$i,host)) 0] "</a>: "
             set r [z39$i.$setNo resultCount]
             html "$r hits</h3>\n<dd>\n"
             
@@ -1518,7 +1541,6 @@ proc z39history {} {
     global html3
     global scriptQuery
 
-    set targetNo 0
     if {![info exists nextSetNo]} {
         return
     }
@@ -1534,67 +1556,77 @@ proc z39history {} {
         html {<dl>} "\n"
     }
     for {set setNo 1} {$setNo < $nextSetNo} {incr setNo} {
-        if {$hist($setNo,scan) > 0} continue
-        set host $hist($setNo,0,host)
-        if {$html3} {
-            html {<td align=left>}
-        } else {
-            html {<dt> }
+        if {[info exists hist($setNo,scan)]} {
+            if {$hist($setNo,scan) > 0} continue
         }
-        html [lindex $targets($host) 0]
-        if {$html3} {
-            html {<td align=left>} [join $hist($setNo,0,database)]
+        if {[info exists hist($setNo,1,host)]} {
+            set start 1
+            set end $hist($setNo,0,host)
         } else {
-            if {[llength [lindex $targets($host) 1]] > 1} {
-                html ": "
-                foreach b $hist($setNo,0,database) {
-                    html " $b"
+            set start 0
+            set end 0
+        }
+        for {set i $start} {$i <= $end} {incr i} {
+            if {$html3} {
+                html {<td align=left>}
+            } else {
+                html {<dt> }
+            }
+            set host $hist($setNo,$i,host)
+            html [lindex $targets($host) 0]
+            if {$html3} {
+                html {<td align=left>} [join $hist($setNo,$i,database)]
+            } else {
+                if {[llength [lindex $targets($host) 1]] > 1} {
+                    html ": "
+                    foreach b $hist($setNo,$i,database) {
+                        html " $b"
+                    }
                 }
+                html {. }
             }
-            html {. }
-        }
-        if {$html3} {
-            html {<td align=right>}
-        }
-        if {[info exists hist($setNo,hits)]} {
-            html { <a href="http:} $env(SCRIPT_NAME)
-            html / $sessionId {/search.egw/} $setNo + $targetNo + 1
-            html + $hist($setNo,maxPresent)
-            if {1} {
-                html {">} $hist($setNo,hits) {</a>}
+            if {$html3} {
+                html {<td align=right>}
+            }
+            if {[info exists hist($setNo,$i,hits)]} {
+                html { <a href="http:} $env(SCRIPT_NAME)
+                html / $sessionId {/search.egw/} $setNo + $i + 1
+                html + $hist($setNo,maxPresent)
+                html {">} $hist($setNo,$i,hits) {</a>}
             } else {
-                html {">Result</a>: } $hist($setNo,hits) { hits.}
+                if {$html3} {
+                    html {Failed}
+                } else {
+                    html {Search failed.}
+                }
             }
-        } else {
             if {$html3} {
-                html {Failed}
+                html {<td align=left>}
             } else {
-                html {Search failed.}
+                html "<dd>\n"
             }
-        }
-        if {$html3} {
-            html {<td align=left>}
-        } else {
-            html "<dd>\n"
-        }
-        html { <a href="http:} $env(SCRIPT_NAME)
-        html / $sessionId / $scriptQuery / $setNo + $host
-        if {$html3} {
-            html {">}
-        } else {
-            html {">Query</a>: }
-        }
-        set op {}
-        for {set i 1} {$i <= 3} {incr i} {
-            if {[string length $hist($setNo,form,entry$i)] > 0} {
-                html " <b>" [join $op " "] "</b> "
-                html [join $hist($setNo,form,menu$i)] "=" 
-                html $hist($setNo,form,entry$i)
-                set op $hist($setNo,form,logic$i)
+            html { <a href="http:} $env(SCRIPT_NAME)
+            html / $sessionId / $scriptQuery {;/} $setNo + $host
+            if {$html3} {
+                html {">}
+            } else {
+                html {">Query</a>: }
+            }
+            set op {}
+            for {set j 1} {$j <= 3} {incr j} {
+                if {[string length $hist($setNo,form,entry$j)] > 0} {
+                    html " <b>" [join $op " "] "</b> "
+                set pre [join $hist($setNo,form,menu$j)]
+                    if {[string length $pre] > 0} {
+                        html $pre "="
+                    }
+                    html $hist($setNo,form,entry$j)
+                    set op $hist($setNo,form,logic$j)
+                }
+            }
+            if {$html3} {
+                html {</a><tr>} "\n"
             }
-        }
-        if {$html3} {
-            html {</a><tr>} "\n"
         }
     }
     if {$html3} {
@@ -1625,7 +1657,7 @@ proc button-main {} {
     }
 }
 
-proc button-define-target {more} {
+proc button-define-target {} {
     global useIcons
     global env
     global sessionId
@@ -1643,11 +1675,10 @@ proc button-define-target {more} {
     }
 }
 
-proc button-new-target {more} {
+proc button-new-target {} {
     global useIcons
     global env
     global sessionId
-    global mMode
     global scriptTarget
 
     if {[string length $scriptTarget] == 0} return
@@ -1665,7 +1696,7 @@ proc button-new-target {more} {
     }
 }
 
-proc button-view-history {more} {
+proc button-view-history {} {
     global useIcons
     global env
     global sessionId
@@ -1685,19 +1716,18 @@ proc button-view-history {more} {
     }
 }
 
-proc button-new-query {more setNo} {
+proc button-new-query {setNo} {
     global useIcons
     global env
     global sessionId
     global hist
-    global mMode
     global scriptQuery
 
     if {!$useIcons} {
         html "\n | "
     }
     html {<a href="http:} $env(SCRIPT_NAME)
-    html / $sessionId / $scriptQuery / $setNo + $hist($setNo,0,host) {">}
+    html / $sessionId / $scriptQuery {;/} $setNo + $hist($setNo,0,host) {">}
 
     if {$useIcons} {
         html {<img src="/egwgif/button-new-query.gif" }
@@ -1707,7 +1737,31 @@ proc button-new-query {more setNo} {
     }
 }
 
-proc button-scan-window {more setNo} {
+proc button-result-set {setNo tno} {
+    global useIcons
+    global env
+    global sessionId
+    global hist
+
+    if {!$useIcons} {
+        html "\n | "
+    }
+    html {<a href="http:} $env(SCRIPT_NAME) / $sessionId 
+    if {$tno > 0} {
+        html {/msearch.egw/} $setNo
+    } else {
+        html {/search.egw/} $setNo + $tno
+    }
+    html + 1 + $hist($setNo,maxPresent)
+    if {$useIcons} {
+        html {"><img src="/egwgif/button-result-set.gif" }
+       html {alt="Result Set" border=0></a>}
+    } else {
+        html {">Result Set</a>}
+    }
+}
+
+proc button-scan-window {setNo} {
     global useIcons
     global env
     global sessionId
@@ -1779,6 +1833,45 @@ proc mkAssoc {assoc host} {
     }
 }
 
+proc serverList {headlineProc targetProc} {
+    global targets
+    global groupsDescription
+   
+    proc targetsCmp {l r} {
+        global targets
+        return [string compare [string tolower [lindex $targets($l) 0]] \
+                               [string tolower [lindex $targets($r) 0]]]
+    }
+    proc groupCmp {l r} {
+        global groupsOrder
+        if {[catch {set lo $groupsOrder($l)}]} {
+            set lo 10
+        }
+        if {[catch {set ro $groupsOrder($r)}]} {
+            set ro 10
+        }
+        return [expr $lo - $ro]
+    }
+    
+    foreach tt [array names targets] {
+        lappend groupsTmp([lindex $targets($tt) 6]) $tt
+    }
+    set gts [lsort -command groupCmp [array names groupsTmp]]
+    foreach gt $gts {
+        if {[info exists groupsDescription($gt)]} {
+            eval $headlineProc [list $groupsDescription($gt)]
+        } else {
+            eval $headlineProc $gt
+        }
+        set tn [lsort -command targetsCmp $groupsTmp($gt)]
+        foreach t $tn {
+            eval $targetProc $t
+        }
+    }
+
+    rename targetsCmp {}
+}
+
 if {[info exists utilExtension]} {
     source $utilExtension
 }
\ No newline at end of file
index d1515fb..b7d2dfd 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: ztargets.conf,v 1.30 1996/03/12 16:30:30 adam Exp $
+# $Id: ztargets.conf,v 1.31 1996/03/13 14:07:33 adam Exp $
 #
 # This file contains the predefined targets in the WWW-Z39.50 gateway
 # Each target is an entry in the associative array "targets". The
@@ -49,6 +49,7 @@ set targets(myriad.middlebury.edu/MIDCAT) {
     {} 
     {Middlebury College (DRA).} 
     1
+    university
 }
 
 set targets(rlg.stanford.edu/SAM) [list \
@@ -58,6 +59,7 @@ set targets(rlg.stanford.edu/SAM) [list \
     {} \
     {Research Libraries group, Stanford University. Sample database} \
     1 \
+    z39sample \
 ]
 
 set targets(z3950.bibsys.no:2100/BIBSYS) [list \
@@ -67,6 +69,7 @@ set targets(z3950.bibsys.no:2100/BIBSYS) [list \
     {} \
     {BIBSYS; Norway.} \
     0 \
+    union \
 ]
 
 #set targets(dtbsun.dtv.dk:4501/DEM) [list \
@@ -90,9 +93,10 @@ set targets(ir.dbc.bib.dk:2008/danbib) {
     {}
     {Danish Union Catalogue} 
     0 
+    union
 }
 
-set targets(dtbsun.dtv.dk:9999/usgs-esdd-uah) {
+set targets(dtbsun.dtv.dk:9999/usgs-esdd-iah-cd_rom) {
     Zebra
     USMARC
  {
@@ -102,15 +106,17 @@ set targets(dtbsun.dtv.dk:9999/usgs-esdd-uah) {
  { Date {@attr 1=30} }
  { {Doc ID} {@attr 1=1032} }
  { All {@attr 1=1016} }
- { Ranked {@attr 1=1016 @attr 4=105} }
+ { Free-text {@attr 1=1016 @attr 4=105} }
  }
     {}
-    {New Zebra Z39.50 test server with GILS records. Databases: <br>
+    {Zebra Z39.50 test server with GILS records. Databases: <br>
      usgs: sample of USGS data directory <br>
      esdd: additional Earch Science Data Directory records <br>
-     uah: data directory for the International Association of Hydrologists <br>
+     iah: data directory for the International Association of Hydrologists <br>
+     cd_rom: SIG-CAT compendium of CD-ROMs.
     }
     1
+    gils
 }
 
 set targets(z3950.research.att.com/books) [list \
@@ -120,6 +126,7 @@ set targets(z3950.research.att.com/books) [list \
     {} \
     {AT&T book catalog, mainly IEEE} \
     1 \
+    assorted \
 ]
 
 set targets(dranet.dra.com/drewdb) [list \
@@ -129,6 +136,7 @@ set targets(dranet.dra.com/drewdb) [list \
     {} \
     {Sample database of 400,000 bibliographic records from Drew University} \
     1 \
+    z39sample \
 ]
 
 set targets(libcat1.cc.emory.edu/UNICORN) [list \
@@ -138,6 +146,7 @@ set targets(libcat1.cc.emory.edu/UNICORN) [list \
     {} \
     {Emory University} \
     0 \
+    assorted \
 ]
 
 set targets(161.253.225.10/UNICORN) [ list \
@@ -147,6 +156,7 @@ set targets(161.253.225.10/UNICORN) [ list \
     {} \
     {George Washington University} \
     0 \
+    assorted \
 ]
 
 set targets(IBM2.LOC.GOV:2210/BOOKS) [ list \
@@ -156,6 +166,7 @@ set targets(IBM2.LOC.GOV:2210/BOOKS) [ list \
     {} \
     {Library of Congress: Production file of monograph (book) records} \
     1 \
+    union \
 ]
 
 set targets(IBM2.LOC.GOV:2210/NAMES) [ list \
@@ -165,6 +176,7 @@ set targets(IBM2.LOC.GOV:2210/NAMES) [ list \
     {} \
     {Library of Congress: Production file of name authority records} \
     1 \
+    union \
 ]
 
 set targets(199.92.147.99/Baystate) [list \
@@ -174,6 +186,7 @@ set targets(199.92.147.99/Baystate) [list \
     {} \
     {Baystate Medical Center} \
     0 \
+    assorted \
 ]
 
 set targets(Tikal.dev.oclc.org/AGRICOLA) [list \
@@ -183,43 +196,48 @@ set targets(Tikal.dev.oclc.org/AGRICOLA) [list \
     {} \
     {OCLC-FirstSearch: AGRICOLA} \
     1 \
+    union \
 ]
 
 set targets(nwi.ub2.lu.se/sverige) {
     NWI-Sweden
     WAIS \
-    { { Ranked {@attr 1=4} } }
+    { { Free-text {@attr 1=4} } }
     {}
     {Nordic Web Index - Sweden}
     1
+    nwi
 }
 
 
 set targets(nwi.ub2.lu.se/new_nor_lib) {
     NWI-Norway
     WAIS
-    { { Ranked {@attr 1=4} } }
+    { { Free-text {@attr 1=4} } }
     {}
     {Nordic Web Index - Norway}
     1
+    nwi
 }
 
 set targets(netsrv.casi.sti.nasa.gov:10210/GILS) {
     NASA
     WAIS
-    { { Ranked {@attr 1=4} } }
+    { { Free-text {@attr 1=4} } }
     {}
     {NASA database}
     1
+    gils
 }
 
 set targets(localhost:9999/test) {
     localwais
     WAIS
-    { { Ranked {@attr 1=4} } }
+    { { Free-text {@attr 1=4} } }
     {}
-    {Localhost test base}
+    {WAIS test server on localhost:9999}
     1
+    test
 }
 
 
@@ -230,6 +248,7 @@ set targets(z3950.research.att.com/z39dbs) {
     {}
     {Server with description of other Z39.50 databases}
     1
+    assorted
 }
 
 set targets(z3950.research.att.com/netlib) {
@@ -239,6 +258,7 @@ set targets(z3950.research.att.com/netlib) {
     {}
     {Netlib server}
     1
+    assorted
 }
 
 set targets(localhost:210/Default) {
@@ -251,9 +271,33 @@ set targets(localhost:210/Default) {
  { Date {@attr 1=30} }
  { {Doc ID} {@attr 1=1032} }
  { All {@attr 1=1016} }
- { Ranked {@attr 1=1016 @attr 4=105} }
+ { Free-text {@attr 1=1016 @attr 4=105} }
  }
     {}
-    {Test server on port 210}
+    {Z39.50 Test server on port 210}
     1
+    test
 }
+
+set groupsDescription(union)        {Union catalogues}
+set groupsOrder(union)              10
+
+set groupsDescription(university)   {Universities}
+set groupsOrder(university)         11
+
+set groupsDescription(nwi)          {Nordic Web Index servers}
+set groupsOrder(nwi)                12
+
+set groupsDescription(gils)         {Government Information Locators (GILS)}
+set groupsOrder(gils)               13
+
+set groupsDescription(assorted)     {Assorted servers}
+set groupsOrder(assorted)           14
+
+set groupsDescription(z39sample)    {Z39.50 Test sample servers}
+set groupsOrder(z39sample)          99
+
+
+set groupsDescription(test)         {Test servers}
+set groupsOrder(test)               100
+