[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm
www
lon-capa-cvs@mail.lon-capa.org
Sat, 19 Jul 2003 21:44:51 -0000
www Sat Jul 19 17:44:51 2003 EDT
Modified files:
/loncom/interface loncreateuser.pm
Log:
Bug #795, continued.
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.63 loncom/interface/loncreateuser.pm:1.64
--- loncom/interface/loncreateuser.pm:1.63 Fri Jul 18 20:51:05 2003
+++ loncom/interface/loncreateuser.pm Sat Jul 19 17:44:51 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.63 2003/07/19 00:51:05 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 @@
<table border=2>
<tr><th>Revoke</th><th>Delete</th><th>Role</th><th>Extent</th><th>Start</th><th>End</th>
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,6 +315,13 @@
(&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/[^7-9a-e]//g;
@@ -365,7 +375,14 @@
} else {
$row.=' ';
}
- $row.= '</td><td>'.&Apache::lonnet::plaintext($role_code).
+ my $plaintext='';
+ unless ($croletitle) {
+ $plaintext=&Apache::lonnet::plaintext($role_code);
+ } else {
+ $plaintext=
+ "Customrole '$croletitle' defined by $croleuname\@$croleudom";
+ }
+ $row.= '</td><td>'.$plaintext.
'</td><td>'.$area.
'</td><td>'.($role_start_time?localtime($role_start_time)
: ' ' ).
@@ -735,7 +752,8 @@
next if (! $ENV{$_});
# Revoke roles
if ($_=~/^form\.rev/) {
- if ($_=~/^form\.rev\:([^\_]+)\_([^\_]+)$/) {
+ if ($_=~/^form\.rev\:([^\_]+)\_([^\_\.]+)$/) {
+# Revoke standard role
$r->print('Revoking '.$2.' in '.$1.': <b>'.
&Apache::lonnet::assignrole($ENV{'form.ccdomain'},
$ENV{'form.ccuname'},$1,$2,$now).'</b><br>');
@@ -752,6 +770,12 @@
$ENV{'course.'.$cid.'.home'}).'</b><br>');
}
}
+ if ($_=~/^form\.rev\:([^\_]+)\_cr\.cr\/(\w+)\/(\w+)\/(\w+)$/) {
+# Revoke custom role
+ $r->print(
+ 'Revoking custom role '.$4.' by '.$3.'\@'.$2.' in '.$1.': <b>'.
+ '</b><br>');
+ }
} elsif ($_=~/^form\.del/) {
if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) {
$r->print('Deleting '.$2.' in '.$1.': '.
@@ -826,7 +850,9 @@
$ENV{'form.ccdomain'},$ENV{'form.ccuname'},
$url,$2,$end,$start)
.'</b><br>');
- }
+ } else {
+ $r->print('<p>ERROR: Unknown command <tt>'.$_.'</tt></p><br>');
+ }
}
} # End of foreach (keys(%ENV))
$r->print('</body></html>');