--- loncom/auth/lonroles.pm 2010/08/17 21:35:40 1.256.2.2
+++ loncom/auth/lonroles.pm 2011/09/27 20:33:34 1.256.2.6
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.256.2.2 2010/08/17 21:35:40 raeburn Exp $
+# $Id: lonroles.pm,v 1.256.2.6 2011/09/27 20:33:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -142,7 +142,7 @@ use Apache::loncoursequeueadmin;
use GDBM_File;
use LONCAPA qw(:DEFAULT :match);
use HTML::Entities;
-
+
sub redirect_user {
my ($r,$title,$url,$msg,$launch_nav) = @_;
@@ -579,7 +579,9 @@ ENDENTERKEY
}
}
# Are we allowed to look at the first resource?
- if ($furl !~ m|^/adm/|) {
+ if (($furl !~ m|^/adm/|) ||
+ (($env{'environment.remotenavmap'} eq 'on') &&
+ ($furl =~ m{^/adm/navmaps}))) {
# Guess not ...
$furl=&Apache::lonpageflip::first_accessible_resource();
}
@@ -748,6 +750,7 @@ ENDHEADER
$r->print('');
$r->print('');
}
+ $r->rflush();
my (%roletext,%sortrole,%roleclass,%futureroles,%timezones);
my ($countactive,$countfuture,$inrole,$possiblerole) =
@@ -863,12 +866,16 @@ ENDHEADER
} elsif ($numdc > 0) {
unless ($role =~/^error\:/) {
my ($roletext,$role_text_end) = &display_cc_role('user.role.'.$role);
- $output.= &Apache::loncommon::start_data_table_row().
- $roletext.
- &Apache::loncommon::end_data_table_row().
- &Apache::loncommon::continue_data_table_row().
- $role_text_end.
- &Apache::loncommon::end_data_table_row();
+ if ($roletext) {
+ $output.= &Apache::loncommon::start_data_table_row().
+ $roletext.
+ &Apache::loncommon::end_data_table_row();
+ if ($role_text_end) {
+ $output .= &Apache::loncommon::continue_data_table_row().
+ $role_text_end.
+ &Apache::loncommon::end_data_table_row();
+ }
+ }
}
}
}
@@ -949,16 +956,9 @@ sub gather_roles {
&Apache::lonnet::role_status($envkey,$then,$refresh,$now,\$role,\$where,
\$trolecode,\$tstatus,\$tstart,\$tend);
next if (!defined($role) || $role eq '' || $role =~ /^gr/);
- my $timezone = &role_timezone($where,$timezones);
$tremark='';
$tpstart=' ';
$tpend=' ';
- if ($tstart) {
- $tpstart=&Apache::lonlocal::locallocaltime($tstart,$timezone);
- }
- if ($tend) {
- $tpend=&Apache::lonlocal::locallocaltime($tend,$timezone);
- }
if ($env{'request.role'} eq $trolecode) {
$tstatus='selected';
}
@@ -967,6 +967,13 @@ sub gather_roles {
|| ($tstatus eq 'selected')
|| ($tstatus eq 'future')
|| ($env{'form.showall'})) {
+ my $timezone = &role_timezone($where,$timezones);
+ if ($tstart) {
+ $tpstart=&Apache::lonlocal::locallocaltime($tstart,$timezone);
+ }
+ if ($tend) {
+ $tpend=&Apache::lonlocal::locallocaltime($tend,$timezone);
+ }
if ($tstatus eq 'is') {
$tbg='LC_roles_is';
$possiblerole=$trolecode;
@@ -1050,10 +1057,12 @@ sub gather_roles {
'';
unless ($home && grep(/^\Q$home\E$/,@ids) && $loncaparev eq '') {
my $required = $env{'course.'.$tcourseid.'.internal.releaserequired'};
- ($switchserver,$switchwarning) =
- &check_release_required($loncaparev,$tcourseid,$trolecode,$required);
- if ($switchserver || $switchwarning) {
- $button = 0;
+ if ($required ne '') {
+ ($switchserver,$switchwarning) =
+ &check_release_required($loncaparev,$tcourseid,$trolecode,$required);
+ if ($switchserver || $switchwarning) {
+ $button = 0;
+ }
}
}
}
@@ -1071,10 +1080,12 @@ sub gather_roles {
my $home = $newhash{'home'};
unless ($home && grep(/^\Q$home\E$/,@ids) && $loncaparev eq '') {
my $required = $newhash{'internal.releaserequired'};
- ($switchserver,$switchwarning) =
- &check_release_required($loncaparev,$tcourseid,$trolecode,$required);
- if ($switchserver || $switchwarning) {
- $button = 0;
+ if ($required ne '') {
+ ($switchserver,$switchwarning) =
+ &check_release_required($loncaparev,$tcourseid,$trolecode,$required);
+ if ($switchserver || $switchwarning) {
+ $button = 0;
+ }
}
}
} else {
@@ -1120,9 +1131,15 @@ sub role_timezone {
my $cnum = $2;
if ($cdom && $cnum) {
if (!exists($timezones->{$cdom.'_'.$cnum})) {
- my %timehash =
- &Apache::lonnet::get('environment',['timezone'],$cdom,$cnum);
- if ($timehash{'timezone'} eq '') {
+ my $tz;
+ if ($env{'course.'.$cdom.'_'.$cnum.'.description'}) {
+ $tz = $env{'course.'.$cdom.'_'.$cnum.'.timezone'};
+ } else {
+ my %timehash =
+ &Apache::lonnet::get('environment',['timezone'],$cdom,$cnum);
+ $tz = $timehash{'timezone'};
+ }
+ if ($tz eq '') {
if (!exists($timezones->{$cdom})) {
my %domdefaults =
&Apache::lonnet::get_domain_defaults($cdom);
@@ -1135,7 +1152,7 @@ sub role_timezone {
$timezones->{$cdom.'_'.$cnum} = $timezones->{$cdom};
} else {
$timezones->{$cdom.'_'.$cnum} =
- &Apache::lonlocal::gettimezone($timehash{'timezone'});
+ &Apache::lonlocal::gettimezone($tz);
}
}
$timezone = $timezones->{$cdom.'_'.$cnum};
@@ -1746,7 +1763,7 @@ sub display_cc_role {
my %newhash=&Apache::lonnet::coursedescription($tcourseid);
if (%newhash) {
$twhere=$newhash{'description'}.
- ' '.
+ ' '.
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom).
'';
$ttype = $newhash{'type'};
@@ -1755,7 +1772,7 @@ sub display_cc_role {
$env{'course.'.$tcourseid.'.description'}=$twhere;
}
my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid);
- $twhere.="
".&mt('Domain').":".$1;
+ $twhere.="
".&mt('Domain').":".$tdom;
($roletext,$roletext_end) = &build_roletext($trolecode,$tdom,$trest,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'');
}
}