[vhffs-dev] [875] Add a warning in the home page of the panel for projects which are over 90% of their quota

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


Revision: 875
Author:   gradator
Date:     2007-09-08 01:21:00 +0000 (Sat, 08 Sep 2007)

Log Message:
-----------
Add a warning in the home page of the panel for projects which are over 90% of their quota

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Main.pm
    trunk/vhffs-panel/templates/misc/welcome.tmpl


Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2007-09-08 00:43:52 UTC (rev 874)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm	2007-09-08 01:21:00 UTC (rev 875)
@@ -517,9 +517,24 @@
 
 	$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 buoy button in the upper right of the screen") );
+	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 has reached or are going to reach the disk quota limit, please take a look !') );
+		$template->param( OVER_QUOTA => \@overquota );
+	}
+
 	return $template;
 }
 

Modified: trunk/vhffs-panel/templates/misc/welcome.tmpl
===================================================================
--- trunk/vhffs-panel/templates/misc/welcome.tmpl	2007-09-08 00:43:52 UTC (rev 874)
+++ trunk/vhffs-panel/templates/misc/welcome.tmpl	2007-09-08 01:21:00 UTC (rev 875)
@@ -1 +1,11 @@
 <tmpl_var name="TEXT_WELCOME">
+<tmpl_if name="OVER_QUOTA">
+<div id="overQuota">
+<h2><tmpl_var name="OVER_QUOTA_TEXT"></h2>
+<ul>
+<tmpl_loop name="OVER_QUOTA">
+    <li><a href="/group/view.pl?project=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a></li>
+</tmpl_loop>
+</ul>
+</div>
+</tmpl_if>


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