--- loncom/cgi/clusterstatus.pl 2008/11/29 00:57:09 1.25
+++ 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.25 2008/11/29 00:57:09 raeburn Exp $
+# $Id: clusterstatus.pl,v 1.27 2009/01/15 22:34:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,7 @@ use Apache::lonnet;
use Apache::lonlocal;
use LONCAPA::Configuration;
use LONCAPA::loncgi;
+use LONCAPA::lonauthcgi;
use LWP::UserAgent();
use HTTP::Headers;
use IO::File;
@@ -259,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
@@ -726,9 +729,9 @@ if (!&LONCAPA::loncgi::check_cookie_and_
exit;
}
-if (!&LONCAPA::loncgi::can_view('clusterstatus')) {
+if (!&LONCAPA::lonauthcgi::can_view('clusterstatus')) {
&Apache::lonlocal::get_language_handle();
- print &LONCAPA::loncgi::unauthorized_msg('clusterstatus');
+ print &LONCAPA::lonauthcgi::unauthorized_msg('clusterstatus');
exit;
}
@@ -739,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};