[vhffs-dev] [1827] No more HTML::Template in object/delete_avatar

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


Revision: 1827
Author:   beuss
Date:     2011-05-28 22:30:23 +0200 (Sat, 28 May 2011)
Log Message:
-----------
No more HTML::Template in object/delete_avatar

Modified Paths:
--------------
    trunk/vhffs-panel/admin/object/delete_avatar.pl

Modified: trunk/vhffs-panel/admin/object/delete_avatar.pl
===================================================================
--- trunk/vhffs-panel/admin/object/delete_avatar.pl	2011-05-28 20:30:12 UTC (rev 1826)
+++ trunk/vhffs-panel/admin/object/delete_avatar.pl	2011-05-28 20:30:23 UTC (rev 1827)
@@ -32,7 +32,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use CGI;
@@ -40,23 +39,12 @@
 use strict;
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Stats;
-use Vhffs::Constants;
+use Vhffs::Panel::Admin;
 use Vhffs::Panel::Avatar;
 
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
+my $panel = new Vhffs::Panel::Admin();
 
 my $vhffs = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
 my $cgi = $panel->{'cgi'};
 my $oid = $cgi->param("OID");
 my $path;
@@ -65,46 +53,23 @@
 
 my $object;
 
-my $templatesdir = $vhffs->get_config->get_templatedir;
-my $template = new HTML::Template( filename => $templatesdir."/panel/misc/simplemsg.tmpl" );
-if( $panel->use_avatars == 0 )
-{
+if( $panel->use_avatars == 0 ) {
 	$message =  gettext( "This platform does not support avatar");
-}
-elsif( $user->is_admin != 1 )
-{
-	$message =  gettext( "You are not allowed to see it");
-}
-elsif( ! defined $oid ) 
-{
+} elsif( ! defined $oid ) {
 	$message =  gettext( "CGI Error !");
-}
-elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) )
-{
+} elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) ) {
 	$message = gettext( "Cannot fetch object");
-}
-else
-{
+} else {
 	$path = Vhffs::Panel::Avatar::exists_avatar( $vhffs , $object );
 
-	if( defined ( $path ) )
-	{
-		if( unlink( $path ) <= 0 )
-		{
+	if( defined ( $path ) ) {
+		if( unlink( $path ) <= 0 ) {
 			$message = gettext( "Cannot delete this avatar" );
-		}
-		else
-		{
+		} else {
 			$message = gettext( "Avatar deleted" );
 		}
-	}
-	else
-	{
+	} else {
 		$message = gettext( "This object does not have an avatar" );
 	}
 }
-$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/