version 1.354, 2021/11/15 22:36:38
|
version 1.375, 2024/12/20 00:24:39
|
Line 149 my $registered_cleanup;
|
Line 149 my $registered_cleanup;
|
my $rosterupdates; |
my $rosterupdates; |
|
|
sub start_loading_course { |
sub start_loading_course { |
my ($r,$title) = @_; |
my ($r,$title,$only_body) = @_; |
&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(); |
if ($only_body) { |
# Breadcrumbs |
$r->print(&Apache::loncommon::start_page($title,undef,{'only_body' => 1, |
my $brcrum = [{'href' => '', |
'add_progressbar' => 1})); |
'text' => $title},]; |
} else { |
my $start_page = &Apache::loncommon::start_page($title,undef, |
my $swinfo=&Apache::lonmenu::rawconfig(); |
{'bread_crumbs' => $brcrum, |
# Breadcrumbs |
'bread_crumbs_nomenu' => 1, |
my $brcrum = [{'href' => '', |
'links_disabled' => 1}); |
'text' => $title},]; |
$r->print(<<ENDREDIR); |
my $start_page = &Apache::loncommon::start_page($title,undef, |
|
{'bread_crumbs' => $brcrum, |
|
'bread_crumbs_nomenu' => 1, |
|
'links_disabled' => 1}); |
|
$r->print(<<ENDREDIR); |
$start_page |
$start_page |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 176 document.body.addEventListener('click',
|
Line 180 document.body.addEventListener('click',
|
// ]]> |
// ]]> |
</script> |
</script> |
ENDREDIR |
ENDREDIR |
|
} |
return; |
return; |
} |
} |
|
|
sub finish_loading_course { |
sub finish_loading_course { |
my ($r,$msg,$url) = @_; |
my ($r,$msg,$url,$only_body) = @_; |
my $link = '<div id="LC_course_loaded" style="display:none"><a href="'.$url.'">'.&mt('Continue').'</a></div>'; |
my $link = '<div id="LC_course_loaded" style="display:none"><a href="'. |
|
&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 $reenable; |
|
unless ($only_body) { |
|
$reenable = <<REENABLE; |
|
\$('.isDisabled > a').removeAttr("aria-disabled"); |
|
\$('.isDisabled').removeClass("isDisabled"); |
|
REENABLE |
|
} |
$r->print(<<END); |
$r->print(<<END); |
$msg |
$msg |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
\$(document).ready(function() { |
\$(document).ready(function() { |
\$("#LC_course_loaded").css("display","block"); |
\$("#LC_course_loaded").css("display","block"); |
\$('.isDisabled > a').removeAttr("aria-disabled"); |
$reenable |
\$('.isDisabled').removeClass("isDisabled"); |
|
var url = "$js_url"; |
var url = "$js_url"; |
\$(location).attr('href',url); |
\$(location).attr('href',url); |
}); |
}); |
|
// ]]> |
</script> |
</script> |
$link |
$link |
$end_page |
$end_page |
Line 277 sub handler {
|
Line 290 sub handler {
|
$update = $then; |
$update = $then; |
} |
} |
|
|
my $norolelist; |
my ($norolelist,$blocked_by_ip,$blocked_type,$clientip); |
|
$clientip = &Apache::lonnet::get_requestor_ip($r); |
if (($env{'request.course.id'}) && ($env{'request.deeplink.login'})) { |
if (($env{'request.course.id'}) && ($env{'request.deeplink.login'})) { |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 314 sub handler {
|
Line 328 sub handler {
|
} |
} |
} |
} |
|
|
|
if ($env{'form.selectrole'}) { |
|
my ($role,$cdom,$cnum,$rest); |
|
if ($env{'form.switchrole'} =~ m{^(co|cc|in|ta|ep|ad|st|cr).*?\./($match_domain)/($match_courseid)(/(\w+)|$)}) { |
|
($role,$cdom,$cnum,$rest) = ($1,$2,$3,$4); |
|
} elsif ($env{'form.newrole'} =~ m{^(co|cc|in|ta|ep|ad|st|cr).*?\./($match_domain)/($match_courseid)(/(\w+)|$)}) { |
|
($role,$cdom,$cnum,$rest) = ($1,$2,$3,$4); |
|
} |
|
if ($cdom ne '') { |
|
my ($has_evb,$check_ipaccess,$showrole); |
|
$showrole = 1; |
|
my $checkrole = "cm./$cdom/$cnum"; |
|
if ($rest ne '') { |
|
$checkrole .= "/$rest"; |
|
} |
|
if ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) && |
|
($role ne 'st')) { |
|
$has_evb = 1; |
|
} |
|
unless ($has_evb) { |
|
my @machinedoms = &Apache::lonnet::current_machine_domains(); |
|
my $udom = $env{'user.domain'}; |
|
if ($udom eq $cdom) { |
|
$check_ipaccess = 1; |
|
} elsif (($udom ne '') && (grep(/^\Q$udom\E$/,@machinedoms))) { |
|
$check_ipaccess = 1; |
|
} else { |
|
my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; |
|
my $internet_names = &Apache::lonnet::get_internet_names($lonhost); |
|
my $cprim = &Apache::lonnet::domain($cdom,'primary'); |
|
my $cintdom = &Apache::lonnet::internet_dom($cprim); |
|
if (($cintdom ne '') && (ref($internet_names) eq 'ARRAY')) { |
|
if (grep(/^\Q$cintdom\E$/,@{$internet_names})) { |
|
$check_ipaccess = 1; |
|
} |
|
} |
|
} |
|
if ($check_ipaccess) { |
|
my ($ipaccessref,$cached)=&Apache::lonnet::is_cached_new('ipaccess',$cdom); |
|
unless (defined($cached)) { |
|
my %domconfig = |
|
&Apache::lonnet::get_dom('configuration',['ipaccess'],$cdom); |
|
$ipaccessref = &Apache::lonnet::do_cache_new('ipaccess',$cdom,$domconfig{'ipaccess'},1800); |
|
} |
|
if (ref($ipaccessref) eq 'HASH') { |
|
foreach my $id (keys(%{$ipaccessref})) { |
|
if (ref($ipaccessref->{$id}) eq 'HASH') { |
|
my $range = $ipaccessref->{$id}->{'ip'}; |
|
if ($range) { |
|
my $type = 'exclude'; |
|
if (&Apache::lonnet::ip_match($clientip,$range)) { |
|
$type = 'include'; |
|
} |
|
if (ref($ipaccessref->{$id}->{'courses'}) eq 'HASH') { |
|
if ($ipaccessref->{$id}->{'courses'}{$cdom.'_'.$cnum}) { |
|
if ($type eq 'include') { |
|
$showrole = 1; |
|
last; |
|
} else { |
|
$showrole = 0; |
|
} |
|
} else { |
|
if ($type eq 'include') { |
|
$showrole = 0; |
|
} else { |
|
$showrole = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
unless ($showrole) { |
|
$blocked_by_ip = 1; |
|
$blocked_type = &Apache::loncommon::course_type($cdom.'_'.$cnum); |
|
delete($env{'form.selectrole'}); |
|
delete($env{'form.newrole'}); |
|
} |
|
} |
|
} |
|
|
$registered_cleanup=0; |
$registered_cleanup=0; |
@{$rosterupdates}=(); |
@{$rosterupdates}=(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
Line 347 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 = (); |
Line 402 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 599 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 677 ENDENTERKEY
|
Line 781 ENDENTERKEY
|
} |
} |
my $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum); |
my $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum); |
$crstype = lc($crstype); |
$crstype = lc($crstype); |
|
my ($msg,$critmsg_check,$title,$loadmsg,$only_body); |
|
$critmsg_check = 1; |
|
$title = &mt("Loading $crstype"); |
|
$loadmsg = &mt("Please be patient while your $crstype loads"); |
|
if (($env{'request.deeplink.login'}) && ($env{'request.linkprot'})) { |
|
if ($env{'request.linkprot'} =~ /^\d+(c|d):\Q$env{'form.destinationurl'}\E$/) { |
|
$title = &mt('Loading LON-CAPA session'); |
|
$loadmsg = &mt('Please be patient while LON-CAPA loads'); |
|
$only_body = 1; |
|
$critmsg_check = 0; |
|
} |
|
} |
my $preamble = '<div id="LC_update_'.$cdom.'_'.$cnum.'" class="LC_info">'. |
my $preamble = '<div id="LC_update_'.$cdom.'_'.$cnum.'" class="LC_info">'. |
'<br />'. |
'<br />'. |
&mt("Please be patient while your $crstype loads"). |
$loadmsg. |
'<br /></div>'. |
'<br /></div>'. |
'<div style="padding:0;clear:both;margin:0;border:0"></div>'; |
'<div style="padding:0;clear:both;margin:0;border:0"></div>'; |
my $closure = <<ENDCLOSE; |
my $closure = <<ENDCLOSE; |
Line 689 ENDENTERKEY
|
Line 805 ENDENTERKEY
|
// ]]> |
// ]]> |
</script> |
</script> |
ENDCLOSE |
ENDCLOSE |
my $title = &mt("Loading $crstype"); |
&start_loading_course($r,$title,$only_body); |
&start_loading_course($r,$title); |
|
my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble); |
my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble); |
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Loading ...')); |
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Loading ...')); |
$r->rflush(); |
$r->rflush(); |
my ($msg,$blockcrit,$critmsg_check); |
if ($critmsg_check) { |
$critmsg_check = 1; |
my $blockcrit = &Apache::loncommon::blocking_status('alert',$clientip,$cnum,$cdom,undef,1); |
$blockcrit = &Apache::loncommon::blocking_status('alert',$cnum,$cdom,undef,1); |
if ($blockcrit) { |
if ($blockcrit) { |
my $checkrole = "cm./$cdom/$cnum"; |
my $checkrole = "cm./$cdom/$cnum"; |
if ($csec ne '') { |
if ($csec ne '') { |
$checkrole .= "/$csec"; |
$checkrole .= "/$csec"; |
} |
} |
unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) && |
unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) && |
($trolecode !~ m{^st\./$cdom/$cnum})) { |
($trolecode !~ m{^st\./$cdom/$cnum})) { |
$critmsg_check = 0; |
$critmsg_check = 0; |
} |
} |
} |
} |
} |
my ($furl,$ferr)= |
my ($furl,$ferr)= |
Line 745 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 778 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); |
Line 813 ENDCLOSE
|
Line 929 ENDCLOSE
|
($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) { |
($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) { |
&process_lti($r,$cdom,$cnum); |
&process_lti($r,$cdom,$cnum); |
} |
} |
|
if ($env{'request.deeplink.login'}) { |
|
&set_deeplink_target($cnum,$cdom); |
|
} |
$msg = '<p>'.&mt('Entering [_1] ...', |
$msg = '<p>'.&mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
'</p>'; |
'</p>'; |
&finish_loading_course($r,$msg,$dest); |
&finish_loading_course($r,$msg,$dest,$only_body); |
} |
} |
} |
} |
$r->rflush(); |
$r->rflush(); |
Line 840 ENDCLOSE
|
Line 959 ENDCLOSE
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
} else { |
} else { |
|
&set_supplemental_access($cnum,$cdom); |
if (($env{'request.lti.login'}) && |
if (($env{'request.lti.login'}) && |
($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) { |
($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) { |
&process_lti($r,$cdom,$cnum); |
&process_lti($r,$cdom,$cnum); |
} |
} |
|
if ($env{'request.deeplink.login'}) { |
|
&set_deeplink_target($cnum,$cdom); |
|
} |
# Check to see if the user is a CC entering a course |
# Check to see if the user is a CC entering a course |
# for the first time |
# for the first time |
if ((($role eq 'cc') || ($role eq 'co')) |
if ((($role eq 'cc') || ($role eq 'co')) |
Line 859 ENDCLOSE
|
Line 982 ENDCLOSE
|
$msg = '<p>'.&mt('Entering [_1] ...', |
$msg = '<p>'.&mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
'</p>'; |
'</p>'; |
&finish_loading_course($r,$msg,'/adm/placement'); |
&finish_loading_course($r,$msg,'/adm/placement',$only_body); |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
} |
} |
Line 926 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.lti.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>'; |
} |
} |
&finish_loading_course($r,$msg,$dest); |
&finish_loading_course($r,$msg,$dest,$only_body); |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
} |
} |
Line 946 ENDCLOSE
|
Line 1069 ENDCLOSE
|
$msg = '<p>'.&mt('Entering [_1] ...', |
$msg = '<p>'.&mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
'</p>'; |
'</p>'; |
&finish_loading_course($r,$msg,'/adm/whatsnew?refpage=start'); |
&finish_loading_course($r,$msg,'/adm/whatsnew?refpage=start',$only_body); |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
} |
} |
Line 994 ENDCLOSE
|
Line 1117 ENDCLOSE
|
} |
} |
if ($env{'request.lti.login'}) { |
if ($env{'request.lti.login'}) { |
undef($msg); |
undef($msg); |
&finish_loading_course($r,$msg,$furl); |
&finish_loading_course($r,$msg,$furl,$only_body); |
} else { |
} else { |
$msg = '<p>'.&mt('Entering [_1] ...', |
$msg = '<p>'.&mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
'</p>'; |
'</p>'; |
&finish_loading_course($r,$msg,$furl); |
&finish_loading_course($r,$msg,$furl,$only_body); |
} |
} |
} |
} |
$r->rflush(); |
$r->rflush(); |
Line 1016 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 1068 ENDCLOSE
|
Line 1197 ENDCLOSE
|
$recent = &mt('Recent Courses'); |
$recent = &mt('Recent Courses'); |
$standby = &mt('Course selected. Please stand by.'); |
$standby = &mt('Course selected. Please stand by.'); |
} |
} |
|
if (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) { |
|
$crumbtext = 'Access Denied'; |
|
$pagetitle = 'Unauthorized'; |
|
} |
my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}]; |
my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}]; |
|
|
my %roles_in_env; |
my %roles_in_env; |
Line 1104 ENDCLOSE
|
Line 1237 ENDCLOSE
|
$start_page=&Apache::loncommon::start_page($pagetitle,undef, |
$start_page=&Apache::loncommon::start_page($pagetitle,undef, |
{bread_crumbs=>$brcrum,crstype=>'Placement'}); |
{bread_crumbs=>$brcrum,crstype=>'Placement'}); |
} else { |
} else { |
$funcs = &get_roles_functions($showcount,$cattype); |
my ($crumbsright,$crumbs_style); |
my $crumbsright; |
unless (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) { |
if ($env{'browser.mobile'}) { |
$funcs = &get_roles_functions($showcount,$cattype,$domdefs{'userapprovals'}); |
$crumbsright = $funcs; |
if ($env{'browser.mobile'}) { |
undef($funcs); |
$crumbsright = $funcs; |
|
undef($funcs); |
|
$crumbs_style = 'overflow: visible;'; |
|
} |
} |
} |
$start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum, |
$start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum, |
bread_crumbs_component=>$crumbsright}); |
bread_crumbs_component=>$crumbsright, |
|
bread_crumbs_style=>$crumbs_style,}); |
} |
} |
&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 1142 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') || |
Line 1216 ENDHEADER
|
Line 1357 ENDHEADER
|
} |
} |
if ($nochoose) { |
if ($nochoose) { |
$r->print("<h2>".&mt('Sorry ...')."</h2>\n<span class='LC_error'>". |
$r->print("<h2>".&mt('Sorry ...')."</h2>\n<span class='LC_error'>". |
&mt('This action is currently not authorized.').'</span>'. |
&mt('This action is currently not authorized.').'</span>'); |
&Apache::loncommon::end_page()); |
if ($error && $norolelist) { |
|
$r->print('<br /><br /><h4><span class="LC_error">'. |
|
&mt('As your session was launched from a web page external to LON-CAPA some course content may be unavailable, including the resource you were trying to access.'). |
|
'</span></h4>'. |
|
'<h4><span class="LC_error">'. |
|
&mt('You may need to login to LON-CAPA directly, or re-launch from a different external system.'). |
|
'</span></h4>'); |
|
} |
|
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} else { |
} else { |
if ($updateresult || $reqauthor || $hotlist) { |
if ($updateresult || $reqauthor || $hotlist) { |
Line 1230 ENDHEADER
|
Line 1379 ENDHEADER
|
} |
} |
if ($hotlist) { |
if ($hotlist) { |
$showresult .= $hotlist; |
$showresult .= $hotlist; |
} |
} |
$showresult .= '</div>'; |
$showresult .= '</div>'; |
$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) { |
|
my $blocked_role = 'student'; |
|
if ($blocked_type eq 'Community') { |
|
$blocked_role = 'member'; |
|
} |
|
$r->print('<h3><span class="LC_error">'. |
|
&mt('The [_1] you selected is not available for access with a [_2] role from your current IP address: [_3].', |
|
lc($blocked_type),$blocked_role,$clientip). |
|
'</span></h3>'); |
|
} |
} |
} |
$r->rflush(); |
$r->rflush(); |
|
|
Line 1635 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 1883 sub findcourse_advice {
|
Line 2051 sub findcourse_advice {
|
} 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>'); |
if ($elapsed > 600) { |
if ($elapsed > 600) { |
$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>'); |
} |
} |
Line 2079 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 2538 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 3219 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 3248 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 3351 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 { |
sub process_lti { |
my ($r,$cdom,$cnum) = @_; |
my ($r,$cdom,$cnum) = @_; |
my %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
my %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); |
Line 3435 sub ltienroll {
|
Line 3634 sub ltienroll {
|
&LONCAPA::ltiutils::batchaddroster($item); |
&LONCAPA::ltiutils::batchaddroster($item); |
} |
} |
} |
} |
|
$rosterupdates = []; |
|
} |
|
return OK; |
|
} |
|
|
|
sub set_deeplink_target { |
|
my ($cnum,$cdom) = @_; |
|
if (($cnum ne '') && ($cdom ne '')) { |
|
my $deeplink_symb = &Apache::loncommon::deeplink_login_symb($cnum,$cdom); |
|
if ($deeplink_symb ne '') { |
|
my $deeplink; |
|
if ($deeplink_symb =~ /\.(page|sequence)$/) { |
|
my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]); |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
$deeplink = $navmap->get_mapparam(undef,$mapname,'0.deeplink'); |
|
} |
|
} elsif ($deeplink_symb ne '') { |
|
$deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$deeplink_symb); |
|
} |
|
if ($deeplink ne '') { |
|
my ($state,$others,$listed,$scope,$protect,$display,$target) = split(/,/,$deeplink); |
|
if ($target ne '') { |
|
&Apache::lonnet::appenv({'request.deeplink.target' => $target}); |
|
} elsif (exists($env{'request.deeplink.target'})) { |
|
&Apache::lonnet::delenv('request.deeplink.target'); |
|
} |
|
} |
|
} |
|
} |
|
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); |
} |
} |
} |
} |
|
|