[vhffs-dev] [svn] commit: r98 - in /trunk: vhffs-api/src/Vhffs/Group.pm vhffs-backend/conf/vhffs.conf vhffs-panel/admin/user/edit.pl vhffs-panel/admin/user/list.pl vhffs-panel/templates/admin/user/edit.tmpl vhffs-panel/user/prefs.pl

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


Author: soda
Date: Tue Dec  6 01:56:51 2005
New Revision: 98

Log:
bla


Modified:
    trunk/vhffs-api/src/Vhffs/Group.pm
    trunk/vhffs-backend/conf/vhffs.conf
    trunk/vhffs-panel/admin/user/edit.pl
    trunk/vhffs-panel/admin/user/list.pl
    trunk/vhffs-panel/templates/admin/user/edit.tmpl
    trunk/vhffs-panel/user/prefs.pl

Modified: trunk/vhffs-api/src/Vhffs/Group.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Group.pm Tue Dec  6 01:56:51 2005
@@ -614,6 +614,39 @@
 
 }
 
+sub getall_by_user
+{
+    my $vhffs = shift;
+    my $state = shift;
+    my $user = shift;
+	my $name;	
+	return undef if( $user->fetch < 0 );
+
+    my $db = $vhffs->get_db_object;
+    my @result;
+    my $query = "SELECT groupname FROM vhffs_groups g, vhffs_object o , vhffs_user_group ug WHERE ug.gid=g.gid AND g.object_id=o.object_id AND g.groupname NOT IN (SELECT username FROM vhffs_users ) AND ug.uid=".$user->get_uid;
+
+    $query .= " AND o.state=$state " if( defined $state );
+    $query .= " ORDER BY g.groupname";
+
+    my $request = $db->{'DB_READ'}->prepare( $query );
+    my $rows = $request->execute;
+
+    return undef if( $rows <= 0 );
+
+    my $names = $request->fetchall_arrayref;
+
+    my $group;
+    foreach $name ( @{$names} )
+    {
+
+        $group = new Vhffs::Group( $vhffs , $name->[0] , '401' );
+        push( @result , $group) if( $group->fetch > 0 );
+    }
+    return \@result;
+}
+
+
 sub getall
 {
 	my $vhffs = shift;

Modified: trunk/vhffs-backend/conf/vhffs.conf
==============================================================================
--- trunk/vhffs-backend/conf/vhffs.conf (original)
+++ trunk/vhffs-backend/conf/vhffs.conf Tue Dec  6 01:56:51 2005
@@ -21,7 +21,7 @@
 		use_mailling	=	yes
 		use_mailing		=	yes
 		use_mail		=	yes
-		use_mailuser	=	yes
+		use_mailuser	=	no
 	</modules>
 	<panel>
 		url				=   http://your.panel.url

Modified: trunk/vhffs-panel/admin/user/edit.pl
==============================================================================
--- trunk/vhffs-panel/admin/user/edit.pl (original)
+++ trunk/vhffs-panel/admin/user/edit.pl Tue Dec  6 01:56:51 2005
@@ -184,6 +184,23 @@
     }
 
 
+	my $groups = Vhffs::Group::getall_by_user( $vhffs , undef , $object );
+    my $g;
+    my $subtemplate;
+    my $tmp = "";
+    foreach $g ( @{$groups} )
+    {
+        $subtemplate = new HTML::Template( filename => $templatedir."/admin/user/group-part.tmpl" );
+        $subtemplate->param( GROUPNAME => $g->get_groupname );
+        $subtemplate->param( OWNER_TEXT => gettext("Owner of this group") );
+        $subtemplate->param( OWNER => $g->get_owner_username );
+        $subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $g->get_status) );
+
+        $tmp .= $subtemplate->output;
+    }
+
+    $template->param( TEXT_GROUPS => gettext("Groups of this user") );
+    $template->param( GROUPS => $tmp );
 
 
 	if( $object->is_moderator )
@@ -198,6 +215,8 @@
 	{
 		$template->param( SELECTED_NORMAL_USER => "selected" );
 	}
+
+
 
 
 	if( $vhffs->get_config->use_notation == 1 )

