[vhffs-dev] [svn] commit: r50 - trunk/vhffs-api/src/Vhffs trunk/vhffs-api/src/Vhffs/Services trunk/vhffs-backend/conf trunk/vhffs-panel/admin trunk/vhffs-panel/templates/admin/misc trunk/vhffs-robots/src

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


Author: soda
Date: Tue Jul 12 22:11:57 2005
New Revision: 50

Log:
- Modifications of the API, all services have now the getall( state , name ) method
- Modify some robots, work now with the getall method
- Users can receive a note now. Usage of notation is enable in the config file


Modified:
    trunk/vhffs-api/src/Vhffs/Conf.pm
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-api/src/Vhffs/Object.pm
    trunk/vhffs-api/src/Vhffs/Services/DNS.pm
    trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm
    trunk/vhffs-api/src/Vhffs/Services/Mailing.pm
    trunk/vhffs-api/src/Vhffs/Services/Postgres.pm
    trunk/vhffs-api/src/Vhffs/User.pm
    trunk/vhffs-backend/conf/vhffs.conf
    trunk/vhffs-panel/admin/moderation.pl
    trunk/vhffs-panel/admin/moderation_submit.pl
    trunk/vhffs-panel/templates/admin/misc/moderation_part.tmpl
    trunk/vhffs-robots/src/create_groups.pl
    trunk/vhffs-robots/src/create_ml.pl
    trunk/vhffs-robots/src/delete_ml.pl
    trunk/vhffs-robots/src/fix_quota.pl
    trunk/vhffs-robots/src/treat_refused.pl

Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm Tue Jul 12 22:11:57 2005
@@ -474,6 +474,21 @@
 }
 
 
+
+sub use_notation
+{
+	if( $Config{"global"}{"panel"}{use_notation} )
+	{
+		if( $Config{"global"}{"panel"}{use_notation} eq "yes" )
+		{
+			return 1;
+		}
+	}
+	return 0;
+}
+
+
+
 sub get_panel_public_users
 {
     if( $Config{"global"}{"panel"}{users} )

Modified: trunk/vhffs-api/src/Vhffs/Group.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Group.pm Tue Jul 12 22:11:57 2005
@@ -116,13 +116,17 @@
 
     foreach ( keys %{$hash} )
     {
+		#Fix DB bug, quota and quota_used is in vhffs_groups and vhffs_groups_info
 		next if( $_ eq "quota");
 		next if( $_ eq "quota_used");
 	    $self->{$_} = $hash->{$_};
     }
 
 
-	$self->SUPER::fetch;
+	return -2 if( $self->SUPER::fetch < 0 );
+
+	$self->{group}	=	$self;
+
     return 1;
 }
 
@@ -597,8 +601,21 @@
     return \@users;
 }
 
-
-sub getall_by_state
+sub get_owner
+{
+	my $self = shift;
+
+	if( ! defined $self->{'user'} )
+	{
+		$self->{'user'} = new  Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} );
+		$self->{'user'}->fetch if( defined $self->{'user'} );
+	}
+
+	return( $self->{'user'} );
+
+}
+
+sub getall
 {
 	my $vhffs = shift;
 	my $state = shift;
@@ -614,7 +631,10 @@
 	$query .= " ORDER BY g.groupname";
 
 	my $request = $db->{'DB_READ'}->prepare( $query );
-	$request->execute;
+	my $rows = $request->execute;
+
+	return undef if( $rows <= 0 );
+	
 	my $names = $request->fetchall_arrayref;
 
 	my $group;

Modified: trunk/vhffs-api/src/Vhffs/Object.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Object.pm Tue Jul 12 22:11:57 2005
@@ -161,7 +161,9 @@
 		$self->{"$_"} = $result->{"$_"}
     }
 
+	#Fix encofing of description
 	$self->{'description'} =~ s/\\//g;
+
 
     return 1;    
 }
@@ -360,7 +362,19 @@
 sub get_group
 {
     my $self = shift;
-    return $self->{'group'} if( defined $self->{'group'} );
+    if( defined $self->{'group'} )
+	{
+		return( $self->{'group'} );
+	}
+	else
+	{
+		if( defined $self->{'owner_gid'} )
+		{
+			use Vhffs::Group;
+			$self->{'group'} = new Vhffs::Group( $self->{'main'} , undef ,  $self->{'owner_uid'} , $self->{'owner_gid'} );
+			return( $self->{'group'} ) if( defined( $self->{'group'} ) && (  $self->{'group'}->fetch > 0 ) );
+		}
+	}
     return undef;
 }
 
