--- loncom/interface/loncreateuser.pm 2003/07/18 19:50:28 1.61 +++ loncom/interface/loncreateuser.pm 2003/07/19 21:44:51 1.64 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.61 2003/07/18 19:50:28 www Exp $ +# $Id: loncreateuser.pm,v 1.64 2003/07/19 21:44:51 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -280,13 +280,16 @@ END
Revoke | Delete | Role | Extent | Start | End | END - foreach my $area (keys(%rolesdump)) { + foreach my $area (sort keys(%rolesdump)) { next if ($area =~ /^rolesdef/); my $role = $rolesdump{$area}; my $thisrole=$area; $area =~ s/\_\w\w$//; my ($role_code,$role_end_time,$role_start_time) = split(/_/,$role); +# Is this a custom role? Get role owner and title. + my ($croleudom,$croleuname,$croletitle)= + ($role_code=~/^cr\/(\w+)\/(\w+)\/(\w+)$/); my $bgcol='ffffff'; my $allowed=0; my $delallowed=0; @@ -312,10 +315,17 @@ END (&Apache::lonnet::allowed('dro',$ccdomain))) { $delallowed=1; } +# - custom role. Needs more info, too + if ($croletitle) { + if (&Apache::lonnet::allowed('ccr',$1.'/'.$2)) { + $allowed=1; + $thisrole.='.'.$role_code; + } + } # Compute the background color based on $area $bgcol=$1.'_'.$2; - $bgcol=~s/[^8-9b-e]//g; - $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',0,6); + $bgcol=~s/[^7-9a-e]//g; + $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); if ($area=~/^\/(\w+)\/(\d\w+)\/(\w+)/) { $carea.='
---|---|---|---|---|---|
'; + $row.=' | |||||
'; my $active=1; $active=0 if (($role_end_time) && ($now>$role_end_time)); if (($active) && ($allowed)) { @@ -365,7 +375,14 @@ END } else { $row.=' '; } - $row.= ' | '.&Apache::lonnet::plaintext($role_code). + my $plaintext=''; + unless ($croletitle) { + $plaintext=&Apache::lonnet::plaintext($role_code); + } else { + $plaintext= + "Customrole '$croletitle' defined by $croleuname\@$croleudom"; + } + $row.= ' | '.$plaintext. ' | '.$area. ' | '.($role_start_time?localtime($role_start_time)
: ' ' ).
@@ -735,7 +752,8 @@ END
next if (! $ENV{$_});
# Revoke roles
if ($_=~/^form\.rev/) {
- if ($_=~/^form\.rev\:([^\_]+)\_([^\_]+)$/) {
+ if ($_=~/^form\.rev\:([^\_]+)\_([^\_\.]+)$/) {
+# Revoke standard role
$r->print('Revoking '.$2.' in '.$1.': '.
&Apache::lonnet::assignrole($ENV{'form.ccdomain'},
$ENV{'form.ccuname'},$1,$2,$now).' '); @@ -752,6 +770,12 @@ END $ENV{'course.'.$cid.'.home'}).' '); } } + if ($_=~/^form\.rev\:([^\_]+)\_cr\.cr\/(\w+)\/(\w+)\/(\w+)$/) { +# Revoke custom role + $r->print( + 'Revoking custom role '.$4.' by '.$3.'\@'.$2.' in '.$1.': '. + ' '); + } } elsif ($_=~/^form\.del/) { if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) { $r->print('Deleting '.$2.' in '.$1.': '. @@ -826,7 +850,9 @@ END $ENV{'form.ccdomain'},$ENV{'form.ccuname'}, $url,$2,$end,$start) .' '); - } + } else { + $r->print(' ERROR: Unknown command '.$_.' '); + } } } # End of foreach (keys(%ENV)) $r->print(' |