version 1.177, 2007/04/17 15:44:58
|
version 1.205, 2008/09/02 02:56:52
|
Line 43 use Apache::lonpageflip();
|
Line 43 use Apache::lonpageflip();
|
use Apache::lonnavdisplay(); |
use Apache::lonnavdisplay(); |
use GDBM_File; |
use GDBM_File; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
use HTML::Entities; |
|
|
|
|
sub redirect_user { |
sub redirect_user { |
Line 106 sub handler {
|
Line 107 sub handler {
|
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($env{'form.selectrole'}) { |
if ($env{'form.selectrole'}) { |
|
|
|
my $locknum=&Apache::lonnet::get_locks(); |
|
if ($locknum) { return 409; } |
|
|
if ($env{'form.newrole'}) { |
if ($env{'form.newrole'}) { |
$env{'form.'.$env{'form.newrole'}}=1; |
$env{'form.'.$env{'form.newrole'}}=1; |
} |
} |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
|
# Check if user is CC trying to select a course role |
|
if ($env{'form.switchrole'}) { |
|
if (!defined($env{'user.role.'.$env{'form.switchrole'}})) { |
|
&adhoc_course_role($then); |
|
} |
|
} |
my %temp=('logout_'.$env{'request.course.id'} => time); |
my %temp=('logout_'.$env{'request.course.id'} => time); |
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::delenv('user.state.'.$env{'request.course.id'}); |
&Apache::lonnet::delenv('user.state.'.$env{'request.course.id'}); |
} |
} |
&Apache::lonnet::appenv("request.course.id" => '', |
&Apache::lonnet::appenv({"request.course.id" => '', |
"request.course.fn" => '', |
"request.course.fn" => '', |
"request.course.uri" => '', |
"request.course.uri" => '', |
"request.course.sec" => '', |
"request.course.sec" => '', |
"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 if user is a DC trying to enter a course or author space and needs privs to be created |
# Check if user is a DC trying to enter a course and needs privs to be created |
|
if ($numdc > 0) { |
if ($numdc > 0) { |
foreach my $envkey (keys %env) { |
foreach my $envkey (keys %env) { |
|
# Is this an ad-hoc CC-role? |
if (my ($domain,$coursenum) = |
if (my ($domain,$coursenum) = |
($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) { |
($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) { |
if ($dcroles{$domain}) { |
if ($dcroles{$domain}) { |
&check_privs($domain,$coursenum,$then,$now); |
&check_privs($domain,$coursenum,$then,$now,'cc'); |
|
} |
|
last; |
|
} |
|
# Is this an ad-hoc CA-role? |
|
if (my ($domain,$user) = |
|
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { |
|
# Check if author blocked ca-access |
|
my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user); |
|
if ($blocked{'domcoord.author'} eq 'blocked') { |
|
my %roleshash = &Apache::lonnet::get_my_roles($user,$domain); |
|
if (!defined($roleshash{$env{'user.name'}.':'.$env{'user.domain'}.':ca'})) { |
|
delete($env{$envkey}); |
|
$env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access'; |
|
last; |
|
} |
|
} |
|
if ($dcroles{$domain}) { |
|
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
|
if (($server_status eq 'ok') || ($server_status eq 'switchserver')) { |
|
&check_privs($domain,$user,$then,$now,'ca'); |
|
if ($server_status eq 'switchserver') { |
|
my $trolecode = 'ca./'.$domain.'/'.$user; |
|
my $switchserver = '/adm/switchserver?' |
|
.'otherserver='.$home.'&role='.$trolecode; |
|
$r->internal_redirect($switchserver); |
|
} |
|
} else { |
|
delete($env{$envkey}); |
|
} |
|
} else { |
|
delete($env{$envkey}); |
} |
} |
last; |
last; |
} |
} |
Line 190 sub handler {
|
Line 232 sub handler {
|
$cdom,$cnum, |
$cdom,$cnum, |
$env{'user.domain'}, |
$env{'user.domain'}, |
$env{'user.name'}, |
$env{'user.name'}, |
'Assigned from '.$ENV{'REMOTE_ADDR'}.' at '.localtime().' for '. |
&mt('Assigned from [_1] at [_2] for [_3]' |
$trolecode); |
,$ENV{'REMOTE_ADDR'} |
|
,&Apache::lonlocal::locallocaltime() |
|
,$trolecode) |
|
); |
unless ($assignresult eq 'ok') { |
unless ($assignresult eq 'ok') { |
$assignresult=~s/^error\:\s*//; |
$assignresult=~s/^error\:\s*//; |
$message=&mt($assignresult). |
$message=&mt($assignresult). |
Line 201 sub handler {
|
Line 246 sub handler {
|
} |
} |
$r->print(<<ENDENTEREDKEY); |
$r->print(<<ENDENTEREDKEY); |
$start_page |
$start_page |
<script> |
<script type="text/javascript"> |
$swinfo |
$swinfo |
</script> |
</script> |
<form method="post"> |
<form method="post"> |
Line 224 ENDENTEREDKEY
|
Line 269 ENDENTEREDKEY
|
my $end_page=&Apache::loncommon::end_page(); |
my $end_page=&Apache::loncommon::end_page(); |
$r->print(<<ENDENTERKEY); |
$r->print(<<ENDENTERKEY); |
$start_page |
$start_page |
<script> |
<script type="text/javascript"> |
$swinfo |
$swinfo |
</script> |
</script> |
<form method="post"> |
<form method="post"> |
Line 245 ENDENTERKEY
|
Line 290 ENDENTERKEY
|
"Role ".$trolecode); |
"Role ".$trolecode); |
|
|
&Apache::lonnet::appenv( |
&Apache::lonnet::appenv( |
'request.role' => $trolecode, |
{'request.role' => $trolecode, |
'request.role.domain' => $cdom, |
'request.role.domain' => $cdom, |
'request.course.sec' => $csec, |
'request.course.sec' => $csec, |
'request.course.groups' => $cgrps); |
'request.course.groups' => $cgrps}); |
my $tadv=0; |
my $tadv=0; |
|
|
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { |
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { |
Line 259 ENDENTERKEY
|
Line 304 ENDENTERKEY
|
($env{'form.orgurl'}!~/^\/adm\/flip/)) { |
($env{'form.orgurl'}!~/^\/adm\/flip/)) { |
my $dest=$env{'form.orgurl'}; |
my $dest=$env{'form.orgurl'}; |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
&Apache::lonnet::appenv('request.role.adv'=>$tadv); |
&Apache::lonnet::appenv({'request.role.adv'=>$tadv}); |
if (($ferr) && ($tadv)) { |
if (($ferr) && ($tadv)) { |
&error_page($r,$ferr,$dest); |
&error_page($r,$ferr,$dest); |
} else { |
} else { |
Line 269 ENDENTERKEY
|
Line 314 ENDENTERKEY
|
} else { |
} else { |
if (!$env{'request.course.id'}) { |
if (!$env{'request.course.id'}) { |
&Apache::lonnet::appenv( |
&Apache::lonnet::appenv( |
"request.course.id" => $cdom.'_'.$cnum); |
{"request.course.id" => $cdom.'_'.$cnum}); |
$furl='/adm/roles?tryagain=1'; |
$furl='/adm/roles?tryagain=1'; |
$msg= |
$msg= |
'<h1><span class="LC_error">'. |
'<h1><span class="LC_error">'. |
Line 278 ENDENTERKEY
|
Line 323 ENDENTERKEY
|
'</span></h1><h3>'.&mt('Please try again.').'</h3>'.$ferr; |
'</span></h1><h3>'.&mt('Please try again.').'</h3>'.$ferr; |
} |
} |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
&Apache::lonnet::appenv('request.role.adv'=>$tadv); |
&Apache::lonnet::appenv({'request.role.adv'=>$tadv}); |
|
|
if (($ferr) && ($tadv)) { |
if (($ferr) && ($tadv)) { |
&error_page($r,$ferr,$furl); |
&error_page($r,$ferr,$furl); |
Line 295 ENDENTERKEY
|
Line 340 ENDENTERKEY
|
$furl = "/adm/helper/course.initialization.helper"; |
$furl = "/adm/helper/course.initialization.helper"; |
# Send the user to the course they selected |
# Send the user to the course they selected |
} elsif ($env{'request.course.id'}) { |
} elsif ($env{'request.course.id'}) { |
|
if ($env{'form.destinationurl'}) { |
|
my $dest = $env{'form.destinationurl'}; |
|
if ($env{'form.destsymb'} ne '') { |
|
my $esc_symb = &HTML::Entities::encode($env{'form.destsymb'},'"<>&'); |
|
$dest .= '?symb='.$esc_symb; |
|
} |
|
&redirect_user($r,&mt('Entering [_1]', |
|
$env{'course.'.$courseid.'.description'}), |
|
$dest,$msg, |
|
$env{'environment.remotenavmap'}); |
|
return OK; |
|
} |
if (&Apache::lonnet::allowed('whn', |
if (&Apache::lonnet::allowed('whn', |
$env{'request.course.id'}) |
$env{'request.course.id'}) |
|| &Apache::lonnet::allowed('whn', |
|| &Apache::lonnet::allowed('whn', |
Line 303 ENDENTERKEY
|
Line 360 ENDENTERKEY
|
) { |
) { |
my $startpage = &courseloadpage($courseid); |
my $startpage = &courseloadpage($courseid); |
unless ($startpage eq 'firstres') { |
unless ($startpage eq 'firstres') { |
$msg = &mt('Entering [_1] ....', |
$msg = &mt('Entering [_1] ...', |
$env{'course.'.$courseid.'.description'}); |
$env{'course.'.$courseid.'.description'}); |
&redirect_user($r,&mt('New in course'), |
&redirect_user($r,&mt('New in course'), |
'/adm/whatsnew?refpage=start',$msg, |
'/adm/whatsnew?refpage=start',$msg, |
Line 365 ENDENTERKEY
|
Line 422 ENDENTERKEY
|
my $start_page=&Apache::loncommon::start_page('User Roles'); |
my $start_page=&Apache::loncommon::start_page('User Roles'); |
my $standby=&mt('Role selected. Please stand by.'); |
my $standby=&mt('Role selected. Please stand by.'); |
$standby=~s/\n/\\n/g; |
$standby=~s/\n/\\n/g; |
|
my $noscript='<span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />'; |
|
|
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
$start_page |
$start_page |
<br /> |
<br /> |
<script> |
<noscript> |
|
$noscript |
|
</noscript> |
|
<script type="text/javascript"> |
$swinfo |
$swinfo |
window.focus(); |
window.focus(); |
|
|
Line 406 ENDHEADER
|
Line 467 ENDHEADER
|
# -------------------------------------------------------- Generate Page Output |
# -------------------------------------------------------- Generate Page Output |
# --------------------------------------------------------------- Error Header? |
# --------------------------------------------------------------- Error Header? |
if ($error) { |
if ($error) { |
$r->print("<h1>LON-CAPA Access Control</h1>"); |
$r->print("<h1>".&mt('LON-CAPA Access Control')."</h1>"); |
$r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>"); |
$r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>"); |
if ($priv ne '') { |
if ($priv ne '') { |
$r->print("Access : ".&Apache::lonnet::plaintext($priv)."\n"); |
$r->print(&mt('Access : ').&Apache::lonnet::plaintext($priv)."\n"); |
} |
} |
if ($fn ne '') { |
if ($fn ne '') { |
$r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n"); |
$r->print(&mt('Resource: ').&Apache::lonenc::check_encrypt($fn)."\n"); |
} |
} |
if ($msg ne '') { |
if ($msg ne '') { |
$r->print("Action : $msg\n"); |
$r->print(&mt('Action : ').$msg."\n"); |
} |
} |
$r->print("</pre><hr />"); |
$r->print("</pre><hr />"); |
my $url=$fn; |
my $url=$fn; |
Line 443 ENDHEADER
|
Line 504 ENDHEADER
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} else { |
} else { |
if ($advanced) { |
|
$r->print('<span class="LC_rolesinfo">'.&mt("Your home server is "). |
|
&Apache::lonnet::hostname(&Apache::lonnet::homeserver |
|
($env{'user.name'},$env{'user.domain'})). |
|
"<br />\n"); |
|
$r->print(&mt( |
|
"Author and Co-Author roles are not available on servers other than their respective home servers.").'</span>'); |
|
} |
|
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
} |
} |
Line 459 ENDHEADER
|
Line 512 ENDHEADER
|
$r->print('<input type="hidden" name="selectrole" value="1" />'); |
$r->print('<input type="hidden" name="selectrole" value="1" />'); |
$r->print('<input type="hidden" name="newrole" value="" />'); |
$r->print('<input type="hidden" name="newrole" value="" />'); |
} |
} |
if ($env{'user.adv'}) { |
|
$r->print( |
|
'<br /><span class="LC_rolesinfo"><label>'.&mt('Show all roles').': <input type="checkbox" name="showall"'); |
|
if ($env{'form.showall'}) { $r->print(' checked="checked" '); } |
|
$r->print(' /></label><input type="submit" value="'.&mt('Display').'" /></span>'); |
|
} |
|
|
|
my (%roletext,%sortrole,%roleclass); |
my (%roletext,%sortrole,%roleclass); |
my $countactive=0; |
my $countactive=0; |
|
my $countfuture=0; |
|
my $countwill=0; |
my $inrole=0; |
my $inrole=0; |
my $possiblerole=''; |
my $possiblerole=''; |
|
my %futureroles; |
|
my %roles_nextlogin; |
foreach $envkey (sort keys %env) { |
foreach $envkey (sort keys %env) { |
my $button = 1; |
my $button = 1; |
my $switchserver=''; |
my $switchserver=''; |
Line 506 ENDHEADER
|
Line 556 ENDHEADER
|
} elsif ($tstatus eq 'future') { |
} elsif ($tstatus eq 'future') { |
$tbg='#FFFF77'; |
$tbg='#FFFF77'; |
$button=0; |
$button=0; |
|
$futureroles{$trolecode} = $tstart.':'.$tend; |
|
$countfuture ++; |
} elsif ($tstatus eq 'will') { |
} elsif ($tstatus eq 'will') { |
$tbg='#FFAA77'; |
$tbg='#FFAA77'; |
$tremark.=&mt('Active at next login. '); |
$tremark.=&mt('Active at next login.').' '; |
|
$roles_nextlogin{$trolecode} = $tstart.':'.$tend; |
|
$countwill ++; |
} elsif ($tstatus eq 'expired') { |
} elsif ($tstatus eq 'expired') { |
$tbg='#FF7777'; |
$tbg='#FF7777'; |
$tfont='#330000'; |
$tfont='#330000'; |
$button=0; |
$button=0; |
} elsif ($tstatus eq 'will_not') { |
} elsif ($tstatus eq 'will_not') { |
$tbg='#AAFF77'; |
$tbg='#AAFF77'; |
$tremark.=&mt('Expired after logout. '); |
$tremark.=&mt('Expired after logout.').' '; |
} elsif ($tstatus eq 'selected') { |
} elsif ($tstatus eq 'selected') { |
$tbg='#11CC55'; |
$tbg='#11CC55'; |
$tfont='#002200'; |
$tfont='#002200'; |
$inrole=1; |
$inrole=1; |
$countactive++; |
$countactive++; |
$tremark.=&mt('Currently selected. '); |
$tremark.=&mt('Currently selected.').' '; |
} |
} |
my $trole; |
my $trole; |
if ($role =~ /^cr\//) { |
if ($role =~ /^cr\//) { |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
if ($tremark) { $tremark.='<br />'; } |
if ($tremark) { $tremark.='<br />'; } |
$tremark.=&mt('Defined by ').$rauthor. |
$tremark.=&mt('Defined by [_1] at [_2].',$rauthor,$rdomain); |
&mt(' at ').$rdomain.'.'; |
|
} |
} |
$trole=Apache::lonnet::plaintext($role); |
$trole=Apache::lonnet::plaintext($role); |
my $ttype; |
my $ttype; |
Line 624 ENDHEADER
|
Line 677 ENDHEADER
|
} |
} |
} |
} |
} |
} |
|
if ($env{'user.adv'}) { |
|
$r->print( |
|
'<br /><span class="LC_rolesinfo"><label>'.&mt('Show all roles').': <input type="checkbox" name="showall"'); |
|
if ($env{'form.showall'}) { $r->print(' checked="checked" '); } |
|
$r->print(' /></label><input type="submit" value="'.&mt('Display').'" /></span>'); |
|
} else { |
|
if ($countactive > 0) { |
|
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
|
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
|
$r->print('<p>'.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','<b>','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a></b>',$domdesc).'<br />'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','<b>','</b>').'</p>'); |
|
} |
|
} |
|
|
# No active roles |
# No active roles |
if ($countactive==0) { |
if ($countactive==0) { |
if ($inrole) { |
if ($inrole) { |
Line 631 ENDHEADER
|
Line 697 ENDHEADER
|
} else { |
} else { |
$r->print('<h2>'.&mt('Currently no active roles or courses').'</h2>'); |
$r->print('<h2>'.&mt('Currently no active roles or courses').'</h2>'); |
} |
} |
$r->print('</form>'.&Apache::loncommon::end_page()); |
&findcourse_advice($r); |
|
$r->print('</form>'); |
|
if ($countfuture) { |
|
$r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture)); |
|
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole, |
|
$nochoose); |
|
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles, |
|
\%roletext); |
|
my $tremark=''; |
|
my $tfont='#003300'; |
|
if ($env{'request.role'} eq 'cm') { |
|
$r->print('<tr bgcolor="#11CC55">'); |
|
$tremark=&mt('Currently selected.').' '; |
|
$tfont='#002200'; |
|
} else { |
|
$r->print('<tr bgcolor="#77FF77">'); |
|
} |
|
$r->print('<td></td><td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified'). |
|
'</span></font></td><td><font color="'.$tfont.'">'.$tremark. |
|
' </font></td></tr>'."\n"); |
|
|
|
$r->print('</table>'); |
|
} |
|
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
# Is there only one choice? |
# Is there only one choice? |
} elsif (($countactive==1) && ($env{'request.role'} eq 'cm')) { |
} elsif ($countactive==1) { |
$r->print('<h3>'.&mt('Please stand by.').'</h3>'. |
my $needs_switchserver; |
'<input type="hidden" name="'.$possiblerole.'" value="1" />'); |
if ($env{'user.author'}) { |
$r->print("</form>\n"); |
$needs_switchserver = &check_needs_switchserver($possiblerole); |
$r->rflush(); |
} |
$r->print('<script>document.forms.rolechoice.submit();</script>'); |
if ((!$needs_switchserver) && ($env{'request.role'} eq 'cm')) { |
$r->print(&Apache::loncommon::end_page()); |
$r->print('<h3>'.&mt('Please stand by.').'</h3>'. |
return OK; |
'<input type="hidden" name="'.$possiblerole.'" value="1" />'. |
|
'<noscript><br /><input type="submit" name="submit" value="'.&mt('Continue').'" /></noscript>'); |
|
$r->print("</form>\n"); |
|
$r->rflush(); |
|
$r->print('<script type="text/javascript">document.forms.rolechoice.submit();</script>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
|
} |
|
if ($needs_switchserver) { |
|
$r->print("<h2>".&mt('Server Switch Required')."</h2>\n". |
|
&mt('Construction Space access is only available from '. |
|
'the home server of the corresponding Author.').'<br />'. |
|
&mt("Click the 'Switch Server' link to go there.").'<br />'); |
|
} |
} |
} |
# More than one possible role |
# More than one possible role |
# ----------------------------------------------------------------------- Table |
# ----------------------------------------------------------------------- Table |
unless (($advanced) || ($nochoose)) { |
unless ((!&Apache::lonmenu::show_course()) || ($nochoose) || ($countactive==1)) { |
$r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n"); |
$r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n"); |
} |
} |
$r->print('<br /><table id="LC_rolesmenu"><tr>'); |
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,$nochoose); |
unless ($nochoose) { $r->print('<th> </th>'); } |
|
$r->print('<th>'.&mt('User Role').'</th><th>'.&mt('Extent'). |
|
'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th></tr>'."\n"); |
|
my $doheaders=-1; |
|
foreach my $type ('Domain','Construction Space','Course','Unavailable','System') { |
|
my $haverole=0; |
|
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { |
|
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { |
|
$haverole=1; |
|
} |
|
} |
|
if ($haverole) { $doheaders++; } |
|
} |
|
|
|
if ($env{'environment.recentroles'}) { |
if ($env{'environment.recentroles'}) { |
my %recent_roles = |
my %recent_roles = |
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); |
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); |
Line 672 ENDHEADER
|
Line 760 ENDHEADER
|
$output.=$roletext{'user.role.'.$_}; |
$output.=$roletext{'user.role.'.$_}; |
if ($_ =~ m-dc\./($match_domain)/- |
if ($_ =~ m-dc\./($match_domain)/- |
&& $dcroles{$1}) { |
&& $dcroles{$1}) { |
$output .= &allcourses_row($1,'recent'); |
$output .= &adhoc_roles_row($1,'recent'); |
} |
} |
} elsif ($numdc > 0) { |
} elsif ($numdc > 0) { |
unless ($_ =~/^error\:/) { |
unless ($_ =~/^error\:/) { |
Line 682 ENDHEADER
|
Line 770 ENDHEADER
|
} |
} |
if ($output) { |
if ($output) { |
$r->print("<tr><td align='center' colspan='5'><font face='arial'>". |
$r->print("<tr><td align='center' colspan='5'><font face='arial'>". |
&mt('Recent Roles')."</font></td>"); |
&mt('Recent Roles')."</font></td></tr>"); |
$r->print($output); |
$r->print($output); |
$r->print("</tr>"); |
|
$doheaders ++; |
$doheaders ++; |
} |
} |
} |
} |
|
|
if ($numdc > 0) { |
if ($numdc > 0) { |
$r->print(&coursepick_jscript()); |
$r->print(&coursepick_jscript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript(). |
|
&Apache::loncommon::authorbrowser_javascript()); |
} |
} |
foreach my $type ('Construction Space','Domain','Course','Unavailable','System') { |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext); |
my $output; |
if ($countactive > 1) { |
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { |
my $tremark=''; |
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { |
my $tfont='#003300'; |
$output.=$roletext{$sortrole{$which}}; |
if ($env{'request.role'} eq 'cm') { |
if ($sortrole{$which} =~ m-dc\./($match_domain)/-) { |
$r->print('<tr bgcolor="#11CC55">'); |
if ($dcroles{$1}) { |
$tremark=&mt('Currently selected.').' '; |
$output .= &allcourses_row($1,''); |
$tfont='#002200'; |
} |
} else { |
} |
$r->print('<tr bgcolor="#77FF77">'); |
} |
} |
} |
unless ($nochoose) { |
if ($output) { |
if ($env{'request.role'} ne 'cm') { |
if ($doheaders > 0) { |
$r->print('<td><input type="submit" value="'. |
$r->print("<tr>". |
&mt('Select').'" name="cm" /></td>'); |
"<td align='center' colspan='5'><font face='arial'>".&mt($type)."</font></td></tr>"); |
} else { |
|
$r->print('<td> </td>'); |
} |
} |
$r->print($output); |
} |
} |
$r->print('<td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified'). |
} |
'</span></font></td><td><font color="'.$tfont.'">'.$tremark. |
my $tremark=''; |
' </font></td></tr>'."\n"); |
my $tfont='#003300'; |
} |
if ($env{'request.role'} eq 'cm') { |
|
$r->print('<tr bgcolor="#11CC55">'); |
|
$tremark=&mt('Currently selected. '); |
|
$tfont='#002200'; |
|
} else { |
|
$r->print('<tr bgcolor="#77FF77">'); |
|
} |
|
unless ($nochoose) { |
|
if ($env{'request.role'} ne 'cm') { |
|
$r->print('<td><input type="submit" value="'. |
|
&mt('Select').'" name="cm"></td>'); |
|
} else { |
|
$r->print('<td> </td>'); |
|
} |
|
} |
|
$r->print('<td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified'). |
|
'</font></span></td><td><font color="'.$tfont.'">'.$tremark. |
|
' </font></td></tr>'."\n"); |
|
|
|
$r->print('</table>'); |
$r->print('</table>'); |
unless ($nochoose) { |
unless ($nochoose) { |
$r->print("</form>\n"); |
$r->print("</form>\n"); |
Line 745 ENDHEADER
|
Line 815 ENDHEADER
|
} |
} |
$r->print(&Apache::lonnet::getannounce()); |
$r->print(&Apache::lonnet::getannounce()); |
if ($advanced) { |
if ($advanced) { |
$r->print('<p><small><i>This is LON-CAPA '. |
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
$r->dir_config('lonVersion').'</i><br />'. |
$r->print('<p><small><i>' |
'<a href="/adm/logout">'.&mt('Logout').'</a></small></p>'); |
.&mt('This is LON-CAPA [_1]',$r->dir_config('lonVersion')) |
|
.'</i><br />' |
|
.'<a href="/adm/logout">'.&mt('Logout').'</a> ' |
|
.'<a href="/adm/coursecatalog?showdom='.$esc_dom.'">' |
|
.&mt('Course Catalog') |
|
.'</small></p>'); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
|
sub roletable_headers { |
|
my ($r,$roleclass,$sortrole,$nochoose) = @_; |
|
my $doheaders; |
|
if ((ref($sortrole) eq 'HASH') && (ref($roleclass) eq 'HASH')) { |
|
$r->print('<br /><table id="LC_rolesmenu"><tr>'); |
|
if (!$nochoose) { $r->print('<th> </th>'); } |
|
$r->print('<th>'.&mt('User Role').'</th><th>'.&mt('Extent') |
|
.'</th><th>'.&mt('Start').'</th><th>'.&mt('End') |
|
.'</th></tr>'."\n"); |
|
$doheaders=-1; |
|
my @roletypes = &roletypes(); |
|
foreach my $type (@roletypes) { |
|
my $haverole=0; |
|
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%{$sortrole}))) { |
|
if ($roleclass->{$sortrole->{$which}} =~ /^\Q$type\E/) { |
|
$haverole=1; |
|
} |
|
} |
|
if ($haverole) { $doheaders++; } |
|
} |
|
} |
|
return $doheaders; |
|
} |
|
|
|
sub roletypes { |
|
my @types = ('Domain','Construction Space','Course','Unavailable','System'); |
|
return @types; |
|
} |
|
|
|
sub print_rolerows { |
|
my ($r,$doheaders,$roleclass,$sortrole,$dcroles,$roletext) = @_; |
|
if ((ref($roleclass) eq 'HASH') && (ref($sortrole) eq 'HASH')) { |
|
my @types = &roletypes(); |
|
foreach my $type (@types) { |
|
my $output; |
|
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%{$sortrole}))) { |
|
if ($roleclass->{$sortrole->{$which}} =~ /^\Q$type\E/) { |
|
if (ref($roletext) eq 'HASH') { |
|
$output.=$roletext->{$sortrole->{$which}}; |
|
if ($sortrole->{$which} =~ m-dc\./($match_domain)/-) { |
|
if (ref($dcroles) eq 'HASH') { |
|
if ($dcroles->{$1}) { |
|
$output .= &adhoc_roles_row($1,''); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($output) { |
|
if ($doheaders > 0) { |
|
$r->print("<tr>". |
|
"<td align='center' colspan='5'><font face='arial'>". |
|
&mt($type)."</font></td></tr>"); |
|
} |
|
$r->print($output); |
|
} |
|
} |
|
} |
|
} |
|
|
|
sub findcourse_advice { |
|
my ($r) = @_; |
|
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
|
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
|
if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) { |
|
$r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).' |
|
<ul> |
|
<li>'.&mt('The course has yet to be created.').'</li> |
|
<li>'.&mt('Automatic enrollment of registered students has not been enabled for the course.').'</li> |
|
<li>'.&mt('You are in a section of course for which automatic enrollment in the corresponding LON-CAPA course is not active.').'</li> |
|
<li>'.&mt('The start date for automated enrollment has yet to be reached.').'</li> |
|
<li>'.&mt('You registered for the course recently and there is a time lag between the time you register, and the time this information becomes available for the update of LON-CAPA course rosters.').'</li> |
|
</ul>'); |
|
} else { |
|
$r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'<br />'); |
|
} |
|
$r->print('<p>'.&mt('The [_1]Course Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created.','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a>',$domdesc).'<br />'); |
|
$r->print(&mt('You can search the course catalog for courses which permit self-enrollment, if you would like to enroll in a course.').'</p>'); |
|
return; |
|
} |
|
|
sub privileges_info { |
sub privileges_info { |
my ($which) = @_; |
my ($which) = @_; |
my $output; |
my $output; |
Line 788 sub privileges_info {
|
Line 945 sub privileges_info {
|
$ttype='System'; |
$ttype='System'; |
$twhere='/'; |
$twhere='/'; |
} |
} |
$output .= "\n<h3>".$ttype.': '.$twhere.'</h3>'."\n<ul>"; |
$output .= "\n<h3>".&mt($ttype).': '.$twhere.'</h3>'."\n<ul>"; |
foreach my $priv (sort(split(/:/,$env{$envkey}))) { |
foreach my $priv (sort(split(/:/,$env{$envkey}))) { |
next if (!$priv); |
next if (!$priv); |
|
|
Line 853 sub build_roletext {
|
Line 1010 sub build_roletext {
|
} elsif ($tstatus eq 'is') { |
} elsif ($tstatus eq 'is') { |
$roletext.='<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
$roletext.='<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
&mt('Select').'" onClick="javascript:enterrole(this.form,\''. |
&mt('Select').'" onClick="javascript:enterrole(this.form,\''. |
$trolecode."','".$buttonname.'\');"></td>'; |
$trolecode."','".$buttonname.'\');" /></td>'; |
} elsif ($tryagain) { |
} elsif ($tryagain) { |
$roletext.= |
$roletext.= |
'<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
'<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
&mt('Try Selecting Again').'" onClick="javascript:enterrole(this.form,\''. |
&mt('Try Selecting Again').'" onClick="javascript:enterrole(this.form,\''. |
$trolecode."','".$buttonname.'\');"></td>'; |
$trolecode."','".$buttonname.'\');" /></td>'; |
} elsif ($advanced) { |
} elsif ($advanced) { |
$roletext.= |
$roletext.= |
'<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
'<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
&mt('Re-Initialize').'" onClick="javascript:enterrole(this.form,\''. |
&mt('Re-Initialize').'" onClick="javascript:enterrole(this.form,\''. |
$trolecode."','".$buttonname.'\');"></td>'; |
$trolecode."','".$buttonname.'\');" /></td>'; |
} else { |
} else { |
$roletext.='<td'.$rowspan.'> </td>'; |
$roletext.='<td'.$rowspan.'> </td>'; |
} |
} |
Line 884 sub build_roletext {
|
Line 1041 sub build_roletext {
|
return $roletext; |
return $roletext; |
} |
} |
|
|
|
sub check_needs_switchserver { |
|
my ($possiblerole) = @_; |
|
my $needs_switchserver; |
|
my ($role,$where) = split(/\./,$possiblerole,2); |
|
my (undef,$tdom,$twho) = split(/\//,$where); |
|
my ($server_status,$home); |
|
if (($role eq 'ca') || ($role eq 'aa')) { |
|
($server_status,$home) = &check_author_homeserver($twho,$tdom); |
|
} else { |
|
($server_status,$home) = &check_author_homeserver($env{'user.name'}, |
|
$env{'user.domain'}); |
|
} |
|
if ($server_status eq 'switchserver') { |
|
$needs_switchserver = 1; |
|
} |
|
return $needs_switchserver; |
|
} |
|
|
|
sub check_author_homeserver { |
|
my ($uname,$udom)=@_; |
|
if (($uname eq '') || ($udom eq '')) { |
|
return ('fail',''); |
|
} |
|
my $home = &Apache::lonnet::homeserver($uname,$udom); |
|
if (&Apache::lonnet::host_domain($home) ne $udom) { |
|
return ('fail',$home); |
|
} |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
if (grep(/^\Q$home\E$/,@ids)) { |
|
return ('ok',$home); |
|
} else { |
|
return ('switchserver',$home); |
|
} |
|
} |
|
|
sub check_privs { |
sub check_privs { |
my ($cdom,$cnum,$then,$now) = @_; |
my ($cdom,$cnum,$then,$now,$checkrole) = @_; |
my $cckey = 'user.role.cc./'.$cdom.'/'.$cnum; |
my $cckey = 'user.role.'.$checkrole.'./'.$cdom.'/'.$cnum; |
if ($env{$cckey}) { |
if ($env{$cckey}) { |
my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont); |
my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont); |
&role_status($cckey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend); |
&role_status($cckey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend); |
unless (($tstatus eq 'is') || ($tstatus eq 'will_not')) { |
unless (($tstatus eq 'is') || ($tstatus eq 'will_not')) { |
&set_privileges($cdom,$cnum); |
&set_privileges($cdom,$cnum,$checkrole); |
} |
} |
} else { |
} else { |
&set_privileges($cdom,$cnum); |
&set_privileges($cdom,$cnum,$checkrole); |
} |
} |
} |
} |
|
|
Line 919 sub check_fordc {
|
Line 1111 sub check_fordc {
|
return $numdc; |
return $numdc; |
} |
} |
|
|
|
sub adhoc_course_role { |
|
my ($then) = @_; |
|
my ($cdom,$cnum); |
|
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if (&check_forcc($cdom,$cnum,$then)) { |
|
my $setprivs; |
|
if (!defined($env{'user.role.'.$env{'form.switchrole'}})) { |
|
$setprivs = 1; |
|
} else { |
|
my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.switchrole'}}); |
|
if (($start && ($start>$then || $start == -1)) || |
|
($end && $end<$then)) { |
|
$setprivs = 1; |
|
} |
|
} |
|
if ($setprivs) { |
|
if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) { |
|
my $role = $1; |
|
my $custom_role = $2; |
|
my $usec = $3; |
|
if ($role eq 'cr') { |
|
if ($custom_role =~ m-^/$match_domain/$match_username/\w+$-) { |
|
$role .= $custom_role; |
|
} else { |
|
return; |
|
} |
|
} |
|
my (%userroles,%newrole,%newgroups); |
|
my $area = '/'.$cdom.'/'.$cnum; |
|
my $spec = $role.'.'.$area; |
|
if ($usec ne '') { |
|
$spec .= '/'.$usec; |
|
$area .= '/'.$usec; |
|
} |
|
&Apache::lonnet::standard_roleprivs(\%newrole,$role,$cdom,$spec,$cnum,$area); |
|
&Apache::lonnet::set_userprivs(\%userroles,\%newrole,%newgroups); |
|
my $adhocstart = $then-1; |
|
$userroles{'user.role.'.$spec} = $adhocstart.'.'; |
|
&Apache::lonnet::appenv(\%userroles,[$role,'cm']); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
sub check_forcc { |
|
my ($cdom,$cnum,$then) = @_; |
|
my $is_cc; |
|
if ($cdom ne '' && $cnum ne '') { |
|
if (&Apache::lonnet::is_course($cdom,$cnum)) { |
|
my $envkey = 'user.role.cc./'.$cdom.'/'.$cnum; |
|
if (defined($env{$envkey})) { |
|
$is_cc = 1; |
|
my ($tstart,$tend)=split(/\./,$env{$envkey}); |
|
if ($tstart && $tstart>$then) { $is_cc = 0; } |
|
if ($tend && $tend <$then) { $is_cc = 0; } |
|
} |
|
} |
|
} |
|
return $is_cc; |
|
} |
|
|
sub courselink { |
sub courselink { |
my ($dcdom,$rowtype,$selecttype) = @_; |
my ($dcdom,$rowtype) = @_; |
my $courseform=&Apache::loncommon::selectcourse_link |
my $courseform=&Apache::loncommon::selectcourse_link |
('rolechoice','dccourse'.$rowtype.'_'.$dcdom, |
('rolechoice','dccourse'.$rowtype.'_'.$dcdom, |
'dcdomain'.$rowtype.'_'.$dcdom,'coursedesc'.$rowtype.'_'. |
'dcdomain'.$rowtype.'_'.$dcdom,'coursedesc'.$rowtype.'_'. |
Line 933 sub courselink {
|
Line 1188 sub courselink {
|
} |
} |
|
|
sub coursepick_jscript { |
sub coursepick_jscript { |
|
my %lt = &Apache::lonlocal::texthash( |
|
plsu => "Please use the 'Select Course' link to open a separate pick course window where you may select the course you wish to enter.", |
|
youc => 'You can only use this screen to select courses in the current domain.', |
|
); |
my $verify_script = <<"END"; |
my $verify_script = <<"END"; |
<script> |
<script type="text/javascript"> |
function verifyCoursePick(caller) { |
function verifyCoursePick(caller) { |
var numbutton = getIndex(caller) |
var numbutton = getIndex(caller) |
var pickedCourse = document.rolechoice.elements[numbutton+4].value |
var pickedCourse = document.rolechoice.elements[numbutton+4].value |
Line 948 function verifyCoursePick(caller) {
|
Line 1207 function verifyCoursePick(caller) {
|
} |
} |
} |
} |
else { |
else { |
alert("Please use the 'Select Course' link to open a separate pick course window where you may select the course you wish to enter."); |
alert("$lt{'plsu'}"); |
} |
} |
} |
} |
else { |
else { |
alert("You can only use this screen to select courses in the current domain") |
alert("$lt{'youc'}") |
} |
} |
} |
} |
function getIndex(caller) { |
function getIndex(caller) { |
Line 968 END
|
Line 1227 END
|
return $verify_script; |
return $verify_script; |
} |
} |
|
|
sub processpick { |
sub coauthorlink { |
my $process_pick = <<"END"; |
my ($dcdom,$rowtype) = @_; |
<script> |
my $coauthorform=&Apache::loncommon::selectauthor_link('rolechoice',$dcdom); |
function process_pick(dom) { |
my $hiddenitems = '<input type="hidden" name="adhoccauname'.$rowtype.'_'.$dcdom.'" value="" />'; |
var pickedCourse=opener.document.rolechoice.$env{'form.cnumelement'}.value; |
return $coauthorform.$hiddenitems; |
var pickedDomain=opener.document.rolechoice.$env{'form.cdomelement'}.value; |
|
var okDomain = 0; |
|
|
|
if (pickedDomain == dom) { |
|
if (pickedCourse != '') { |
|
var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse |
|
opener.document.title='Role selected. Please stand by.'; |
|
opener.status='Role selected. Please stand by.'; |
|
opener.document.rolechoice.newrole.value=courseTarget |
|
opener.document.rolechoice.submit() |
|
} |
|
} else { |
|
alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain"); |
|
} |
|
} |
|
|
|
</script> |
|
END |
|
return $process_pick; |
|
} |
} |
|
|
sub display_cc_role { |
sub display_cc_role { |
Line 1026 sub display_cc_role {
|
Line 1266 sub display_cc_role {
|
return ($roletext); |
return ($roletext); |
} |
} |
|
|
sub allcourses_row { |
sub adhoc_roles_row { |
my ($dcdom,$rowtype) = @_; |
my ($dcdom,$rowtype) = @_; |
my $output = '<tr bgcolor="#77FF77">'. |
my $output = '<tr bgcolor="#77FF77">'. |
' <td colspan="5">'; |
' <td colspan="5"><table><tr><td><span class="LC_rolesinfo">' |
my $selectlink = &courselink($dcdom,$rowtype); |
.&mt('[_1]Ad hoc[_2] roles in domain [_3] --', |
|
'<span class="LC_cusr_emph">','</span>',$dcdom).'</span></td><td>'; |
|
my $selectcclink = &courselink($dcdom,$rowtype); |
my $ccrole = &Apache::lonnet::plaintext('cc'); |
my $ccrole = &Apache::lonnet::plaintext('cc'); |
|
my $carole = &Apache::lonnet::plaintext('ca'); |
|
my $selectcalink = &coauthorlink($dcdom,$rowtype); |
$output.= '<span class="LC_rolesinfo">'. |
$output.= '<span class="LC_rolesinfo">'. |
&mt('[_1]: [_2] from domain [_3]',$ccrole,$selectlink,$dcdom). |
&mt('[_1]: [_2]',$ccrole,$selectcclink). |
'</span><br /></tr><tr><td colspan="5" height="3"></td></tr>'."\n"; |
'</span><br /></td><td> </td><td><span class="LC_rolesinfo">'. |
|
&mt('[_1]: [_2]',$carole,$selectcalink). |
|
'</span><br /></td></tr></table></td></tr>'. |
|
'<tr><td colspan="5" height="3"></td></tr>'."\n"; |
return $output; |
return $output; |
} |
} |
|
|
Line 1044 sub recent_filename {
|
Line 1291 sub recent_filename {
|
} |
} |
|
|
sub set_privileges { |
sub set_privileges { |
my ($dcdom,$pickedcourse) = @_; |
# role can be cc or ca |
|
my ($dcdom,$pickedcourse,$role) = @_; |
my $area = '/'.$dcdom.'/'.$pickedcourse; |
my $area = '/'.$dcdom.'/'.$pickedcourse; |
my $role = 'cc'; |
|
my $spec = $role.'.'.$area; |
my $spec = $role.'.'.$area; |
my %userroles = &Apache::lonnet::set_arearole($role,$area,'','', |
my %userroles = &Apache::lonnet::set_arearole($role,$area,'','', |
$env{'user.domain'}, |
$env{'user.domain'}, |
Line 1054 sub set_privileges {
|
Line 1301 sub set_privileges {
|
my %ccrole = (); |
my %ccrole = (); |
&Apache::lonnet::standard_roleprivs(\%ccrole,$role,$dcdom,$spec,$pickedcourse,$area); |
&Apache::lonnet::standard_roleprivs(\%ccrole,$role,$dcdom,$spec,$pickedcourse,$area); |
my ($author,$adv)= &Apache::lonnet::set_userprivs(\%userroles,\%ccrole); |
my ($author,$adv)= &Apache::lonnet::set_userprivs(\%userroles,\%ccrole); |
&Apache::lonnet::appenv(%userroles); |
&Apache::lonnet::appenv(\%userroles,[$role,'cm']); |
|
|
&Apache::lonnet::log($env{'user.domain'}, |
&Apache::lonnet::log($env{'user.domain'}, |
$env{'user.name'}, |
$env{'user.name'}, |
$env{'user.home'}, |
$env{'user.home'}, |
"Role ".$role); |
"Role ".$role); |
&Apache::lonnet::appenv( |
&Apache::lonnet::appenv( |
'request.role' => $spec, |
{'request.role' => $spec, |
'request.role.domain' => $dcdom, |
'request.role.domain' => $dcdom, |
'request.course.sec' => ''); |
'request.course.sec' => ''}); |
my $tadv=0; |
my $tadv=0; |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } |
&Apache::lonnet::appenv('request.role.adv' => $tadv); |
&Apache::lonnet::appenv({'request.role.adv' => $tadv}); |
} |
} |
|
|
sub courseloadpage { |
sub courseloadpage { |