$OpenBSD: patch-sdr_src_new_tcl,v 1.1 2001/03/17 17:33:19 wilfried Exp $
--- sdr/src/new.tcl.orig	Thu Feb 25 22:25:49 1999
+++ sdr/src/new.tcl	Fri Mar 16 20:55:41 2001
@@ -10,16 +10,31 @@ set new_wiz_norm_panels \
 set new_wiz_tech_panels \
 	"info type timing_tech scope_tech media_tech contact accept"
 
-proc new {aid} {
+proc new {aid {w .w0}} {
     global ifstyle ldata
     if {[string compare $aid "new"]!=0} {
 	#we need a working variable while we think about editing sessions,
 	#in case we don't commit the changes.
 	set ldata($aid,tmpmulticast) $ldata($aid,multicast)
     }
+
+    # Hack to handle multiple directory windows:
+    # Temporarily change the available 'zones' to those that are
+    # appropriate for creating a new session in this directory:
+    global zone savedZoneData zoneDataForWindow
+    set savedZoneData [array get zone]
+    array set zone $zoneDataForWindow($w)
+
     new_wiz_init $aid $ifstyle(create)
 }
 
+proc cleanup_after_new {} {
+    destroy .new
+
+    # Restore the original zone data:
+    global zone savedZoneData
+    catch {array set zone $savedZoneData}
+}
 
 proc new_wiz_init {aid iftype} {
     global new_wiz_norm_panels new_wiz_tech_panels 
@@ -50,7 +65,7 @@ proc new_wiz_init {aid iftype} {
 	    -relief raised \
 	    -borderwidth 1 -highlightthickness 0
     pack .new.f.b.accept -side left -fill x    -expand true
-    button .new.f.b.cancel -text "Cancel" -command {destroy .new} \
+    button .new.f.b.cancel -text "Cancel" -command {cleanup_after_new} \
 	    -relief raised \
 	    -borderwidth 1 -highlightthickness 0
     pack .new.f.b.cancel -side left -fill x    -expand true
@@ -430,7 +445,7 @@ proc new_wiz_panel_accept {panelnum pane
     .new.f.b.next configure -state disabled
     .new.f.b.accept configure -state normal -command \
 	"if {\[create\]==1} \
-	  {destroy .new}"
+	  {cleanup_after_new}"
     .new.f.b.back configure -state normal -command "new_wiz_panel_[lindex $panels $back_panel] $back_panel \"$panels\" $aid"
     new_mk_session_accept .new.f.f.accept .new.f.f $aid
 }
@@ -1452,13 +1467,13 @@ proc new_mk_session_buttons {win aid} {
 	button $win.create -text [tt "Modify"] -command \
 	    "if {\[create\]==1} \
                 { do_ad_creation $aid;\
-                  destroy .new}"
+                  cleanup_after_new}"
 	tixAddBalloon $win.create Button [tt "Click here to advertise the modified session.  
 
 Changing the session name may result in some sites seeing duplicate announcements for a while."]
     } else {
 	button $win.create -text [tt "Create"] -command \
-	    "if {\[create\]==1} {destroy .new}" \
+	    "if {\[create\]==1} {cleanup_after_new}" \
 	     -highlightthickness 0
 	tixAddBalloon $win.create Button [tt "When you've filled out all the above information, click here to create and advertise this session"]
     }
@@ -1469,7 +1484,7 @@ Changing the session name may result in 
 	 -highlightthickness 0
     tixAddBalloon $win.help Button [tt "Click here for more help or to turn balloon help off"]
 
-    button $win.dismiss -text "Dismiss" -command "destroy .new" \
+    button $win.dismiss -text "Dismiss" -command "cleanup_after_new" \
 	 -highlightthickness 0
     tixAddBalloon $win.dismiss Button [tt "Click here to close this window"]
     pack $win.create -side left -fill x -expand true
