[vhffs-dev] [1779] No more HTML::Template in cron/index

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


Revision: 1779
Author:   beuss
Date:     2011-05-19 22:35:27 +0200 (Thu, 19 May 2011)
Log Message:
-----------
No more HTML::Template in cron/index

Modified Paths:
--------------
    trunk/vhffs-panel/cron/index.pl

Modified: trunk/vhffs-panel/cron/index.pl
===================================================================
--- trunk/vhffs-panel/cron/index.pl	2011-05-19 20:35:16 UTC (rev 1778)
+++ trunk/vhffs-panel/cron/index.pl	2011-05-19 20:35:27 UTC (rev 1779)
@@ -32,7 +32,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use strict;
@@ -48,24 +47,32 @@
 
 my $vhffs = $panel->{vhffs};
 my $cgi = $panel->{'cgi'};
+my $user = $panel->{user};
 my $group = Vhffs::Group::get_by_groupname( $vhffs , $cgi->param('group') );
 
 unless( defined $group ) {
 	$panel->set_title( gettext('Error') );
-	$panel->add_error( gettext('You have to select a group first') );
-	$panel->build;
-	$panel->display;
+    $panel->render('misc/message.tt', { message => gettext('You have to select a group first') } );
 } else {
+    if($group->get_status != Vhffs::Constants::ACTIVATED) {
+        $panel->render( 'misc/message.tt', { message => gettext('This group is not activated yet') } );
+    } elsif( ! $user->can_modify( $group ) ) {
+        $panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this (ACL rights)' ) } );
+    }
+
 	# Group is in session => access is granted for user and group is activated
 	# no need to check
 	$panel->set_title( sprintf(gettext('Cron jobs for %s'), $group->get_groupname) );
 	my $crons = Vhffs::Panel::Cron::getall_per_group( $vhffs, $group->get_gid );
 	if($crons < 0) {
-		$panel->add_error( gettext('Unable to get cron jobs') );
-		$panel->build;
-		$panel->display;
+        $panel->render('misc/message.tt', { message => gettext('Unable to get cron jobs') } );
 	} else {
-		$panel->build( $panel->create_service_index('cron', $crons) );
-		$panel->display;
+        $panel->render( 'misc/service-index.tt', {
+            label => 'Cron jobs',
+            group => $group,
+            list => $crons,
+            help_url => $vhffs->get_config->get_service('cron')->{url_doc},
+            type => 'cron'
+        });
 	}
 }


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