New function zwait that waits for a variable change - due to i/o events
[egate.git] / www / query.egw
index 3f0d25f..319d5f1 100644 (file)
@@ -1,42 +1,49 @@
 <html>
+<head>
+<title> WWW/Z39.50 Gateway Query Form</title>
+</head>
+<body>
 {
-# $Id: query.egw,v 1.3 1995/10/27 17:30:15 adam Exp $
+# $Id: query.egw,v 1.4 1995/10/30 17:35:17 adam Exp $
 proc fail-response {} {
     global sessionWait
-    htmlr {Init fail<br>}
-    set sessionWait 0
+    set sessionWait -1
 }
 
 proc init-response {} {
     global sessionWait
-    htmlr {Init ok <br>}
-    htmlr {</body>}
-    htmlr {</html>}
-    set sessionWait 0
+    set sessionWait 1
 }
 
     set t $sessionParms
     set databases [lindex $targets($t) 1]
-    set sessionWait 1
+    set sessionWait 0
     ir z39
     z39 failback fail-response
-    z39 connect $t
+    if {[catch {z39 connect $t}]} {
+        htmlr "Cannot connect to target $t <br>"
+        htmlr "</body></html>"
+        return
+    }        
     z39 callback init-response
     z39 init
-}
-<head>
-<title> WWW/Z39.50 Gateway Query Form</title>
-</head>
-<body>
-<h2> Search in databases </h2>
-<h1> <blink> Not Functional Yet </blink> </h1>
-{
+    zwait sessionWait
+    if {$sessionWait == -1} {
+        htmlr "Cannot initialize with target $t <br>"
+        htmlr "</body></html>"
+        return
+    }
+    htmlr {
+        <h2> Search in databases </h2>
+        <h1> <blink> Not Functional Yet </blink> </h1>
+    }
     html {<form action="http://} $env(SERVER_NAME) $env(SCRIPT_NAME)
     htmlr / $sessionId {/search.egw" method=post>}
     set nodb [llength $databases]
     if {$nodb > 1} {
         if {$nodb > 2} {
-            htmlr {The chosen target supports searching in several databases. <br>}
+            html {The chosen target supports searching in }
+            htmlr {several databases. <br>}
             htmlr {Choose the bases you want to search: <br>}
         }
         set i 0
@@ -54,10 +61,8 @@ proc init-response {} {
             htmlr [concat $databases] {"> All <br>}
         }
     }
-}
-<hr>
-<strong>Input your search criteria: </strong> <br>
-{
+    htmlr {<hr>}
+    htmlr {<strong>Input your search criteria: </strong> <br>}
     set fields [lindex $targets($t) 2]
     for {set no 1} {$no < 4} {incr no} {
         htmlr {<select name="menu} $no {">}
@@ -75,38 +80,39 @@ proc init-response {} {
         }
         htmlr <br>
     }
-}
-<hr>
-<p>
-Alternatively you can enter your query in <a href="ccl.html"> CCL </a> here: <br>
-<input type=text name="cclentry" size=60> <br>
-<hr>
-<strong> Various technical parameters: </strong> <br>
-Max hits: <input type="text" name="hits" value="50" size=3>
-Records are shown in:
-<select name="format">
-<option> Long format
-<option> Medium format
-<option> Short format
-<option> Raw MARC
-</select>
-<br>
-<p>
-<input type="submit" value="Send Query">
-</form>
-<hr>
-This page is maintained by <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
-Last modified 29. september 1995. <br>
-<em> This and the following pages are under construction and will continue to be so
-until the end of December 1995.</em>
-<hr>
-sessionId: {html $sessionId} <br>
-sessionParms: {html $sessionParms} <br>
-{
+    html {<hr><p>
+     Alternatively you can enter your query
+     in <a href="ccl.html"> CCL </a> here: <br>
+     <input type=text name="cclentry" size=60> <br>
+     <hr>
+     <strong> Various technical parameters: </strong> <br>
+      Max hits: <input type="text" name="hits" value="50" size=3>
+      Records are shown in:
+     <select name="format">
+     <option> Long format
+     <option> Medium format
+     <option> Short format
+     <option> Raw MARC
+     </select>
+     <br>
+     <p>
+     <input type="submit" value="Send Query">
+     </form>
+     <hr>
+     This page is maintained by
+      <a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.
+     Last modified 29. september 1995. <br>
+     <em> This and the following pages are under construction
+     and will continue to be so until the end of December 1995.</em>
+     <hr>
+    }
+    htmlr {sessionId: } $sessionId { <br>}
+    htmlr {sessionParms: } $sessionParms { <br>}
     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
         htmlr $e {: } $env($e) {<br>}
     }
-}
-form: {html [form]} <br>
-target: {html $t} <br>
-databases: {html $databases} <br>
+    htmlr {form: } [form] {<br>}
+    htmlr {target: } $t { <br>}
+    htmlr {databases: } $databases { <br>}
+    htmlr {</body></html>}
+}
\ No newline at end of file