");
+ if ($priv ne '') {
+ $r->print("Access : ".&Apache::lonnet::plaintext($priv)."\n");
+ }
+ if ($fn ne '') {
+ $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
+ }
+ if ($msg ne '') {
+ $r->print("Action : $msg\n");
+ }
+ $r->print("
");
my $url=$fn;
my $last;
if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
@@ -430,19 +438,11 @@ ENDHEADER
}
# -------------------------------------------------------- Choice or no choice?
if ($nochoose) {
- $r->print("
".&mt('Sorry ...')."
\n".
- &mt('This action is currently not authorized.').
+ $r->print("
".&mt('Sorry ...')."
\n".
+ &mt('This action is currently not authorized.').''.
&Apache::loncommon::end_page());
return OK;
} else {
- if ($advanced) {
- $r->print(&mt("Your home server is ").
- $Apache::lonnet::hostname{&Apache::lonnet::homeserver
- ($env{'user.name'},$env{'user.domain'})}.
- " \n");
- $r->print(&mt(
- "Author and Co-Author roles are not available on servers other than their respective home servers."));
- }
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
}
@@ -453,9 +453,9 @@ ENDHEADER
}
if ($env{'user.adv'}) {
$r->print(
- ' ');
}
my (%roletext,%sortrole,%roleclass);
@@ -538,7 +538,7 @@ ENDHEADER
$switchserver='otherserver='.$home.'&role='.$trolecode;
}
#next if ($home eq 'no_host');
- $home = $Apache::lonnet::hostname{$home};
+ $home = &Apache::lonnet::hostname($home);
$ttype='Construction Space';
$twhere=&mt('User').': '.$trest.' '.&mt('Domain').
': '.$tdom.' '.
@@ -558,7 +558,7 @@ ENDHEADER
$switchserver='otherserver='.$home.'&role='.$trolecode;
}
#next if ($home eq 'no_host');
- $home = $Apache::lonnet::hostname{$home};
+ $home = &Apache::lonnet::hostname($home);
$ttype='Construction Space';
$twhere=&mt('Domain').': '.$tdom.' '.&mt('Server').
': '.$home;
@@ -596,7 +596,7 @@ ENDHEADER
}
}
if ($tsection) {
- $twhere.=' '.&mt('Section/Group').': '.$tsection;
+ $twhere.=' '.&mt('Section').': '.$tsection;
}
if ($role ne 'st') { $twhere.=" ".&mt('Domain').":".$tdom; }
} elsif ($tdom) {
@@ -638,14 +638,14 @@ ENDHEADER
# More than one possible role
# ----------------------------------------------------------------------- Table
unless (($advanced) || ($nochoose)) {
- $r->print("
".&mt('Select a Course/Group to Enter')."
\n");
+ $r->print("
".&mt('Select a Course to Enter')."
\n");
}
- $r->print('
');
+ $r->print('
');
unless ($nochoose) { $r->print('
'); }
$r->print('
'.&mt('User Role').'
'.&mt('Extent').
'
'.&mt('Start').'
'.&mt('End').'
'."\n");
my $doheaders=-1;
- foreach my $type ('Domain','Construction Space','Course','Group','Unavailable','System') {
+ foreach my $type ('Domain','Construction Space','Course','Unavailable','System') {
my $haverole=0;
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
@@ -662,7 +662,8 @@ ENDHEADER
foreach (sort(keys(%recent_roles))) {
if (defined($roletext{'user.role.'.$_})) {
$output.=$roletext{'user.role.'.$_};
- if ($_ =~ m-dc\./(\w+)/- && $dcroles{$1}) {
+ if ($_ =~ m-dc\./($match_domain)/-
+ && $dcroles{$1}) {
$output .= &allcourses_row($1,'recent');
}
} elsif ($numdc > 0) {
@@ -684,12 +685,12 @@ ENDHEADER
$r->print(&coursepick_jscript());
$r->print(&Apache::loncommon::coursebrowser_javascript());
}
- foreach my $type ('Construction Space','Domain','Course','Group','Unavailable','System') {
+ foreach my $type ('Construction Space','Domain','Course','Unavailable','System') {
my $output;
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
$output.=$roletext{$sortrole{$which}};
- if ($sortrole{$which} =~ m-dc\./(\w+)/-) {
+ if ($sortrole{$which} =~ m-dc\./($match_domain)/-) {
if ($dcroles{$1}) {
$output .= &allcourses_row($1,'');
}
@@ -721,8 +722,8 @@ ENDHEADER
$r->print('
');
}
}
- $r->print('
'.&mt('No role specified').
- '
'.$tremark.
+ $r->print('
'.&mt('No role specified').
+ '
'.$tremark.
'
'."\n");
$r->print('
');
@@ -732,57 +733,7 @@ ENDHEADER
# ------------------------------------------------------------ Privileges Info
if (($advanced) && (($env{'user.error.msg'}) || ($error))) {
$r->print('
');
- foreach (sort split(/:/,$env{$envkey})) {
- if ($_) {
- my ($prv,$restr)=split(/\&/,$_);
- my $trestr='';
- if ($restr ne 'F') {
- my $i;
- $trestr.=' (';
- for ($i=0;$iprint('
'.
- Apache::lonnet::plaintext($prv).$trestr.
- '
');
- }
- }
- $r->print('
');
- }
- }
+ $r->print(&privileges_info());
}
$r->print(&Apache::lonnet::getannounce());
if ($advanced) {
@@ -794,6 +745,61 @@ ENDHEADER
return OK;
}
+sub privileges_info {
+ my ($which) = @_;
+ my $output;
+
+ $which ||= $env{'request.role'};
+
+ foreach my $envkey (sort(keys(%env))) {
+ next if ($envkey!~/^user\.priv\.\Q$which\E\.(.*)/);
+
+ my $where=$1;
+ my $ttype;
+ my $twhere;
+ my (undef,$tdom,$trest,$tsec)=split(m{/},$where);
+ if ($trest) {
+ if ($env{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') {
+ $ttype='Construction Space';
+ $twhere='User: '.$trest.', Domain: '.$tdom;
+ } else {
+ $ttype= &Apache::loncommon::course_type($tdom.'_'.$trest);
+ $twhere=$env{'course.'.$tdom.'_'.$trest.'.description'};
+ if ($tsec) {
+ my $sec_type = 'Section';
+ if (exists($env{"user.role.gr.$where"})) {
+ $sec_type = 'Group';
+ }
+ $twhere.=' ('.$sec_type.': '.$tsec.')';
+ }
+ }
+ } elsif ($tdom) {
+ $ttype='Domain';
+ $twhere=$tdom;
+ } else {
+ $ttype='System';
+ $twhere='/';
+ }
+ $output .= "\n
".$ttype.': '.$twhere.'
'."\n
";
+ foreach my $priv (sort(split(/:/,$env{$envkey}))) {
+ next if (!$priv);
+
+ my ($prv,$restr)=split(/\&/,$priv);
+ my $trestr='';
+ if ($restr ne 'F') {
+ $trestr.=' ('.
+ join(', ',
+ map { &Apache::lonnet::plaintext($_) }
+ (split('',$restr))).') ';
+ }
+ $output .= "\n\t".
+ '
'.&Apache::lonnet::plaintext($prv).$trestr.'
';
+ }
+ $output .= "\n".'
';
+ }
+ return $output;
+}
+
sub role_status {
my ($rolekey,$then,$now,$role,$where,$trolecode,$tstatus,$tstart,$tend) = @_;
my @pwhere = ();
@@ -821,7 +827,7 @@ sub role_status {
sub build_roletext {
my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_;
- my $roletext='
';
+ my $roletext='
';
my $is_dc=($trolecode =~ m/^dc\./);
my $rowspan=($is_dc) ? ''
: ' rowspan="2" ';
@@ -831,8 +837,8 @@ sub build_roletext {
$buttonname=~s/\W//g;
if (!$button) {
if ($switchserver) {
- $roletext.='