@@ -368,7 +382,19 @@
 sub get_user
 {
     my $self = shift;
-    return $self->{'user'} if( defined $self->{'user'} );
+    if( defined $self->{'user'} )
+	{
+		return( $self->{'user'} );
+	}
+	else
+	{
+		if( defined $self->{'owner_uid'} )
+		{
+			use Vhffs::User;
+			$self->{'user'} = new  Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} );
+			return( $self->{'user'} ) if( defined ( $self->{'user'} ) && (  $self->{'user'}->fetch > 0 ));
+		}
+	}
     return undef;
 }
 

Modified: trunk/vhffs-api/src/Vhffs/Services/DNS.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/DNS.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/DNS.pm Tue Jul 12 22:11:57 2005
@@ -71,7 +71,7 @@
     $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query );
     my $rows = $request->execute;
 
-    return undef if( $rows == 0);
+    return undef if( $rows <= 0);
     
     foreach( $result = $request->fetchrow_hashref() )
     {
@@ -931,4 +931,6 @@
     return $self->{domain};
 }
 
+
+
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Httpd.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Httpd.pm Tue Jul 12 22:11:57 2005
@@ -114,6 +114,14 @@
 	}
 
 	$self->SUPER::fetch;
+
+    $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef ,  $self->{'owner_uid'} , $self->{'owner_gid'} );
+    return -1 if( $self->{'group'}->fetch < 0 );
+
+    $self->{'user'} = new  Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} );
+    return -1 if( $self->{'user'}->fetch < 0 );
+
+	return 1;
 }
 
 
@@ -338,4 +346,6 @@
 }
 
 
+
+
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm Tue Jul 12 22:11:57 2005
@@ -496,4 +496,33 @@
 }
 
 
+sub getall
+{
+    my $vhffs = shift;
+    my $state = shift;
+	
+    my $query;
+    my $request;
+
+    my $objs;
+    my $result;
+    my $tmp;
+
+    $query = "SELECT m.domain FROM  vhffs_mxdomain m, vhffs_object o WHERE m.object_id = o.object_id";
+	$query .= " AND o.state='".$state."'" if( defined $state );
+    $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query );
+    my $rows = $request->execute;
+
+    return undef if( $rows <= 0);
+
+    foreach( $result = $request->fetchrow_hashref() )
+    {
+    	$tmp = new Vhffs::Services::Mail( $vhffs , $result->{'domain'} );
+    	push( @{$objs} , $tmp ) if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) )
+    }
+    return $objs;
+}
+
+
+
 1;

Modified: trunk/vhffs-api/src/Vhffs/Services/Mailing.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mailing.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Mailing.pm Tue Jul 12 22:11:57 2005
@@ -574,7 +574,7 @@
     return ( keys %{$self->{subs}} );
 }
 
-sub getall_by_state
+sub getall
 {
     my $vhffs = shift;
     my $state = shift;

Modified: trunk/vhffs-api/src/Vhffs/Services/Postgres.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Postgres.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Services/Postgres.pm Tue Jul 12 22:11:57 2005
@@ -223,5 +223,36 @@
     return 1;
 }
 
+sub getall
+{   
+    my $vhffs = shift;
+    my $state = shift;
+
+    my $query;
+    my $request;
+
+    my @objs;
+    my $result;
+    my $tmp;
+
+    $query = "SELECT dbname FROM vhffs_pgsql p, vhffs_object o WHERE o.object_id=p.object_id";
+	$query .= " AND o.state='".$state."'" if( defined $state );
+
+    $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query );
+    my $rows = $request->execute;
+
+    return undef if( $rows <= 0);
+    $result = $request->fetchall_hashref('dbname');
+    foreach( keys %{$result} )
+    {
+            $tmp = new Vhffs::Services::Postgres( $vhffs , $_ );
+            if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) )
+            {
+                    push @objs , $tmp;
+            }
+    }
+    return \@objs;
+}
+
 
 1;

