[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm
raeburn
raeburn at source.lon-capa.org
Tue May 21 19:13:41 EDT 2013
raeburn Tue May 21 23:13:41 2013 EDT
Modified files:
/loncom/auth lonroles.pm
Log:
- Changes for which role, group or privilege information is unavailable
excluded from display generated by "Check for changes" item.
- Eliminates o -- items in "Expired roles" where roles are ad hoc
course or community roles previously selected by a Coordinator.
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.285 loncom/auth/lonroles.pm:1.286
--- loncom/auth/lonroles.pm:1.285 Fri May 10 15:02:45 2013
+++ loncom/auth/lonroles.pm Tue May 21 23:13:40 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.285 2013/05/10 15:02:45 raeburn Exp $
+# $Id: lonroles.pm,v 1.286 2013/05/21 23:13:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2440,9 +2440,11 @@
&unescape($groupinfo{'description'});
}
$groupdesc = $groupdescs{$cdom.'_'.$cnum}{$group};
- $groupmsg .= '<li>'.
- &mt('[_1] with status: [_2].',
- '<b>'.$groupdesc.'</b>',$newgroup{$item}).'</li>';
+ if ($groupdesc) {
+ $groupmsg .= '<li>'.
+ &mt('[_1] with status: [_2].',
+ '<b>'.$groupdesc.'</b>',$newgroup{$item}).'</li>';
+ }
}
}
if ($groupmsg) {
@@ -2456,47 +2458,67 @@
}
}
if (keys(%newrole) > 0) {
- $changemsg .= '<li>'.&mt('New roles').
- '<ul>';
+ my $newmsg;
foreach my $item (sort(keys(%newrole))) {
my $desc = &role_desc($item,$update,$refresh,$now);
- $changemsg .= '<li>'.
- &mt('[_1] with status: [_2].',
- $desc,$newrole{$item}).'</li>';
+ if ($desc) {
+ $newmsg .= '<li>'.
+ &mt('[_1] with status: [_2].',
+ $desc,$newrole{$item}).'</li>';
+ }
+ }
+ if ($newmsg) {
+ $changemsg .= '<li>'.&mt('New roles').
+ '<ul>'.$newmsg.'</ul>'.
+ '</li>';
}
- $changemsg .= '</ul></li>';
}
if (keys(%customprivchg) > 0) {
- $changemsg .= '<li>'.
- &mt('Custom roles with privilege changes').
- '<ul>';
+ my $privmsg;
foreach my $item (sort(keys(%customprivchg))) {
my $desc = &role_desc($item,$update,$refresh,$now);
- $changemsg .= '<li>'.$desc.'</li>';
+ if ($desc) {
+ $privmsg .= '<li>'.$desc.'</li>';
+ }
}
- $changemsg .= '</ul></li>';
+ if ($privmsg) {
+ $changemsg .= '<li>'.
+ &mt('Custom roles with privilege changes').
+ '<ul>'.$privmsg.'</ul>'.
+ '</li>';
+ }
}
if (keys(%rolechange) > 0) {
- $changemsg .= '<li>'.
- &mt('Existing roles with status changes').'</li>'.
- '<ul>';
+ my $rolemsg;
foreach my $item (sort(keys(%rolechange))) {
my $desc = &role_desc($item,$update,$refresh,$now);
+ if ($desc) {
+ $rolemsg .= '<li>'.
+ &mt('[_1] status now: [_2].',$desc,
+ $rolechange{$item}).'</li>';
+ }
+ }
+ if ($rolemsg) {
$changemsg .= '<li>'.
- &mt('[_1] status now: [_2].',$desc,
- $rolechange{$item}).'</li>';
+ &mt('Existing roles with status changes').'</li>'.
+ '<ul>'.$rolemsg.'</ul>'.
+ '</li>';
}
- $changemsg .= '</ul></li>';
}
if (keys(%deletedroles) > 0) {
- $changemsg .= '<li>'.
- &mt('Existing roles now expired').'</li>'.
- '<ul>';
+ my $delmsg;
foreach my $item (sort(keys(%deletedroles))) {
my $desc = &role_desc($item,$update,$refresh,$now);
- $changemsg .= '<li>'.$desc.'</li>';
+ if ($desc) {
+ $delmsg .= '<li>'.$desc.'</li>';
+ }
+ }
+ if ($delmsg) {
+ $changemsg .= '<li>'.
+ &mt('Existing roles now expired').'</li>'.
+ '<ul>'.$delmsg.'</ul>'.
+ '</li>';
}
- $changemsg .= '</ul></li>';
}
}
if ((keys(%changed_groups) > 0) || (keys(%groupchange) > 0)) {
@@ -2556,6 +2578,12 @@
}
if ($changemsg) {
$msg .= '<ul>'.$changemsg.'</ul>';
+ } else {
+ if (&Apache::loncommon::show_course()) {
+ $msg = &mt('No new courses or communities');
+ } else {
+ $msg = &mt('No role changes');
+ }
}
return $msg;
}
@@ -2567,6 +2595,7 @@
&Apache::lonnet::role_status('user.role.'.$item,$update,$refresh,
$now,\$role,\$where,\$trolecode,
\$tstatus,\$tstart,\$tend);
+ return unless ($role);
if ($role =~ /^cr\//) {
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
$tremark = &mt('Customrole defined by [_1].',$rauthor.':'.$rdomain);
@@ -2608,9 +2637,15 @@
} elsif ($tdom) {
$twhere = &mt('Domain').': '.$tdom;
}
- my $output = "$trole -- $twhere";
- if ($tremark) {
- $output .= '<br />'.$tremark;
+ my $output;
+ if ($trole) {
+ $output = $trole;
+ if ($twhere) {
+ $output .= " -- $twhere";
+ }
+ if ($tremark) {
+ $output .= '<br />'.$tremark;
+ }
}
return $output;
}
More information about the LON-CAPA-cvs
mailing list