[vhffs-dev] [555] Various DNS hashes (CNAME, NS, MX, A) are now indexed by id ( was by some data).

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


Revision: 555
Author:   beuss
Date:     2007-04-12 12:40:04 +0000 (Thu, 12 Apr 2007)

Log Message:
-----------
Various DNS hashes (CNAME, NS, MX, A) are now indexed by id (was by some data).
DNS record modification/deletion uses id an no more data (perfs and coherence).
DNS record creation/modification/deletion returns various error codes.
Added records manipulation methods to Vhffs::Panel::DNS which act as proxies for Vhffs::Service::DNS ones but die with a meaningfull error message instead of returning error code.
All data manipulation for DNS stuff is now done on preference page (no more tricky error messages) => no more add_xxx.pl, modify_xxx.pl or delete_xxx.pl in vhffs-panel/dns/.
Improved page design (?) for DNS preferences.
DNS preferences templates now use loops, removed some unused parameters, preference page use common error and info handling.
Added some doc to Vhffs::Functions, added an option to allow acceptance of FQDN in check_domain_name.
Changed doctype for panel (why did we have a strict DTD if we didn't follow it ?), fixed some validation errors.
Updated tests.

Sorry for the commit size...

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm
    branches/vhffs_4.1/vhffs-panel/dns/prefs.pl
    branches/vhffs_4.1/vhffs-panel/templates/admin/main/general.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/dns/list_a_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/dns/list_cname_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/dns/list_mx_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/dns/list_ns_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/dns/menu_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/dns/prefs.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/group/menu_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/mailinglist/menu_sub.tmpl
    branches/vhffs_4.1/vhffs-panel/templates/main/panel.tmpl
    branches/vhffs_4.1/vhffs-panel/themes/vhffs-ng/main.css
    branches/vhffs_4.1/vhffs-tests/src/Services/DNS.pl

Removed Paths:
-------------
    branches/vhffs_4.1/vhffs-panel/dns/add_a.pl
    branches/vhffs_4.1/vhffs-panel/dns/add_cname.pl
    branches/vhffs_4.1/vhffs-panel/dns/add_mx.pl
    branches/vhffs_4.1/vhffs-panel/dns/add_ns.pl
    branches/vhffs_4.1/vhffs-panel/dns/delete_a.pl
    branches/vhffs_4.1/vhffs-panel/dns/delete_cname.pl
    branches/vhffs_4.1/vhffs-panel/dns/delete_mx.pl
    branches/vhffs_4.1/vhffs-panel/dns/delete_ns.pl
    branches/vhffs_4.1/vhffs-panel/dns/modif_a.pl
    branches/vhffs_4.1/vhffs-panel/dns/modif_cname.pl
    branches/vhffs_4.1/vhffs-panel/dns/modif_mx.pl


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Functions.pm	2007-04-12 12:40:04 UTC (rev 555)
@@ -436,8 +436,21 @@
 	return( 1 );
 }
 
-sub check_domain_name($) {
+=pod
+
+=head2 check_domain_name
+
+    die "Domain name is invalid (you can't use FQDN)\n" unless(Vhffs::Function::check_domain_name($name));
+    die "Domain name is invalid (could be FQDN or not)\n" unless(Vhffs::Function::check_domain_name($name, 1));
+
+Checks for domain name validity.
+
+=cut
+
+sub check_domain_name($;$) {
     my $domain_name = shift;
+    my $fqdn = shift;
+    $domain_name =~ s/\.$// if($fqdn);
     return (defined $domain_name && length($domain_name) >= 5 && $domain_name =~ /^(?:[a-z0-9\-]{1,63}[.])+([a-z0-9]{2,10})$/);
 }
 

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/DNS.pm	2007-04-12 12:40:04 UTC (rev 555)
@@ -180,4 +180,155 @@
 	return $template->output;
 }
 
