[vhffs-dev] [1819] No more HTML::Template in broadcast/delete

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


Revision: 1819
Author:   beuss
Date:     2011-05-26 14:21:23 +0200 (Thu, 26 May 2011)
Log Message:
-----------
No more HTML::Template in broadcast/delete

Modified Paths:
--------------
    trunk/vhffs-panel/admin/broadcast/delete.pl

Modified: trunk/vhffs-panel/admin/broadcast/delete.pl
===================================================================
--- trunk/vhffs-panel/admin/broadcast/delete.pl	2011-05-26 12:21:16 UTC (rev 1818)
+++ trunk/vhffs-panel/admin/broadcast/delete.pl	2011-05-26 12:21:23 UTC (rev 1819)
@@ -32,7 +32,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use CGI;
@@ -41,58 +40,29 @@
 
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Services::Web;
-use Vhffs::Acl;
-use Vhffs::Constants;
+use Vhffs::Panel::Admin;
+use Vhffs::Mailings;
 
-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 $template;
+my $cgi          = $panel->{cgi};
+my $vhffs        = $panel->{vhffs};
 
-my $cgi          = $panel->{'cgi'};
-my $vhffs        = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
-my $user         = $panel->{'user'};
+my $mid         = $cgi->param('ID');
 
-my $mid         = $cgi->param("ID");
-
-my $templatedir  = $vhffs->get_config->get_templatedir;
-
-$template        = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
 my $message;
 
-#Use is not allowed to see this page, only MODERATOR and ADMIN
-if( $user->is_admin != 1 ) 
-{
-	$message = gettext("You're not allowed to do this (ACL rights)");
-	$template->param( MESSAGE => $message );
-}
-elsif( ! defined $mid )
-{
-	$message = gettext("CGI Error !");
-	$template->param( MESSAGE => $message );
-}
-else
-{
-	use Vhffs::Mailings;
-	if( Vhffs::Mailings::del_mailing( $vhffs , $mid ) == 1 )
-	{
-		$template->param( MESSAGE  => gettext("Mailing successfully deleted") );
+if( ! defined $mid ) {
+    $message = gettext("CGI Error !");
+} else {
+	if( Vhffs::Mailings::del_mailing( $vhffs , $mid ) == 1 ) {
+		$message = gettext('Mailing successfully deleted');
+	} else {
+        $message = gettext('An error occured while deleting this mailing');
 	}
-	else
-	{
-		$template->param( MESSAGE  => gettext("An error occured while deleting this mailing") );
-	}
 }
 
-$panel->set_refresh_url( "/admin/broadcast_list.pl" );
-$panel->build( $template );
-$panel->display;
+$panel->render('misc/message.tt', {
+    message => $message,
+    refresh_url => '/admin/broadcast/list.pl'
+});


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