--- loncom/interface/loncreateuser.pm 2003/07/18 19:50:28 1.61
+++ loncom/interface/loncreateuser.pm 2003/07/19 00:51:05 1.63
@@ -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.63 2003/07/19 00:51:05 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -314,8 +314,8 @@ END
}
# 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.='
Section/Group: '.$3;
}
@@ -347,7 +347,7 @@ END
}
}
my $row = '';
- $row.='
';
+ $row.=' |
';
my $active=1;
$active=0 if (($role_end_time) && ($now>$role_end_time));
if (($active) && ($allowed)) {
@@ -842,7 +842,7 @@ sub custom_role_editor {
$rolename=$ENV{'form.newrolename'};
}
- $rolename=~s/\W//gs;
+ $rolename=~s/[^A-Za-z0-9]//gs;
unless ($rolename) {
&print_username_entry_form($r);
@@ -861,7 +861,6 @@ sub custom_role_editor {
$r->print('Existing Role "');
# ------------------------------------------------- Get current role privileges
($syspriv,$dompriv,$coursepriv)=split(/\_/,$roledef);
- $r->print($syspriv.' '.$dompriv.' '.$coursepriv);
} else {
$r->print('New Role "');
$roledef='';
@@ -932,7 +931,7 @@ sub set_custom_role {
my $rolename=$ENV{'form.rolename'};
- $rolename=~s/\W//gs;
+ $rolename=~s/[^A-Za-z0-9]//gs;
unless ($rolename) {
&print_username_entry_form($r);
@@ -979,8 +978,19 @@ sub set_custom_role {
$sysrole.=':'.$_;
}
}
- $r->print('Defining Role: '.
+ $r->print(' Defining Role: '.
&Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole));
+ if ($ENV{'request.course.id'}) {
+ my $url='/'.$ENV{'request.course.id'};
+ $url=~s/\_/\//g;
+ $r->print(' Assigning Role to Self: '.
+ &Apache::lonnet::assigncustomrole($ENV{'user.domain'},
+ $ENV{'user.name'},
+ $url,
+ $ENV{'user.domain'},
+ $ENV{'user.name'},
+ $rolename));
+ }
$r->print(' |