+=pod
+
+=head2 add_a
+
+    eval { Vhffs::Panel::DNS::add_a($dns, $redirect, $name, $ip); };
+    if($@) {
+        print "An error occured: $@\n";
+    } else {
+        print "A Record added\n";
+    }
+
+Add a new A resource record to $dns. If $redirect is true, $name points
+to default address defined in configuration, else, it points on $ip.
+
+=cut
+
+sub add_a {
+    my ($dns, $redirect, $name, $ip) = @_;
+    die() unless(defined $dns && defined $redirect && defined $name && defined $ip);
+    my $rval;
+    if($redirect) {
+        $rval = $dns->add_a($name);
+    } else {
+        $rval = $dns->add_a($name, $ip);
+    }
+    return 1 if($rval > 0);
+    die(gettext('Invalid prefix')."\n") if($rval == -1);
+    die(gettext('Prefix already exists')."\n") if($rval == -2);
+    die(gettext('Unable to find default redirection address, please contact administrators')."\n") if($rval == -3);
+    die(gettext('Invalid IP address')."\n") if($rval == -4);
+    die(gettext('Database error')."\n") if($rval == -5);
+    die(gettext('Unknown error')."\n");
+}
+
+sub update_a {
+    my ($dns, $id, $ip) = @_;
+    die() unless(defined $dns && defined $id && defined $ip);
+    my $rval = $dns->update_a($id, $ip);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Invalid IP address')."\n") if($rval == -3);
+    die(gettext('Database error')."\n") if($rval == -4);
+    die(gettext('Unknown error')."\n");
+}
+
+sub delete_a {
+    my ($dns, $id) = @_;
+    die() unless(defined $dns && defined $id);
+    my $rval = $dns->delete_a($id);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Database error')."\n") if($rval == -3);
+    die(gettext('Unknown error')."\n");
+}
+
+sub add_mx {
+    my ($dns, $host, $priority) = @_;
+    die() unless(defined $dns && defined $host && defined $priority);
+    my $rval = $dns->add_mx($host, $priority);
+    return 1 if($rval > 0);
+    die(gettext('Invalid hostname')."\n") if($rval == -1);
+    die(gettext('Invalid priority')."\n") if($rval == -2);
+    die(gettext('An MX record with the same name already exists for this domain')."\n") if($rval == -3);
+    die(gettext('Database error')."\n") if($rval == -4);
+    die(gettext('Unknown error')."\n");
+}
+
+sub update_mx {
+    my ($dns, $id, $host) = @_;
+    die() unless(defined $dns && defined $id && defined $host);
+    my $rval = $dns->update_mx($id, $host);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Invalid host')."\n") if($rval == -3);
+    die(gettext('Database error')."\n") if($rval == -4);
+    die(gettext('Unknown error')."\n"),;
+}
+
+sub delete_mx {
+    my ($dns, $id) = @_;
+    die() unless(defined $dns && defined $id);
+    my $rval = $dns->delete_mx($id);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Database error')."\n") if($rval == -3);
+    die(gettext('Unknown error')."\n");
+}
+
+sub delete_ns {
+    my ($dns, $id) = @_;
+    die() unless(defined $dns && defined $id);
+    my $rval = $dns->delete_ns($id);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Database error')."\n") if($rval == -3);
+    die(gettext('Unknown error')."\n");
+}
+
+sub add_ns {
+    my ($dns, $host) = @_;
+    die() unless(defined $dns && defined $host);
+    my $rval = $dns->add_ns($host);
+    return 1 if($rval > 0);
+    die(gettext('Invalid hostname')."\n") if($rval == -1);
+    die(gettext('An NS record with the same name already exists for this domain')."\n") if($rval == -2);
+    die(gettext('Database error')."\n") if($rval == -3);
+    die(gettext('Unknown error')."\n");
+}
+
+sub update_cname {
+    my ($dns, $id, $dest) = @_;
+    die() unless(defined $dns && defined $id && defined $dest);
+    my $rval = $dns->update_cname($id, $dest);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Invalid destination')."\n") if($rval == -3);
+    die(gettext('Database error')."\n") if($rval == -4);
+    die(gettext('Unknown error')."\n");
+
+}
+
+sub delete_cname {
+    my ($dns, $id) = @_;
+    die() unless(defined $dns && defined $id);
+    my $rval = $dns->delete_cname($id);
+    return 1 if($rval > 0);
+    die(gettext('Invalid record')."\n") if($rval == -1);
+    die(gettext('Record does not exists')."\n") if($rval == -2);
+    die(gettext('Database error')."\n") if($rval == -3);
+    die(gettext('Unknown error')."\n");
+}
+
+sub add_cname {
+    my ($dns, $name, $dest) = @_;
+    die() unless(defined $dns && defined $name && defined $dest);
+    my $rval = $dns->add_cname($name, $dest);
+    return 1 if($rval > 0);
+    die(gettext('Invalid alias')."\n") if($rval == -1);
+    die(gettext('Invalid destination host')."\n") if($rval == -2);
+    die(gettext('A CNAME or A record with the same name already exists for this domain')."\n") if($rval == -3);
+    die(gettext('Database error')."\n") if($rval == -4);
+    die(gettext('Unknown error')."\n");
+}
+ 
+
 1;

Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Services/DNS.pm	2007-04-12 12:40:04 UTC (rev 555)
@@ -149,11 +149,7 @@
             foreach( keys %{$init->{a}} ) {
                 $name = $_;
                 $ip = $init->{a}{$_};
-                if( $name eq "default" ) {
-                    $self->add_a( "" , $ip );
-                } else {
-                    $self->add_a( $name , $ip );
-                }
+                $self->add_a( $name , $ip );
             }
         }
         if( defined $init->{mx} ) {
@@ -225,28 +221,28 @@
     $sql = 'SELECT id, zone, (CASE WHEN name = \'\' THEN \'default\' ELSE name END) AS name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = \'A\'';
     my $sth = $dbh->prepare($sql);
     $sth->execute($dns_id);
-    my $a = $sth->fetchall_hashref('name');
+    my $a = $sth->fetchall_hashref('id');
     push @params, $a;
 
     # Fetches NS records
     $sql = 'SELECT id, zone, name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = ?';
     $sth = $dbh->prepare($sql);
     $sth->execute($dns_id, 'NS');
-    my $ns = $sth->fetchall_hashref('data');
+    my $ns = $sth->fetchall_hashref('id');
     push @params, $ns;
 
     # Fetches CNAME records
     $sql = 'SELECT id, zone, (CASE WHEN name = \'\' THEN \'default\' ELSE name END) AS name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = ?';
     $sth = $dbh->prepare($sql);
     $sth->execute($dns_id, 'CNAME');
-    my $cname = $sth->fetchall_hashref('name');
+    my $cname = $sth->fetchall_hashref('id');
     push @params, $cname;
 
     # Fetches MX records
     $sql = 'SELECT id, zone, name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = ?';
     $sth = $dbh->prepare($sql);
     $sth->execute($dns_id, 'MX');
-    my $mx = $sth->fetchall_hashref('aux');
+    my $mx = $sth->fetchall_hashref('id');
     push @params, $mx;
 
     return _new Vhffs::Services::DNS($main, @params);
@@ -290,58 +286,62 @@
 
 sub delete_cname
 {
-    my ($self, $name) = @_;
+    my ($self, $id) = @_;
 
-    return -1 if( ! ($name =~ /^[a-z0-9\.\-]*$/ ) );
-    $name = '' if( $name eq 'default' );
+    return -1 unless($id =~ /^\d+$/ );
+    my $rr = $self->{CNAME}{$id};
+    return -2 unless(defined $rr);
 
     my $dbh = $self->get_main()->get_db_object();
-    my $sql = 'DELETE FROM vhffs_dns_rr WHERE type = \'CNAME\' AND zone = ? AND name = ?';
-    $dbh->do($sql, undef, $self->{dns_id}, $name) or return -2;
+    my $sql = 'DELETE FROM vhffs_dns_rr WHERE id = ? AND type = \'CNAME\' AND zone = ?';
+    $dbh->do($sql, undef, $id, $self->{dns_id}) or return -3;
 
-    delete $self->{CNAME}->{$name};
+    $self->add_history('Deleted CNAME record '.$rr->{name});
+    delete $self->{CNAME}{$id};
 
     #Update SOA
     $self->update_serial();
-    $self->add_history("Deleted CNAME record $name");
-    
     return 1;
 }
 
 
 sub delete_ns
 {
-    my ($self, $host) = @_;
+    my ($self, $id) = @_;
 
-    return -1 if( ! ($host =~ /^[a-z0-9\.\-]+$/ ) );
+    return -1 unless( $id =~ /^\d+$/ );
+    my $rr = $self->{NS}{$id};
+    return -2 unless(defined $rr);
 
     my $dbh = $self->get_main->get_db_object();
-    my $sql = 'DELETE FROM vhffs_dns_rr WHERE type = \'NS\' AND zone = ? AND data = ?';
-    $dbh->do($sql, undef, $self->{dns_id}, $host) or return -2;
+    my $sql = 'DELETE FROM vhffs_dns_rr WHERE id = ? AND type = \'NS\' AND zone = ?';
+    $dbh->do($sql, undef, $id, $self->{dns_id}) or return -3;
 
-    delete $self->{NS}->{$host};
+    $self->add_history('Deleted NS record '.$rr->{data});
 
-    $self->add_history("Deleted NS record $host");
+    delete $self->{NS}{$id};
     
-    $self->update_serial;
+    $self->update_serial();
     
     return 1;
 }
 
 sub delete_mx
 {
-    my ($self, $aux) = @_;
+    my ($self, $id) = @_;
 
-    return -1 if( ! ($aux =~ /^[a-z0-9\.\-]+$/ ) );
+    return -1 unless( $id =~ /^\d+$/ );
+    my $rr = $self->{MX}{$id};
+    return -2 unless(defined $rr);
 
     my $dbh = $self->get_main->get_db_object();
-    my $sql = 'DELETE FROM vhffs_dns_rr WHERE type=\'MX\' AND zone= ? AND aux = ?';
-    $dbh->do($sql, undef, $self->{dns_id}, $aux) or return -2;
+    my $sql = 'DELETE FROM vhffs_dns_rr WHERE id = ? AND type = \'MX\' AND zone = ?';
+    $dbh->do($sql, undef, $id, $self->{dns_id}) or return -3;
 
-    delete $self->{MX}->{$aux};
+    $self->add_history('Deleted the MX record '.$rr->{name}.' (priority: '.$rr->{aux}.')');
 
-    $self->add_history("Deleted the MX record with priority $aux");
-    
+    delete $self->{MX}{$id};
+
     $self->update_serial();
     return 1;
 }
@@ -349,18 +349,17 @@
 
 sub delete_a
 {
-    my ($self, $name) = @_;
+    my ($self, $id) = @_;
 
-    return -1 if( ! ($name =~ /^[a-z0-9\-]*|\*$/ ) );
-    $name = '' if( $name eq 'default' );
+    return -1 unless($id =~ /^\d+$/ );
+    return -2 unless(defined $self->{A}{$id});
 
     my $dbh = $self->get_main->get_db_object();
-    my $sql = 'DELETE FROM vhffs_dns_rr WHERE type = \'A\' AND zone = ? AND name = ?';
-    $dbh->do($sql, undef, $self->{dns_id}, $name) or return -2;
+    my $sql = 'DELETE FROM vhffs_dns_rr WHERE type = \'A\' AND zone = ? AND id = ?';
+    $dbh->do($sql, undef, $self->{dns_id}, $id) or return -3;
 
-    delete $self->{A}->{$name};
-
-    $self->add_history("Deleted A record $name");
+    $self->add_history('Deleted A record '.$self->{A}{$id}{name});
+    delete $self->{A}{$id};
     
     $self->update_serial();
     return 1;
@@ -369,19 +368,20 @@
 
 sub update_a
 {
-    my ( $self , $name , $ip ) = @_;
+    my ( $self , $id, $ip ) = @_;
     
-    return -1 unless( Vhffs::Functions::check_ip($ip) );
-    return -1 if( ! ($name =~ /^[a-z0-9\-]*|\*$/ ) );
-    $name = '' if( $name eq 'default' );
+    return -1 unless($id =~ /^\d+$/ );
+    my $rr = $self->{A}{$id};
+    return -2 unless(defined $rr);
+    return -3 unless( Vhffs::Functions::check_ip($ip) );
 
     my $dbh = $self->get_main()->get_db_object();
-    my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE name = ? AND zone = ? AND type = \'A\'';
-    $dbh->do($sql, undef, $ip, $name, $self->{dns_id}) or return -2;
+    my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE id = ? AND zone = ? AND type = \'A\'';
+    $dbh->do($sql, undef, $ip, $id, $self->{dns_id}) or return -4;
 
-    $self->{A}->{$name}->{data} = $ip;
+    $rr->{data} = $ip;
 
-    $self->add_history("Updated A record $name poiting now on $ip");
+    $self->add_history('Updated A record '.$rr->{name}." pointing now on $ip");
     
     $self->update_serial();
     return 1;
@@ -394,17 +394,16 @@
     
     $ttl = 900 if ( ! defined $ttl );
     
-    return -1 if( ! ($host =~ /^[a-z0-9\-\.]+$/ ) );
+    return -1 unless(Vhffs::Functions::check_domain_name($host));
 
-    return -1 if( ! defined $host);
-    $host .= "." unless($host =~ /\.$/ );
+    $host .= '.' unless($host =~ /\.$/ );
 
     my $sql = 'SELECT * FROM vhffs_dns_rr WHERE type=\'NS\' AND data=? AND zone=?';
     my $dbh = $self->get_main->get_db_object();
-    return -1 if($dbh->do($sql, undef, $host, $self->{dns_id}) != 0);
+    return -2 if($dbh->do($sql, undef, $host, $self->{dns_id}) != 0);
 
     $sql = 'INSERT INTO vhffs_dns_rr(zone, name, type, data, aux, ttl) VALUES(?, \'\', \'NS\', ?, 0, ?)';
-    $dbh->do($sql, undef, $self->{dns_id}, $host, $ttl) or return -2;
+    $dbh->do($sql, undef, $self->{dns_id}, $host, $ttl) or return -3;
 
     my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef);
 
@@ -416,12 +415,12 @@
               aux => 0,
               ttl => $ttl
             };
-    $self->{NS}->{$host} = $ns;
+    $self->{NS}{$id} = $ns;
 
     $self->update_serial;
 
     $self->add_history("Added a NS record ($host)");
-    return 1;
+    return $id;
 }
 
 
