+<html>
+<head>
+<title> WWW/Z39.50 Gateway Target Definition Response</title>
+</head>
+<body>
+{
+# $Id: tdefine.egw,v 1.1 1996/01/24 14:14:19 adam Exp $
+
+ if {[info commands saveState] == ""} {
+ source z39util.tcl
+ }
+ html "<h2>Target definition response</h2><br>\n"
+
+ set name [lindex [egw_form name] 0]
+ set description [lindex [egw_form description] 0]
+ set host [lindex [egw_form host] 0]
+ set databases [lindex [egw_form databases] 0]
+ set authentication [egw_form authentication]
+ set fields [lindex [egw_form fields] 0]
+
+ set ok 1
+ if {[string length $name] == 0} {
+ html "You didn't specify a target name. You <em>must</em> specify"
+ html " a target name<br>\n"
+ set ok 0
+ }
+ if {[string length $host] == 0} {
+ html "You didn't specify a target name. You <em>must</em> specify"
+ html " a host name<br>\n"
+ set ok 0
+ }
+ if {[string length $databases] == 0} {
+ html "You didn't specify any database(s). You <em>must</em> specify"
+ html " at least one database</br>\n"
+ set ok 0
+ }
+ catch {unset item}
+ catch {unset attrList}
+ set fname {}
+ foreach e $fields {
+ set eqn [string first = $e]
+ if {$eqn > 0} {
+ lappend item {@attr} $e
+ } else {
+ if {[info exists item]} {
+ lappend attrList [list $fname $item]
+ set fname {}
+ unset item
+ }
+ if {[string length $fname] > 0} {
+ set fname "${fname} $e"
+ } else {
+ set fname $e
+ }
+ }
+ }
+ if {[info exists item]} {
+ lappend attrList [list $fname $item]
+ }
+ if {![info exists attrList]} {
+ html "You didn't specify proper search fields. At least one"
+ html " search fields must be present<br>\n"
+ set ok 0
+ }
+ if {$ok} {
+ global targets
+ set targets($host) [list \
+ [join $name] \
+ $databases \
+ $attrList \
+ $authentication \
+ $description \
+ 1 ]
+ html "Target successfully defined<br>\n"
+ }
+}
+{
+ button-europagate
+ button-define-target 1
+ button-new-target 0
+}
+
+{
+ global debug
+
+ if {!$debug} return
+
+ html "name=" $name "<br>\n"
+ html "description=" $description "<br>\n"
+ html "host=" $host "<br>\n"
+ html "databases=" $databases "<br>\n"
+ html "fields=" $fields "<br>\n"
+ html "attrList=$attrList<br>\n"
+}
+
+</body></html>