version 1.1075.2.141, 2020/01/10 05:15:29
|
version 1.1075.2.149, 2020/11/12 01:18:26
|
Line 428 sub studentbrowser_javascript {
|
Line 428 sub studentbrowser_javascript {
|
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
// <![CDATA[ |
// <![CDATA[ |
var stdeditbrowser; |
var stdeditbrowser; |
function openstdbrowser(formname,uname,udom,clicker,roleflag,ignorefilter,courseadvonly) { |
function openstdbrowser(formname,uname,udom,clicker,roleflag,ignorefilter,courseadv) { |
var url = '/adm/pickstudent?'; |
var url = '/adm/pickstudent?'; |
var filter; |
var filter; |
if (!ignorefilter) { |
if (!ignorefilter) { |
Line 443 sub studentbrowser_javascript {
|
Line 443 sub studentbrowser_javascript {
|
'&udomelement='+udom+ |
'&udomelement='+udom+ |
'&clicker='+clicker; |
'&clicker='+clicker; |
if (roleflag) { url+="&roles=1"; } |
if (roleflag) { url+="&roles=1"; } |
if (courseadvonly) { url+="&courseadvonly=1"; } |
if (courseadv == 'condition') { |
|
if (document.getElementById('courseadv')) { |
|
courseadv = document.getElementById('courseadv').value; |
|
} |
|
} |
|
if ((courseadv == 'only') || (courseadv == 'none')) { url+="&courseadv="+courseadv; } |
var title = 'Student_Browser'; |
var title = 'Student_Browser'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
options += ',width=700,height=600'; |
options += ',width=700,height=600'; |
Line 475 ENDRESBRW
|
Line 480 ENDRESBRW
|
} |
} |
|
|
sub selectstudent_link { |
sub selectstudent_link { |
my ($form,$unameele,$udomele,$courseadvonly,$clickerid)=@_; |
my ($form,$unameele,$udomele,$courseadv,$clickerid)=@_; |
my $callargs = "'".&Apache::lonhtmlcommon::entity_encode($form)."','". |
my $callargs = "'".&Apache::lonhtmlcommon::entity_encode($form)."','". |
&Apache::lonhtmlcommon::entity_encode($unameele)."','". |
&Apache::lonhtmlcommon::entity_encode($unameele)."','". |
&Apache::lonhtmlcommon::entity_encode($udomele)."'"; |
&Apache::lonhtmlcommon::entity_encode($udomele)."'"; |
Line 486 sub selectstudent_link {
|
Line 491 sub selectstudent_link {
|
return ''; |
return ''; |
} |
} |
$callargs.=",'".&Apache::lonhtmlcommon::entity_encode($clickerid)."'"; |
$callargs.=",'".&Apache::lonhtmlcommon::entity_encode($clickerid)."'"; |
if ($courseadvonly) { |
if ($courseadv eq 'only') { |
$callargs .= ",'',1,1"; |
$callargs .= ",'',1,'$courseadv'"; |
|
} elsif ($courseadv eq 'none') { |
|
$callargs .= ",'','','$courseadv'"; |
|
} elsif ($courseadv eq 'condition') { |
|
$callargs .= ",'','','$courseadv'"; |
} |
} |
return '<span class="LC_nobreak">'. |
return '<span class="LC_nobreak">'. |
'<a href="javascript:openstdbrowser('.$callargs.');">'. |
'<a href="javascript:openstdbrowser('.$callargs.');">'. |
Line 3231 sub check_passwd_rules {
|
Line 3240 sub check_passwd_rules {
|
$rulenames{'min'} = &mt('Minimum password length: [_1]',$min); |
$rulenames{'min'} = &mt('Minimum password length: [_1]',$min); |
$rulenames{'max'} = &mt('Maximum password length: [_1]',$max); |
$rulenames{'max'} = &mt('Maximum password length: [_1]',$max); |
$warning = &mt('Password did not satisfy the following:').'<ul>'; |
$warning = &mt('Password did not satisfy the following:').'<ul>'; |
foreach my $rule ('min','max','uc','ls','num','spec') { |
foreach my $rule ('min','max','uc','lc','num','spec') { |
if (grep(/^$rule$/,@brokerule)) { |
if (grep(/^$rule$/,@brokerule)) { |
$warning .= '<li>'.$rulenames{$rule}.'</li>'; |
$warning .= '<li>'.$rulenames{$rule}.'</li>'; |
} |
} |
Line 4414 sub get_student_view_with_retries {
|
Line 4423 sub get_student_view_with_retries {
|
} |
} |
} |
} |
|
|
|
sub css_links { |
|
my ($currsymb,$level) = @_; |
|
my ($links,@symbs,%cssrefs,%httpref); |
|
if ($level eq 'map') { |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
my ($map,undef,$url)=&Apache::lonnet::decode_symb($currsymb); |
|
my @resources = $navmap->retrieveResources($map,sub { $_[0]->is_problem() },0,0); |
|
foreach my $res (@resources) { |
|
if (ref($res) && $res->symb()) { |
|
push(@symbs,$res->symb()); |
|
} |
|
} |
|
} |
|
} else { |
|
@symbs = ($currsymb); |
|
} |
|
foreach my $symb (@symbs) { |
|
my $css_href = &Apache::lonnet::EXT('resource.0.cssfile',$symb); |
|
if ($css_href =~ /\S/) { |
|
unless ($css_href =~ m{https?://}) { |
|
my $url = (&Apache::lonnet::decode_symb($symb))[-1]; |
|
my $proburl = &Apache::lonnet::clutter($url); |
|
my ($probdir) = ($proburl =~ m{(.+)/[^/]+$}); |
|
unless ($css_href =~ m{^/}) { |
|
$css_href = &Apache::lonnet::hreflocation($probdir,$css_href); |
|
} |
|
if ($css_href =~ m{^/(res|uploaded)/}) { |
|
unless (($httpref{'httpref.'.$css_href}) || |
|
(&Apache::lonnet::is_on_map($css_href))) { |
|
my $thisurl = $proburl; |
|
if ($env{'httpref.'.$proburl}) { |
|
$thisurl = $env{'httpref.'.$proburl}; |
|
} |
|
$httpref{'httpref.'.$css_href} = $thisurl; |
|
} |
|
} |
|
} |
|
$cssrefs{$css_href} = 1; |
|
} |
|
} |
|
if (keys(%httpref)) { |
|
&Apache::lonnet::appenv(\%httpref); |
|
} |
|
if (keys(%cssrefs)) { |
|
foreach my $css_href (keys(%cssrefs)) { |
|
next unless ($css_href =~ m{^(/res/|/uploaded/|https?://)}); |
|
$links .= '<link rel="stylesheet" type="text/css" href="'.$css_href.'" />'."\n"; |
|
} |
|
} |
|
return $links; |
|
} |
|
|
=pod |
=pod |
|
|
=item * &get_student_answers() |
=item * &get_student_answers() |
Line 4669 sub findallcourses {
|
Line 4731 sub findallcourses {
|
############################################### |
############################################### |
|
|
sub blockcheck { |
sub blockcheck { |
my ($setters,$activity,$uname,$udom,$url,$is_course) = @_; |
my ($setters,$activity,$uname,$udom,$url,$is_course,$symb,$caller) = @_; |
|
|
if (defined($udom) && defined($uname)) { |
if (defined($udom) && defined($uname)) { |
# If uname and udom are for a course, check for blocks in the course. |
# If uname and udom are for a course, check for blocks in the course. |
if (($is_course) || (&Apache::lonnet::is_course($udom,$uname))) { |
if (($is_course) || (&Apache::lonnet::is_course($udom,$uname))) { |
my ($startblock,$endblock,$triggerblock) = |
my ($startblock,$endblock,$triggerblock) = |
&get_blocks($setters,$activity,$udom,$uname,$url); |
&get_blocks($setters,$activity,$udom,$uname,$url,$symb,$caller); |
return ($startblock,$endblock,$triggerblock); |
return ($startblock,$endblock,$triggerblock); |
} |
} |
} else { |
} else { |
Line 4802 sub blockcheck {
|
Line 4864 sub blockcheck {
|
# of specified user, unless user has 'evb' privilege. |
# of specified user, unless user has 'evb' privilege. |
|
|
my ($start,$end,$trigger) = |
my ($start,$end,$trigger) = |
&get_blocks($setters,$activity,$cdom,$cnum,$url); |
&get_blocks($setters,$activity,$cdom,$cnum,$url,$symb,$caller); |
if (($start != 0) && |
if (($start != 0) && |
(($startblock == 0) || ($startblock > $start))) { |
(($startblock == 0) || ($startblock > $start))) { |
$startblock = $start; |
$startblock = $start; |
Line 4822 sub blockcheck {
|
Line 4884 sub blockcheck {
|
} |
} |
|
|
sub get_blocks { |
sub get_blocks { |
my ($setters,$activity,$cdom,$cnum,$url) = @_; |
my ($setters,$activity,$cdom,$cnum,$url,$symb,$caller) = @_; |
my $startblock = 0; |
my $startblock = 0; |
my $endblock = 0; |
my $endblock = 0; |
my $triggerblock = ''; |
my $triggerblock = ''; |
Line 4835 sub get_blocks {
|
Line 4897 sub get_blocks {
|
my $now = time; |
my $now = time; |
my %commblocks = &Apache::lonnet::get_comm_blocks($cdom,$cnum); |
my %commblocks = &Apache::lonnet::get_comm_blocks($cdom,$cnum); |
if ($activity eq 'docs') { |
if ($activity eq 'docs') { |
@blockers = &Apache::lonnet::has_comm_blocking('bre',undef,$url,\%commblocks); |
my ($blocked,$nosymbcache,$noenccheck); |
|
if (($caller eq 'blockedaccess') || ($caller eq 'blockingstatus')) { |
|
$blocked = 1; |
|
$nosymbcache = 1; |
|
$noenccheck = 1; |
|
} |
|
@blockers = &Apache::lonnet::has_comm_blocking('bre',$symb,$url,$nosymbcache,$noenccheck,$blocked,\%commblocks); |
foreach my $block (@blockers) { |
foreach my $block (@blockers) { |
if ($block =~ /^firstaccess____(.+)$/) { |
if ($block =~ /^firstaccess____(.+)$/) { |
my $item = $1; |
my $item = $1; |
Line 4957 sub parse_block_record {
|
Line 5025 sub parse_block_record {
|
} |
} |
|
|
sub blocking_status { |
sub blocking_status { |
my ($activity,$uname,$udom,$url,$is_course) = @_; |
my ($activity,$uname,$udom,$url,$is_course,$symb,$caller) = @_; |
my %setters; |
my %setters; |
|
|
# check for active blocking |
# check for active blocking |
my ($startblock,$endblock,$triggerblock) = |
my ($startblock,$endblock,$triggerblock) = |
&blockcheck(\%setters,$activity,$uname,$udom,$url,$is_course); |
&blockcheck(\%setters,$activity,$uname,$udom,$url,$is_course,$symb,$caller); |
my $blocked = 0; |
my $blocked = 0; |
if ($startblock && $endblock) { |
if ($startblock && $endblock) { |
$blocked = 1; |
$blocked = 1; |
Line 4978 sub blocking_status {
|
Line 5046 sub blocking_status {
|
$querystring .= "&udom=$udom" if ($udom =~ /^$match_domain$/); |
$querystring .= "&udom=$udom" if ($udom =~ /^$match_domain$/); |
$querystring .= "&uname=$uname" if ($uname =~ /^$match_username$/); |
$querystring .= "&uname=$uname" if ($uname =~ /^$match_username$/); |
} elsif ($activity eq 'docs') { |
} elsif ($activity eq 'docs') { |
$querystring .= '&url='.&HTML::Entities::encode($url,'&"'); |
my $showurl = &Apache::lonenc::check_encrypt($url); |
|
$querystring .= '&url='.&HTML::Entities::encode($showurl,'\'&"<>'); |
|
if ($symb) { |
|
my $showsymb = &Apache::lonenc::check_encrypt($symb); |
|
$querystring .= '&symb='.&HTML::Entities::encode($showsymb,'\'&"<>'); |
|
} |
} |
} |
|
|
my $output .= <<'END_MYBLOCK'; |
my $output .= <<'END_MYBLOCK'; |
Line 5027 sub check_ip_acc {
|
Line 5100 sub check_ip_acc {
|
return 1; |
return 1; |
} |
} |
my $allowed=0; |
my $allowed=0; |
my $ip=$ENV{'REMOTE_ADDR'} || $clientip || $env{'request.host'}; |
my $ip; |
|
if (($ENV{'REMOTE_ADDR'} eq '127.0.0.1') || |
|
($ENV{'REMOTE_ADDR'} eq &Apache::lonnet::get_host_ip($Apache::lonnet::perlvar{'lonHostID'}))) { |
|
$ip = $env{'request.host'} || $ENV{'REMOTE_ADDR'} || $clientip; |
|
} else { |
|
$ip = $ENV{'REMOTE_ADDR'} || $env{'request.host'} || $clientip; |
|
} |
|
|
my $name; |
my $name; |
foreach my $pattern (split(',',$acc)) { |
foreach my $pattern (split(',',$acc)) { |
Line 7912 ADDMETA
|
Line 7991 ADDMETA
|
my $dom_in_use = $Apache::lonnet::perlvar{'lonDefDomain'}; |
my $dom_in_use = $Apache::lonnet::perlvar{'lonDefDomain'}; |
unless (&Apache::lonnet::allowed('mau',$dom_in_use)) { |
unless (&Apache::lonnet::allowed('mau',$dom_in_use)) { |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom_in_use); |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom_in_use); |
|
my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; |
|
my $offload; |
if (ref($domdefs{'offloadnow'}) eq 'HASH') { |
if (ref($domdefs{'offloadnow'}) eq 'HASH') { |
my $lonhost = $Apache::lonnet::perlvar{'lonHostID'}; |
|
if ($domdefs{'offloadnow'}{$lonhost}) { |
if ($domdefs{'offloadnow'}{$lonhost}) { |
my $newserver = &Apache::lonnet::spareserver(30000,undef,1,$dom_in_use); |
$offload = 1; |
if (($newserver) && ($newserver ne $lonhost)) { |
} |
my $numsec = 5; |
} |
my $timeout = $numsec * 1000; |
unless ($offload) { |
my ($newurl,$locknum,%locks,$msg); |
if (ref($domdefs{'offloadoth'}) eq 'HASH') { |
if ($env{'request.role.adv'}) { |
if ($domdefs{'offloadoth'}{$lonhost}) { |
($locknum,%locks) = &Apache::lonnet::get_locks(); |
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne $dom_in_use) && |
} |
(!(($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')))) { |
my $disable_submit = 0; |
unless (&Apache::lonnet::shared_institution($env{'user.domain'})) { |
if ($requrl =~ /$LONCAPA::assess_re/) { |
$offload = 1; |
$disable_submit = 1; |
$dom_in_use = $env{'user.domain'}; |
|
} |
} |
} |
if ($locknum) { |
} |
my @lockinfo = sort(values(%locks)); |
} |
$msg = &mt('Once the following tasks are complete: ')."\\n". |
} |
join(", ",sort(values(%locks)))."\\n". |
if ($offload) { |
&mt('your session will be transferred to a different server, after you click "Roles".'); |
my $newserver = &Apache::lonnet::spareserver(30000,undef,1,$dom_in_use); |
|
if (($newserver) && ($newserver ne $lonhost)) { |
|
my $numsec = 5; |
|
my $timeout = $numsec * 1000; |
|
my ($newurl,$locknum,%locks,$msg); |
|
if ($env{'request.role.adv'}) { |
|
($locknum,%locks) = &Apache::lonnet::get_locks(); |
|
} |
|
my $disable_submit = 0; |
|
if ($requrl =~ /$LONCAPA::assess_re/) { |
|
$disable_submit = 1; |
|
} |
|
if ($locknum) { |
|
my @lockinfo = sort(values(%locks)); |
|
$msg = &mt('Once the following tasks are complete: ')."\n". |
|
join(", ",sort(values(%locks)))."\n"; |
|
if (&show_course()) { |
|
$msg .= &mt('your session will be transferred to a different server, after you click "Courses".'); |
} else { |
} else { |
if (($requrl =~ m{^/res/}) && ($env{'form.submitted'} =~ /^part_/)) { |
$msg .= &mt('your session will be transferred to a different server, after you click "Roles".'); |
$msg = &mt('Your LON-CAPA submission has been recorded')."\\n"; |
} |
|
} else { |
|
if (($requrl =~ m{^/res/}) && ($env{'form.submitted'} =~ /^part_/)) { |
|
$msg = &mt('Your LON-CAPA submission has been recorded')."\n"; |
|
} |
|
$msg .= &mt('Your current LON-CAPA session will be transferred to a different server in [quant,_1,second].',$numsec); |
|
$newurl = '/adm/switchserver?otherserver='.$newserver; |
|
if (($env{'request.role'}) && ($env{'request.role'} ne 'cm')) { |
|
$newurl .= '&role='.$env{'request.role'}; |
|
} |
|
if ($env{'request.symb'}) { |
|
my $shownsymb = &Apache::lonenc::check_encrypt($env{'request.symb'}); |
|
if ($shownsymb =~ m{^/enc/}) { |
|
my $reqdmajor = 2; |
|
my $reqdminor = 11; |
|
my $reqdsubminor = 3; |
|
my $newserverrev = &Apache::lonnet::get_server_loncaparev('',$newserver); |
|
my $remoterev = &Apache::lonnet::get_server_loncaparev(undef,$newserver); |
|
my ($major,$minor,$subminor) = ($remoterev =~ /^\'?(\d+)\.(\d+)\.(\d+|)[\w.\-]+\'?$/); |
|
if (($major eq '' && $minor eq '') || |
|
(($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)) || |
|
(($reqdmajor == $major) && ($reqdminor == $minor) && (($subminor eq '') || |
|
($reqdsubminor > $subminor))))) { |
|
undef($shownsymb); |
|
} |
} |
} |
$msg .= &mt('Your current LON-CAPA session will be transferred to a different server in [quant,_1,second].',$numsec); |
if ($shownsymb) { |
$newurl = '/adm/switchserver?otherserver='.$newserver; |
&js_escape(\$shownsymb); |
if (($env{'request.role'}) && ($env{'request.role'} ne 'cm')) { |
$newurl .= '&symb='.$shownsymb; |
$newurl .= '&role='.$env{'request.role'}; |
|
} |
|
if ($env{'request.symb'}) { |
|
$newurl .= '&symb='.$env{'request.symb'}; |
|
} else { |
|
$newurl .= '&origurl='.$requrl; |
|
} |
} |
|
} else { |
|
my $shownurl = &Apache::lonenc::check_encrypt($requrl); |
|
&js_escape(\$shownurl); |
|
$newurl .= '&origurl='.$shownurl; |
} |
} |
&js_escape(\$msg); |
} |
$result.=<<OFFLOAD |
&js_escape(\$msg); |
|
$result.=<<OFFLOAD |
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 7969 function LC_Offload_Now() {
|
Line 8090 function LC_Offload_Now() {
|
// ]]> |
// ]]> |
</script> |
</script> |
OFFLOAD |
OFFLOAD |
} |
|
} |
} |
} |
} |
} |
} |
Line 8390 sub modal_link {
|
Line 8510 sub modal_link {
|
$target_attr = 'target="'.$target.'"'; |
$target_attr = 'target="'.$target.'"'; |
} |
} |
return <<"ENDLINK"; |
return <<"ENDLINK"; |
<a href="$link" $target_attr title="$title" onclick="javascript:openMyModal('$link',$width,$height,'$scrolling','$transparency','$style'); return false;"> |
<a href="$link" $target_attr title="$title" onclick="javascript:openMyModal('$link',$width,$height,'$scrolling','$transparency','$style'); return false;">$linktext</a> |
$linktext</a> |
|
ENDLINK |
ENDLINK |
} |
} |
|
|
Line 15455 sub construct_course {
|
Line 15574 sub construct_course {
|
# Open all assignments |
# Open all assignments |
# |
# |
if ($args->{'openall'}) { |
if ($args->{'openall'}) { |
|
my $opendate = time; |
|
if ($args->{'openallfrom'} =~ /^\d+$/) { |
|
$opendate = $args->{'openallfrom'}; |
|
} |
my $storeunder=$$crsudom.'_'.$$crsunum.'.0.opendate'; |
my $storeunder=$$crsudom.'_'.$$crsunum.'.0.opendate'; |
my %storecontent = ($storeunder => time, |
my %storecontent = ($storeunder => $opendate, |
$storeunder.'.type' => 'date_start'); |
$storeunder.'.type' => 'date_start'); |
|
$outcome .= &mt('All assignments open starting [_1]', |
$outcome .= &mt('Opening all assignments').': '.&Apache::lonnet::cput |
&Apache::lonlocal::locallocaltime($opendate)).': '. |
('resourcedata',\%storecontent,$$crsudom,$$crsunum).$linefeed; |
&Apache::lonnet::cput |
|
('resourcedata',\%storecontent,$$crsudom,$$crsunum).$linefeed; |
} |
} |
# |
# |
# Set first page |
# Set first page |
Line 17187 sub is_nonframeable {
|
Line 17311 sub is_nonframeable {
|
} |
} |
my $uselink; |
my $uselink; |
my $request = new HTTP::Request('HEAD',$url); |
my $request = new HTTP::Request('HEAD',$url); |
my $response = &LONCAPA::LWPReq::makerequest('',$request,'','',5); |
my $ua = LWP::UserAgent->new; |
|
$ua->timeout(5); |
|
my $response=$ua->request($request); |
if ($response->is_success()) { |
if ($response->is_success()) { |
my $secpolicy = lc($response->header('content-security-policy')); |
my $secpolicy = lc($response->header('content-security-policy')); |
my $xframeop = lc($response->header('x-frame-options')); |
my $xframeop = lc($response->header('x-frame-options')); |