@@ -432,26 +431,27 @@
     my ( $self , $name , $ip , $ttl ) = @_;
     
     $ttl = 900 if ( ! defined $ttl );
-    return -1 if( ! ($name =~ /^[a-z0-9\-]+|\*$/ ) );
+    return -1 if( ! ($name =~ /^(?:[a-z0-9\-]+|\*)$/ ) );
     $name = '' if( $name eq 'default' );
-    return -1 if ( $self->name_exists( $name ) != 0 );
+    return -2 if ( $self->name_exists( $name ) != 0 );
 
     if( ! defined $ip ) {
         my $config = $self->{'main'}->get_config;	
     	if( defined $config->get_default_a ) {
     	    $ip = $config->get_default_a;
 	    } else {
-    	    return -1;
+    	    return -3;
     	}
     }
     
-    return -1 unless( Vhffs::Functions::check_ip($ip) );
+    return -4 unless( Vhffs::Functions::check_ip($ip) );
 
     my $dbh = $self->get_main()->get_db_object();
     my $sql = 'INSERT INTO vhffs_dns_rr (zone, name, type, data, aux, ttl) VALUES(?, ?, \'A\', ?, 0, ?)';
-    $dbh->do($sql, undef, $self->{dns_id}, $name, $ip, $ttl) or return -2;
+    $dbh->do($sql, undef, $self->{dns_id}, $name, $ip, $ttl) or return -5;
 
     my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef);
+    $name = 'default' if($name eq '');
     my $a = {id => $id,
              zone => $self->{dns_id},
              name => $name,
@@ -460,29 +460,43 @@
              aux => 0,
              ttl => $ttl
             };
-    $self->{A}->{$name} = $a;
+    $self->{A}{$id} = $a;
 
     $self->update_serial();
 
     $self->add_history("Added a A TYPE with name $name pointing on $ip");
-    return 1;
+    return $id;
 }
 
+=pod
 
+=head2 update_mx
+    $dns->update_mx($rr_id, $host);
 
+Replace address for MX record C<$rr_id>.
+
+=cut
+
 sub update_mx
 {
-    my ($self, $data, $aux) = @_;
+    my ($self, $id, $host) = @_;
+    
+    return -1 unless($id =~ /^\d+$/);
+    my $rr = $self->{MX}{$id};
+    return -2 unless(defined $rr);
+    return -3 unless(Vhffs::Functions::check_domain_name($host, 1));
 
-    my $sql = 'UPDATE vhffs_dns_rr SET data= ? WHERE zone = ? AND aux = ? AND type=\'MX\'';
+    my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE id = ? AND zone = ? AND type=\'MX\'';
     my $dbh = $self->get_main()->get_db_object();
 
-    $dbh->do($sql, undef, $data, $self->{dns_id}, $self->{aux}) or return -2;
+    $host .= '.' unless($host =~ /\.$/);
 
-    $self->{MX}->{$aux}->{data} = $data;
+    $dbh->do($sql, undef, $host, $id, $self->{dns_id}) or return -4;
 
-    $self->add_history("Changed the MX for priority $aux : $data");
+    $rr->{data} = $host;
 
+    $self->add_history('Changed the MX for priority '.$rr->{aux}.": $host");
+
     $self->update_serial();
 }
 
@@ -493,17 +507,18 @@
 
     $ttl = 900 if ( ! defined $ttl );
     $aux = 10 if ( !defined $aux );
+    
+    return -1 unless( Vhffs::Functions::check_domain_name($host, 1) );
+    return -2 unless( $aux =~ /^\d+$/ );
 
-    return -1 if( ! ($host =~ /^[a-z0-9\.\-]+$/ ) );
-
     $host .= '.' unless($host =~ /\.$/);
 
     my $sql = 'SELECT id FROM vhffs_dns_rr WHERE type=\'MX\' AND data=? AND zone=?';
     my $dbh = $self->get_main()->get_db_object();
-    return -1 if($dbh->do($sql, undef, $host, $self->{dns_id}) != 0); 
+    return -3 if($dbh->do($sql, undef, $host, $self->{dns_id}) != 0); 
 
     $sql = 'INSERT INTO vhffs_dns_rr(zone, name, type, data, aux, ttl) VALUES(?, \'\', \'MX\', ?, ?, ?)';
-    $dbh->do($sql, undef, $self->{dns_id}, $host, $aux, $ttl) or return -2;
+    $dbh->do($sql, undef, $self->{dns_id}, $host, $aux, $ttl) or return -4;
     
     my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef);
     my $mx = {id => $id,
@@ -514,70 +529,71 @@
               aux => $aux,
               ttl => $ttl
             };
-    $self->{MX}->{$aux} = $mx;
+    $self->{MX}->{$id} = $mx;
 
     $self->add_history("Added an MX record, host : $host - priority : $aux");
     
     $self->update_serial();
+    return $id;
 }
 
 
 
 sub update_cname
 {
-    my ($self, $name, $host) = @_;
+    my ($self, $id, $dest) = @_;
     
-    return -1 if( ! ($name =~ /^[a-z0-9\.\-]*$/ ) );
-    return -1 if( ! ($host =~ /^[a-z0-9\.\-]+$/ ) );
+    return -1 unless($id =~ /^\d+$/ );
+    my $rr = $self->{CNAME}{$id};
+    return -2 unless(defined $rr);
+    return -3 unless(Vhffs::Functions::check_domain_name($dest, 1));
     
-    $host .='.' unless($host =~ /\.$/);
+    $dest .='.' unless($dest =~ /\.$/);
     my $dbh = $self->get_main()->get_db_object();
-    my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE type = \'CNAME\' AND zone = ? AND name = ?';
-    $dbh->do($sql, undef, $host, $self->{dns_id}, $name)or return -2;
+    my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE id = ? AND type = \'CNAME\' AND zone = ?';
+    $dbh->do($sql, undef, $dest, $id, $self->{dns_id})or return -4;
 
-    $self->{CNAME}->{$name}->{data} = $host;
+    $rr->{data} = $dest;
 
-    $self->add_history("Updated CNAME $name pointing now on $host");
+    $self->add_history('Updated CNAME '.$rr->{data}." pointing now on $dest");
     $self->update_serial();
 }
 
 sub add_cname
 {
-    my ($self, $name, $host, $ttl) = @_;
-    
+    my ($self, $name, $dest, $ttl) = @_;
+
     $ttl = 900 if ( ! defined $ttl );
-
-
+    return -1 unless($name =~ /^[a-z0-9\-]+$/ );
+    return -2 unless(Vhffs::Functions::check_domain_name($dest, 1));
     $name = '' if( $name eq 'default' );
-    return -1  if( ! ($name =~ /^[a-z0-9\-]+$/ ) );
-    return -1  if( ! ($host =~ /[a-z0-9\.\-]+/ ) );
+    return -3 if ( $self->name_exists( $name ) != 0 );
 
-    return -1  if ( $self->name_exists( $name ) != 0 );
-
-
     # Add a '.' the the submitted name. Otherwise, if the user submit tata.toto.com IN CNAME foo.com
     # MyDNS will understand tata.toto.com IN CNAME foo.com.toto.com
-    $host .= '.' unless($host =~ /\.$/);
+    $dest .= '.' unless($dest =~ /\.$/);
 
     my $dbh = $self->get_main()->get_db_object();
 
     my $sql = 'INSERT INTO vhffs_dns_rr(zone, name, type, data, aux, ttl) VALUES(?, ?, \'CNAME\', ?, 0, ?)';
-    $dbh->do($sql, undef, $self->{dns_id}, $name, $host, $ttl) or return -2;
+    $dbh->do($sql, undef, $self->{dns_id}, $name, $dest, $ttl) or return -4;
     my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef);
 
