Major revision. Single-target result set can be reached from the
[egate.git] / www / mquery.egw
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