[vhffs-dev] [1684] Welcome screen now uses Template::Toolkit |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1684
Author: beuss
Date: 2011-05-01 16:26:08 +0200 (Sun, 01 May 2011)
Log Message:
-----------
Welcome screen now uses Template::Toolkit
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel/Main.pm
trunk/vhffs-panel/panel.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/misc/welcome.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/misc/welcome.tmpl
Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-01 14:26:00 UTC (rev 1683)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-01 14:26:08 UTC (rev 1684)
@@ -451,37 +451,6 @@
$panel->{infos} = [];
}
-sub welcome
-{
- my $panel = shift;
- my $vhffs = $panel->{'vhffs'};
- my $user = $panel->{'user'};
- my $templatedir = $panel->{'templatedir'};
-
- $panel->set_title( sprintf( gettext('Hello %s, welcome in VHFFS !'), $user->get_username() ) );
-
- my $template = new HTML::Template( filename => $templatedir.'/panel/misc/welcome.tmpl' );
- $template->param( TEXT_WELCOME => gettext('If you are new to VHFFS, you should start to read quickly the whole help available by clicking on the help button in the upper right of your screen') );
-
- # check groups quota
- my @overquota;
- foreach my $group ( @{$user->get_groups} ) {
- my $quota = $group->get_quota;
- my $curused = $group->get_quota_used;
- if( $curused > $quota-$quota/10 ) {
- my %g = ( groupname => $group->get_groupname );
- push @overquota, \%g;
- }
- }
- if( @overquota ) {
- $template->param( OVER_QUOTA_TEXT => gettext('The following projects have reached or are going to reach the disk quota limit, please take a look !') );
- $template->param( OVER_QUOTA => \@overquota );
- }
-
- return $template;
-}
-
-
sub project_info
{
my $panel = shift;
Modified: trunk/vhffs-panel/panel.pl
===================================================================
--- trunk/vhffs-panel/panel.pl 2011-05-01 14:26:00 UTC (rev 1683)
+++ trunk/vhffs-panel/panel.pl 2011-05-01 14:26:08 UTC (rev 1684)
@@ -48,5 +48,24 @@
my $session = $panel->get_session;
exit 0 unless $session;
-$panel->build( $panel->welcome );
-$panel->display;
+my $vhffs = $panel->{'vhffs'};
+my $user = $panel->{'user'};
+my $templatedir = $panel->{'templatedir'};
+
+my $vars = {};
+
+$panel->set_title( sprintf( gettext('Hello %s, welcome in VHFFS !'), $user->get_username() ) );
+
+# check groups quota
+my @overquota;
+foreach my $group ( @{$user->get_groups} ) {
+ my $quota = $group->get_quota;
+ my $curused = $group->get_quota_used;
+ if( $curused > $quota-$quota/10 ) {
+ push @overquota, $group->get_groupname;
+ }
+}
+
+$vars->{overquota} = \@overquota;
+
+$panel->render( 'misc/welcome.tt', $vars );
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-01 14:26:00 UTC (rev 1683)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-01 14:26:08 UTC (rev 1684)
@@ -105,7 +105,6 @@
misc/infos.tmpl \
misc/service_index.tmpl \
misc/simplemsg.tmpl \
- misc/welcome.tmpl \
misc/resubmit.tmpl \
mysql/create.tmpl \
mysql/prefs.tmpl \
@@ -152,4 +151,5 @@
misc/header.tt \
misc/infos.tt \
misc/languages.tt \
- misc/message.tt
+ misc/message.tt \
+ misc/welcome.tt
Deleted: trunk/vhffs-panel/templates/misc/welcome.tmpl
===================================================================
--- trunk/vhffs-panel/templates/misc/welcome.tmpl 2011-05-01 14:26:00 UTC (rev 1683)
+++ trunk/vhffs-panel/templates/misc/welcome.tmpl 2011-05-01 14:26:08 UTC (rev 1684)
@@ -1,11 +0,0 @@
-<TMPL_VAR ESCAPE=1 NAME="TEXT_WELCOME">
-<TMPL_IF NAME="OVER_QUOTA">
-<div id="overQuota">
-<h2><TMPL_VAR ESCAPE=1 NAME="OVER_QUOTA_TEXT"></h2>
-<ul>
-<TMPL_LOOP NAME="OVER_QUOTA">
- <li><a href="/group/view.pl?group=<TMPL_VAR ESCAPE=1 NAME="GROUPNAME">"><TMPL_VAR ESCAPE=1 NAME="GROUPNAME"></a></li>
-</TMPL_LOOP>
-</ul>
-</div>
-</TMPL_IF>
Added: trunk/vhffs-panel/templates/misc/welcome.tt
===================================================================
--- trunk/vhffs-panel/templates/misc/welcome.tt (rev 0)
+++ trunk/vhffs-panel/templates/misc/welcome.tt 2011-05-01 14:26:08 UTC (rev 1684)
@@ -0,0 +1,11 @@
+[% 'If you are new to VHFFS, you should start to read quickly the whole help available by clicking on the help button in the upper right of your screen.' | i18n | html %]
+[% IF over_quota.size() %]
+<div id="overQuota">
+<h2>[% 'The following projects have reached or are going to reach the disk quota limit, please take a look !' | i18n | html %]</h2>
+<ul>
+[% FOR g IN overquota %]
+ <li><a href="/group/view.pl?group=[% g %]">[% g %]</a></li>
+[% END %]
+</ul>
+</div>
+[% END %]