[vhffs-dev] [1271] Fixed some undefined warnings

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1271
Author:   beuss
Date:     2008-10-08 17:48:44 +0200 (Wed, 08 Oct 2008)

Log Message:
-----------
Fixed some undefined warnings

Modified Paths:
--------------
    trunk/vhffs-tools/src/vhffs-managedns


Modified: trunk/vhffs-tools/src/vhffs-managedns
===================================================================
--- trunk/vhffs-tools/src/vhffs-managedns	2008-10-08 14:18:10 UTC (rev 1270)
+++ trunk/vhffs-tools/src/vhffs-managedns	2008-10-08 15:48:44 UTC (rev 1271)
@@ -248,10 +248,19 @@
 
 sub list_rr_domain_change {
     my $current = $_[0]->get();
+    my $list = $w_list_rr->getobj( 'list_rr_rrs' );
+    if($current eq '-1') {
+        $list->{-labels} = {};
+        $list->{-values} = [];
+        $list->{-selected} = undef;
+        $list->layout();
+        $list->draw();
+        return;
+    }
     my $domain = Vhffs::Services::DNS::get_by_domainname( $vhffs, $current );
 
-    my %rr_labels = ( -1 => '-- Select one --' );
-    my @rr_values = ( -1 );
+    my %rr_labels = ( 'NONE|-1' => '-- Select one --' );
+    my @rr_values = ( 'NONE|-1' );
     my @record_types = ( 'A', 'AAAA', 'CNAME', 'NS', 'MX', 'TXT' );
     foreach my $rr (@record_types) {
         foreach(values %{$domain->{$rr}}) {
@@ -267,7 +276,6 @@
         }
     }
 
-    my $list = $w_list_rr->getobj( 'list_rr_rrs' );
     $list->{-labels} = \%rr_labels;
     $list->{-values} = \@rr_values;
     $list->{-selected} = 0;
@@ -278,38 +286,46 @@
 
 sub list_rr_rr_change {
     my $value = $_[0]->get();
-    my ($type, $id) = ($value =~ /^([A-Z]+)\|(\d+)$/);
-    my $domain = Vhffs::Services::DNS::get_by_domainname( $vhffs, $w_list_rr->getobj('list_rr_domains')->get() );
-    my $rr = $domain->{$type}{$id};
+    my ($type, $id) = ($value =~ /^([A-Z]+)\|(-?\d+)$/);
+    if($id == -1) {
+        foreach(qw(list_rr_ttl_lbl list_rr_ttl list_rr_data list_rr_aux list_rr_priority_lbl list_rr_ip_lbl list_rr_destination_lbl list_rr_text_lbl)) {
+            my $field = $w_list_rr->getobj( $_ );
+            $field->{-hidden} = 1;
+            $field->{-focusable} = 0;
+        }
+    } else {
+        my $domain = Vhffs::Services::DNS::get_by_domainname( $vhffs, $w_list_rr->getobj('list_rr_domains')->get() );
+        my $rr = $domain->{$type}{$id};
+    
+        my $field = $w_list_rr->getobj( 'list_rr_ttl_lbl' );
+        $field->{-hidden} = 0;
+        $field = $w_list_rr->getobj( 'list_rr_ttl' );
+        $field->{-hidden} = 0;
+        $field->{-focusable} = 1;
+        $field->text($rr->{ttl});
 
-    my $field = $w_list_rr->getobj( 'list_rr_ttl_lbl' );
-    $field->{-hidden} = 0;
-    $field = $w_list_rr->getobj( 'list_rr_ttl' );
-    $field->{-hidden} = 0;
-    $field->{-focusable} = 1;
-    $field->text($rr->{ttl});
+        $field = $w_list_rr->getobj( 'list_rr_data' );
+        $field->{-hidden} = 0;
+        $field->{-focusable} = 1;
+        $field->text($rr->{data});
 
-    $field = $w_list_rr->getobj( 'list_rr_data' );
-    $field->{-hidden} = 0;
-    $field->{-focusable} = 1;
-    $field->text($rr->{data});
+        $field = $w_list_rr->getobj( 'list_rr_aux' );
+        $field->{-hidden} = ($type ne 'MX');
+        $field->{-focusable} = ($type eq 'MX');
+        $field->text($rr->{aux});
 
-    $field = $w_list_rr->getobj( 'list_rr_aux' );
-    $field->{-hidden} = ($type ne 'MX');
-    $field->{-focusable} = ($type eq 'MX');
-    $field->text($rr->{aux});
+        $field = $w_list_rr->getobj( 'list_rr_priority_lbl' );
+        $field->{-hidden} = ($type ne 'MX');
 
-    $field = $w_list_rr->getobj( 'list_rr_priority_lbl' );
-    $field->{-hidden} = ($type ne 'MX');
-
-    $field = $w_list_rr->getobj( 'list_rr_ip_lbl' );
-    $field->{-hidden} = ($type ne 'A' && $type ne 'AAAA');
+        $field = $w_list_rr->getobj( 'list_rr_ip_lbl' );
+        $field->{-hidden} = ($type ne 'A' && $type ne 'AAAA');
     
-    $field = $w_list_rr->getobj( 'list_rr_destination_lbl' );
-    $field->{-hidden} = ($type ne 'CNAME');
+        $field = $w_list_rr->getobj( 'list_rr_destination_lbl' );
+        $field->{-hidden} = ($type ne 'CNAME');
 
-    $field = $w_list_rr->getobj( 'list_rr_text_lbl' );
-    $field->{-hidden} = ($type ne 'TXT');
+        $field = $w_list_rr->getobj( 'list_rr_text_lbl' );
+        $field->{-hidden} = ($type ne 'TXT');
+    }
 
     $w_list_rr->draw();
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/