Updated for YAZ 1.7. HTML output tidy up. Added LOC target.
[egate.git] / www / search.egw
index 5c90170..e526ebd 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 {
-# $Id: search.egw,v 1.36 1996/03/11 17:40:48 adam Exp $
+# $Id: search.egw,v 1.41 2001/02/26 14:32:36 adam Exp $
 
 proc start-scan {scanNo targetNo cache dir initSet} {
     global sessionId
@@ -21,7 +21,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
     html "</head><body>\n"
 
     set useIcons 1
-    button-europagate
+    button-main
 
     if {$dir == "b"} {
         set lines 20
@@ -35,32 +35,38 @@ 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
         }
-        html {<a href="http:} $env(SCRIPT_NAME)
+        if {!$useIcons} {
+           html "\n | "
+        }
+        html {<a href="} $env(SCRIPT_NAME)
         html / $sessionId {/search.egw/} $setNo + $targetNo + 
         html [expr $scanNo - 1] + b {">}
         if {$useIcons} {
             html {<img src="/egwgif/button-previous-terms.gif" }
             html {alt="Next Terms" border=0></a>}
         } else {
-            html {Previous Terms</a> | }
+            html {Previous Terms</a>}
         }
 
-        html {<a href="http:} $env(SCRIPT_NAME)
+        if {!$useIcons} {
+           html "\n | "
+        }
+        html {<a href="} $env(SCRIPT_NAME)
         html / $sessionId {/search.egw/} $setNo + $targetNo +
         html [expr $scanNo + 1] + f {">}
         if {$useIcons} {
             html {<img src="/egwgif/button-next-terms.gif" }
             html {alt="Next Terms" border=0></a>}
         } else {
-            html {Next Terms</a> | }
+            html {Next Terms</a>}
         }
         html {</a>}
     }
-    button-new-query 0 $setNo
+    button-new-query $setNo
 
     set databases [splitDatabaseSpec $host]
 
@@ -72,7 +78,7 @@ proc start-scan {scanNo targetNo cache dir initSet} {
         set databaseDefault $hist($oSetNo,$targetNo,database)
     }
     
-    html {<form action="http:} $env(SCRIPT_NAME)
+    html {<form action="} $env(SCRIPT_NAME)
     html / $sessionId {/search.egw/} $setNo + $targetNo {+1" method=get>} \n
     set nodb [llength $databases]
     if {$nodb > 1} {
@@ -120,8 +126,8 @@ proc start-scan {scanNo targetNo cache dir initSet} {
 
     set useIcons 0
     if {$hist($setNo,$scanNo,scanTerm) == ""} {
-        button-europagate
-        button-new-query 0 $setNo        
+        button-main
+        button-new-query $setNo        
         return
     }
 
@@ -129,29 +135,35 @@ proc start-scan {scanNo targetNo cache dir initSet} {
     display-scan $setNo $scanNo 0
     html "<p>\n"
 
-    button-europagate
+    button-main
 
-    html {<a href="http:} $env(SCRIPT_NAME)
+    if {!$useIcons} {
+        html "\n | "
+    }
+    html {<a href="} $env(SCRIPT_NAME)
     html / $sessionId {/search.egw/} $setNo + $targetNo +
     html [expr $scanNo - 1] + b {">}
     if {$useIcons} {
         html {<img src="/egwgif/button-previous-terms.gif" }
         html {alt="Next Terms" border=0></a>}
     } else {
-        html {Previous Terms</a> | }
+        html {Previous Terms</a>}
     }
 
-    html {<a href="http:} $env(SCRIPT_NAME)
+    if {!$useIcons} {
+        html "\n | "
+    }
+    html {<a href="} $env(SCRIPT_NAME)
     html / $sessionId {/search.egw/} $setNo + $targetNo +
     html [expr $scanNo + 1] + f {">}
     if {$useIcons} {
         html {<img src="/egwgif/button-next-terms.gif" }
         html {alt="Next Terms" border=0></a>}
     } else {
-        html {Next Terms</a> | }
+        html {Next Terms</a>}
     }
     html {</a>}
-    button-new-query 0 $setNo
+    button-new-query $setNo
 
     if {!$debug} return
     html "<hr>\n"
@@ -162,7 +174,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"
@@ -171,6 +182,10 @@ proc start-scan {scanNo targetNo cache dir initSet} {
 
     if {[info commands saveState] == ""} {
         source z39util.tcl
+        if {![info exists debug]} {
+            session-lost
+            egw_abort
+        }
     }
     global sessionWait
     global nextSetNo
@@ -192,7 +207,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 +229,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 +243,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 +251,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 +263,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 +284,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 +331,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>"