[vhffs-dev] [1740] Template::Toolkit on repository/delete

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


Revision: 1740
Author:   beuss
Date:     2011-05-15 00:10:00 +0200 (Sun, 15 May 2011)
Log Message:
-----------
Template::Toolkit on repository/delete

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

Modified: trunk/vhffs-panel/repository/delete.pl
===================================================================
--- trunk/vhffs-panel/repository/delete.pl	2011-05-14 22:09:49 UTC (rev 1739)
+++ trunk/vhffs-panel/repository/delete.pl	2011-05-14 22:10:00 UTC (rev 1740)
@@ -32,7 +32,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use CGI;
@@ -41,12 +40,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::Repository;
 
 my $panel = new Vhffs::Panel::Main();
@@ -55,11 +49,9 @@
 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 $repo_name = $cgi->param( "REPO_NAME" );
 my $sure = $cgi->param( "DELETE" );
@@ -68,39 +60,23 @@
 
 my $repo = Vhffs::Services::Repository::get_by_reponame( $vhffs , $repo_name );
 
-if( ( ! defined $repo_name ) || ( ! defined $sure ) )
-{
+if( ( ! defined $repo_name ) || ( ! defined $sure ) ) {
     $message = sprintf( gettext("CGI Error ! %s"), $repo_name );
-}
-elsif( ! defined $repo )
-{
+} elsif( ! defined $repo ) {
 	$message = gettext( "Cannot retrieve informations about this Download repository" );
-}
-elsif( !$user->can_delete( $repo ) )
-{
+} elsif( !$user->can_delete( $repo ) ) {
 	$message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
-}
-elsif( $sure == 0 )
-{
+} elsif( $sure == 0 ) {
 	$message = gettext( "This Download repository will NOT be deleted" );
-}
-else
-{
+} else {
 	$repo->set_status( Vhffs::Constants::TO_DELETE );
 
 	# Commit all the changes for the current user
-	if( $repo->commit < 0 )
-	{
+	if( $repo->commit < 0 ) {
 	        $message = gettext("An error occured while deleting the Download repository");
-	}  
-	else  
-	{
+	} else {
         $message = gettext("This Download repository will be deleted");
 	}
 }
 
-my $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-$template->param( MESSAGE => $message );
-
-$panel->build( $template );
-$panel->display;
+$panel->render('misc/message.tt', { message => $message });


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