Modified: trunk/vhffs-api/src/Vhffs/User.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm (original)
+++ trunk/vhffs-api/src/Vhffs/User.pm Tue Jul 12 22:11:57 2005
@@ -143,7 +143,6 @@
 	foreach $v qw(firtname lastname address zipcode city country)
 	{
 		$self->{$v} =~ s/[\\]*//g if( defined $self->{$v} );	
-#		$self->{$v} =~ s/\\//g; 
 	}
 
 	$self->SUPER::fetch;

Modified: trunk/vhffs-backend/conf/vhffs.conf
==============================================================================
--- trunk/vhffs-backend/conf/vhffs.conf (original)
+++ trunk/vhffs-backend/conf/vhffs.conf Tue Jul 12 22:11:57 2005
@@ -32,6 +32,7 @@
 		users			=	yes
 		groups			=	yes
 		stats_on_home		=	yes
+		use_notation		= yes
 		<rss>
 			users		=	yes
 			groups		=	yes

Modified: trunk/vhffs-panel/admin/moderation.pl
==============================================================================
--- trunk/vhffs-panel/admin/moderation.pl (original)
+++ trunk/vhffs-panel/admin/moderation.pl Tue Jul 12 22:11:57 2005
@@ -17,7 +17,10 @@
 use Vhffs::Services::Httpd;
 use Vhffs::Acl;
 use Vhffs::Constants;
+use Vhffs::Note;
+
 my $panel = new Vhffs::Panel::Main();
+my $temp;
 if(!$panel)  {
         exit 0;
 }
@@ -53,20 +56,31 @@
 	#Treat Groups to moderate
 	use Vhffs::Panel::Group;
 	$template->param( TEXT_GROUP => gettext("Groups to validate") );
