--- 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(''); } @@ -1026,6 +1036,10 @@ sub handler { sub course_level_table { my %inccourses = @_; my $table = ''; +# Custom Roles? + + my %customroles=&my_custom_roles(); + foreach (sort( keys(%inccourses))) { my $thiscourse=$_; my $protectedcourse=$_; @@ -1034,8 +1048,8 @@ sub course_level_table { my $area=$coursedata{'description'}; if (!defined($area)) { $area='Unavailable course: '.$_; } my $bgcol=$thiscourse; - $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); foreach ('st','ta','ep','ad','in','cc') { if (&Apache::lonnet::allowed('c'.$_,$thiscourse)) { my $plrole=&Apache::lonnet::plaintext($_); @@ -1065,6 +1079,22 @@ ENDTIMEENTRY $table.= "\n"; } } + foreach (sort keys %customroles) { + my $plrole=$_; + $table .= < + +$plrole +$area + + +Set Start Date + +Set End Date +ENDENTRY + } } return '' if ($table eq ''); # return nothing if there is nothing # in the table