Bug fix: in function wo_write realloc is used only when memory is already
[egate.git] / www / search.egw
index ede4eed..588f13a 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 {
-# $Id: search.egw,v 1.27 1996/01/12 10:03:19 adam Exp $
+# $Id: search.egw,v 1.30 1996/01/24 08:27:29 adam Exp $
 
 proc start-scan {scanNo cache dir initSet} {
     global sessionId
@@ -72,9 +72,13 @@ proc start-scan {scanNo cache dir initSet} {
     html { size=35> }
     html {<input type=submit name=submit value="Scan">}
     html "\n"
-    html {</form>}
+    html {</form><br>}
+
+    button-europagate
+
     if {$hist($setNo,$scanNo,scanTerm) == ""} {
-        wabort
+        button-new-query 0 $setNo
+        egw_abort
         return
     }
     if {$dir == "b"} {
@@ -91,7 +95,27 @@ proc start-scan {scanNo cache dir initSet} {
         return
     }
 
-    html "<br><p>\n"
+    html {<a href="http:} $env(SCRIPT_NAME)
+    html / $sessionId {/search.egw/} $setNo + [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 {<a href="http:} $env(SCRIPT_NAME)
+    html / $sessionId {/search.egw/} $setNo + [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 {</a>}
+    button-new-query 0 $setNo
+
+    html "<p>\n"
     display-scan $setNo $scanNo 0
     html "<p>\n"
 
@@ -125,10 +149,10 @@ proc start-scan {scanNo cache dir initSet} {
     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
         html $e {: } $env($e) {<br>} \n
     }
-    html "form: " [wform] " <br>\n"
+    html "form: " [egw_form] " <br>\n"
     html "target: " $host " <br>\n"
     html "databases: " $hist($setNo,database) " <br>\n"
-    html "selected: " [wform base] " <br>\n"
+    html "selected: " [egw_form base] " <br>\n"
     html "setNo: " $setNo " <br>\n"
     html "nextSetNo: " $nextSetNo " <br>\n"    
 }
@@ -181,7 +205,7 @@ proc buttons {setNo setMax startPos after} {
 
     set setNo [lindex $sessionParms 0]
 
-    if {[wform] != ""} {
+    if {[egw_form] != ""} {
         set hist($nextSetNo,idAuthentication) $hist($setNo,idAuthentication)
         set hist($nextSetNo,host) $hist($setNo,host)
 
@@ -193,37 +217,37 @@ proc buttons {setNo setMax startPos after} {
         }
         set hist($setNo,scan) 0
 
-        set hist($setNo,form,menu1) [wform menu1]
-        set hist($setNo,form,menu2) [wform menu2]
-        set hist($setNo,form,menu3) [wform menu3]
+        set hist($setNo,form,menu1) [egw_form menu1]
+        set hist($setNo,form,menu2) [egw_form menu2]
+        set hist($setNo,form,menu3) [egw_form menu3]
 
-        set hist($setNo,form,entry1) [wform entry1]
-        set hist($setNo,form,entry2) [wform entry2]
-        set hist($setNo,form,entry3) [wform entry3]
+        set hist($setNo,form,entry1) [egw_form entry1]
+        set hist($setNo,form,entry2) [egw_form entry2]
+        set hist($setNo,form,entry3) [egw_form entry3]
 
-        set hist($setNo,form,logic1) [wform logic1]
-        set hist($setNo,form,logic2) [wform logic2]
+        set hist($setNo,form,logic1) [egw_form logic1]
+        set hist($setNo,form,logic2) [egw_form logic2]
         set hist($setNo,form,logic3) {}
         
         set host $hist($setNo,host)
         set databases [lindex $targets($host) 1]
 
-        set b [wform base]
-       if {[wform baseall] != ""} {
+        set b [egw_form base]
+       if {[egw_form 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]
+        set hist($setNo,maxPresent) [egw_form hits]
         if {$hist($setNo,maxPresent) == ""} {
             set hist($setNo,maxPresent) 30
         }
         set i [lindex $sessionParms 1]
         if {$i == ""} {
             for {set j 1} {$j <= 3} {incr j} {
-                if {[wform scan$j] != ""} {
+                if {[egw_form scan$j] != ""} {
                     set i $j
                     break
                 }
@@ -235,9 +259,9 @@ proc buttons {setNo setMax startPos after} {
             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 {} $setNo
+            start-scan $scanNo 0 {} {}
             html "</body></html>\n"
-            wabort
+            egw_abort
             return
         }
         set query [build-query $hist($setNo,host) 3]
@@ -246,10 +270,17 @@ proc buttons {setNo setMax startPos after} {
             displayError "Empty query" \
                 "You must specify at least one search word"
             html "</body></html>\n"
-            wabort
+            egw_abort
         }
         set hist($setNo,query) $query
     } else {
+        if {[lindex $sessionParms 1] == "scan"} {
+            set scanNo 1000
+            set hist($setNo,$scanNo,scanTerm) {}
+            start-scan $scanNo 0 {} {}
+            html "</body></html>\n"
+            egw_abort
+        }
         if {![info exists hist($setNo,scan)]} return
         if {$hist($setNo,scan) > 0} {
             set scanNo [lindex $sessionParms 1]
@@ -259,7 +290,7 @@ proc buttons {setNo setMax startPos after} {
             }
             start-scan $scanNo 1 $dir $setNo
             html "</body></html>\n"
-            wabort
+            egw_abort
         }
     }
     set host $hist($setNo,host)
@@ -282,7 +313,7 @@ proc buttons {setNo setMax startPos after} {
         } else {
             html "<h3> No hits</h3>\n"
         }
-        wflush
+        egw_flush
         html "<ul>\n"
         display-rec 1 $setOffset display-brief 0
         incr setOffset
@@ -308,7 +339,7 @@ proc buttons {setNo setMax startPos after} {
         } else {
             html "<h3> No hits</h3>\n"
         }
-        wflush
+        egw_flush
         html "<ul>\n"
     }
     if {$setMax > 0} {
@@ -328,10 +359,10 @@ proc buttons {setNo setMax startPos after} {
     foreach n [array names env] {
         html "env($n) = " $env($n) " <br>\n"
     }
-    html "form: " [wform] " <br>\n"
+    html "form: " [egw_form] " <br>\n"
     html "target: " $host " <br>\n"
     html "databases: " $hist($setNo,database) " <br>\n"
-    html "selected: " [wform base] " <br>\n"
+    html "selected: " [egw_form base] " <br>\n"
     html "query: --" $hist($setNo,query) "-- <br>"
     html "setNo: " $setNo " <br>\n"
     html "nextSetNo: " $nextSetNo " <br>\n"