version 1.182, 2008/01/26 21:12:32
|
version 1.184, 2008/03/04 22:44:21
|
Line 134 sub handler {
|
Line 134 sub handler {
|
last; |
last; |
} |
} |
# Is this a recent ad-hoc CA-role? |
# Is this a recent ad-hoc CA-role? |
if (my ($domain,$coursenum) = |
if (my ($domain,$user) = |
($envkey =~ m-^form\.ca\./($match_domain)/($match_courseid)$-)) { |
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { |
if ($dcroles{$domain}) { |
if (($dcroles{$domain}) && (&is_author_homeserver($user,$domain))) { |
&check_privs($domain,$coursenum,$then,$now,'ca'); |
&check_privs($domain,$user,$then,$now,'ca'); |
|
} else { |
|
delete($env{$envkey}); |
} |
} |
last; |
last; |
} |
} |
Line 147 sub handler {
|
Line 149 sub handler {
|
if ($dcroles{$domain}) { |
if ($dcroles{$domain}) { |
my $user=$env{'form.adhoccauname.'.$domain}; |
my $user=$env{'form.adhoccauname.'.$domain}; |
if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} }; |
if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} }; |
if (($user) && ($user=~/$match_username/)) { |
if (($user) && ($user=~/$match_username/) && (&is_author_homeserver($user,$domain))) { |
&check_privs($domain,$user,$then,$now,'ca'); |
&check_privs($domain,$user,$then,$now,'ca'); |
$env{'form.ca./'.$domain.'/'.$user}=1; |
$env{'form.ca./'.$domain.'/'.$user}=1; |
} |
} |
Line 387 ENDENTERKEY
|
Line 389 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 ba unavailable.').'</span><br />'; |
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 |
Line 905 sub build_roletext {
|
Line 907 sub build_roletext {
|
return $roletext; |
return $roletext; |
} |
} |
|
|
|
sub is_author_homeserver { |
|
my ($uname,$udom)=@_; |
|
my $home = &Apache::lonnet::homeserver($uname,$udom); |
|
my @ids=&Apache::lonnet::current_machine_ids(); |
|
foreach my $id (@ids) { |
|
if ($id eq $home) { |
|
if (-e "/home/".$uname."/public_html") { |
|
return 1; |
|
} |
|
} |
|
} |
|
return 0; |
|
} |
|
|
sub check_privs { |
sub check_privs { |
my ($cdom,$cnum,$then,$now,$checkrole) = @_; |
my ($cdom,$cnum,$then,$now,$checkrole) = @_; |
my $cckey = 'user.role.'.$checkrole.'./'.$cdom.'/'.$cnum; |
my $cckey = 'user.role.'.$checkrole.'./'.$cdom.'/'.$cnum; |
Line 954 sub courselink {
|
Line 970 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 type="text/javascript"> |
<script type="text/javascript"> |
function verifyCoursePick(caller) { |
function verifyCoursePick(caller) { |
Line 969 function verifyCoursePick(caller) {
|
Line 989 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 1063 sub set_privileges {
|
Line 1083 sub set_privileges {
|
&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); |
|
|
&Apache::lonnet::log($env{'user.domain'}, |
&Apache::lonnet::log($env{'user.domain'}, |
$env{'user.name'}, |
$env{'user.name'}, |
$env{'user.home'}, |
$env{'user.home'}, |