Modified: trunk/vhffs-panel/admin/user/list.pl
==============================================================================
--- trunk/vhffs-panel/admin/user/list.pl (original)
+++ trunk/vhffs-panel/admin/user/list.pl Tue Dec  6 01:56:51 2005
@@ -7,11 +7,11 @@
 use CGI;
 use CGI::Session;
 use strict;
-use Data::Dumper;
 
 use Vhffs::User;
 use Vhffs::Group;
 use Vhffs::Main;
+use Vhffs::Functions;
 use Vhffs::Panel::Main;
 use Vhffs::Panel::Menu;
 use Vhffs::Stats;
@@ -55,12 +55,14 @@
 
 	use Vhffs::Panel::User;
 
-	my $users = Vhffs::Panel::User::getall_users( $vhffs , $name );
+#	my $users = Vhffs::Panel::User::getall_users( $vhffs , $name );
+	my $users = Vhffs::User::getall( $vhffs , undef , $name );
+	my $u;
 
 	if( defined $users )
 	{
 		my $output = "";
-		foreach( sort ( keys %{$users} ) )
+		foreach $u ( @{$users} ) 
 		{
 			my $subtemplate;
 
@@ -70,29 +72,11 @@
 				$subtemplate = new HTML::Template( filename => $templatedir."/admin/user/part-modo.tmpl" );
 			}
 
-			$subtemplate->param( NAME => $_ );
-			$subtemplate->param( FIRSTNAME => $users->{$_}{'firstname'} ) if( defined $users->{$_}{'firstname'} );
-			$subtemplate->param( LASTNAME => $users->{$_}{'lastname'} ) if( defined $users->{$_}{'lastname'} );
+			$subtemplate->param( NAME => $u->get_username );
+			$subtemplate->param( FIRSTNAME => $u->get_firstname);
+			$subtemplate->param( LASTNAME => $u->get_lastname );
 
-			if( defined $users->{$_}{'state'} )
-			{
-			if( $users->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_CREATION )
-			{
-				$subtemplate->param( STATE => gettext("Waiting for creation") );
-			}
-			elsif( $users->{$_}{'state'} == Vhffs::Constants::ACTIVATED )
-			{
-				$subtemplate->param( STATE => gettext("Activated") );
-			}
-			elsif( $users->{$_}{'state'} == Vhffs::Constants::TO_DELETE )
-			{
-				$subtemplate->param( STATE => gettext("Waiting for delete") );
-			}
-			elsif( $users->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_VALIDATION )
-			{
-				$subtemplate->param( STATE => gettext("Waiting for validation") );
-			}
-			}
+			$subtemplate->param( STATE => gettext( Vhffs::Functions::status_string_from_status_id( $u->get_status ) ) );
 
 			if( $user->is_admin == 1 )  {
 				$subtemplate->param( SEND => gettext("Modify this user") );

Modified: trunk/vhffs-panel/templates/admin/user/edit.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/admin/user/edit.tmpl (original)
+++ trunk/vhffs-panel/templates/admin/user/edit.tmpl Tue Dec  6 01:56:51 2005
@@ -143,3 +143,9 @@
 		</label>
 	</p>	
 
+    <p>
+        <h2><TMPL_VAR NAME="TEXT_GROUPS"></h2>
+        <label for="GROUPS">
+            <TMPL_VAR NAME="GROUPS">
+        </label>
+    </p>

Modified: trunk/vhffs-panel/user/prefs.pl
==============================================================================
--- trunk/vhffs-panel/user/prefs.pl (original)
+++ trunk/vhffs-panel/user/prefs.pl Tue Dec  6 01:56:51 2005
@@ -121,6 +121,9 @@
     my $subtemplate = new HTML::Template( filename => $templatedir."/user/mailuser.tmpl" );
     my $config = $vhffs->get_config->get_service( "mailuser" );
     my $mu = init Vhffs::Services::MailUser( $vhffs , $user );
+
+	if( defined $mu )
+	{
     
     $subtemplate->param( ACTIV_CHECKED => "checked" ) if( $mu->exists == 1         );
     $subtemplate->param( POP_CHECKED => "checked" )   if( $mu->exists_box == 1     );
@@ -132,6 +135,7 @@
     $subtemplate->param( TEXT_MAILFORWARD => sprintf( gettext("Forward emails from %s\@%s to %s"), $username, $config->{domain}, $usermail ) );
     
     $template->param( MAILUSER => $subtemplate->output );
+	}
     
 }
 




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