[vhffs-dev] [1713] User deletion use Template::Toolkit

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


Revision: 1713
Author:   beuss
Date:     2011-05-13 13:30:33 +0200 (Fri, 13 May 2011)
Log Message:
-----------
User deletion use Template::Toolkit

Modified Paths:
--------------
    trunk/vhffs-panel/user/delete.pl

Modified: trunk/vhffs-panel/user/delete.pl
===================================================================
--- trunk/vhffs-panel/user/delete.pl	2011-05-13 11:30:25 UTC (rev 1712)
+++ trunk/vhffs-panel/user/delete.pl	2011-05-13 11:30:33 UTC (rev 1713)
@@ -41,12 +41,7 @@
 
 use lib '%VHFFS_LIB_DIR%';
 use Vhffs::User;
-use Vhffs::Main;
-use Vhffs::Group;
 use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Group;
-use Vhffs::Services::Web;
 use Vhffs::Acl;
 
 my $panel = new Vhffs::Panel::Main();
@@ -55,16 +50,12 @@
 exit 0 unless $session;
 
 my $vhffs = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
 my $user = $panel->{'user'};
 my $cgi = $panel->{'cgi'};
 my $message;
-my $owner = $cgi->param("PROJECT_OWNER");
 
 my $delete = $cgi->param("DELETE");
 
-my $templatedir = $vhffs->get_config->get_templatedir;
-
 my $userp;
 my $username = $cgi->param('name');
 if( defined $username ) {
@@ -73,45 +64,24 @@
 	$userp = $user;
 }
 
-#We test if the owner exist
-
 # We make sure the current user is allowed to delete the specified user
-if( !$user->can_delete( $userp ) )
-{
-	$message = gettext("You\'re not allowed to delete this user");
-}
-else
-{
-	if( $delete == 1 )
-	{
-		if( $userp->have_activegroups )
-		{
-			$message = gettext("This user is always in a group");
-		}
-		else
-		{
+unless( $user->can_delete( $userp ) ) {
+    $message = gettext("You\'re not allowed to delete this user");
+} else {
+	if( $delete == 1 ) {
+		if( $userp->have_activegroups ) {
+			$message = gettext("This user is still in a group");
+		} else {
 			$userp->set_status( Vhffs::Constants::TO_DELETE );
-			if( $userp->commit < 0 )
-			{
+			if( $userp->commit < 0 ) {
 				$message = gettext("An error occured while applying changes. This user will NOT be deleted");
-			}
-			else
-			{
+			} else {
 				$message = gettext("This user will BE DELETED");
 			}
 		}
-	}
-	else
-	{
+	} else {
 			$message = gettext("This user will NOT be DELETED");
-		
 	}
 }
 
-
-my $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-$template->param( MESSAGE => $message );
-
-$panel->set_refresh_url( '/panel.pl' );
-$panel->build( $template );
-$panel->display;
+$panel->render('misc/message.tt', { message => $message, refresh_url => '/panel.pl' });


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