--- loncom/interface/domainstatus.pm 2008/12/22 21:13:25 1.1
+++ loncom/interface/domainstatus.pm 2010/05/26 16:24:41 1.4
@@ -2,7 +2,7 @@
# Generate a menu page containing links to server status pages accessible
# to user.
#
-# $Id: domainstatus.pm,v 1.1 2008/12/22 21:13:25 raeburn Exp $
+# $Id: domainstatus.pm,v 1.4 2010/05/26 16:24:41 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,7 +35,7 @@ use Apache::lonnet;
use Apache::loncommon;
use Apache::lonhtmlcommon;
use Apache::lonlocal;
-use LONCAPA::loncgi;
+use LONCAPA::lonauthcgi;
sub handler {
my $r = shift;
@@ -57,12 +57,12 @@ sub handler {
my $domdesc = &Apache::lonnet::domain($dom,'description');
my %candisplay;
- my $titles = &LONCAPA::loncgi::serverstatus_titles();
+ my $titles = &LONCAPA::lonauthcgi::serverstatus_titles();
if (ref($titles) eq 'HASH') {
foreach my $page (keys(%{$titles})) {
- if (&LONCAPA::loncgi::can_view($page)) {
+ if (&LONCAPA::lonauthcgi::can_view($page)) {
$candisplay{$page} = 'F';
- } elsif (&LONCAPA::loncgi::check_ipbased_access($page)) {
+ } elsif (&LONCAPA::lonauthcgi::check_ipbased_access($page)) {
$candisplay{$page} = 'F';
}
}
@@ -74,15 +74,19 @@ sub handler {
text=>"Server Status Information"});
$r->print(&Apache::loncommon::start_page('Server Status').
- &Apache::lonhtmlcommon::breadcrumbs('Server Status Information').
- '
');
+ &Apache::lonhtmlcommon::breadcrumbs('Server Status Information'));
if (keys(%candisplay) > 0) {
$r->print(''.&mt('Server Utilities for Domain: [_1]',''.$domdesc.'').
'
'.&print_status_menu(\%candisplay));
} else {
- $r->print(''.&mt('No information available').'
'.
- ''.&mt('Your current role and/or IP address does not have permission to display information about server status for servers in the domain: [_1].',''.$domdesc.' ('.$dom.')').'');
+ $r->print(
+ ''.&mt('No information available').'
'
+ .''
+ .&mt('Your current role and/or IP address does not have permission to display information about server status for servers in the domain: [_1].',
+ ''.$domdesc.' ('.$dom.')')
+ .'
'
+ );
}
$r->print(&Apache::loncommon::end_page());
return OK;
@@ -91,44 +95,13 @@ sub handler {
sub print_status_menu {
my ($candisplay) = @_;
return '' if (ref($candisplay) ne 'HASH');
- my $menu_html;
- my @menu = &servermenu_items($candisplay);
- foreach my $item (@menu) {
- if (ref($item) eq 'HASH') {
- my $display;
- if (ref($item->{'items'}) eq 'ARRAY') {
- foreach my $page (@{$item->{'items'}}) {
- if (ref($page) eq 'HASH') {
- if ($page->{'permission'} eq 'F') {
- $display .= '
';
- }
- }
- }
- }
- if ($display) {
- $menu_html .= ''.
- '
'.&mt($item->{'categorytitle'}).'
'.
- $display.'';
- }
- }
- }
- if ($menu_html) {
- $menu_html .= '';
- }
- return $menu_html;
+ return &Apache::lonhtmlcommon::generate_menu(
+ &servermenu_items($candisplay));
}
sub servermenu_items {
my ($candisplay) = @_;
- my $titles = &LONCAPA::loncgi::serverstatus_titles();
+ my $titles = &LONCAPA::lonauthcgi::serverstatus_titles();
my $linknames = &serverstatus_links();
my @menu;
if ((ref($candisplay) eq 'HASH') && (ref($titles) eq 'HASH') &&
@@ -137,7 +110,8 @@ sub servermenu_items {
items =>
[{
linktext => $linknames->{'userstatus'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Userstatus',
url => '/cgi-bin/userstatus.pl',
permission => $candisplay->{'userstatus'},
@@ -145,7 +119,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'lonstatus'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Connection_Status',
url => '/lon-status/',
permission => $candisplay->{'lonstatus'},
@@ -153,7 +128,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'server-status'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Apache_Status',
url => '/server-status',
permission => $candisplay->{'server-status'},
@@ -161,7 +137,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'clusterstatus'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Apache_Status',
url => '/cgi-bin/clusterstatus.pl',
permission => $candisplay->{'clusterstatus'},
@@ -169,7 +146,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'codeversions'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Code_Versions',
url => '/cgi-bin/lonversions.pl',
permission => $candisplay->{'codeversions'},
@@ -177,7 +155,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'showenv'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_User_Environment',
url => '/adm/test',
permission => $candisplay->{'showenv'},
@@ -187,7 +166,8 @@ sub servermenu_items {
items =>
[{
linktext => $linknames->{'loncron'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Connection_Reload',
url => '/cgi-bin/loncron.pl',
permission => $candisplay->{'loncron'},
@@ -195,7 +175,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'takeoffline'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Server_Offline',
url => '/cgi-bin/takeoffline.pl',
permission => $candisplay->{'takeoffline'},
@@ -203,7 +184,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'takeonline'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Server_Online',
url => '/cgi-bin/takeonline.pl',
permission => $candisplay->{'takeonline'},
@@ -213,7 +195,8 @@ sub servermenu_items {
items =>
[{
linktext => $linknames->{'metadata_keywords'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Metadata_Keywords',
url => '/cgi-bin/metadata_keywords.pl',
permission => $candisplay->{'metadata_keywords'},
@@ -221,7 +204,8 @@ sub servermenu_items {
},
{
linktext => $linknames->{'metadata_harvest'},
- #icon => '',
+ icon => '',
+ alttext => '',
#help => 'Domain_Coordination_Metadata_Harvest',
url => '/cgi-bin/metadata_harvest.pl',
permission => $candisplay->{'metadata_harvest'},