Work on queries.
[egate.git] / www / query.egw
index e188c71..1677291 100644 (file)
@@ -1,35 +1,50 @@
 <html>
+<head>
+<title> WWW/Z39.50 Gateway Query Form</title>
+</head>
+<body>
 {
-# $Id: query.egw,v 1.2 1995/10/27 15:12:04 adam Exp $
+# $Id: query.egw,v 1.5 1995/10/31 10:03:51 adam Exp $
+proc fail-response {} {
+    global sessionWait
+    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]
+    catch {z39 disconnect}
+    set sessionWait 0
     ir z39
-    set sessionWait 1
-    z39 connect $t
+    z39 failback fail-response
+    if {[catch {z39 connect $t}]} {
+        htmlr "Cannot connect to target $t <br>"
+        htmlr "</body></html>"
+        wabort
+    }        
     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>"
+        wabort
+    }
+    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
@@ -69,9 +84,9 @@ proc init-response {} {
         htmlr <br>
     }
 }
-<hr>
-<p>
-Alternatively you can enter your query in <a href="ccl.html"> CCL </a> here: <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>
@@ -90,11 +105,11 @@ Records are shown in:
 <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>
+<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>
+sessionParms: {html $sessionParms}<br>
 {
     foreach e {SERVER_NAME PATH_INFO SCRIPT_NAME} {
         htmlr $e {: } $env($e) {<br>}
@@ -103,3 +118,4 @@ sessionParms: {html $sessionParms} <br>
 form: {html [form]} <br>
 target: {html $t} <br>
 databases: {html $databases} <br>
+</body></html>