+    $name = 'default' if($name eq '');
     my $cname = {id => $id,
                  zone => $self->{dns_id},
                  name => $name,
                  type => 'CNAME',
-                 data => $host,
+                 data => $dest,
                  aux => 0,
                  ttl => $ttl};
 
-    $self->{CNAME}->{$name} = $cname;
+    $self->{CNAME}{$id} = $cname;
 
-    $self->add_history("Added a CNAME record ($name -> $host)");
+    $self->add_history("Added a CNAME record ($name -> $dest)");
 
     $self->update_serial();
+    return $id;
 }
 
 

Deleted: branches/vhffs_4.1/vhffs-panel/dns/add_a.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/add_a.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/add_a.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,135 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-#Add a A to a domain
-#This is the CGI part, it uses the main API of VHFFS
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::DNS;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-
-
-#Fetch some vars from the main API
-my $cgi = $panel->{'cgi'};
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $name = $cgi->param("PREFIX");
-my $ip = $cgi->param("IP");
-my $user = $panel->{'user'};
-my $question = $cgi->param("QUESTION");
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $name ) || ( ! defined $ip ))
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-	$message = gettext( "Cannot get informations on this object");
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-    #If $question equals to 1, we must use the adress defined in the VHFFS config file
-    #With this option, the user just put the name for the A redir and the API takes the IP from the config file
-    if( ( defined $question ) && ( $question == 1 ) )
-    {
-	# add_a( $foo , undef ) will add to the domain
-	#                                            foo.domain  IN    A    adress_in_config_file
-	if( $dns->add_a( $name , undef ) < 0 )
-	{
-	    $message = gettext("Cannot add this ressource to this domain");
-	}
-	else
-	{
-	    $message = gettext("Resource successfully added to this domain");
-	}
-    }
-    else
-    {
-	#Check if the IP is valid and add it on the domain
-	if( ! ( $ip =~ /[\d+\.].[\d+\.].[\d+\.].[\d+]/ ) )
-	{
-	    $message = gettext("Invalid IP");
-	}
-	elsif( $dns->add_a( $name , $ip ) < 0 )
-	{
-	    $message = gettext("Cannot add this ressource to this domain");
-	}
-	else
-	{
-	    $message = gettext("Resource successfully added to this domain");
-	}
-    }
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/add_cname.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/add_cname.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/add_cname.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,110 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $name = $cgi->param("PREFIX");
-my $destination = $cgi->param("DESTINATION");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $name ) || ( ! defined $destination ))
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->add_cname( $name , $destination ) < 0 )
-	{
-		$message = gettext("Cannot add this ressource to this domain");
-	}
-	else
-	{
-		$message = gettext("Resource successfully added to this domain");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/add_mx.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/add_mx.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/add_mx.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,108 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $priority = $cgi->param("PRIORITY");
-my $mx = $cgi->param("MXNAME");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $mx ) || ( ! defined $priority ))
-{
-	$message = gettext( "CGI Error!");
-} elsif( !defined $dns ) {
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->add_mx( $mx , $priority ) < 0 )
-	{
-		$message = gettext("Cannot add this ressource to this domain");
-	}
-	else
-	{
-		$message = gettext("Resource successfully added to this domain");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/add_ns.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/add_ns.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/add_ns.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,106 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $destination = $cgi->param("DESTINATION");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $destination ))
-{
-	$message = gettext( "CGI Error!");
-} elsif( !defined $dns ) {
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if(  $dns->add_ns( $destination ) < 0 )
-	{
-		$message = gettext("Cannot add this ressource to this domain");
-	}
-	else
-	{
-		$message = gettext("Resource successfully added to this domain");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/delete_a.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/delete_a.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/delete_a.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,80 +0,0 @@
-#!/usr/bin/perl -w
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $name = $cgi->param("ANAME");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-
-my $template;
-my $output = "";
-my $message;
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $name ) )
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->delete_a( $name  ) < 0 )
-	{
-		$message = gettext("Cannot delete it.");
-	}
-	else
-	{
-		$message = gettext("This part of the domain is now removed.");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/delete_cname.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/delete_cname.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/delete_cname.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,107 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::DNS;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $name = $cgi->param("NAME");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $name ) ) {
-	$message = gettext( "CGI Error!");
-} elsif( !defined $dns ) {
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->delete_cname( $name  ) < 0 )
-	{
-		$message = gettext("Cannot delete it.");
-	}
-	else
-	{
-		$message = gettext("This part of the domain is now removed.");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/delete_mx.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/delete_mx.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/delete_mx.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,109 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $priority = $cgi->param("PRIORITY");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $priority ) )
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->delete_mx( $priority  ) < 0 )
-	{
-		$message = gettext("Cannot delete it.");
-	}
-	else
-	{
-		$message = gettext("This part of the domain is now removed.");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/delete_ns.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/delete_ns.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/delete_ns.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,108 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $ip = $cgi->param("IP");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $ip ) )
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->delete_ns( $ip  ) < 0 )
-	{
-		$message = gettext("Cannot delete it.");
-	}
-	else
-	{
-		$message = gettext("This part of the domain is now removed.");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/modif_a.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/modif_a.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/modif_a.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,112 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $name = $cgi->param("PREFIX");
-my $ip = $cgi->param("IP");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $name ) || ( ! defined $ip ))
-{
-	$message = gettext( "CGI Error!");
-} elsif( !defined $dns ) {
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( ! ( $ip =~ /[\d+\.].[\d+\.].[\d+\.].[\d+]/ ) )
-	{
-		$message = gettext("Invalid IP");
-	}
-	elsif( $dns->update_a( $name , $ip ) < 0 )
-	{
-		$message = gettext("Cannot modify this ressource on this domain");
-	}
-	else
-	{
-		$message = gettext("Updated !");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/modif_cname.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/modif_cname.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/modif_cname.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,111 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::DNS;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $name = $cgi->param("PREFIX");
-my $destination = $cgi->param("DESTINATION");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $name ) || ( ! defined $destination ))
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->update_cname( $name , $destination ) < 0 )
-	{
-		$message = gettext("Cannot update CNAME on this domain");
-	}
-	else
-	{
-		$message = gettext("CNAME field successfully updated");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Deleted: branches/vhffs_4.1/vhffs-panel/dns/modif_mx.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/modif_mx.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/modif_mx.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,111 +0,0 @@
-#!/usr/bin/perl -w
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-
-use lib "/usr/share/vhffs/api/";
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::DNS;
-
-my $panel = new Vhffs::Panel::Main();
-if(!$panel)  {
-        exit 0;
-}
-my $cgi = $panel->{'cgi'};
-
-my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("DOMAIN");
-my $priority = $cgi->param("PRIORITY");
-my $mx = $cgi->param("IP");
-my $user = $panel->{'user'};
-
-my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
-
-
-my $session = $panel->{'session'};
-my $maintemplate = $panel->{'template'};
-
-my $group = $panel->{'group'};
-my $projectname = $session->param("project");
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-my $template;
-my $output = "";
-my $message;
-
-$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
-
-if( ( ! defined $domain_name ) || ( ! defined $mx ) || ( ! defined $priority ))
-{
-	$message = gettext( "CGI Error!");
-}
-elsif( !defined $dns )
-{
-
-	$message = gettext( "Cannot get informations on this object");
-
-}
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-elsif( $dns->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext("You're not allowed to do this (ACL rights)");
-}
-else
-{
-	if( $dns->update_mx( $mx , $priority ) < 0 )
-	{
-		$message = gettext("Cannot update MX on this domain");
-	}
-	else
-	{
-		$message = gettext("MX successfully changed");
-	}
-}
-
-$template->param( MESSAGE => $message );
-set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0);
-display Vhffs::Panel::Main($panel, $template->output);

Modified: branches/vhffs_4.1/vhffs-panel/dns/prefs.pl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/dns/prefs.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/dns/prefs.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -53,7 +53,7 @@
 my $cgi = $panel->{'cgi'};
 
 my $vhffs = $panel->{'vhffs'};
-my $domain_name = $cgi->param("name");
+my $domain_name = $cgi->param('domain');
 my $user = $panel->{'user'};
 
 my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name );
