[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm
raeburn
raeburn@source.lon-capa.org
Thu, 03 Mar 2011 06:37:30 -0000
raeburn Thu Mar 3 06:37:30 2011 EDT
Modified files:
/loncom/auth lonlogin.pm
Log:
- Improve changes in rev 1.145.
- No display of table rows for User Load, Server Load, or Version if
there are no numbers to display.
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.146 loncom/auth/lonlogin.pm:1.147
--- loncom/auth/lonlogin.pm:1.146 Fri Feb 11 10:41:59 2011
+++ loncom/auth/lonlogin.pm Thu Mar 3 06:37:30 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Login Screen
#
-# $Id: lonlogin.pm,v 1.146 2011/02/11 10:41:59 bisitz Exp $
+# $Id: lonlogin.pm,v 1.147 2011/03/03 06:37:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -151,10 +151,14 @@
$loadavg=<$loadfile>;
}
$loadavg =~ s/\s.*//g;
- my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
- unless ($loadlim) { $loadpercent='---'; }
- my $userloadpercent=&Apache::lonnet::userload();
- unless ($uloadlim) { $userloadpercent='---'; }
+
+ my ($loadpercent,$userloadpercent);
+ if ($loadlim) {
+ $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
+ }
+ if ($uloadlim) {
+ $userloadpercent=&Apache::lonnet::userload();
+ }
my $firsturl=
($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
@@ -464,10 +468,8 @@
</div>
<hr style="clear:both;" />
ENDTOP
-
-$r->print(<<ENDDOCUMENT);
- <div style="float: left;">
- <table border="0" cellspacing="0" cellpadding="0">
+ my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
+ $domainrow = <<"END";
<tr>
<td align="left" valign="top">
<small><b>$lt{'dom'}: </b></small>
@@ -476,6 +478,8 @@
<small><tt> $domain</tt></small>
</td>
</tr>
+END
+ $serverrow = <<"END";
<tr>
<td align="left" valign="top">
<small><b>$lt{'serv'}: </b></small>
@@ -484,6 +488,9 @@
<small><tt> $lonhost ($role)</tt></small>
</td>
</tr>
+END
+ if ($loadlim) {
+ $loadrow = <<"END";
<tr>
<td align="left" valign="top">
<small><b>$lt{'load'}: </b></small>
@@ -492,6 +499,10 @@
<small><tt> $loadpercent $lt{'perc'}</tt></small>
</td>
</tr>
+END
+ }
+ if ($uloadlim) {
+ $userloadrow = <<"END";
<tr>
<td align="left" valign="top">
<small><b>$lt{'userload'}: </b></small>
@@ -500,11 +511,26 @@
<small><tt> $userloadpercent $lt{'perc'}</tt></small>
</td>
</tr>
+END
+ }
+ if (($version ne '') && ($version ne '<!-- VERSION -->')) {
+ $versionrow = <<"END";
<tr>
<td colspan="2" align="left">
<small>$version</small>
</td>
</tr>
+END
+ }
+
+$r->print(<<ENDDOCUMENT);
+ <div style="float: left;">
+ <table border="0" cellspacing="0" cellpadding="0">
+$domainrow
+$serverrow
+$loadrow
+$userloadrow
+$versionrow
</table>
</div>
<div style="float: right;">