version 1.269.2.39.2.2, 2022/01/16 17:32:44
|
version 1.269.2.39.2.8, 2023/12/30 00:07:09
|
Line 145 use LONCAPA qw(:DEFAULT :match);
|
Line 145 use LONCAPA qw(:DEFAULT :match);
|
use HTML::Entities; |
use HTML::Entities; |
|
|
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 172 document.body.addEventListener('click',
|
Line 176 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 $remote_js; |
my $remote_js; |
Line 200 window.status='Done.';
|
Line 206 window.status='Done.';
|
ENDCLOSE |
ENDCLOSE |
} |
} |
} |
} |
|
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"); |
|
$remote_js |
$remote_js |
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 495 sub handler {
|
Line 508 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 771 ENDENTERKEY
|
Line 785 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 783 ENDENTERKEY
|
Line 809 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',$clientip,$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 839 ENDCLOSE
|
Line 864 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 872 ENDCLOSE
|
Line 896 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 903 ENDCLOSE
|
Line 929 ENDCLOSE
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
} else { |
} else { |
|
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 930 ENDCLOSE
|
Line 959 ENDCLOSE
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
} else { |
} else { |
|
&set_supplemental_access($cnum,$cdom); |
|
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 996 ENDCLOSE
|
Line 1029 ENDCLOSE
|
$dest .= (($dest =~/\?/)? '&':'?').'symb='.$esc_symb; |
$dest .= (($dest =~/\?/)? '&':'?').'symb='.$esc_symb; |
} |
} |
} |
} |
$msg = '<p>'.&mt('Entering [_1] ...', |
|
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
|
'</p>'; |
|
if ($env{'form.ttoken'}) { |
if ($env{'form.ttoken'}) { |
$dest .= (($dest =~/\?/)? '&':'?').'ttoken='.$env{'form.ttoken'}; |
$dest .= (($dest =~/\?/)? '&':'?').'ttoken='.$env{'form.ttoken'}; |
} |
} |
&finish_loading_course($r,$msg,$dest); |
unless ($env{'request.deeplink.login'}) { |
|
$msg = '<p>'.&mt('Entering [_1] ...', |
|
$env{'course.'.$cdom.'_'.$cnum.'.description'}). |
|
'</p>'; |
|
} |
|
&finish_loading_course($r,$msg,$dest,$only_body); |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
} |
} |
Line 1017 ENDCLOSE
|
Line 1052 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 1066 ENDCLOSE
|
Line 1101 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,$furl); |
&finish_loading_course($r,$msg,$furl,$only_body); |
} |
} |
$r->rflush(); |
$r->rflush(); |
return OK; |
return OK; |
Line 1082 ENDCLOSE
|
Line 1117 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 1659 sub gather_roles {
|
Line 1700 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 3381 sub get_queued {
|
Line 3422 sub get_queued {
|
$output.'</fieldset></div><br clear="all" />'; |
$output.'</fieldset></div><br clear="all" />'; |
} |
} |
|
|
|
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); |
|
} |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|