[vhffs-dev] [1741] No more HTML::Template in repository/index |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1741
Author: beuss
Date: 2011-05-15 00:10:08 +0200 (Sun, 15 May 2011)
Log Message:
-----------
No more HTML::Template in repository/index
Modified Paths:
--------------
trunk/vhffs-panel/repository/index.pl
Modified: trunk/vhffs-panel/repository/index.pl
===================================================================
--- trunk/vhffs-panel/repository/index.pl 2011-05-14 22:10:00 UTC (rev 1740)
+++ trunk/vhffs-panel/repository/index.pl 2011-05-14 22:10:08 UTC (rev 1741)
@@ -32,7 +32,6 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use strict;
@@ -47,26 +46,32 @@
exit 0 unless $session;
my $vhffs = $panel->{vhffs};
-my $cgi = $panel->{'cgi'};
+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
+ 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('Download repositories for %s'), $group->get_groupname) );
- my $repos = Vhffs::Panel::Repository::getall_per_group( $vhffs, $group->get_gid );
- if($repos < 0) {
- $panel->add_error( gettext('Unable to get repositories') );
- $panel->build;
- $panel->display;
+
+ my $repositories = Vhffs::Panel::Repository::getall_per_group( $vhffs, $group->get_gid );
+ if($repositories < 0) {
+ $panel->render( 'misc/message.tt', { message => gettext('Unable to get download repositories') } );
} else {
- $panel->build( $panel->create_service_index('repository', $repos) );
- $panel->display;
+ $panel->render( 'misc/service-index.tt', {
+ label => 'Download repositories',
+ group => $group,
+ list => $repositories,
+ help_url => $vhffs->get_config->get_service('repository')->{url_doc},
+ type => 'repository'
+ });
}
}