@@ -101,16 +101,88 @@
 }
 else
 {
+    my $action = $cgi->param('action');
+ACTION: {
+    if(defined $action) {
+        # Check user's rights
+        if( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) {
+            $panel->add_error(gettext('You\'re not allowed to do this (ACL rights)'));
+            last ACTION;
+        }
+        my $id = $cgi->param('rr_id');
+        my $data = $cgi->param('data');
+        my $name = $cgi->param('name');
+        my $aux = $cgi->param('aux');
+
+        if($action eq 'manage_a') {
+            if(defined $cgi->param('modify_a_submit')) {
+                # User just want to modify an A record
+                eval { Vhffs::Panel::DNS::update_a($dns, $id, $data); };
+                if($@) { $panel->add_error(sprintf(gettext('Unable to modify A record: %s'), $@)); }
+                else { $panel->add_info(gettext('A Record updated')); }
+            } else {
+                # User wants to delete it
+                eval { Vhffs::Panel::DNS::delete_a($dns, $id); };
+                if($@) { $panel->add_error(sprintf(gettext('Unable to delete A record: %s'), $@)); }
+                else { $panel->add_info(gettext('A Record deleted')); }
+            }
+        } elsif($action eq 'add_a') {
+            my $redirect = $cgi->param('redirect');
+            eval { Vhffs::Panel::DNS::add_a($dns, (defined $redirect && $redirect eq 'true'), $name, $data); };
+            if($@) { $panel->add_error(sprintf(gettext('Unable to add A record: %s'), $@)); }
+            else { $panel->add_info(gettext('A record added')); }
+        } elsif($action eq 'manage_mx') {
+            if(defined $cgi->param('modify_mx_submit')) {
+                # User wants to modify an MX record
+                eval { Vhffs::Panel::DNS::update_mx($dns, $id, $data); };
+                if($@) { $panel->add_error(sprintf(gettext('Unable to modify MX record: %s'), $@)); }
+                else { $panel->add_info(gettext('MX Record updated')); }
+            } else {
+                # MX deletion
+                eval { Vhffs::Panel::DNS::delete_mx($dns, $id); };
+                if($@) { $panel->add_error(sprintf(gettext('Unable to delete MX record: %s'), $@)); }
+                else { $panel->add_info(gettext('MX Record deleted')); }
+            }
+        } elsif($action eq 'add_mx') {
+            eval { Vhffs::Panel::DNS::add_mx($dns, $data, $aux); };
+            if($@) { $panel->add_error(sprintf(gettext('Unable to add MX record: %s'), $@)); }
+            else { $panel->add_info(gettext('MX Record added')); }
+        } elsif($action eq 'manage_ns') {
+            # Only deletion is allowed for NS record
+            eval { Vhffs::Panel::DNS::delete_ns($dns, $id); };
+            if($@) { $panel->add_error(sprintf(gettext('Unable to delete NS record: %s'), $@)); }
+            else { $panel->add_info(gettext('NS Record deleted')); }
+        } elsif($action eq 'add_ns') {
+            eval { Vhffs::Panel::DNS::add_ns($dns, $data); };
+            if($@) { $panel->add_error(sprintf(gettext('Unable to add NS record: %s'), $@)); }
+            else { $panel->add_info(gettext('NS Record added')); }
+        } elsif($action eq 'manage_cname') {
+            if(defined $cgi->param('modify_cname_submit')) {
+                eval { Vhffs::Panel::DNS::update_cname($dns, $id, $data); };
+                if($@) { $panel->add_error(sprintf(gettext('Unable to modify CNAME record: %s'), $@)); }
+                else { $panel->add_info(gettext('CNAME Record updated')); }
+            } else {
+                eval { Vhffs::Panel::DNS::delete_cname($dns, $id); };
+                if($@) { $panel->add_error(sprintf(gettext('Unable to delete CNAME record: %s'), $@)); }
+                else { $panel->add_info(gettext('CNAME Record deleted')); }
+            }
+        } elsif($action eq 'add_cname') {
+            eval { Vhffs::Panel::DNS::add_cname($dns, $name, $data); };
+            if($@) { $panel->add_error(sprintf(gettext('Unable to add CNAME record: %s'), $@)); }
+            else { $panel->add_info(gettext('CNAME Record added')); }
+        }
+    }
+}
 	my $cnames = $dns->get_cname_type;
-	my $a = $dns->get_a_type;
+	my $a_rr = $dns->get_a_type;
 	my $mx = $dns->get_mx_type;
 	my $ns = $dns->get_ns_type;
 
+    $panel->set_title(sprintf(gettext("DNS Administration - %s"), $domain_name));
 	$template = new HTML::Template( filename => $templatedir."/dns/prefs.tmpl" );
-	$template->param( TITLE => gettext("Admin DNS") );
 
+    $template->param( DOMAIN_NAME => $domain_name );
 
-    $template->param( DOMAIN_NAME => $domain_name );
     $template->param( TEXT_TYPEA => gettext("All A TYPE for you domain name") );
     $template->param( TEXT_TYPEMX => gettext("All MX TYPE for you domain name") );
     $template->param( TEXT_TYPECNAME => gettext("All CNAME for you domain name") );
@@ -173,86 +245,56 @@
 
 	$subtemplate = new HTML::Template( filename =>$templatedir. "/dns/list_sub.tmpl" );
 
+    if( scalar(keys %{$a_rr}) ) {
+        my $thirdtemplate = new HTML::Template( filename => $templatedir.'/dns/list_a_sub.tmpl', global_vars => 1, die_on_bad_params => 0);
+        my @list_a = sort {$a->{name} cmp $b->{name}} values(%{$a_rr});
+	    $thirdtemplate->param( DEL => gettext( 'Delete' ) );
+        $thirdtemplate->param( DOMAIN => $domain_name );
+        $thirdtemplate->param( MODIFY => gettext( 'Modify' ) );
+        $thirdtemplate->param( A_RR => \@list_a);
+    	$template->param( LIST_A => $thirdtemplate->output );
+    } else {
+    	$template->param( LIST_A => gettext('No A type found' ));
+    }
 
-	if( defined $a )
-	{
-		foreach( keys %{$a} )
-		{
-	          my $thirdtemplate = new HTML::Template( filename => $templatedir."/dns/list_a_sub.tmpl" );
-	          $thirdtemplate->param( NOM => $_ );
-	          $thirdtemplate->param( IPNOM => $a->{$_}{data} );
-	          $thirdtemplate->param( DEL => gettext( "Delete" ) );
-	          $thirdtemplate->param( MODIFY => gettext( "Modify" ) );
-	          $thirdtemplate->param( DOMAIN => $domain_name );
-	          $output .= $thirdtemplate->output;
-    	 }
-    	$template->param( LIST_A => $output );
-	 }
-	 else
-	 {
-    	$template->param( LIST_A => gettext("No A type found" ));
-	 }
+	if( scalar(keys %{$mx} ) ) {
+        $thirdtemplate = new HTML::Template( filename => $templatedir.'/dns/list_mx_sub.tmpl', global_vars => 1, die_on_bad_params => 0 );
+        my @list_mx = sort {$a->{aux} <=> $b->{aux}} values(%{$mx});
+        $thirdtemplate->param( DEL => gettext( 'Delete' ) );
+        $thirdtemplate->param( DOMAIN => $domain_name );
+        $thirdtemplate->param( MODIFY => gettext( 'Modify' ) );
+        $thirdtemplate->param( TEXT_PRIORITY => gettext( 'Priority: ' ));
+        $thirdtemplate->param( MX_RR => \@list_mx );
+		$template->param( LIST_MX => $thirdtemplate->output );
+    } else {
+        $template->param( LIST_MX => gettext( 'No MX reccord for this domain' ));
+    }
 
-	if( defined $mx )
-	{
-		$output = "";
-		foreach( keys ( %{$mx} ) )
-		{
-	            $thirdtemplate = new HTML::Template( filename => $templatedir."/dns/list_mx_sub.tmpl" );
-	            $thirdtemplate->param( PRIORITY_VALUE => $_ );
-	            $thirdtemplate->param( TEXT_PRIORITY => gettext("Priority: "));
-	            $thirdtemplate->param( IP_VALUE => $mx->{$_}{data} );
-	          	$thirdtemplate->param( DEL => gettext( "Delete" ) );
-				$thirdtemplate->param( MODIFY => gettext( "Modify" ) );
-	            $thirdtemplate->param( DOMAIN => $domain_name );
-				$output .= $thirdtemplate->output;
-	    }
-		$template->param( LIST_MX => $output );
-	}
-	else
-	{
-		$template->param( LIST_MX => gettext( "No MX reccord for this domain" ));
-	}
+    if( scalar(keys %{$cnames} ) ) {
+        $thirdtemplate = new HTML::Template( filename => $templatedir.'/dns/list_cname_sub.tmpl', global_vars => 1, die_on_bad_params => 0 );
+        $thirdtemplate->param( DEL => gettext( 'Delete' ) );
+        $thirdtemplate->param( MODIFY => gettext( 'Modify' ) );
+        $thirdtemplate->param( DOMAIN => $domain_name );
+        my @list_cname = sort {$a->{name} cmp $b->{name}} values(%{$cnames});
+        $thirdtemplate->param( CNAME_RR => \@list_cname );
 
-	if( defined $cnames )
-	{
-		$output = "";
-		foreach( keys ( %{$cnames} ) )
-		{
-            $thirdtemplate = new HTML::Template( filename => $templatedir."/dns/list_cname_sub.tmpl" );
-            $thirdtemplate->param( VALUE_NAME => $_ );
-            $thirdtemplate->param( VALUE_DESTINATION => $cnames->{$_}{data} );
-          	$thirdtemplate->param( DEL => gettext( "Delete" ) );
-			$thirdtemplate->param( MODIFY => gettext( "Modify" ) );
-            $thirdtemplate->param( DOMAIN => $domain_name );
-		    $output .= $thirdtemplate->output;
-    	 }
-		$template->param( LIST_CNAME => $output );
-	}
-	else
-	{
-		$template->param( LIST_CNAME => gettext( "No CNAME available on this domain") );
-	}
+   		$template->param( LIST_CNAME => $thirdtemplate->output );
+    } else {
+        $template->param( LIST_CNAME => gettext( 'No CNAME available on this domain' ) );
+    }
 
 
 
-	if( defined $ns )
-	{
-		$output = "";
-		foreach( keys ( %{$ns} ) )
-		{
-            $thirdtemplate = new HTML::Template( filename => $templatedir."/dns/list_ns_sub.tmpl" );
-            $thirdtemplate->param( IP => $_ );
-          	$thirdtemplate->param( DEL => gettext( "Delete" ) );
-            $thirdtemplate->param( DOMAIN => $domain_name );
-		    $output .= $thirdtemplate->output;
-    	 }
-		$template->param( LIST_NS => $output );
-	}
-	else
-	{
-		$template->param( LIST_NS => gettext( "No NS available on this domain") );
-	}
+    if( scalar(keys %{$ns}) ) {
+        my @list_ns = sort {$a->{data} cmp $b->{data}} values(%{$ns});
+        $thirdtemplate = new HTML::Template( filename => $templatedir.'/dns/list_ns_sub.tmpl', global_vars => 1, die_on_bad_params => 0 );
+        $thirdtemplate->param( DEL => gettext( 'Delete' ) );
+        $thirdtemplate->param( DOMAIN => $domain_name );
+        $thirdtemplate->param( NS_RR => \@list_ns );
+        $template->param( LIST_NS => $thirdtemplate->output );
+    } else {
+        $template->param( LIST_NS => gettext( "No NS available on this domain") );
+    }
 
 	if( $user->is_admin == 1 )
 	{

Modified: branches/vhffs_4.1/vhffs-panel/templates/admin/main/general.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/admin/main/general.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/admin/main/general.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -6,7 +6,7 @@
           				              <tmpl_var name="TEXT_STATS">
       					          </a>
 					</li>
-					<li id="adminHomeStats">
+					<li id="adminHomeSubstituteUser">
                					 <a href="/admin/su.pl">
           				              <tmpl_var name="TEXT_VHFFSSU">
       					          </a>
@@ -31,7 +31,7 @@
                 				        <tmpl_var name="TEXT_MAILING">
 						</a>
 					</li>
-					<li id="adminHomeMailing">
+					<li id="adminHomeMailingHandling">
 				                <a href="/admin/broadcast_list.pl">
                 				        <tmpl_var name="TEXT_AMAILING">
 						</a>

Modified: branches/vhffs_4.1/vhffs-panel/templates/dns/list_a_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/dns/list_a_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/dns/list_a_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,21 +1,16 @@
-<form method="post" action="modif_a.pl">
-	<p>
-		<label for="IP">
-			<TMPL_VAR NAME="NOM">->
-		</label>
-		<input type="text" name="IP" id="IP" value="<TMPL_VAR NAME="IPNOM">" />
-	</p>
-
-	<p class="button" id="buttonModify">
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-		<input type="hidden" name="PREFIX" value="<TMPL_VAR NAME="NOM">" />
-		<input type="submit" value="<TMPL_VAR NAME="MODIFY">" />
-	</p>
+<tmpl_loop name="A_RR">
+<form method="post" action="prefs.pl">
+    <p>
+    <label for="data_<tmpl_var name="id">">
+    <TMPL_VAR NAME="NAME">-&gt;
+    </label>
+        <input type="text" name="data" id="data_<tmpl_var name="id">" value="<TMPL_VAR NAME="data">" />
+        <input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN">" />
+        <input type="hidden" name="rr_id" value="<tmpl_var name="id">" />
+        <input type="hidden" name="name" value="<TMPL_VAR NAME="NAME">" />
+        <input type="hidden" name="action" value="manage_a"/>
+        <input type="submit" value="<TMPL_VAR NAME="MODIFY">" class="autowidth" name="modify_a_submit" />
+        <input type="submit" value="<TMPL_VAR NAME="DEL">" name="delete_a_submit" class="autowidth"/>
+    </p>
 </form>
-<form method="post" action="delete_a.pl">
-	<p class="button" id="buttonDelete">
-		<input type="hidden" name="ANAME" value="<TMPL_VAR NAME="NOM">" />
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-		<input type="submit" value="<TMPL_VAR NAME="DEL">" />
-	</p>
-</form>
+</tmpl_loop>

Modified: branches/vhffs_4.1/vhffs-panel/templates/dns/list_cname_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/dns/list_cname_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/dns/list_cname_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,22 +1,15 @@
-<form method="post" action="modif_cname.pl">
+<tmpl_loop CNAME_RR>
+<form method="post" action="prefs.pl">
 	<p>
-		<label for="IP">
-			<TMPL_VAR NAME="VALUE_NAME">->
+		<label for="data_<tmpl_var name="id">">
+			<TMPL_VAR NAME="name">-&gt;
 		</label>
-		<input type="text" name="DESTINATION" value="<TMPL_VAR NAME="VALUE_DESTINATION">" />
+		<input type="text" name="data" id="data_<tmpl_var name="id">"value="<TMPL_VAR NAME="data">" />
+        <input type="hidden" name="action" value="manage_cname" />
+        <input type="hidden" name="rr_id" value="<tmpl_var name="id">"/>
+		<input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN">" />
+		<input type="submit" name="modify_cname_submit" value="<TMPL_VAR NAME="MODIFY">" class="autowidth" />
+		<input type="submit" name="delete_cname_submit" value="<TMPL_VAR NAME="DEL">" class="autowidth" />
 	</p>
-	
-	<p class="button" id="buttonModify">
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-		<input type="hidden" name="PREFIX" value="<TMPL_VAR NAME="VALUE_NAME">" />
-		<input type="submit" value="<TMPL_VAR NAME="MODIFY">">
-	</p>
 </form>
-<form method="post" action="delete_cname.pl">
-	<p class="button" id="buttonDelete">
-		<input type="hidden" name="NAME" value="<TMPL_VAR NAME="VALUE_NAME">" />
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-		<input type="submit" value="<TMPL_VAR NAME="DEL">" />
-	</p>
-</form>
-
+</tmpl_loop>

Modified: branches/vhffs_4.1/vhffs-panel/templates/dns/list_mx_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/dns/list_mx_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/dns/list_mx_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,30 +1,14 @@
-
-<tr>
-	<td>
-		<label for="IP">
-			<TMPL_VAR NAME="TEXT_PRIORITY"><TMPL_VAR NAME="PRIORITY_VALUE">
-		</label>
-		</td>
-	<td>
-	<form method="post" action="modif_mx.pl">
-		<input type="text" name="IP"  id="IP" value="<TMPL_VAR NAME="IP_VALUE">" />
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-		<input type="hidden" name="PRIORITY" value="<TMPL_VAR NAME="PRIORITY_VALUE">" />
-		<input type="submit" value="<TMPL_VAR NAME="MODIFY">" />
-		</form>
-	</td>
-</tr>
-
-<tr>
-	<td>
-		&nbsp;
-	</td>
-	<td>
-		<form method="post" action="delete_mx.pl">
-			<input type="hidden" name="PRIORITY" value="<TMPL_VAR NAME="PRIORITY_VALUE">" />
-			<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-			<input type="submit" value="<TMPL_VAR NAME="DEL">" />
-		</form>
-	</td>
-</tr>
-
+<tmpl_loop name="MX_RR">
+<form method="post" action="prefs.pl">
+<p><label for="data_<tmpl_var name="id">">
+    <TMPL_VAR NAME="TEXT_PRIORITY"><TMPL_VAR NAME="aux">
+</label>
+    <input type="text" name="data"  id="data_<tmpl_var name="id">" value="<TMPL_VAR NAME="data">" />
+    <input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN">" />
+    <input type="hidden" name="rr_id" value="<tmpl_var name="id">" />
+    <input type="hidden" name="action" value="manage_mx" />
+    <input type="submit" value="<TMPL_VAR NAME="MODIFY">" name="modify_mx_submit" class="autowidth"/>
+    <input type="submit" value="<TMPL_VAR NAME="DEL">" name="delete_mx_submit" class="autowidth"/>
+</p>
+</form>
+</tmpl_loop>

Modified: branches/vhffs_4.1/vhffs-panel/templates/dns/list_ns_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/dns/list_ns_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/dns/list_ns_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,13 +1,11 @@
-<tr>
-	<td>
-		<TMPL_VAR NAME="IP">
-	</td>
-	<td>
-		<form method="post" action="delete_ns.pl">
-			<input type="hidden" name="IP" value="<TMPL_VAR NAME="IP">" />
-			<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN">" />
-			<input type="submit" value="<TMPL_VAR NAME="DEL">" />
-		</form>
-	</td>
-</tr>
-
+<tmpl_loop name="NS_RR">
+<form method="post" action="prefs.pl">
+<p>
+    <label><TMPL_VAR NAME="data"></label>
+    <input type="hidden" name="action" value="manage_ns" />
+    <input type="hidden" name="rr_id" value="<TMPL_VAR NAME="id">" />
+    <input type="hidden" name="domain" value="<TMPL_VAR NAME="domain">" />
+    <input type="submit" name="delete_ns_submit" value="<TMPL_VAR NAME="DEL">" class="autowidth"/>
+</p>
+</form>
+</tmpl_loop>

Modified: branches/vhffs_4.1/vhffs-panel/templates/dns/menu_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/dns/menu_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/dns/menu_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,5 +1,5 @@
 						<li class="DNSEntry">
-							<a href="/dns/prefs.pl?name=<tmpl_var name="DOMAIN">" title="<tmpl_var name="DOMAIN">">
+							<a href="/dns/prefs.pl?domain=<tmpl_var name="DOMAIN">" title="<tmpl_var name="DOMAIN">">
 								<tmpl_var name="DOMAIN">
 							</a>
                             <ul>

Modified: branches/vhffs_4.1/vhffs-panel/templates/dns/prefs.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/dns/prefs.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/dns/prefs.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,48 +1,32 @@
-
-<h1><TMPL_VAR NAME="TITLE"> - <TMPL_VAR NAME="DOMAIN_NAME"></h1>
-
-
-
 <h2><TMPL_VAR NAME="TEXT_TYPEA"></h2>
-
 <h3><TMPL_VAR NAME="TEXT_LIST_A"></h3>
-<table>
-	<TMPL_VAR NAME="LIST_A">
-</table>
+<TMPL_VAR NAME="LIST_A">
 
 <h3><TMPL_VAR NAME="TEXT_ADD_A"></h3>
-<form method="post" action="add_a.pl">
+<form method="post" action="prefs.pl">
 	<p>
-		<label for="PREFIX">
+		<label for="add_a_prefix">
 			<TMPL_VAR NAME="TEXT_DOMAINNAME">
 		</label>
-		<input type="text" name="PREFIX"  id="PREFIX" /><strong>.<TMPL_VAR NAME="DOMAIN_NAME"></strong>
+		<input type="text" name="name"  id="add_a_prefix" /><strong>.<TMPL_VAR NAME="DOMAIN_NAME"></strong>
 	</p>
-	<p id="ipField" style="display:none">
-		<label for="IP">
+	<p id="add_a_ip" style="display:none">
+		<label for="add_a_data">
 		<TMPL_VAR NAME="TEXT_ADDIP">
 		</label>
-		<input type="text" name="IP" />
+		<input type="text" name="data" id="add_a_data" />
 	</p>
-	<fieldset>
-		<legend>
-			<TMPL_VAR NAME="TEXT_QUESTION_REDIRECTION"> :
-		</legend>
-		<p>
-			<input type="radio" name="QUESTION" id="QUESTION_YES" value="1" checked="checked" onclick="document.getElementById('ipField').style.display='none'"/>
-			<label for="QUESTION_YES">
-				<TMPL_VAR NAME="TEXT_YES">
-			</label>
-		</p>
-		<p>
-			<input type="radio" name="QUESTION" value="0" id="QUESTION_NO" onclick="document.getElementById('ipField').style.display='block'"/>
-			<label for="QUESTION_NO">
-				<TMPL_VAR NAME="TEXT_NO">
-			</label>
-		</p>
-	</fieldset>
-	<p class="button" id="buttonModify">
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN_NAME">" />
+	<p><TMPL_VAR NAME="TEXT_QUESTION_REDIRECTION">:
+		<input type="radio" name="redirect" id="redirect_true" value="true" checked="checked"
+            onclick="document.getElementById('add_a_ip').style.display='none'"/>
+        <label for="redirect_true" style="display:inline;float:none"><TMPL_VAR NAME="TEXT_YES"></label>
+        <input type="radio" name="redirect" value="false" id="redirect_false"
+            onclick="document.getElementById('add_a_ip').style.display='block'"/>
+        <label for="redirect_false" style="display:inline;float:none"><TMPL_VAR NAME="TEXT_NO"></label>
+    </p>
+	<p class="button">
+		<input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN_NAME">" />
+        <input type="hidden" name="action" value="add_a"/>
 		<input type="submit" value="<TMPL_VAR NAME="TEXT_SUBMIT">" />
 	</p>
 </form>
@@ -51,56 +35,52 @@
 <h2><TMPL_VAR NAME="TEXT_TYPEMX"></h2>
 <h3><TMPL_VAR NAME="TEXT_LIST_MX"></h3>
 
-<table><TMPL_VAR NAME="LIST_MX"></table>
+<TMPL_VAR NAME="LIST_MX">
 
 <h3><TMPL_VAR NAME="TEXT_ADD_MX"></h3>
-
-<TMPL_VAR NAME="FORM_ADD_MX">
-
-<form method="post" action="/dns/add_mx.pl">
+<form method="post" action="prefs.pl">
 	<p>
-		<label for="MXNAME">
+		<label for="add_mx_data">
 			<TMPL_VAR NAME="MX_NAME">
 		</label>
-		<input type="text" name="MXNAME" id="MXNAME" />
+		<input type="text" name="data" id="add_mx_data" />
 	</p>
 	<p>
-		<label for="PRIORITY">
+		<label for="add_mx_aux">
 			<TMPL_VAR NAME="MX_PRIORITY">
 		</label>
-		<input type="text" name="PRIORITY" id="PRIORITY" />
+		<input type="text" name="aux" id="add_mx_aux" />
 	</p>
-	<p class="button" id="buttonSubmit">
+	<p class="button">
+        <input type="hidden" name="action" value="add_mx" />
+		<input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN_NAME">" />
 		<input type="submit" value="<TMPL_VAR name="TEXT_SUBMIT">" />
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN_NAME">" />
 	</p>
 </form>
 
 
 <h2><TMPL_VAR NAME="TEXT_TYPECNAME"></h2>
 <h3><TMPL_VAR NAME="TEXT_LIST_CNAME"></h3>
-<table>
-	<TMPL_VAR NAME="LIST_CNAME">
-</table>
+<TMPL_VAR NAME="LIST_CNAME">
 
 <h3><TMPL_VAR NAME="TEXT_ADD_CNAME"></h3>
-<TMPL_VAR NAME="FORM_ADD_CNAME">
 
-<form method="post" action="/dns/add_cname.pl">
+<form method="post" action="prefs.pl">
 	<p>
-		<label for="PREFIX">
+		<label for="add_cname_name">
 			<TMPL_VAR NAME="CNAME_PREFIX">
 		</label>
-		<input type="text" name="PREFIX" id="PREFIX" /><strong>.<TMPL_VAR NAME="DOMAIN_NAME"></strong>
+		<input type="text" name="name" id="add_cname_name" /><strong>.<TMPL_VAR NAME="DOMAIN_NAME"></strong>
 	</p>
 	<p>
-		<label for="DESTINATION">
+		<label for="add_cname_data">
     		<TMPL_VAR NAME="CNAME_DESTINATION">
 		</label>
-			<input type="text" name="DESTINATION" id="DESTINATION" />
+			<input type="text" name="data" id="add_cname_data" />
 	</p>
-	<p class="button" id="buttonSubmit">
-		<input type="hidden" name="DOMAIN" value="<TMPL_VAR NAME="DOMAIN_NAME">" />
+	<p class="button">
+        <input type="hidden" name="action" value="add_cname" />
+		<input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN_NAME">" />
 		<input type="submit" value="<TMPL_VAR NAME="TEXT_SUBMIT">" />
 	</p>
 </form>
@@ -109,26 +89,12 @@
 <h3><TMPL_VAR NAME="TEXT_LIST_NS"></h3>
 <TMPL_VAR NAME="LIST_NS">
 <h3><TMPL_VAR NAME="TEXT_ADD_NS"></h3>
-<TMPL_VAR NAME="FORM_ADD_NS">
-
-
-<form method="post" action="/dns/add_ns.pl">
-        <table border=0 width="60%">
-                <tr>
-                    <td>
-                        <TMPL_VAR NAME="NS_HOSTNAME_TEXT">
-                        </td>
-                <td>
-                                <INPUT TYPE="TEXT" name="DESTINATION">
-                        </td>
-                </tr>
-                <tr>
-                    <td colspan="2" align="right">
-                <INPUT TYPE="HIDDEN" NAME="DOMAIN" VALUE=<TMPL_VAR NAME="DOMAIN_NAME">>
-                                <INPUT TYPE="SUBMIT" VALUE=<TMPL_VAR NAME="TEXT_SUBMIT">>
-                        </td>
-                </tr>
-        </table>
+<form method="post" action="prefs.pl">
+    <label for="add_ns_data"><TMPL_VAR NAME="NS_HOSTNAME_TEXT"></label>
+    <input type="text" name="data" id="add_ns_data"/>
+    <input type="hidden" name="action" value="add_ns"/>
+    <input type="hidden" name="domain" value="<TMPL_VAR NAME="DOMAIN_NAME">"/>
+    <input type="submit" value="<TMPL_VAR NAME="TEXT_SUBMIT">" class="autowidth"/>
 </form>
 
 
@@ -168,7 +134,7 @@
 		</p>
 	</fieldset>
 	
-	<p class="button" id="buttonDelete">
+	<p class="button">
 		<input type="hidden" name="name" value="<tmpl_var name="DOMAIN_NAME">" />
 		<input type="submit" value="<tmpl_var name="TEXT_DELETE">" />
 	</p>

Modified: branches/vhffs_4.1/vhffs-panel/templates/group/menu_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/group/menu_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/group/menu_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -3,8 +3,8 @@
 								<tmpl_var name="PROJECTNAME">
 							</a>
                             <ul>
-                                <a href="/history.pl?OID=<tmpl_var name="OID">" title="<tmpl_var name="HISTORY_TEXT">">
+                                <li><a href="/history.pl?OID=<tmpl_var name="OID">" title="<tmpl_var name="HISTORY_TEXT">">
                                     <tmpl_var name="HISTORY_TEXT">
-                                </a>
+                                </a></li>
                             </ul>
 						</li>

Modified: branches/vhffs_4.1/vhffs-panel/templates/mailinglist/menu_sub.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/mailinglist/menu_sub.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/mailinglist/menu_sub.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,5 +1,5 @@
 						<li class="mailingListEntry">
-							<a href="/mailinglist/prefs.pl?local=<tmpl_var name="LOCAL">&domain=<tmpl_var name="DOMAIN">" title="<tmpl_var name="NAME">">
+							<a href="/mailinglist/prefs.pl?local=<tmpl_var name="LOCAL">&amp;domain=<tmpl_var name="DOMAIN">" title="<tmpl_var name="NAME">">
 								<tmpl_var name="NAME">
 							</a>
 							<ul>

Modified: branches/vhffs_4.1/vhffs-panel/templates/main/panel.tmpl
===================================================================
--- branches/vhffs_4.1/vhffs-panel/templates/main/panel.tmpl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/templates/main/panel.tmpl	2007-04-12 12:40:04 UTC (rev 555)
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>   
 <html xmlns="http://www.w3.org/1999/xhtml";>
 	<head>
 	

Modified: branches/vhffs_4.1/vhffs-panel/themes/vhffs-ng/main.css
===================================================================
--- branches/vhffs_4.1/vhffs-panel/themes/vhffs-ng/main.css	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-panel/themes/vhffs-ng/main.css	2007-04-12 12:40:04 UTC (rev 555)
@@ -304,6 +304,11 @@
 {
 	width:200px;
 }
+
+input.autowidth {
+    width:auto;
+}
+
 form textarea {
     width:350px;
 }

Modified: branches/vhffs_4.1/vhffs-tests/src/Services/DNS.pl
===================================================================
--- branches/vhffs_4.1/vhffs-tests/src/Services/DNS.pl	2007-04-10 15:36:04 UTC (rev 554)
+++ branches/vhffs_4.1/vhffs-tests/src/Services/DNS.pl	2007-04-12 12:40:04 UTC (rev 555)
@@ -29,32 +29,32 @@
 my ($new_max_oid) = $main->get_db_object->selectrow_array('SELECT MAX(object_id) FROM vhffs_object');
 cmp_ok($new_max_oid, '==', $max_oid, 'DNS service creation is a "all or nothing" process');
 
-$dns1->add_a('sample', '10.10.10.10');
+my $id = $dns1->add_a('sample', '10.10.10.10');
 my $As = $dns1->get_a_type;
-cmp_ok($As->{sample}->{data}, 'eq', '10.10.10.10', 'A record IP matches');
-cmp_ok($As->{sample}->{zone}, '==', $dns1->get_dns_id(), 'A record registered for the right zone');
-cmp_ok($As->{sample}->{type}, 'eq', 'A', 'A Record has the right type');
+cmp_ok($As->{$id}->{data}, 'eq', '10.10.10.10', 'A record IP matches');
+cmp_ok($As->{$id}->{zone}, '==', $dns1->get_dns_id(), 'A record registered for the right zone');
+cmp_ok($As->{$id}->{type}, 'eq', 'A', 'A Record has the right type');
 
-$dns1->add_ns('ns.test.com');
+$id = $dns1->add_ns('ns.test.com');
 my $NSs = $dns1->get_ns_type;
-cmp_ok($NSs->{'ns.test.com.'}->{data}, 'eq', 'ns.test.com.', 'NS record name matches');
-cmp_ok($NSs->{'ns.test.com.'}->{zone}, '==', $dns1->get_dns_id(), 'NS record registered for the right zone');
-cmp_ok($NSs->{'ns.test.com.'}->{type}, 'eq', 'NS', 'NS record has the right type');
+cmp_ok($NSs->{$id}{data}, 'eq', 'ns.test.com.', 'NS record name matches');
+cmp_ok($NSs->{$id}->{zone}, '==', $dns1->get_dns_id(), 'NS record registered for the right zone');
+cmp_ok($NSs->{$id}->{type}, 'eq', 'NS', 'NS record has the right type');
 
-$dns1->add_cname('host1', 'host2.test.com');
+$id = $dns1->add_cname('host1', 'host2.test.com');
 my $CNAMEs = $dns1->get_cname_type;
-cmp_ok($CNAMEs->{host1}->{data}, 'eq', 'host2.test.com.', 'Real name matches');
-cmp_ok($CNAMEs->{host1}->{name}, 'eq', 'host1', 'Alias matches');
-cmp_ok($CNAMEs->{host1}->{zone}, '==', $dns1->get_dns_id(), 'CNAME record registered for the right zone');
-cmp_ok($CNAMEs->{host1}->{type}, 'eq', 'CNAME', 'CNAME record has the right type');
+cmp_ok($CNAMEs->{$id}->{data}, 'eq', 'host2.test.com.', 'Real name matches');
+cmp_ok($CNAMEs->{$id}->{name}, 'eq', 'host1', 'Alias matches');
+cmp_ok($CNAMEs->{$id}->{zone}, '==', $dns1->get_dns_id(), 'CNAME record registered for the right zone');
+cmp_ok($CNAMEs->{$id}->{type}, 'eq', 'CNAME', 'CNAME record has the right type');
 
 
-$dns1->add_mx('mx1.sample.com', 10);
+$id = $dns1->add_mx('mx1.sample.com', 10);
 my $MXs = $dns1->get_mx_type;
-cmp_ok($MXs->{10}->{data}, 'eq', 'mx1.sample.com.', 'Mail server name matches');
-cmp_ok($MXs->{10}->{aux}, '==', 10, 'MX priority matches');
-cmp_ok($MXs->{10}->{zone}, '==', $dns1->get_dns_id(), 'MX record registered for the right zone');
-cmp_ok($MXs->{10}->{type}, 'eq', 'MX', 'MX record has the right type');
+cmp_ok($MXs->{$id}->{data}, 'eq', 'mx1.sample.com.', 'Mail server name matches');
+cmp_ok($MXs->{$id}->{aux}, '==', 10, 'MX priority matches');
+cmp_ok($MXs->{$id}->{zone}, '==', $dns1->get_dns_id(), 'MX record registered for the right zone');
+cmp_ok($MXs->{$id}->{type}, 'eq', 'MX', 'MX record has the right type');
 
 my $dns2 = Vhffs::Services::DNS::get_by_domainname($main, 'test.com');
 is_deeply($dns1, $dns2, 'Created DNS matches fetched DNS')


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