version 1.269.2.39.2.5, 2022/07/08 15:45:20
|
version 1.375, 2024/12/20 00:24:39
|
Line 140 use Apache::lonnavdisplay();
|
Line 140 use Apache::lonnavdisplay();
|
use Apache::loncoursequeueadmin; |
use Apache::loncoursequeueadmin; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
|
use Apache::lonplacementtest; |
use GDBM_File; |
use GDBM_File; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use HTML::Entities; |
use HTML::Entities; |
|
|
|
my $registered_cleanup; |
|
my $rosterupdates; |
|
|
sub start_loading_course { |
sub start_loading_course { |
my ($r,$title,$only_body) = @_; |
my ($r,$title,$only_body) = @_; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 186 sub finish_loading_course {
|
Line 190 sub finish_loading_course {
|
&HTML::Entities::encode($url,'"<>&').'">'.&mt('Continue').'</a></div>'; |
&HTML::Entities::encode($url,'"<>&').'">'.&mt('Continue').'</a></div>'; |
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
my $js_url = &js_escape($url); |
my $js_url = &js_escape($url); |
my $remote_js; |
|
if ($env{'environment.remote'} eq 'on') { |
|
my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect(); |
|
if ($menucoll) { |
|
&Apache::lonnet::put('environment',{'remote' => 'off'}); |
|
&Apache::lonnet::appenv({'environment.remote' => 'off'}); |
|
my $menu_name = &Apache::lonmenu::get_menu_name(); |
|
$remote_js = <<ENDCLOSE; |
|
window.status='Accessing Remote Control'; |
|
menu=window.open("/adm/rat/empty.html","$menu_name", |
|
"height=350,width=150,scrollbars=no,menubar=no"); |
|
window.status='Disabling Remote Control'; |
|
menu.active=0; |
|
menu.autologout=0; |
|
window.status='Closing Remote Control'; |
|
menu.close(); |
|
window.status='Done.'; |
|
ENDCLOSE |
|
} |
|
} |
|
my $reenable; |
my $reenable; |
unless ($only_body) { |
unless ($only_body) { |
$reenable = <<REENABLE; |
$reenable = <<REENABLE; |
Line 220 $msg
|
Line 204 $msg
|
\$(document).ready(function() { |
\$(document).ready(function() { |
\$("#LC_course_loaded").css("display","block"); |
\$("#LC_course_loaded").css("display","block"); |
$reenable |
$reenable |
$remote_js |
|
var url = "$js_url"; |
var url = "$js_url"; |
\$(location).attr('href',url); |
\$(location).attr('href',url); |
}); |
}); |
Line 238 sub redirect_user {
|
Line 221 sub redirect_user {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
my $swinfo=&Apache::lonmenu::rawconfig(); |
|
|
|
# Breadcrumbs |
my $start_page; |
my $brcrum = [{'href' => $url, |
if ($env{'request.lti.login'}) { |
'text' => 'Switching Role'},]; |
$start_page = &Apache::loncommon::start_page(undef,undef, |
my $start_page = &Apache::loncommon::start_page('Switching Role',undef, |
{'redirect' => [0,$url],}).$msg; |
{'redirect' => [1,$url], |
} else { |
'bread_crumbs' => $brcrum,}); |
# Breadcrumbs |
my $end_page = &Apache::loncommon::end_page(); |
my $brcrum = [{'href' => $url, |
|
'text' => 'Switching Role'},]; |
|
$start_page = &Apache::loncommon::start_page('Switching Role',undef, |
|
{'redirect' => [1,$url], |
|
'bread_crumbs' => $brcrum,}). |
|
"\n<p>$msg</p>"; |
|
} |
|
my $end_page = &Apache::loncommon::end_page(); |
|
|
# Note to style police: |
# Note to style police: |
# This must only replace the spaces, nothing else, or it bombs elsewhere. |
# This must only replace the spaces, nothing else, or it bombs elsewhere. |
$url=~s/ /\%20/g; |
$url=~s/ /\%20/g; |
$r->print(<<ENDREDIR); |
$r->print(<<ENDREDIR); |
$start_page |
$start_page |
<script type="text/javascript"> |
|
// <![CDATA[ |
|
$swinfo |
|
// ]]> |
|
</script> |
|
<p>$msg</p> |
|
$end_page |
$end_page |
ENDREDIR |
ENDREDIR |
return; |
return; |
Line 428 sub handler {
|
Line 411 sub handler {
|
} |
} |
} |
} |
|
|
|
$registered_cleanup=0; |
|
@{$rosterupdates}=(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
|
# -------------------------------------------------- Check if setting hot list |
# -------------------------------------------------- Check if setting hot list |
Line 459 sub handler {
|
Line 444 sub handler {
|
$reqauthor = &Apache::loncoursequeueadmin::process_reqauthor(\$update); |
$reqauthor = &Apache::loncoursequeueadmin::process_reqauthor(\$update); |
} |
} |
|
|
|
# ------------------------------------------------- Check for approval results |
|
my $approvalresult; |
|
if (($env{'form.approvals'} eq 'show') && ($env{'form.state'} eq 'done')) { |
|
$approvalresult = &Apache::loncoursequeueadmin::update_request_queue('othdombyuser', |
|
$env{'user.domain'}); |
|
} |
my $envkey; |
my $envkey; |
my %dcroles = (); |
my %dcroles = (); |
my %helpdeskroles = (); |
my %helpdeskroles = (); |
my ($numdc,$numhelpdesk,$numadhoc) = |
my ($numdc,$numhelpdesk,$numadhoc) = |
&check_for_adhoc(\%dcroles,\%helpdeskroles,$update,$then); |
&check_for_adhoc(\%dcroles,\%helpdeskroles,$update,$then); |
my $loncaparev = $r->dir_config('lonVersion'); |
my $loncaparev = $r->dir_config('lonVersion'); |
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($env{'form.selectrole'}) { |
if ($env{'form.selectrole'}) { |
|
if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq '')) { |
|
if ($env{'form.ltitarget'} eq 'iframe') { |
|
&Apache::lonnet::appenv({'request.lti.target' => 'iframe'}); |
|
delete($env{'form.ltitarget'}); |
|
} |
|
} |
|
|
my $locknum=&Apache::lonnet::get_locks(); |
my $locknum=&Apache::lonnet::get_locks(); |
if ($locknum) { return 409; } |
if ($locknum) { return 409; } |
Line 508 sub handler {
|
Line 505 sub handler {
|
"request.course.sec" => '', |
"request.course.sec" => '', |
"request.course.tied" => '', |
"request.course.tied" => '', |
"request.course.timechecked" => '', |
"request.course.timechecked" => '', |
|
"request.course.suppupdated" => '', |
"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'}}); |
Line 520 sub handler {
|
Line 518 sub handler {
|
if ($custom_adhoc) { |
if ($custom_adhoc) { |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($cdom.'_'.$cnum,1); |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($cdom.'_'.$cnum,1); |
if (ref($possroles) eq 'ARRAY') { |
if (ref($possroles) eq 'ARRAY') { |
if (grep(/^\Q$rolename\E$/,@{$possroles})) { |
if (grep(/^\Q$rolename\E$/,@{$possroles})) { |
if (&Apache::lonnet::check_adhoc_privs($cdom,$cnum,$update,$refresh,$now, |
if (&Apache::lonnet::check_adhoc_privs($cdom,$cnum,$update,$refresh,$now, |
"cr/$cdom/$cdom".'-domainconfig/'.$rolename,undef,$sec)) { |
"cr/$cdom/$cdom".'-domainconfig/'.$rolename,undef,$sec)) { |
&Apache::lonnet::appenv({"environment.internal.$cdom.$cnum.cr/$cdom/$cdom".'-domainconfig/'."$rolename.adhoc" => time}); |
&Apache::lonnet::appenv({"environment.internal.$cdom.$cnum.cr/$cdom/$cdom".'-domainconfig/'."$rolename.adhoc" => time}); |
Line 532 sub handler {
|
Line 530 sub handler {
|
# 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 or author space and needs privs to be created |
# Check if user is a DH or DA trying to enter a course and needs privs to be created |
# Check if user is a DH or DA trying to enter a course and needs privs to be created |
foreach my $envkey (keys(%env)) { |
foreach my $envkey (keys(%env)) { |
if ($numdc) { |
|
# Is this an ad-hoc Coordinator role? |
# Is this an ad-hoc Coordinator role? |
|
if ($numdc) { |
if (my ($ccrole,$domain,$coursenum) = |
if (my ($ccrole,$domain,$coursenum) = |
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) { |
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) { |
if ($dcroles{$domain}) { |
if ($dcroles{$domain}) { |
Line 624 sub handler {
|
Line 622 sub handler {
|
} |
} |
last; |
last; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
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 706 sub handler {
|
Line 703 sub handler {
|
$env{'user.name'}, |
$env{'user.name'}, |
&mt('Assigned from [_1] at [_2] for [_3]' |
&mt('Assigned from [_1] at [_2] for [_3]' |
,$ip |
,$ip |
,&Apache::lonlocal::locallocaltime() |
,&Apache::lonlocal::locallocaltime($now) |
,$trolecode) |
,$trolecode) |
); |
); |
unless ($assignresult eq 'ok') { |
unless ($assignresult eq 'ok') { |
Line 835 ENDCLOSE
|
Line 832 ENDCLOSE
|
$furl = '/adm/roles?tryagain=1'; |
$furl = '/adm/roles?tryagain=1'; |
} else { |
} else { |
&Apache::lonnet::appenv({'request.course.timechecked'=>$now}); |
&Apache::lonnet::appenv({'request.course.timechecked'=>$now}); |
unless (($env{'form.switchrole'}) || |
unless (($env{'form.switchrole'}) || |
($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) { |
($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) { |
&Apache::lonnet::put('nohist_crslastlogin', |
&Apache::lonnet::put('nohist_crslastlogin', |
{$env{'user.name'}.':'.$env{'user.domain'}. |
{$env{'user.name'}.':'.$env{'user.domain'}. |
Line 863 ENDCLOSE
|
Line 860 ENDCLOSE
|
my ($feeds,$syllabus_time); |
my ($feeds,$syllabus_time); |
&Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds); |
&Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds); |
&Apache::lonnet::appenv({'request.course.feeds' => $feeds}); |
&Apache::lonnet::appenv({'request.course.feeds' => $feeds}); |
&Apache::lonnet::get_numsuppfiles($cnum,$cdom,1); |
|
unless ($env{'course.'.$cdom.'_'.$cnum.'.updatedsyllabus'}) { |
unless ($env{'course.'.$cdom.'_'.$cnum.'.updatedsyllabus'}) { |
unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) || |
unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) || |
($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) { |
($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) { |
Line 877 ENDCLOSE
|
Line 873 ENDCLOSE
|
} |
} |
if (($env{'form.orgurl'}) && |
if (($env{'form.orgurl'}) && |
($env{'form.orgurl'}!~/^\/adm\/flip/) && |
($env{'form.orgurl'}!~/^\/adm\/flip/) && |
($env{'form.orgurl'} ne '/adm/roles')) { |
($env{'form.orgurl'} ne '/adm/roles')) { |
my $dest=$env{'form.orgurl'}; |
my $dest=$env{'form.orgurl'}; |
if ($env{'form.symb'}) { |
if ($env{'form.symb'}) { |
if ($dest =~ /\?/) { |
if ($dest =~ /\?/) { |
Line 896 ENDCLOSE
|
Line 892 ENDCLOSE
|
if ($env{'form.symb'}) { |
if ($env{'form.symb'}) { |
$furl .= '&symb='.&HTML::Entities::encode($env{'form.symb'},'<>&"'); |
$furl .= '&symb='.&HTML::Entities::encode($env{'form.symb'},'<>&"'); |
} |
} |
|
} else { |
|
&set_supplemental_access($cnum,$cdom); |
} |
} |
if (($ferr) && ($tadv)) { |
if (($ferr) && ($tadv)) { |
&error_page($r,$ferr,$furl); |
&error_page($r,$ferr,$furl); |
} else { |
} else { |
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
if (($env{'form.orgurl'} ne '') && ($env{'form.symb'} ne '')) { |
if (($env{'form.orgurl'} ne '') && ($env{'form.symb'} ne '')) { |
unless (&Apache::lonnet::symbverify($env{'form.symb'},$env{'form.orgurl'})) { |
unless (&Apache::lonnet::symbverify($env{'form.symb'},$env{'form.orgurl'})) { |
$dest=$env{'form.orgurl'}; |
$dest=$env{'form.orgurl'}; |
} |
} |
} |
} |
} |
} |
if ($dest =~ m{^/adm/coursedocs\?folderpath}) { |
if ($dest =~ m{^/adm/coursedocs\?folderpath}) { |
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
Line 927 ENDCLOSE
|
Line 925 ENDCLOSE
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
} else { |
} else { |
|
if (($env{'request.lti.login'}) && |
|
($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) { |
|
&process_lti($r,$cdom,$cnum); |
|
} |
if ($env{'request.deeplink.login'}) { |
if ($env{'request.deeplink.login'}) { |
&set_deeplink_target($cnum,$cdom); |
&set_deeplink_target($cnum,$cdom); |
} |
} |
Line 942 ENDCLOSE
|
Line 944 ENDCLOSE
|
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}); |
} |
} |
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) { |
if ($ferr) { |
if ($tadv) { |
if ($tadv) { |
&error_page($r,$ferr,$furl); |
&error_page($r,$ferr,$furl); |
} else { |
} else { |
$r->print('<p class="LC_error">'. |
$r->print('<p class="LC_error">'. |
&mt('Could not initialize [_1] at this time.', |
&mt('Could not initialize [_1] at this time.', |
Line 957 ENDCLOSE
|
Line 959 ENDCLOSE
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
} else { |
} else { |
|
&set_supplemental_access($cnum,$cdom); |
|
if (($env{'request.lti.login'}) && |
|
($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) { |
|
&process_lti($r,$cdom,$cnum); |
|
} |
if ($env{'request.deeplink.login'}) { |
if ($env{'request.deeplink.login'}) { |
&set_deeplink_target($cnum,$cdom); |
&set_deeplink_target($cnum,$cdom); |
} |
} |
Line 967 ENDCLOSE
|
Line 974 ENDCLOSE
|
$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 ((&Apache::loncommon::course_type() eq 'Placement') && |
|
(!$env{'request.role.adv'})) { |
|
my ($score,$incomplete) = |
|
&Apache::lonplacementtest::check_completion(undef,undef,1); |
|
if (($incomplete) && ($incomplete < 100)) { |
|
$msg = '<p>'.&mt('Entering [_1] ...', |
|
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
|
'</p>'; |
|
&finish_loading_course($r,$msg,'/adm/placement',$only_body); |
|
$r->rflush(); |
|
return OK; |
|
} |
|
} |
my ($dest,$destsymb,$checkenc); |
my ($dest,$destsymb,$checkenc); |
$dest = $env{'form.destinationurl'}; |
$dest = $env{'form.destinationurl'}; |
$destsymb = $env{'form.destsymb'}; |
$destsymb = $env{'form.destsymb'}; |
Line 995 ENDCLOSE
|
Line 1015 ENDCLOSE
|
if ($env{'request.role.adv'}) { |
if ($env{'request.role.adv'}) { |
$dest = &Apache::lonenc::unencrypted($dest); |
$dest = &Apache::lonenc::unencrypted($dest); |
if ($destsymb eq '') { |
if ($destsymb eq '') { |
($destsymb) = ($dest =~ /(?:\?|\&)symb=([^\&]*)/); |
($destsymb) = ($dest =~ /(?:\?|\&)symb=([^\&]*)/); |
$destsymb = &unescape($destsymb); |
$destsymb = &unescape($destsymb); |
} |
} |
} |
} |
Line 1020 ENDCLOSE
|
Line 1040 ENDCLOSE
|
} |
} |
} |
} |
} |
} |
unless (($dest =~ m{^/enc/}) || ($dest =~ /(\?|\&)symb=.+___\d+___.+/)) { |
unless (($dest =~ m{^/enc/}) || ($dest =~ /(\?|\&)symb=.+___\d+___.+/)) { |
if (($destsymb ne '') && ($destsymb !~ m{^/enc/})) { |
if (($destsymb ne '') && ($destsymb !~ m{^/enc/})) { |
my $esc_symb = &escape($destsymb); |
my $esc_symb = &escape($destsymb); |
$dest .= (($dest =~/\?/)? '&':'?').'symb='.$esc_symb; |
$dest .= (($dest =~/\?/)? '&':'?').'symb='.$esc_symb; |
Line 1029 ENDCLOSE
|
Line 1049 ENDCLOSE
|
if ($env{'form.ttoken'}) { |
if ($env{'form.ttoken'}) { |
$dest .= (($dest =~/\?/)? '&':'?').'ttoken='.$env{'form.ttoken'}; |
$dest .= (($dest =~/\?/)? '&':'?').'ttoken='.$env{'form.ttoken'}; |
} |
} |
unless ($env{'request.deeplink.login'}) { |
unless (($env{'request.lti.login'}) || ($env{'request.deeplink.login'})) { |
$msg = '<p>'.&mt('Entering [_1] ...', |
$msg = '<p>'.&mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
'</p>'; |
'</p>'; |
Line 1051 ENDCLOSE
|
Line 1071 ENDCLOSE
|
'</p>'; |
'</p>'; |
&finish_loading_course($r,$msg,'/adm/whatsnew?refpage=start',$only_body); |
&finish_loading_course($r,$msg,'/adm/whatsnew?refpage=start',$only_body); |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
} |
} |
} |
} |
} |
} |
# Are we allowed to look at the first resource? |
# Are we allowed to look at the first resource? |
# |
# |
# $furl returned by lonuserstate::readmap() has format: |
# $furl returned by lonuserstate::readmap() has format: |
# $url?symb=escaped($symb). If the resource has the |
# $url?symb=escaped($symb). If the resource has the |
# encrypturl parameter in effect, the entire string |
# encrypturl parameter in effect, the entire string |
# $url?symb=escaped($symb) is encrypted as a string |
# $url?symb=escaped($symb) is encrypted as a string |
# beginning /enc/. |
# beginning /enc/. |
# |
# |
my ($access,$unencfurl,$unencsymb); |
my ($access,$unencfurl,$unencsymb); |
if ($furl =~ m{^(.+)(?:\?|\&)symb=([^&]+)(?:$|&)}) { |
if ($furl =~ m{^(.+)(?:\?|\&)symb=([^&]+)(?:$|&)}) { |
my ($poss_url,$poss_symb) = ($1,$2); |
my ($poss_url,$poss_symb) = ($1,$2); |
Line 1095 ENDCLOSE
|
Line 1115 ENDCLOSE
|
$furl = '/adm/navmaps?showOnlyHomework=1'; |
$furl = '/adm/navmaps?showOnlyHomework=1'; |
} |
} |
} |
} |
$msg = '<p>'.&mt('Entering [_1] ...', |
if ($env{'request.lti.login'}) { |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
undef($msg); |
'</p>'; |
&finish_loading_course($r,$msg,$furl,$only_body); |
&finish_loading_course($r,$msg,$furl,$only_body); |
} else { |
|
$msg = '<p>'.&mt('Entering [_1] ...', |
|
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
|
'</p>'; |
|
&finish_loading_course($r,$msg,$furl,$only_body); |
|
} |
} |
} |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
} |
} |
} |
} |
# |
# |
Line 1114 ENDCLOSE
|
Line 1139 ENDCLOSE
|
$redirect_url .= $where; |
$redirect_url .= $where; |
} |
} |
$redirect_url .= '/'; |
$redirect_url .= '/'; |
|
if ($env{'form.orgurl'} =~ /^\Q$redirect_url\E/) { |
|
my ($path) = ($env{'form.orgurl'} =~ m{^(.+)/[^/]+$}); |
|
if (($path ne '') && (-e $Apache::lonnet::perlvar{'lonDocRoot'}.$path)) { |
|
$redirect_url = $env{'form.orgurl'}; |
|
} |
|
} |
&redirect_user($r,&mt('Entering Authoring Space'), |
&redirect_user($r,&mt('Entering Authoring Space'), |
$redirect_url); |
$redirect_url); |
return OK; |
return OK; |
Line 1181 ENDCLOSE
|
Line 1212 ENDCLOSE
|
if ($domdefs{'catauth'}) { |
if ($domdefs{'catauth'}) { |
$cattype = $domdefs{'catauth'}; |
$cattype = $domdefs{'catauth'}; |
} |
} |
my ($funcs,$crumbsright); |
my $placementonly; |
unless (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) { |
if ($showcount == 1) { |
$funcs = &get_roles_functions($showcount,$cattype); |
if ($env{'request.course.id'}) { |
if ($env{'browser.mobile'}) { |
if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') { |
$crumbsright = $funcs; |
$placementonly = 1; |
undef($funcs); |
} |
|
} else { |
|
foreach my $rolecode (keys(%roles_in_env)) { |
|
my ($cid) = ($rolecode =~ m{^\Quser.role.st./\E($match_domain/$match_courseid)(?:/|$)}); |
|
if ($cid) { |
|
my %coursedescription = |
|
&Apache::lonnet::coursedescription($cid,{'one_time' => '1'}); |
|
if ($coursedescription{'type'} eq 'Placement') { |
|
$placementonly = 1; |
|
} |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
my ($start_page,$funcs); |
|
if ($placementonly) { |
|
$start_page=&Apache::loncommon::start_page($pagetitle,undef, |
|
{bread_crumbs=>$brcrum,crstype=>'Placement'}); |
|
} else { |
|
my ($crumbsright,$crumbs_style); |
|
unless (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) { |
|
$funcs = &get_roles_functions($showcount,$cattype,$domdefs{'userapprovals'}); |
|
if ($env{'browser.mobile'}) { |
|
$crumbsright = $funcs; |
|
undef($funcs); |
|
$crumbs_style = 'overflow: visible;'; |
|
} |
} |
} |
|
$start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum, |
|
bread_crumbs_component=>$crumbsright, |
|
bread_crumbs_style=>$crumbs_style,}); |
} |
} |
my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum, |
|
bread_crumbs_component=>$crumbsright}); |
|
&js_escape(\$standby); |
&js_escape(\$standby); |
my $noscript='<br /><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 />'; |
my $noscript='<br /><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 />'; |
|
|
Line 1220 function enterrole (thisform,rolecode,bu
|
Line 1279 function enterrole (thisform,rolecode,bu
|
} |
} |
|
|
function rolesView (caller) { |
function rolesView (caller) { |
if ((caller == 'showall') || (caller == 'noshowall')) { |
if (caller == 'approvals') { |
|
document.rolechoice.approvals.value = 'show'; |
|
} else if (caller == 'noapprovals') { |
|
document.rolechoice.approvals.value = 'hide'; |
|
} else if ((caller == 'showall') || (caller == 'noshowall')) { |
document.rolechoice.display.value = caller; |
document.rolechoice.display.value = caller; |
} else { |
} else { |
if ((caller == 'doupdate') || (caller == 'requestauthor') || |
if ((caller == 'doupdate') || (caller == 'requestauthor') || |
(caller == 'queued')) { |
(caller == 'queued')) { |
document.rolechoice.state.value = caller; |
document.rolechoice.state.value = caller; |
} |
} |
} |
} |
Line 1303 ENDHEADER
|
Line 1366 ENDHEADER
|
&mt('You may need to login to LON-CAPA directly, or re-launch from a different external system.'). |
&mt('You may need to login to LON-CAPA directly, or re-launch from a different external system.'). |
'</span></h4>'); |
'</span></h4>'); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} else { |
} else { |
if ($updateresult || $reqauthor || $hotlist) { |
if ($updateresult || $reqauthor || $hotlist) { |
Line 1321 ENDHEADER
|
Line 1384 ENDHEADER
|
$r->print($showresult); |
$r->print($showresult); |
} elsif ($env{'form.state'} eq 'queued') { |
} elsif ($env{'form.state'} eq 'queued') { |
$r->print(&get_queued()); |
$r->print(&get_queued()); |
|
} elsif ($env{'form.approvals'} eq 'show') { |
|
if ($env{'form.state'} eq 'done') { |
|
$r->print($approvalresult).'<br />'; |
|
} |
|
$r->print('<div class="LC_left_float"><fieldset><legend>'.&mt('Role assignments queued pending your acceptance').'</legend>'. |
|
&get_approvals(). |
|
'</fieldset></div><br clear="all" />'); |
} |
} |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
} |
} |
my $display = ($env{'form.display'} =~ /^(showall)$/); |
my $display = ($env{'form.display'} =~ /^(showall)$/); |
|
my $approvals = ($env{'form.approvals'} =~ /^(show)$/); |
$r->print('<form method="post" name="rolechoice" action="'.(($fn)?$fn:$r->uri).'">'); |
$r->print('<form method="post" name="rolechoice" action="'.(($fn)?$fn:$r->uri).'">'); |
$r->print('<input type="hidden" name="orgurl" value="'.$fn.'" />'); |
$r->print('<input type="hidden" name="orgurl" value="'.$fn.'" />'); |
$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="" />'); |
$r->print('<input type="hidden" name="display" value="'.$display.'" />'); |
$r->print('<input type="hidden" name="display" value="'.$display.'" />'); |
$r->print('<input type="hidden" name="state" value="" />'); |
$r->print('<input type="hidden" name="state" value="" />'); |
|
$r->print('<input type="hidden" name="approvals" value="'.$approvals.'" />'); |
if ($blocked_by_ip) { |
if ($blocked_by_ip) { |
my $blocked_role = 'student'; |
my $blocked_role = 'student'; |
if ($blocked_type eq 'Community') { |
if ($blocked_type eq 'Community') { |
Line 1351 ENDHEADER
|
Line 1423 ENDHEADER
|
\%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev); |
\%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev); |
$refresh = $now; |
$refresh = $now; |
&Apache::lonnet::appenv({'user.refresh.time' => $refresh}); |
&Apache::lonnet::appenv({'user.refresh.time' => $refresh}); |
if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'})) { |
if ($countactive == 1) { |
|
if ($env{'request.course.id'}) { |
|
if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') { |
|
$placementonly = 1; |
|
} |
|
} elsif ($possiblerole) { |
|
if ($possiblerole =~ m{^st\./($match_domain)/($match_courseid)(?:/|$)}) { |
|
if ($env{'course.'.$1.'_'.$2.'.type'} eq 'Placement') { |
|
$placementonly = 1; |
|
} |
|
} |
|
} |
|
} |
|
if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'}) && |
|
(!$placementonly)) { |
if ($countactive > 0) { |
if ($countactive > 0) { |
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
Line 1428 ENDHEADER
|
Line 1514 ENDHEADER
|
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
|
} elsif (($placementonly) && ($env{'request.role'} eq 'cm')) { |
|
$r->print('<h3>'.&mt('Please stand by.').'</h3> |
|
<input type="hidden" name="'.$possiblerole.'" value="1" /> |
|
<noscript><br /> |
|
<input type="submit" name="submit" value="'.&mt('Continue').'" /> |
|
</noscript></form>'); |
|
$r->rflush(); |
|
$r->print('<script type="text/javascript">document.forms.rolechoice.submit();</script>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
} |
} |
# ----------------------------------------------------------------------- Table |
# ----------------------------------------------------------------------- Table |
|
|
Line 1575 sub gather_roles {
|
Line 1671 sub gather_roles {
|
my $advanced = $env{'user.adv'}; |
my $advanced = $env{'user.adv'}; |
my $tryagain = $env{'form.tryagain'}; |
my $tryagain = $env{'form.tryagain'}; |
my @ids = &Apache::lonnet::current_machine_ids(); |
my @ids = &Apache::lonnet::current_machine_ids(); |
|
my (%willtrust,%trustchecked); |
if (ref($roles_in_env) eq 'HASH') { |
if (ref($roles_in_env) eq 'HASH') { |
my %adhocdesc; |
my %adhocdesc; |
foreach my $envkey (sort(keys(%{$roles_in_env}))) { |
foreach my $envkey (sort(keys(%{$roles_in_env}))) { |
Line 1643 sub gather_roles {
|
Line 1740 sub gather_roles {
|
if (($role eq 'ca') || ($role eq 'aa')) { |
if (($role eq 'ca') || ($role eq 'aa')) { |
my $home = &Apache::lonnet::homeserver($trest,$tdom); |
my $home = &Apache::lonnet::homeserver($trest,$tdom); |
my $allowed=0; |
my $allowed=0; |
|
my $prohibited; |
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } |
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } |
if (!$allowed) { |
if (!$allowed) { |
$button=0; |
$button=0; |
$switchserver='otherserver='.$home.'&role='.$trolecode; |
unless ($trustchecked{$tdom}) { |
|
if ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$tdom)) && |
|
(&Apache::lonnet::will_trust('coaurem',$tdom,$env{'user.domain'}))) { |
|
$willtrust{$tdom} = 1; |
|
$trustchecked{$tdom} = 1; |
|
} |
|
} |
|
if ($willtrust{$tdom}) { |
|
$switchserver='otherserver='.$home.'&role='.$trolecode; |
|
} else { |
|
$prohibited = 1; |
|
$tremark .= &mt('Session switch required but prohibited.'); |
|
} |
} |
} |
#next if ($home eq 'no_host'); |
#next if ($home eq 'no_host'); |
$home = &Apache::lonnet::hostname($home); |
$home = &Apache::lonnet::hostname($home); |
Line 1655 sub gather_roles {
|
Line 1765 sub gather_roles {
|
': '.$tdom.'<br />'. |
': '.$tdom.'<br />'. |
' '.&mt('Server').': '.$home; |
' '.&mt('Server').': '.$home; |
$env{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
$env{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
$tremark.=&Apache::lonhtmlcommon::authorbombs('/res/'.$tdom.'/'.$trest.'/'); |
unless ($prohibited) { |
|
$tremark.=&Apache::lonhtmlcommon::authorbombs('/res/'.$tdom.'/'.$trest.'/'); |
|
} |
$sortkey=$role."$trest:$tdom"; |
$sortkey=$role."$trest:$tdom"; |
} elsif ($role eq 'au') { |
} elsif ($role eq 'au') { |
# Authors |
# Authors |
Line 1691 sub gather_roles {
|
Line 1803 sub gather_roles {
|
foreach my $rolename (sort(keys(%{$domdef{'adhocroles'}}))) { |
foreach my $rolename (sort(keys(%{$domdef{'adhocroles'}}))) { |
if (ref($domdef{'adhocroles'}{$rolename}) eq 'HASH') { |
if (ref($domdef{'adhocroles'}{$rolename}) eq 'HASH') { |
$adhocdesc{$tdom}{$rolename} = $domdef{'adhocroles'}{$rolename}{'desc'}; |
$adhocdesc{$tdom}{$rolename} = $domdef{'adhocroles'}{$rolename}{'desc'}; |
$desc = $adhocdesc{$tdom}{$rolename}; |
|
} |
} |
} |
} |
|
$desc = $adhocdesc{$tdom}{$rolename}; |
} |
} |
} |
} |
if ($desc ne '') { |
if ($desc ne '') { |
Line 1754 sub gather_roles {
|
Line 1866 sub gather_roles {
|
$skipcal = 1; |
$skipcal = 1; |
} |
} |
} |
} |
|
if ($ttype eq 'Placement') { |
|
$ttype = 'Placement Test'; |
|
} |
if ($tsection) { |
if ($tsection) { |
$twhere.='<br />'.&mt('Section').': '.$tsection; |
$twhere.='<br />'.&mt('Section').': '.$tsection; |
} |
} |
Line 1869 sub roletable_headers {
|
Line 1984 sub roletable_headers {
|
} |
} |
|
|
sub roletypes { |
sub roletypes { |
my @types = ('Domain','Authoring Space','Course','Community','Unavailable','System'); |
my @types = ('Domain','Authoring Space','Course','Placement Test','Community','Unavailable','System'); |
return @types; |
return @types; |
} |
} |
|
|
Line 1931 sub findcourse_advice {
|
Line 2046 sub findcourse_advice {
|
<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('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('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> |
<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> |
<li>'.&mt('Automated enrollment added you to the course in the time since you last logged-in.').' '.&mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'</li> |
<li>'.&mt('Automated enrollment added you to the course in the time since you last logged-in.').' '.&mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'</li> |
</ul></p>'); |
</ul></p>'); |
} else { |
} else { |
$r->print('<p>'.&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'</p>'); |
$r->print('<p>'.&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'</p>'); |
Line 1939 sub findcourse_advice {
|
Line 2054 sub findcourse_advice {
|
$r->print('<p>'.&mt('You may also have been assigned to a course in the time since you last logged-in, or checked for changes.'). |
$r->print('<p>'.&mt('You may also have been assigned to a course in the time since you last logged-in, or checked for changes.'). |
'<br />'. |
'<br />'. |
&mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'</p>'); |
&mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'</p>'); |
} |
} |
} |
} |
if (($cattype eq 'std') || ($cattype eq 'domonly')) { |
if (($cattype eq 'std') || ($cattype eq 'domonly')) { |
$r->print('<h3>'.&mt('Self-Enrollment').'</h3>'. |
$r->print('<h3>'.&mt('Self-Enrollment').'</h3>'. |
Line 2132 sub build_roletext {
|
Line 2247 sub build_roletext {
|
$trolecode."','".$buttonname.'\');" /></td>'; |
$trolecode."','".$buttonname.'\');" /></td>'; |
} |
} |
} |
} |
if (($trolecode !~ m/^(dc|ca|au|aa)\./) && (!$skipcal)) { |
if (($trolecode !~ m/^(ca|aa)\./) && ($trest ne '') && (!$skipcal)) { |
$tremark.=&Apache::lonannounce::showday(time,1, |
$tremark.=&Apache::lonannounce::showday(time,1, |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
} |
} |
Line 2170 sub check_for_adhoc {
|
Line 2285 sub check_for_adhoc {
|
my $numdc = 0; |
my $numdc = 0; |
my $numhelpdesk = 0; |
my $numhelpdesk = 0; |
my $numadhoc = 0; |
my $numadhoc = 0; |
my $num_custom_adhoc = 0; |
my $num_custom_adhoc = 0; |
if (($env{'user.adv'}) || ($env{'user.rar'})) { |
if (($env{'user.adv'}) || ($env{'user.rar'})) { |
foreach my $envkey (sort(keys(%env))) { |
foreach my $envkey (sort(keys(%env))) { |
if ($envkey=~/^user\.role\.(dc|dh|da)\.\/($match_domain)\/$/) { |
if ($envkey=~/^user\.role\.(dc|dh|da)\.\/($match_domain)\/$/) { |
Line 2389 sub display_cc_role {
|
Line 2504 sub display_cc_role {
|
} else { |
} else { |
$twhere=&mt('Currently not available'); |
$twhere=&mt('Currently not available'); |
$env{'course.'.$tcourseid.'.description'}=$twhere; |
$env{'course.'.$tcourseid.'.description'}=$twhere; |
$skipcal = 1; |
$skipcal = 1; |
} |
} |
my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid); |
my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid); |
$twhere.="<br />".&mt('Domain').":".$tdom; |
$twhere.="<br />".&mt('Domain').":".$tdom; |
Line 2414 sub display_curr_role {
|
Line 2529 sub display_curr_role {
|
my $ttype = $env{'course.'.$cid.'.type'}; |
my $ttype = $env{'course.'.$cid.'.type'}; |
my $skipcal = 1; |
my $skipcal = 1; |
my $tbg='LC_roles_is'; |
my $tbg='LC_roles_is'; |
my $twhere = $env{'course.'.$cid.'.description'}. |
my $twhere = $env{'course.'.$cid.'.description'}. |
' <span class="LC_fontsize_small">'. |
' <span class="LC_fontsize_small">'. |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$cnum,$cdom). |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$cnum,$cdom). |
'</span>'; |
'</span>'; |
Line 2460 sub adhoc_customroles_row {
|
Line 2575 sub adhoc_customroles_row {
|
if ($tstart && $tstart>$limit) { $liverole = 0; } |
if ($tstart && $tstart>$limit) { $liverole = 0; } |
if ($tend && $tend <$limit) { $liverole = 0; } |
if ($tend && $tend <$limit) { $liverole = 0; } |
return unless ($liverole); |
return unless ($liverole); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dhdom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dhdom); |
if (ref($domdefaults{'adhocroles'}) eq 'HASH') { |
if (ref($domdefaults{'adhocroles'}) eq 'HASH') { |
if (scalar(keys(%{$domdefaults{'adhocroles'}})) > 0) { |
if (scalar(keys(%{$domdefaults{'adhocroles'}})) > 0) { |
return &Apache::loncommon::continue_data_table_row() |
return &Apache::loncommon::continue_data_table_row() |
Line 2591 sub update_session_roles {
|
Line 2706 sub update_session_roles {
|
} |
} |
} else { |
} else { |
$newrole{$rolekey} = $status_in_db; |
$newrole{$rolekey} = $status_in_db; |
|
if ($role eq 'au') { |
|
my %userenv = |
|
&Apache::lonnet::userenvironment($env{'user.domain'}, |
|
$env{'user.name'},'authoreditors'); |
|
if ($userenv{'authoreditors'}) { |
|
$userenv{'editors'} = $userenv{'authoreditors'}; |
|
} else { |
|
my %domdef = &Apache::lonnet::get_domain_defaults($env{'user.domain'}); |
|
if ($domdef{'editors'} ne '') { |
|
$userenv{'editors'} = $domdef{'editors'}; |
|
} else { |
|
$userenv{'editors'} = 'edit,xml'; |
|
} |
|
} |
|
&Apache::lonnet::appenv(\%userenv); |
|
} |
} |
} |
} |
} |
} |
} |
Line 2790 sub update_session_roles {
|
Line 2921 sub update_session_roles {
|
&curr_role_status($currstart,$currend,$refresh,$update); |
&curr_role_status($currstart,$currend,$refresh,$update); |
my ($rolekey) = ($envkey =~ /^user\.role\.(.+)$/); |
my ($rolekey) = ($envkey =~ /^user\.role\.(.+)$/); |
my ($role,$rest)=split(m{\./},$rolekey,2); |
my ($role,$rest)=split(m{\./},$rolekey,2); |
$rest = '/'.$rest; |
$rest = '/'.$rest; |
if (&Apache::lonnet::delenv($envkey,undef,[$role])) { |
if (&Apache::lonnet::delenv($envkey,undef,[$role])) { |
if ($status_in_env eq 'active') { |
if ($status_in_env eq 'active') { |
if ($role eq 'gr') { |
if ($role eq 'gr') { |
Line 2990 sub update_session_roles {
|
Line 3121 sub update_session_roles {
|
} |
} |
my $groupdesc; |
my $groupdesc; |
unless (ref($curr_groups{$cdom.'_'.$cnum}) eq 'HASH') { |
unless (ref($curr_groups{$cdom.'_'.$cnum}) eq 'HASH') { |
%{$curr_groups{$cdom.'_'.$cnum}} = |
%{$curr_groups{$cdom.'_'.$cnum}} = |
&Apache::longroup::coursegroups($cdom,$cnum); |
&Apache::longroup::coursegroups($cdom,$cnum); |
} |
} |
unless ((ref($groupdescs{$cdom.'_'.$cnum}) eq 'HASH') && |
unless ((ref($groupdescs{$cdom.'_'.$cnum}) eq 'HASH') && |
($groupdescs{$cdom.'_'.$cnum}{$group})) { |
($groupdescs{$cdom.'_'.$cnum}{$group})) { |
|
|
my %groupinfo = |
my %groupinfo = |
&Apache::longroup::get_group_settings($curr_groups{$cdom.'_'.$cnum}{$group}); |
&Apache::longroup::get_group_settings($curr_groups{$cdom.'_'.$cnum}{$group}); |
$groupdescs{$cdom.'_'.$cnum}{$group} = |
$groupdescs{$cdom.'_'.$cnum}{$group} = |
&unescape($groupinfo{'description'}); |
&unescape($groupinfo{'description'}); |
} |
} |
$groupdesc = $groupdescs{$cdom.'_'.$cnum}{$group}; |
$groupdesc = $groupdescs{$cdom.'_'.$cnum}{$group}; |
Line 3117 sub update_session_roles {
|
Line 3248 sub update_session_roles {
|
my $cdom = $env{'course.'.$cid.'.domain'}; |
my $cdom = $env{'course.'.$cid.'.domain'}; |
my $cnum = $env{'course.'.$cid.'.num'}; |
my $cnum = $env{'course.'.$cid.'.num'}; |
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); |
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); |
my %groupdesc; |
my %groupdesc; |
if (ref($groupchange{$crs}) eq 'HASH') { |
if (ref($groupchange{$crs}) eq 'HASH') { |
$groupchgmsg .= '<li>'.&mt('Course/Community: [_1]','<b>'.$crsdesc.'</b><ul>'); |
$groupchgmsg .= '<li>'.&mt('Course/Community: [_1]','<b>'.$crsdesc.'</b><ul>'); |
foreach my $group (sort(keys(%{$groupchange{$crs}}))) { |
foreach my $group (sort(keys(%{$groupchange{$crs}}))) { |
Line 3272 sub is_active_course {
|
Line 3403 sub is_active_course {
|
} |
} |
|
|
sub get_roles_functions { |
sub get_roles_functions { |
my ($rolescount,$cattype) = @_; |
my ($rolescount,$cattype,$userapprovals) = @_; |
my @links; |
my @links; |
push(@links,["javascript:rolesView('doupdate');",'start-here-22x22',&mt('Check for changes')]); |
push(@links,["javascript:rolesView('doupdate');",'start-here-22x22',&mt('Check for changes')]); |
if ($env{'environment.canrequest.author'}) { |
if ($env{'environment.canrequest.author'}) { |
Line 3301 sub get_roles_functions {
|
Line 3432 sub get_roles_functions {
|
unless ($cattype eq 'none') { |
unless ($cattype eq 'none') { |
push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]); |
push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]); |
} |
} |
|
if ($userapprovals) { |
|
if ($env{'form.approvals'} eq 'show') { |
|
push(@links,["javascript:rolesView('noapprovals');",'list-add-22x22',&mt('Hide pending')]); |
|
} else { |
|
push(@links,["javascript:rolesView('approvals');",'list-add-22x22',&mt('Show pending')]); |
|
} |
|
} |
my $funcs; |
my $funcs; |
if ($env{'browser.mobile'}) { |
if ($env{'browser.mobile'}) { |
my @functions; |
my @functions; |
Line 3350 sub get_queued {
|
Line 3488 sub get_queued {
|
if (ref($history{'details'}) eq 'HASH') { |
if (ref($history{'details'}) eq 'HASH') { |
$description = $history{details}{'cdescr'}; |
$description = $history{details}{'cdescr'}; |
} |
} |
@{$reqcrs{$reqtime}} = ($description,$showtype); |
@{$reqcrs{$reqtime}} = ($description,$showtype); |
} |
} |
} |
} |
my @sortedtimes = sort {$a <=> $b} (keys(%reqcrs)); |
my @sortedtimes = sort {$a <=> $b} (keys(%reqcrs)); |
Line 3404 sub get_queued {
|
Line 3542 sub get_queued {
|
unless ($output) { |
unless ($output) { |
if ($env{'environment.canrequest.author'} || $env{'environment.canrequest.official'} || |
if ($env{'environment.canrequest.author'} || $env{'environment.canrequest.official'} || |
$env{'environment.canrequest.unofficial'} || $env{'environment.canrequest.community'}) { |
$env{'environment.canrequest.unofficial'} || $env{'environment.canrequest.community'}) { |
$output = &mt('No requests for courses, communities or authoring currently queued'); |
$output = '<span class="LC_info">'. |
|
&mt('No requests for courses, communities or authoring currently queued'). |
|
'</span>'; |
} else { |
} else { |
$output = &mt('No enrollment requests currently queued awaiting approval'); |
$output = '<span class="LC_info">'. |
|
&mt('No enrollment requests currently queued awaiting approval'). |
|
'</span>'; |
} |
} |
} |
} |
return '<div class="LC_left_float"><fieldset><legend>'.&mt('Queued requests').'</legend>'. |
return '<div class="LC_left_float"><fieldset><legend>'.&mt('Queued requests').'</legend>'. |
$output.'</fieldset></div><br clear="all" />'; |
$output.'</fieldset></div><br clear="all" />'; |
} |
} |
|
|
|
sub get_approvals { |
|
return &Apache::loncoursequeueadmin::display_queued_requests('othdomaction',$env{'user.domain'},'','user'); |
|
} |
|
|
|
sub process_lti { |
|
my ($r,$cdom,$cnum) = @_; |
|
my %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
|
my $uriscope = &LONCAPA::ltiutils::lti_provider_scope($env{'request.lti.uri'}, |
|
$cdom,$cnum); |
|
my $lonhost = $r->dir_config('lonHostID'); |
|
my $internet_names = &Apache::lonnet::get_internet_names($lonhost); |
|
if ($env{'request.lti.rosterid'} && |
|
$env{'request.lti.rosterurl'}) { |
|
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
|
if ($lti{$env{'request.lti.login'}}{'roster'}) { |
|
my @lcroles = ('in','ta','ep','st'); |
|
my @possibleroles; |
|
foreach my $role (@lcroles) { |
|
if (&Apache::lonnet::allowed('c'.$role,"$cdom/$cnum")) { |
|
push(@possibleroles,$role); |
|
} |
|
} |
|
my $owner = $env{'course.'.$cdom.'_'.$cnum.'.internal.courseowner'}; |
|
if ($owner eq $env{'user.name'}.':'.$env{'user.domain'}) { |
|
my $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum); |
|
if ($crstype eq 'Community') { |
|
unshift(@possibleroles,'co'); |
|
} else { |
|
unshift(@possibleroles,'cc'); |
|
} |
|
} |
|
if (@possibleroles) { |
|
push(@{$rosterupdates},{cid => $cdom.'_'.$cnum, |
|
lti => $env{'request.lti.login'}, |
|
ltiref => $lti{$env{'request.lti.login'}}, |
|
id => $env{'request.lti.rosterid'}, |
|
url => $env{'request.lti.rosterurl'}, |
|
sourcecrs => $env{'request.lti.sourcecrs'}, |
|
uriscope => $uriscope, |
|
possroles => \@possibleroles, |
|
intdoms => $internet_names, |
|
}); |
|
unless ($registered_cleanup) { |
|
my $handlers = $r->get_handlers('PerlCleanupHandler'); |
|
$r->set_handlers('PerlCleanupHandler' => |
|
[\<ienroll,@{$handlers}]); |
|
$registered_cleanup=1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($env{'request.lti.passbackid'} && |
|
$env{'request.lti.passbackurl'}) { |
|
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
|
if ($lti{$env{'request.lti.login'}}{'passback'}) { |
|
my ($pbnum,$error) = |
|
&LONCAPA::ltiutils::store_passbackurl($env{'request.lti.login'}, |
|
$env{'request.lti.passbackurl'}, |
|
$cdom,$cnum); |
|
if ($pbnum eq '') { |
|
$pbnum = $env{'request.lti.passbackurl'}; |
|
} |
|
&Apache::lonnet::put('nohist_'.$cdom.'_'.$cnum.'_passback', |
|
{"$uriscope\0$env{'request.lti.sourcecrs'}\0$env{'request.lti.login'}" => |
|
"$pbnum\0$env{'request.lti.passbackid'}"}); |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
sub ltienroll { |
|
if (ref($rosterupdates) eq 'ARRAY') { |
|
foreach my $item (@{$rosterupdates}) { |
|
if (ref($item) eq 'HASH') { |
|
&LONCAPA::ltiutils::batchaddroster($item); |
|
} |
|
} |
|
$rosterupdates = []; |
|
} |
|
return OK; |
|
} |
|
|
sub set_deeplink_target { |
sub set_deeplink_target { |
my ($cnum,$cdom) = @_; |
my ($cnum,$cdom) = @_; |
if (($cnum ne '') && ($cdom ne '')) { |
if (($cnum ne '') && ($cdom ne '')) { |
Line 3441 sub set_deeplink_target {
|
Line 3667 sub set_deeplink_target {
|
return; |
return; |
} |
} |
|
|
|
sub set_supplemental_access { |
|
my ($cnum,$cdom) = @_; |
|
my ($supplemental,$refs_updated) = &Apache::loncommon::get_supplemental($cnum,$cdom); |
|
unless ($refs_updated) { |
|
&Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental); |
|
} |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|