-	my $groups = Vhffs::Panel::Group::getall_groups_to_moderate( $vhffs );
+	my $groups = Vhffs::Group::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
 	
 	$output = "";
 	
 	if( defined $groups )
 	{
-		foreach( keys %{$groups} )
+		foreach $temp ( @{$groups} )
 		{
 			my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-			$subtemplate->param( NAME	=> $_ );
-			$subtemplate->param( OWNER	=> $groups->{$_}{'username'} );
-			$subtemplate->param( GROUP	=> $groups->{$_}{'groupname'} );
-			$subtemplate->param( OID	=> $groups->{$_}{'object_id'} );
-			$subtemplate->param( DESCRIPTION	=> Vhffs::Functions::stripslashes( $groups->{$_}{'description'} ) );
+			$subtemplate->param( NAME	=> $temp->get_groupname );
+	
+            if( $vhffs->get_config->use_notation == 1 )
+            {
+                $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+                $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+            }
+            else
+            {
+                 $subtemplate->param( OWNER  => $temp->get_user->get_username );
+            }
+		
+			
+			$subtemplate->param( GROUP	=> $temp->get_groupname );
+			$subtemplate->param( OID	=> $temp->get_oid );
+			$subtemplate->param( DESCRIPTION	=> Vhffs::Functions::stripslashes( $temp->get_description ) );
 			$subtemplate->param( ACCEPT	=> gettext("Accept") );
 			$subtemplate->param( REFUSE	=> gettext("Refuse") );
 			$output.= $subtemplate->output;
@@ -82,21 +96,32 @@
 	if( $vhffs->get_config->use_web == 1 )
 	{
 		#Treat Website to moderate
-		use Vhffs::Panel::Web;
+		use Vhffs::Services::Httpd;
 		$template->param( TEXT_WEB => gettext("Web Area to validate") );
-		my $webs = Vhffs::Panel::Web::getall_web_to_moderate( $vhffs );
+		my $webs = Vhffs::Services::Httpd::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION);
+		my $web;
 		$output = "";
 	
 		if( defined $webs )
 		{
-			foreach( keys %{$webs} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $_ );
-				$subtemplate->param( OWNER	=> $webs->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $webs->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $webs->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $webs->{$_}{'description'} );
+			foreach $temp ( @{$webs} )
+			{
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+				$subtemplate->param( NAME	=> $temp->get_servername );
+
+				if( $vhffs->get_config->use_notation == 1 )
+				{
+					$subtemplate->param( OWNER	=> $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+					$subtemplate->param( OID_ASKER	=> $temp->get_user->get_oid);
+				}
+				else
+				{
+					$subtemplate->param( OWNER	=> $temp->get_user->get_username );
+				}
+
+				$subtemplate->param( GROUP	=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID	=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION	=> $temp->get_description );
 				$subtemplate->param( ACCEPT	=> gettext("Accept") );
 				$subtemplate->param( REFUSE	=> gettext("Refuse") );
 				$output.= $subtemplate->output;
@@ -111,26 +136,34 @@
 	}
 
 
-	if( $vhffs->get_config->use_mail == 1 )
-	{
-		#Treat Mail domains to moderate
-		use Vhffs::Panel::Mail;
+	if( $vhffs->get_config->use_dns == 1 )
+	{
+		#Treat Mail domains to moderate
+		use Vhffs::Services::DNS;
 		$template->param( TEXT_DNS => gettext("DNS to validate") );
-		my $nss = Vhffs::Panel::DNS::getall_domain_to_moderate( $vhffs );
+		my $nss = Vhffs::Services::DNS::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
 		$output = "";
 	
 		if( defined $nss )
 		{
-			foreach( keys %{$nss} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $_ );
-				$subtemplate->param( OWNER	=> $nss->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $nss->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $nss->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $nss->{$_}{'description'} );
-				$subtemplate->param( ACCEPT	=> gettext("Accept") );
-				$subtemplate->param( REFUSE	=> gettext("Refuse") );
+			foreach $temp ( @{$nss} )
+			{
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+            if( $vhffs->get_config->use_notation == 1 )
+            {
+                $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+                $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+            }
+            else
+            {
+                 $subtemplate->param( OWNER  => $temp->get_user->get_username );
+            }
+				$subtemplate->param( NAME				=> $temp->get_domain );
+				$subtemplate->param( GROUP				=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID				=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION		=> $temp->get_description );
+				$subtemplate->param( ACCEPT				=> gettext("Accept") );
+				$subtemplate->param( REFUSE				=> gettext("Refuse") );
 				$output.= $subtemplate->output;
 			}
 	
@@ -138,7 +171,7 @@
 		}
 		else
 		{
-			$template->param( MODERATION_DNS => gettext("No Mail Area to moderate") );
+			$template->param( MODERATION_DNS => gettext("No DNS to moderate") );
 		}
 	}
 
@@ -147,21 +180,31 @@
 	if( $vhffs->get_config->use_cvs == 1 )
 	{
 		#Treat Mail domains to moderate
-		use Vhffs::Panel::Cvs;
+		use Vhffs::Services::Cvs;
 		$template->param( TEXT_CVS => gettext("CVS Repository to validate") );
-		my $repos = Vhffs::Panel::Cvs::getall_cvs_to_moderate( $vhffs );
+		my $repos = Vhffs::Services::Cvs::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
 		$output = "";
 	
 		if( defined $repos )
 		{
-			foreach( keys %{$repos} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $_ );
-				$subtemplate->param( OWNER	=> $repos->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $repos->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $repos->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $repos->{$_}{'description'} );
+			foreach $temp ( @{$repos} )
+			{
+
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+
+    	        if( $vhffs->get_config->use_notation == 1 )
+	            {
+        	        $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+           		    $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+            	}
+            	else
+            	{
+                 	$subtemplate->param( OWNER  => $temp->get_user->get_username );
+            	}
+				$subtemplate->param( NAME	=> $temp->get_cvsroot );
+				$subtemplate->param( GROUP	=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID	=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION	=> $temp->get_description );
 				$subtemplate->param( ACCEPT	=> gettext("Accept") );
 				$subtemplate->param( REFUSE	=> gettext("Refuse") );
 				$output.= $subtemplate->output;
@@ -182,19 +225,28 @@
 		#Treat Mail domains to moderate
 		use Vhffs::Panel::Mailinglist;
 		$template->param( TEXT_MAILING => gettext("List to validate") );
-		my $mls = Vhffs::Panel::Mailinglist::getall_list_to_moderate( $vhffs );
+		my $mls = Vhffs::Services::Mailing::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
 		$output = "";
 	
 		if( defined $mls )
 		{
-			foreach( keys %{$mls} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $mls->{$_}{'local_part'} ."\@". $mls->{$_}{'domain'});
-				$subtemplate->param( OWNER	=> $mls->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $mls->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $mls->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $mls->{$_}{'description'} );
+			foreach $temp ( @{$mls} )
+			{
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+				$subtemplate->param( NAME	=> $temp->get_localpart ."\@". $temp->get_domain );
+		        
+				if( $vhffs->get_config->use_notation == 1 )
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+                    $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+                }
+                else
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username );
+                }	
+				$subtemplate->param( GROUP	=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID	=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION	=> $temp->get_description );
 				$subtemplate->param( ACCEPT	=> gettext("Accept") );
 				$subtemplate->param( REFUSE	=> gettext("Refuse") );
 				$output.= $subtemplate->output;
@@ -225,7 +277,17 @@
 			{
 				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
 				$subtemplate->param( NAME	=> $svn->get_reponame);
-				$subtemplate->param( OWNER	=> $svn->get_user->get_username );
+				
+                if( $vhffs->get_config->use_notation == 1 )
+                {
+                    $subtemplate->param( OWNER  => $svn->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $svn->get_user ) . ")");
+                    $subtemplate->param( OID_ASKER  => $svn->get_user->get_oid);
+                }
+                else
+                {
+                    $subtemplate->param( OWNER  => $svn->get_user->get_username );
+                }
+
 				$subtemplate->param( GROUP	=> $svn->get_group->get_groupname );
 				$subtemplate->param( OID	=> $svn->get_oid );
 				$subtemplate->param( DESCRIPTION	=> $svn->get_description );
@@ -245,24 +307,34 @@
 
 
 
-	if( $vhffs->get_config->use_dns == 1 )
+	if( $vhffs->get_config->use_mail == 1 )
 	{
 		#Treat Mail domains to moderate
 		use Vhffs::Panel::Mail;
 		$template->param( TEXT_MAIL => gettext("Mail Area to validate") );
-		my $mails = Vhffs::Panel::Mail::getall_mail_to_moderate( $vhffs );
+		my $mails = Vhffs::Services::Mail::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
 		$output = "";
 	
 		if( defined $mails )
 		{
-			foreach( keys %{$mails} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $_ );
-				$subtemplate->param( OWNER	=> $mails->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $mails->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $mails->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $mails->{$_}{'description'} );
+			foreach $temp ( @{$mails} )
+			{
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+				$subtemplate->param( NAME	=> $temp->get_domain );
+
+                if( $vhffs->get_config->use_notation == 1 )
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+                    $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+                }
+                else
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username );
+                }
+
+				$subtemplate->param( GROUP	=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID	=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION	=> $temp->get_description);
 				$subtemplate->param( ACCEPT	=> gettext("Accept") );
 				$subtemplate->param( REFUSE	=> gettext("Refuse") );
 				$output.= $subtemplate->output;
@@ -280,22 +352,31 @@
 
 	if( $vhffs->get_config->use_mysql == 1 )
 	{
-		#Treat Mail domains to moderate
-		use Vhffs::Panel::Mysql;
+		use Vhffs::Services::Mysql;
 		$template->param( TEXT_MYSQL => gettext("MySQL database to validate") );
-		my $dbs = Vhffs::Panel::Mysql::getall_dbs_to_moderate( $vhffs );
+		my $dbs = Vhffs::Services::Mysql::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
 		$output = "";
 	
 		if( defined $dbs )
 		{
-			foreach( keys %{$dbs} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $_ );
-				$subtemplate->param( OWNER	=> $dbs->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $dbs->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $dbs->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $dbs->{$_}{'description'} );
+			foreach $temp ( @{$dbs} )
+			{
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+
+                if( $vhffs->get_config->use_notation == 1 )
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+                    $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+                }
+                else
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username );
+                }
+				
+				$subtemplate->param( NAME	=> $temp->get_dbname );
+				$subtemplate->param( GROUP	=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID	=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION	=> $temp->get_description );
 				$subtemplate->param( ACCEPT	=> gettext("Accept") );
 				$subtemplate->param( REFUSE	=> gettext("Refuse") );
 				$output.= $subtemplate->output;
@@ -312,21 +393,31 @@
 	if( $vhffs->get_config->use_postgres == 1 )
 	{
 		#Treat Mail domains to moderate
-		use Vhffs::Panel::Pgsql;
+		use Vhffs::Services::Postgres;
 		$template->param( TEXT_POSTGRES => gettext("Postgres database to validate") );
-		my $dbs = Vhffs::Panel::Pgsql::getall_dbs_to_moderate( $vhffs );
-		$output = "";
-	
-		if( defined $dbs )
-		{
-			foreach( keys %{$dbs} )
-			{
-				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
-				$subtemplate->param( NAME	=> $_ );
-				$subtemplate->param( OWNER	=> $dbs->{$_}{'username'} );
-				$subtemplate->param( GROUP	=> $dbs->{$_}{'groupname'} );
-				$subtemplate->param( OID	=> $dbs->{$_}{'object_id'} );
-				$subtemplate->param( DESCRIPTION	=> $dbs->{$_}{'description'} );
+		my $dbs = Vhffs::Services::Postgres::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION );
+		$output = "";
+	
+		if( defined @{$dbs} )
+		{
+			foreach $temp ( @{$dbs} )
+			{
+				my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" );
+
+                if( $vhffs->get_config->use_notation == 1 )
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ")");
+                    $subtemplate->param( OID_ASKER  => $temp->get_user->get_oid);
+                }
+                else
+                {
+                    $subtemplate->param( OWNER  => $temp->get_user->get_username );
+                }
+
+				$subtemplate->param( NAME	=> $temp->get_dbname );
+				$subtemplate->param( GROUP	=> $temp->get_group->get_groupname );
+				$subtemplate->param( OID	=> $temp->get_oid );
+				$subtemplate->param( DESCRIPTION	=> $temp->get_description );
 				$subtemplate->param( ACCEPT	=> gettext("Accept") );
 				$subtemplate->param( REFUSE	=> gettext("Refuse") );
 				$output.= $subtemplate->output;

Modified: trunk/vhffs-panel/admin/moderation_submit.pl
==============================================================================
--- trunk/vhffs-panel/admin/moderation_submit.pl (original)
+++ trunk/vhffs-panel/admin/moderation_submit.pl Tue Jul 12 22:11:57 2005
@@ -51,6 +51,7 @@
 {
 	use Vhffs::Object;
 	my $oid = $cgi->param("OID");
+	my $oidasker = $cgi->param("OID_ASKER");
 	my $object = new Vhffs::Object( $vhffs , $oid , '401' );
 
 	if( ( ! defined $oid ) || ( ! defined $object ) || ( ! defined $accept ) )
@@ -78,13 +79,26 @@
 
 			    my $subject = gettext("Your request on VHFFS platform");
 			    Vhffs::Functions::send_mail( $vhffs->get_config->get_master_mail , $userbis->get_mail , $subject , $mail );
-			    
+
+	            if( $vhffs->get_config->use_notation == 1 )
+				{
+					use Vhffs::Note;
+					Vhffs::Note::inc_note( $vhffs , $userbis , 1 );
+				}
+
 			}
-		    }
+		}
 		else
 		{
+			my $askerobject = new Vhffs::Object( $vhffs , $oidasker , '401' );
+			$askerobject->fetch;
 		    $object->set_description( $reason );
 		    $object->set_status( Vhffs::Constants::VALIDATION_REFUSED );
+	        if( $vhffs->get_config->use_notation == 1 )
+			{
+				use Vhffs::Note;
+				Vhffs::Note::inc_note( $vhffs , $askerobject , -1 );
+			}
 		}
 		
 		if( $object->commit < 0 )

Modified: trunk/vhffs-panel/templates/admin/misc/moderation_part.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/admin/misc/moderation_part.tmpl (original)
+++ trunk/vhffs-panel/templates/admin/misc/moderation_part.tmpl Tue Jul 12 22:11:57 2005
@@ -14,6 +14,7 @@
 	<td>
 		<form method="post" action="moderation_submit.pl">
 			<input type="hidden" name="OID" value="<TMPL_VAR NAME="OID">" />
+			<input type="hidden" name="OID_ASKER" value="<TMPL_VAR NAME="OID_ASKER">" />
 			<input type="hidden" name="ACCEPT" value="1" />
 			<input type="submit" value="<TMPL_VAR NAME="ACCEPT">" />
 		</form>
@@ -23,6 +24,7 @@
 		<form method="post" action="moderation_submit.pl">
 			<textarea name="reason" cols=30 rows=4></textarea>
 			<input type="hidden" name="OID" value="<TMPL_VAR NAME="OID">" />
+			<input type="hidden" name="OID_ASKER" value="<TMPL_VAR NAME="OID_ASKER">" />
 			<input type="hidden" name="ACCEPT" value="0" />
 			<input type="submit" value="<TMPL_VAR NAME="REFUSE">" />
 		</form>

Modified: trunk/vhffs-robots/src/create_groups.pl
==============================================================================
--- trunk/vhffs-robots/src/create_groups.pl (original)
+++ trunk/vhffs-robots/src/create_groups.pl Tue Jul 12 22:11:57 2005
@@ -1,17 +1,15 @@
 #!/usr/bin/perl
 
 
-use Vhffs::Robots::Group;
 use Vhffs::Main;
 use Vhffs::Group;
 
 my $main = init Vhffs::Main;
-my $groups = Vhffs::Robots::Group::get_all_groups_to_create( $main );
+my $groups = Vhffs::Group::getall( $main , Vhffs::Constants::WAITING_FOR_CREATION );
 my $group;
 
-foreach( keys %{$groups} )
+foreach $group ( @{$groups} )
 {
-	$group = new Vhffs::Group( $main , $_ , '401' );
 	Vhffs::Robots::Group::create_groupdir( $main , $group );
 }
 

Modified: trunk/vhffs-robots/src/create_ml.pl
==============================================================================
--- trunk/vhffs-robots/src/create_ml.pl (original)
+++ trunk/vhffs-robots/src/create_ml.pl Tue Jul 12 22:11:57 2005
@@ -6,7 +6,7 @@
 use Vhffs::Services::Mailing;
 
 my $main = init Vhffs::Main;
-my $mls  = Vhffs::Services::Mailing::getall_by_state( $main , Vhffs::Constants::WAITING_FOR_CREATION );
+my $mls  = Vhffs::Services::Mailing::getall( $main , Vhffs::Constants::WAITING_FOR_CREATION );
 my $ml;
 
 foreach $ml ( @{$mls} )

Modified: trunk/vhffs-robots/src/delete_ml.pl
==============================================================================
--- trunk/vhffs-robots/src/delete_ml.pl (original)
+++ trunk/vhffs-robots/src/delete_ml.pl Tue Jul 12 22:11:57 2005
@@ -6,7 +6,7 @@
 use Vhffs::Services::Mailing;
 
 my $main = init Vhffs::Main;
-my $mls  = Vhffs::Services::Mailing::getall_by_state( $main , Vhffs::Constants::TO_DELETE );
+my $mls  = Vhffs::Services::Mailing::getall( $main , Vhffs::Constants::TO_DELETE );
 my $ml;
 
 foreach $ml ( @{$mls} )

Modified: trunk/vhffs-robots/src/fix_quota.pl
==============================================================================
--- trunk/vhffs-robots/src/fix_quota.pl (original)
+++ trunk/vhffs-robots/src/fix_quota.pl Tue Jul 12 22:11:57 2005
@@ -9,7 +9,7 @@
 use Vhffs::Group;
 
 my $main = init Vhffs::Main;
-my $groups = Vhffs::Group::getall_by_state( $main , Vhffs::Constants::ACTIVATED );
+my $groups = Vhffs::Group::getall( $main , Vhffs::Constants::ACTIVATED );
 my $group;
 my $blocks;
 my $inodes;

Modified: trunk/vhffs-robots/src/treat_refused.pl
==============================================================================
--- trunk/vhffs-robots/src/treat_refused.pl (original)
+++ trunk/vhffs-robots/src/treat_refused.pl Tue Jul 12 22:11:57 2005
@@ -342,7 +342,7 @@
 
 	use Vhffs::Services::Mailing;
 
-	my $objects = Vhffs::Services::Mailing::getall_by_state( $vhffs , Vhffs::Constants::VALIDATION_REFUSED );
+	my $objects = Vhffs::Services::Mailing::getall( $vhffs , Vhffs::Constants::VALIDATION_REFUSED );
 	my $object;
 
 




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