[LON-CAPA-cvs] cvs: doc /loncapafiles loncapafiles.lpml loncom loncapa_apache.conf loncom/auth lonstatusacc.pm loncom/html/res/adm/pages srvr.png loncom/interface domainstatus.pm mydesk.tab
raeburn
raeburn@source.lon-capa.org
Mon, 22 Dec 2008 21:13:36 -0000
This is a MIME encoded message
--raeburn1229980416
Content-Type: text/plain
raeburn Mon Dec 22 21:13:36 2008 EDT
Added files:
/loncom/interface domainstatus.pm
/loncom/html/res/adm/pages srvr.png
Modified files:
/loncom loncapa_apache.conf
/loncom/auth lonstatusacc.pm
/loncom/interface mydesk.tab
/doc/loncapafiles loncapafiles.lpml
Log:
- Add a page with a list of links to available server status utilities, accessible from Main Menu for Domain Coordinators.
- lonstatusacc.pm modified to perform AccessHandler duties for this new page.
- appropriate HTTP responses returned if access to /adm/domainstatus or /adm/test is unavailable for current user/IP address.
- Include missing identifier numbers for "Modify" and "Course" in mydesk.tab.
--raeburn1229980416
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20081222211336.txt"
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.181 loncom/loncapa_apache.conf:1.182
--- loncom/loncapa_apache.conf:1.181 Fri Nov 28 19:38:05 2008
+++ loncom/loncapa_apache.conf Mon Dec 22 21:13:14 2008
@@ -1,7 +1,7 @@
##
## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
##
-## $Id: loncapa_apache.conf,v 1.181 2008/11/28 19:38:05 raeburn Exp $
+## $Id: loncapa_apache.conf,v 1.182 2008/12/22 21:13:14 raeburn Exp $
##
#
@@ -746,6 +746,15 @@
ErrorDocument 500 /adm/errorhandler
</Location>
+<Location /adm/domainstatus>
+PerlAccessHandler Apache::lonstatusacc
+SetHandler perl-script
+PerlHandler Apache::domainstatus
+ErrorDocument 403 /adm/login
+ErrorDocument 406 /adm/roles
+ErrorDocument 500 /adm/errorhandler
+</Location>
+
<Location /adm/createuser>
AuthType LONCAPA
Require valid-user
Index: loncom/auth/lonstatusacc.pm
diff -u loncom/auth/lonstatusacc.pm:1.2 loncom/auth/lonstatusacc.pm:1.3
--- loncom/auth/lonstatusacc.pm:1.2 Sun Nov 30 14:47:11 2008
+++ loncom/auth/lonstatusacc.pm Mon Dec 22 21:13:19 2008
@@ -1,7 +1,7 @@
#
# LON-CAPA authorization for pages generated by server-status reports
#
-# $Id: lonstatusacc.pm,v 1.2 2008/11/30 14:47:11 raeburn Exp $
+# $Id: lonstatusacc.pm,v 1.3 2008/12/22 21:13:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,7 +31,7 @@
package Apache::lonstatusacc;
use strict;
-use Apache::Constants qw(:common :remotehost);
+use Apache::Constants qw(:common :http :remotehost);
use Apache::lonnet;
use LONCAPA::loncgi;
@@ -39,14 +39,25 @@
my $r = shift;
my $reqhost = $r->get_remote_host(REMOTE_NOLOOKUP);
my $page = 'serverstatus';
- if ($r->uri eq '/adm/test') {
- $page = 'showenv';
+ if (($r->uri eq '/adm/domainstatus') ||
+ ($r->uri eq '/adm/test')) {
if (&LONCAPA::loncgi::check_cookie_and_load_env($r)) {
- if (&LONCAPA::loncgi::can_view($page)) {
- return OK;
- } elsif (&LONCAPA::loncgi::check_ipbased_access($page,$reqhost)) {
+ if ($r->uri eq '/adm/domainstatus') {
return OK;
+ } elsif ($r->uri eq '/adm/test') {
+ $page = 'showenv';
+ if (&LONCAPA::loncgi::can_view($page)) {
+ return OK;
+ } elsif (&LONCAPA::loncgi::check_ipbased_access($page,$reqhost)) {
+ return OK;
+ } else {
+ $Apache::lonnet::env{'user.error.msg'} =
+ $r->uri.":bre:1:1:Access Denied";
+ return HTTP_NOT_ACCEPTABLE;
+ }
}
+ } else {
+ return FORBIDDEN;
}
} elsif ($r->uri ne '/server-status') {
$page = 'lonstatus';
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.95 loncom/interface/mydesk.tab:1.96
--- loncom/interface/mydesk.tab:1.95 Mon Dec 8 23:07:03 2008
+++ loncom/interface/mydesk.tab Mon Dec 22 21:13:25 2008
@@ -80,8 +80,9 @@
6:2:author:rau:res.gif:resource[_1]:space[_1]:go('/res/$udom/$uname/?launch=1');:Browse published resources:cnt
6:2:author:rca:res.gif:co res[_1]:space[_2]:go('/res/$udom/$uname/?launch=1');:Browse published resources:cnt
6:3:clear
-6:3:pccc:$requested_domain:mcrs.gif:modify:course:go('/adm/modifycourse');:View or modify a course:cmn
+6:3:pccc:$requested_domain:mcrs.gif:modify[_1]:course[_15]:go('/adm/modifycourse');:View or modify a course:cmn
7:1:clear
+7:1:pmau:$requested_domain:srvr.gif:server[_1]:status[_1]:go('/adm/domainstatus');:Status of domain servers:dom
7:1:pwhn:$crs:new.gif:what is[_1]:new[_1]:go('/adm/whatsnew');:What's new?:cmn
7:2:clear
7:2:adv:rcm:egrd.gif:enter[_1]:grades[_3]:go('/adm/grades');:Enter grades from check-out assessment resources:oth
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.622 doc/loncapafiles/loncapafiles.lpml:1.623
--- doc/loncapafiles/loncapafiles.lpml:1.622 Sun Dec 21 16:12:19 2008
+++ doc/loncapafiles/loncapafiles.lpml Mon Dec 22 21:13:36 2008
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.622 2008/12/21 16:12:19 riegler Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.623 2008/12/22 21:13:36 raeburn Exp $ -->
<!--
@@ -6453,6 +6453,7 @@
prt.png;
sbkm.png;
src.png;
+srvr.png;
subm.png;
back.png;
catalog.png;
@@ -6989,6 +6990,15 @@
</description>
</file>
<file>
+ <source>loncom/interface/domainstatus.pm</source>
+ <target dist='default'>home/httpd/lib/perl/Apache/domainstatus.pm</target>
+ <categoryname>handler</categoryname>
+ <description>
+ Handler for generation of a menu of links to server status utilities
+ </description>
+</file>
+
+<file>
<source>loncom/interface/lonpopulate.pm</source>
<target dist='default'>home/httpd/lib/perl/Apache/lonpopulate.pm</target>
<categoryname>handler</categoryname>
Index: loncom/interface/domainstatus.pm
+++ loncom/interface/domainstatus.pm
# The LearningOnline Network
# 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 $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
#
package Apache::domainstatus;
use strict;
use Apache::Constants qw(:common);
use Apache::lonnet;
use Apache::loncommon;
use Apache::lonhtmlcommon;
use Apache::lonlocal;
use LONCAPA::loncgi;
sub handler {
my $r = shift;
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
if ($r->header_only) {
return OK;
}
&Apache::lonlocal::get_language_handle();
my $dom = &Apache::lonnet::default_login_domain();
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) {
$dom = $env{'user.domain'};
if ($env{'request.role.domain'} ne '') {
$dom = $env{'request.role.domain'};
}
}
my $domdesc = &Apache::lonnet::domain($dom,'description');
my %candisplay;
my $titles = &LONCAPA::loncgi::serverstatus_titles();
if (ref($titles) eq 'HASH') {
foreach my $page (keys(%{$titles})) {
if (&LONCAPA::loncgi::can_view($page)) {
$candisplay{$page} = 'F';
} elsif (&LONCAPA::loncgi::check_ipbased_access($page)) {
$candisplay{$page} = 'F';
}
}
}
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/domainstatus",
text=>"Server Status Information"});
$r->print(&Apache::loncommon::start_page('Server Status').
&Apache::lonhtmlcommon::breadcrumbs('Server Status Information').
'<div class="LC_clear_float_header"></div>');
if (keys(%candisplay) > 0) {
$r->print('<h2>'.&mt('Server Utilities for Domain: [_1]','<i>'.$domdesc.'</i>').
'</h2>'.&print_status_menu(\%candisplay));
} else {
$r->print('<h2>'.&mt('No information available').'</h2>'.
'<span class="LC_error">'.&mt('Your current role and/or IP address does not have permission to display information about server status for servers in the domain: [_1].','<b>'.$domdesc.'</b> ('.$dom.')').'</span>');
}
$r->print(&Apache::loncommon::end_page());
return OK;
}
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 .= '<span class="LC_parm_menu_item">';
if ($page->{'help'} ne '') {
$display .=
&Apache::loncommon::help_open_topic($page->{'help'});
}
$display .= '<a href="'.$page->{'url'}.'" title="'.
&mt($page->{'linktitle'}).'">'.
&mt($page->{'linktext'}).
'</a></span><br /><br />';
}
}
}
}
if ($display) {
$menu_html .= '<div class="LC_left_float">'.
'<h3>'.&mt($item->{'categorytitle'}).'</h3>'.
$display.'</div>';
}
}
}
if ($menu_html) {
$menu_html .= '<div class="LC_clear_float_footer"></div>';
}
return $menu_html;
}
sub servermenu_items {
my ($candisplay) = @_;
my $titles = &LONCAPA::loncgi::serverstatus_titles();
my $linknames = &serverstatus_links();
my @menu;
if ((ref($candisplay) eq 'HASH') && (ref($titles) eq 'HASH') &&
(ref($linknames) eq 'HASH')) {
@menu = ( {categorytitle => 'Status information',
items =>
[{
linktext => $linknames->{'userstatus'},
#icon => '',
#help => 'Domain_Coordination_Userstatus',
url => '/cgi-bin/userstatus.pl',
permission => $candisplay->{'userstatus'},
linktitle => $titles->{'userstatus'},
},
{
linktext => $linknames->{'lonstatus'},
#icon => '',
#help => 'Domain_Coordination_Connection_Status',
url => '/lon-status/',
permission => $candisplay->{'lonstatus'},
linktitle => $titles->{'lonstatus'},
},
{
linktext => $linknames->{'server-status'},
#icon => '',
#help => 'Domain_Coordination_Apache_Status',
url => '/server-status',
permission => $candisplay->{'server-status'},
linktitle => $titles->{'server-status'},
},
{
linktext => $linknames->{'clusterstatus'},
#icon => '',
#help => 'Domain_Coordination_Apache_Status',
url => '/cgi-bin/clusterstatus.pl',
permission => $candisplay->{'clusterstatus'},
linktitle => $titles->{'clusterstatus'},
},
{
linktext => $linknames->{'codeversions'},
#icon => '',
#help => 'Domain_Coordination_Code_Versions',
url => '/cgi-bin/lonversions.pl',
permission => $candisplay->{'codeversions'},
linktitle => $titles->{'codeversions'},
},
{
linktext => $linknames->{'showenv'},
#icon => '',
#help => 'Domain_Coordination_User_Environment',
url => '/adm/test',
permission => $candisplay->{'showenv'},
linktitle => $titles->{'showenv'},
}]},
{categorytitle => 'Server Actions',
items =>
[{
linktext => $linknames->{'loncron'},
#icon => '',
#help => 'Domain_Coordination_Connection_Reload',
url => '/cgi-bin/loncron.pl',
permission => $candisplay->{'loncron'},
linktitle => $titles->{'loncron'},
},
{
linktext => $linknames->{'takeoffline'},
#icon => '',
#help => 'Domain_Coordination_Server_Offline',
url => '/cgi-bin/takeoffline.pl',
permission => $candisplay->{'takeoffline'},
linktitle => $titles->{'takeoffline'},
},
{
linktext => $linknames->{'takeonline'},
#icon => '',
#help => 'Domain_Coordination_Server_Online',
url => '/cgi-bin/takeonline.pl',
permission => $candisplay->{'takeonline'},
linktitle => $titles->{'takeonline'},
}]},
{categorytitle => 'Metadata Information',
items =>
[{
linktext => $linknames->{'metadata_keywords'},
#icon => '',
#help => 'Domain_Coordination_Metadata_Keywords',
url => '/cgi-bin/metadata_keywords.pl',
permission => $candisplay->{'metadata_keywords'},
linktitle => $titles->{'metadata_keywords'},
},
{
linktext => $linknames->{'metadata_harvest'},
#icon => '',
#help => 'Domain_Coordination_Metadata_Harvest',
url => '/cgi-bin/metadata_harvest.pl',
permission => $candisplay->{'metadata_harvest'},
linktitle => $titles->{'metadata_harvest'},
}]},
);
}
return @menu;
}
sub serverstatus_links {
my $linkname = {
'userstatus' => 'User Sessions',
'lonstatus' => 'Connection Status',
'server-status' => 'Apache Server Status',
'clusterstatus' => 'Domain Status',
'codeversions' => 'LON-CAPA Modules',
'showenv' => 'User Environment for current log-in',
'loncron' => 'Update Connections and Refresh Status Information',
'takeoffline' => 'Replace log-in page with offline notice',
'takeonline' => 'Replace offline notice with log-in page',
'metadata_keywords' => 'Display Metadata Keywords',
'metadata_harvest' => 'Harvest Metadata Keywords',
};
return $linkname;
}
1;
--raeburn1229980416--