--- loncom/cgi/clusterstatus.pl 2008/12/25 01:56:03 1.26 +++ loncom/cgi/clusterstatus.pl 2009/01/15 22:34:18 1.27 @@ -1,7 +1,7 @@ #!/usr/bin/perl $|=1; # Generates a html page showing various status reports about the domain or cluster -# $Id: clusterstatus.pl,v 1.26 2008/12/25 01:56:03 raeburn Exp $ +# $Id: clusterstatus.pl,v 1.27 2009/01/15 22:34:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -260,13 +260,15 @@ sub reroute { sub allreroutes { my $local=shift; &takeoffline($local); - print(&Apache::lonlocal::mt('Reroute to:').' '); - foreach my $remote (sort keys %hostname) { + my $reroute; + foreach my $remote (sort(keys(%hostname))) { unless ($local eq $remote) { - &reroute($local,$remote); + $reroute .= &reroute($local,$remote); } } - print(''); + if ($reroute) { + print(&Apache::lonlocal::mt('Reroute to:').' '.$reroute.''); + } } # ========================================================= Produce a green bar @@ -740,8 +742,22 @@ if ($Apache::lonnet::env{'request.role'} %hostname = %allhostname; $scope = 'Cluster'; } else { + my $roledom = $env{'request.role.domain'}; + if ((!$roledom) || ($roledom eq 'public')) { + print &LONCAPA::lonauthcgi::unauthorized_msg('clusterstatus'); + exit; + } undef(%hostname); my @poss_domains = &Apache::lonnet::current_machine_domains(); + if (!grep(/^\Q$roledom\E$/,@poss_domains)) { + my $home = &Apache::lonnet::domain($roledom,'primary'); + print &LONCAPA::lonauthcgi::unauthorized_msg('clusterstatus'); + print '
'.&mt("You need to select a role in this server's domain ([_1]) to display domain status for this server and other servers in the domain.",$roledom).'
'; + if ($home) { + print ''.&mt("Alternatively, you'll need to [_1]switch server[_2] to display domain status for servers in the domain of your current role ([_3]).",'','',$roledom).'/span>'; + } + exit; + } foreach my $host (keys(%allhostname)) { if (grep(/^\Q$hostdom{$host}\E$/,@poss_domains)) { $hostname{$host} = $allhostname{$host};