version 1.105, 2004/11/09 20:04:48
|
version 1.107, 2004/11/11 23:17:13
|
Line 83 sub handler {
|
Line 83 sub handler {
|
my $then=$ENV{'user.login.time'}; |
my $then=$ENV{'user.login.time'}; |
my $envkey; |
my $envkey; |
my $dcselect=''; |
my $dcselect=''; |
|
my %dcroles = (); |
|
my $numdc = &check_fordc(\%dcroles,$then); |
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($ENV{'form.selectrole'}) { |
if ($ENV{'form.selectrole'}) { |
Line 120 sub handler {
|
Line 121 sub handler {
|
"request.role" => 'cm', |
"request.role" => 'cm', |
"request.role.adv" => $ENV{'user.adv'}, |
"request.role.adv" => $ENV{'user.adv'}, |
"request.role.domain" => $ENV{'user.domain'}); |
"request.role.domain" => $ENV{'user.domain'}); |
|
|
|
# Check to see if the user is a DC trying to enter a course and needs privs to be created |
|
if ($numdc > 0) { |
|
foreach my $envkey (keys %ENV) { |
|
if ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-) { |
|
if ($dcroles{$1}) { |
|
unless ($ENV{'user.role.cc./'.$1.'/'.$2}) { |
|
&set_privileges($1,$2); |
|
} |
|
} |
|
last; |
|
} |
|
} |
|
} |
|
|
|
if ($ENV{'form.dccourse'}) { |
|
my $dcdom = $ENV{'form.dcdomain'}; |
|
my $pickedcourse = $ENV{'form.dccourse'}; |
|
if ($dcdom && $pickedcourse) { |
|
unless ($ENV{'user.role.cc./'.$dcdom.'/'.$pickedcourse}) { |
|
if ($ENV{'user.role.dc./'.$dcdom.'/'}) { |
|
&set_privileges($dcdom,$pickedcourse); |
|
} |
|
} |
|
} |
|
} |
|
|
foreach $envkey (keys %ENV) { |
foreach $envkey (keys %ENV) { |
next if ($envkey!~/^user\.role\./); |
next if ($envkey!~/^user\.role\./); |
my ($where,$trolecode,$role,$tstatus,$tend,$tstart); |
my ($where,$trolecode,$role,$tstatus,$tend,$tstart); |
Line 264 ENDENTERKEY
|
Line 292 ENDENTERKEY
|
} |
} |
# Check to see if the user is a DC coming from the |
# Check to see if the user is a DC coming from the |
# course selection page |
# course selection page |
my $dcflag = 0; |
|
if ($ENV{'form.dccourse'}) { |
if ($ENV{'form.dccourse'}) { |
my $formaction = '/adm/roles/'; |
my $formaction = '/adm/roles/'; |
my ($dcdom,$pickedcourse) = split/_/,$courseid; |
my ($dcdom,$pickedcourse) = split/_/,$courseid; |
Line 408 ENDHEADER
|
Line 435 ENDHEADER
|
$r->print('><input type=submit value="'.&mt('Display').'">'); |
$r->print('><input type=submit value="'.&mt('Display').'">'); |
} |
} |
|
|
my %dcroles = (); |
|
my $numdc = &check_fordc(\%dcroles,$then); |
|
|
|
my (%roletext,%sortrole,%roleclass); |
my (%roletext,%sortrole,%roleclass); |
my $countactive=0; |
my $countactive=0; |
my $inrole=0; |
my $inrole=0; |
Line 675 ENDHEADER
|
Line 699 ENDHEADER
|
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { |
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { |
my $skiprole = 0; |
my $skiprole = 0; |
foreach my $dcdom (keys %dcroles) { |
foreach my $dcdom (keys %dcroles) { |
if ($sortrole{$which} =~ m-(dc|cc)\./$dcdom/-) { |
if ($sortrole{$which} =~ m-(dc)\./$dcdom/-) { |
$skiprole = 1; |
$skiprole = 1; |
last; |
last; |
} |
} |
Line 706 ENDHEADER
|
Line 730 ENDHEADER
|
$r->print("<tr bgcolor='#BBffBB'>". |
$r->print("<tr bgcolor='#BBffBB'>". |
"<td align='center' colspan='7'>".&mt($type)."</td>"); |
"<td align='center' colspan='7'>".&mt($type)."</td>"); |
} |
} |
$r->print($output); |
$r->print($output); |
} |
} |
} |
} |
} |
} |
Line 1009 sub recent_filename {
|
Line 1033 sub recent_filename {
|
return 'nohist_recent_'.&Apache::lonnet::escape($area); |
return 'nohist_recent_'.&Apache::lonnet::escape($area); |
} |
} |
|
|
|
sub set_privileges { |
|
my ($dcdom,$pickedcourse) = @_; |
|
my $area = '/'.$dcdom.'/'.$pickedcourse; |
|
my $role = 'cc'; |
|
my $spec = $role.'.'.$area; |
|
my $userroles = &Apache::lonnet::set_arearole($role,$area,'','',$dcdom,$ENV{'user.name'}); |
|
my %ccrole = (); |
|
&Apache::lonnet::standard_roleprivs(\%ccrole,$role,$dcdom,$spec,$pickedcourse,$area); |
|
my ($author,$adv)= &Apache::lonnet::set_userprivs(\$userroles,\%ccrole); |
|
my @newprivs = split/\n/,$userroles; |
|
my %newccroles = (); |
|
foreach (@newprivs) { |
|
my ($key,$val) = split/=/,$_; |
|
$newccroles{$key} = $val; |
|
} |
|
&Apache::lonnet::appenv(%newccroles); |
|
&Apache::lonnet::log($ENV{'user.domain'}, |
|
$ENV{'user.name'}, |
|
$ENV{'user.home'}, |
|
"Role ".$role); |
|
&Apache::lonnet::appenv( |
|
'request.role' => $role, |
|
'request.role.domain' => $dcdom, |
|
'request.course.sec' => ''); |
|
my $tadv=0; |
|
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
|
&Apache::lonnet::appenv('request.role.adv' => $tadv); |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|