Previus/next scan buttons in scan.
[egate.git] / www / search.egw
index 0feff70..daaf3b7 100644 (file)
@@ -1,8 +1,8 @@
 <html>
 {
-# $Id: search.egw,v 1.21 1996/01/02 10:52:28 adam Exp $
+# $Id: search.egw,v 1.22 1996/01/03 08:59:43 adam Exp $
 
-proc perform-scan {} {
+proc start-scan {scanNo cache dir} {
     global sessionId
     global sessionParms
     global sessionWait
@@ -12,30 +12,49 @@ proc perform-scan {} {
     global nextSetNo
     global env
 
-    set scanNo 1000
-
-    set termPlusAttr [build-scan $hist($setNo,host) 3]
+    set host $hist($setNo,host)
 
-    if {"$termPlusAttr" == ""} {
-        html "<head><title> WWW/Z39.50 Gateway Scan</title>\n<body>\n"
+    html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
+    html "</head><body>\n"
+                
+    if {$hist($setNo,$scanNo,scanTerm) == ""} {
         displayError "Empty query" \
-            "You must specify at least one search word"
+                     "You must specify at least one search word"
         html "</body></html>\n"
         wabort
+        return
     }
-    set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
-    set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
-    
-    set host $hist($setNo,host)
-
-    html "<head><title> WWW/Z39.50 Gateway Scan " $host " </title>\n"
-    html "</head><body>\n"
-
-    if {[z39scan $setNo $scanNo 0 20 10] != "1"} {
+    if {$dir == "b"} {
+        set lines 20
+        set pos 20
+    } elseif {$dir == "f"} {
+        set lines 20
+        set pos 1
+    } else {
+        set lines 20
+        set pos 10
+    }
+    if {[z39scan $setNo $scanNo 0 $lines $pos $cache] != "1"} {
         return
     }
+    html {<a href="http:} $env(SCRIPT_NAME)
+    html / $sessionId {/search.egw/} $setNo + [expr $scanNo - 1] + b
+    html {">Backward</a>} "\n"
+
+    html {<a href="http:} $env(SCRIPT_NAME)
+    html / $sessionId {/search.egw/} $setNo + [expr $scanNo + 1] + f
+    html {">Forward</a><br>}
+
     display-scan $setNo $scanNo 0
 
+    html {<a href="http:} $env(SCRIPT_NAME)
+    html / $sessionId {/search.egw/} $setNo + [expr $scanNo - 1] + b
+    html {">Backward</a>} "\n"
+
+    html {<a href="http:} $env(SCRIPT_NAME)
+    html / $sessionId {/search.egw/} $setNo + [expr $scanNo + 1] + f
+    html {">Forward</a><br>}
+
     html "<hr>\n"
     html "<h3>Debug information</h3>\n"
     html "sessionId: $sessionId <br>\n"
@@ -136,7 +155,7 @@ proc buttons {setNo setMax startPos after} {
 
     set setNo [lindex $sessionParms 0]
 
-    if {[wform menu1] != ""} {
+    if {[wform] != ""} {
         set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
         set hist($nextSetNo,host) $hist($setNo,host)
 
@@ -172,11 +191,19 @@ proc buttons {setNo setMax startPos after} {
         if {$hist($setNo,maxPresent) == ""} {
             set hist($setNo,maxPresent) 30
         }
-
-        if {[wform submit] == "Scan"} {
-            perform-scan
-            wabort
+        for {set i 1} {$i <= 3} {incr i} {
+            if {[wform scan$i] != ""} {
+                set scanNo 1000
+                set hist($setNo,scan) $i
+                set termPlusAttr [build-scan $hist($setNo,host) $i]
+                set hist($setNo,$scanNo,scanTerm) [lindex $termPlusAttr 0]
+                set hist($setNo,scanAttr) [lindex $termPlusAttr 1]
+                start-scan $scanNo 0 {}
+                wabort
+                return
+            }
         }
+        set hist($setNo,scan) 0
         set query [build-query $hist($setNo,host) 3]
         if {"x$query" == "x"} {
             html "<head><title> WWW/Z39.50 Gateway Search</title>\n<body>\n"
@@ -186,6 +213,16 @@ proc buttons {setNo setMax startPos after} {
             wabort
         }
         set hist($setNo,query) $query
+    } else {
+        if {$hist($setNo,scan) > 0} {
+            set scanNo [lindex $sessionParms 1]
+            set dir [lindex $sessionParms 2]
+            if {$scanNo == ""} {
+                set scanNo 1000
+            }
+            start-scan $scanNo 1 $dir
+            wabort
+        }
     }
     set host $hist($setNo,host)