[vhffs-dev] [1769] No more HTML::Template in git/index

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


Revision: 1769
Author:   beuss
Date:     2011-05-17 22:50:55 +0200 (Tue, 17 May 2011)
Log Message:
-----------
No more HTML::Template in git/index

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

Modified: trunk/vhffs-panel/git/index.pl
===================================================================
--- trunk/vhffs-panel/git/index.pl	2011-05-17 20:50:36 UTC (rev 1768)
+++ trunk/vhffs-panel/git/index.pl	2011-05-17 20:50:55 UTC (rev 1769)
@@ -33,7 +33,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use strict;
@@ -49,25 +48,31 @@
 
 my $vhffs = $panel->{vhffs};
 my $cgi = $panel->{'cgi'};
+my $user = $panel->{user};
 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
-    $panel->set_title( sprintf(gettext('GIT repositories for %s'), $group->get_groupname) );
+    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('Git repositories for %s'), $group->get_groupname) );
+
     my $git = Vhffs::Panel::Git::getall_per_group( $vhffs, $group->get_gid );
     if($git < 0) {
-        $panel->add_error( gettext('Unable to get GIT repositories') );
-	$panel->build;
-	$panel->display;
+        $panel->render( 'misc/message.tt', { message => gettext('Unable to get Git repositories') } );
     } else {
-	$panel->build( $panel->create_service_index('git', $git) );
-        $panel->display;
+        $panel->render( 'misc/service-index.tt', {
+            label => 'Git repositories',
+            group => $group,
+            list => $git,
+            help_url => $vhffs->get_config->get_service('git')->{url_doc},
+            type => 'git'
+        });
     }
 }
 


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