[vhffs-dev] [1784] No more HTML::Template in bazaar/index

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


Revision: 1784
Author:   beuss
Date:     2011-05-20 13:13:50 +0200 (Fri, 20 May 2011)
Log Message:
-----------
No more HTML::Template in bazaar/index

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

Modified: trunk/vhffs-panel/bazaar/index.pl
===================================================================
--- trunk/vhffs-panel/bazaar/index.pl	2011-05-20 11:13:44 UTC (rev 1783)
+++ trunk/vhffs-panel/bazaar/index.pl	2011-05-20 11:13:50 UTC (rev 1784)
@@ -47,26 +47,32 @@
 exit 0 unless $session;
 
 my $vhffs = $panel->{vhffs};
-my $cgi = $panel->{'cgi'};
+my $user = $panel->{user};
+my $cgi = $panel->{cgi};
 my $group = Vhffs::Group::get_by_groupname( $vhffs , $cgi->param('group') );
 
 if( ! 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 {
-    # Group is in session => access is granted for user and group is activated
-    # no need to check
+    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)' ) } );
+    }
+
     $panel->set_title( sprintf(gettext('Bazaar repositories for %s'), $group->get_groupname) );
     my $bazaar = Vhffs::Panel::Bazaar::getall_per_group( $vhffs, $group->get_gid );
+
     if($bazaar < 0) {
-        $panel->add_error( gettext('Unable to get Bazaar repositories') );
-	$panel->build;
-	$panel->display;
+        $panel->render('misc/message.tt', { message => gettext('Unable to get Bazaar repositories') } );
     } else {
-	$panel->build( $panel->create_service_index('bazaar', $bazaar) );
-        $panel->display;
+        $panel->render( 'misc/service-index.tt', {
+            label => 'Bazaar repositories',
+            group => $group,
+            list => $bazaar,
+            help_url => 'Finish implementation', # $vhffs->get_config->get_service('bazaar')->{url_doc},
+            type => 'bazaar'
+        });
     }
 }
 


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