--- loncom/auth/lonroles.pm 2014/04/05 12:25:19 1.269.2.17
+++ loncom/auth/lonroles.pm 2014/06/09 21:48:13 1.269.2.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.269.2.17 2014/04/05 12:25:19 raeburn Exp $
+# $Id: lonroles.pm,v 1.269.2.21 2014/06/09 21:48:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -128,7 +128,7 @@ package Apache::lonroles;
use strict;
use Apache::lonnet;
use Apache::lonuserstate();
-use Apache::Constants qw(:common);
+use Apache::Constants qw(:common REDIRECT);
use Apache::File();
use Apache::lonmenu;
use Apache::loncommon;
@@ -208,6 +208,14 @@ sub handler {
my $r = shift;
+ # Check for critical messages and redirect if present.
+ my ($redirect,$url) = &Apache::loncommon::critical_redirect(300);
+ if ($redirect) {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->header_out(Location => $url);
+ return REDIRECT;
+ }
+
my $now=time;
my $then=$env{'user.login.time'};
my $refresh=$env{'user.refresh.time'};
@@ -253,7 +261,7 @@ sub handler {
my $envkey;
my %dcroles = ();
my $numdc = &check_fordc(\%dcroles,$update,$then);
- my $loncaparev = $Apache::lonnet::perlvar{'lonVersion'};
+ my $loncaparev = $r->dir_config('lonVersion');
# ================================================================== Roles Init
if ($env{'form.selectrole'}) {
@@ -598,7 +606,7 @@ ENDENTERKEY
# Check to see if the user is a CC entering a course
# for the first time
if ((($role eq 'cc') || ($role eq 'co'))
- && ($env{'course.' .$cdom.'_'.$cnum.'.course.helper.not.run'})) {
+ && ($env{'course.'.$cdom.'_'.$cnum.'.course.helper.not.run'})) {
$furl = "/adm/helper/course.initialization.helper";
# Send the user to the course they selected
} elsif ($env{'request.course.id'}) {
@@ -650,7 +658,7 @@ ENDENTERKEY
}
}
&redirect_user($r, &mt('Entering [_1]',
- $env{'course.'.$env{'request.course.id'}.'.description'}),
+ $env{'course.'.$cdom.'_'.$cnum.'.description'}),
$dest, $msg);
return OK;
}
@@ -752,7 +760,12 @@ ENDENTERKEY
my $swinfo=&Apache::lonmenu::rawconfig();
my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum});
- my $funcs = &get_roles_functions($showcount);
+ my %domdefs=&Apache::lonnet::get_domain_defaults($env{'user.domain'});
+ my $cattype = 'std';
+ if ($domdefs{'catauth'}) {
+ $cattype = $domdefs{'catauth'};
+ }
+ my $funcs = &get_roles_functions($showcount,$cattype);
$standby=~s/\n/\\n/g;
my $noscript='
'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'
'.&mt('As this is not the case, most functionality in the system will be unavailable.').'
';
@@ -895,7 +908,7 @@ ENDHEADER
\%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev);
$refresh = $now;
&Apache::lonnet::appenv({'user.refresh.time' => $refresh});
- unless ($env{'user.adv'}) {
+ if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'})) {
if ($countactive > 0) {
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
@@ -907,7 +920,7 @@ ENDHEADER
,''
,''
,''
- ,'"'. $domdesc.'"')
+ ,'"'.$domdesc.'"')
.'
'
.&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,'
.' you may be able to enroll if self-enrollment is permitted.'
@@ -919,13 +932,7 @@ ENDHEADER
# No active roles
if ($countactive==0) {
- if ($inrole) {
- $r->print('
'
.&mt('This LON-CAPA server is version [_1]',$r->dir_config('lonVersion'))
- .'
'
- .''.&mt('Logout').' '
- .''
- .&mt('Course/Community Catalog')
- .'
'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','','',$domdesc).'
');
- $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'
'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','','',$domdesc).'
');
+ $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'
'.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'
'. + &mt('You have rights to request the creation of courses and/or communities in the following domain(s):'). + '
'.&mt('Author role request').'
';
if ($status eq 'approval') {
- $output .= &mt('A request for authoring space submitted on [_1] is awaiting approval',
+ $output .= &mt('A request for Authoring Space submitted on [_1] is awaiting approval',
&Apache::lonlocal::locallocaltime($timestamp));
} elsif ($status eq 'approved') {
my %roleshash =