version 1.1393, 2022/10/27 20:30:11
|
version 1.1397, 2022/11/17 13:21:09
|
Line 72 use Apache::lonuserstate();
|
Line 72 use Apache::lonuserstate();
|
use Apache::courseclassifier(); |
use Apache::courseclassifier(); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::LWPReq; |
use LONCAPA::LWPReq; |
|
use LONCAPA::map(); |
use HTTP::Request; |
use HTTP::Request; |
use DateTime::TimeZone; |
use DateTime::TimeZone; |
use DateTime::Locale; |
use DateTime::Locale; |
Line 4284 sub syllabuswrapper {
|
Line 4285 sub syllabuswrapper {
|
|
|
# ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
|
|
|
sub aboutme_on { |
|
my ($uname,$udom)=@_; |
|
unless ($uname) { $uname=$env{'user.name'}; } |
|
unless ($udom) { $udom=$env{'user.domain'}; } |
|
return if ($udom eq 'public' && $uname eq 'public'); |
|
my $hashkey=$uname.':'.$udom; |
|
my ($aboutme,$cached)=&Apache::lonnet::is_cached_new('aboutme',$hashkey); |
|
if ($cached) { |
|
return $aboutme; |
|
} |
|
$aboutme = &Apache::lonnet::usertools_access($uname,$udom,'aboutme'); |
|
&Apache::lonnet::do_cache_new('aboutme',$hashkey,$aboutme,3600); |
|
return $aboutme; |
|
} |
|
|
|
sub devalidate_aboutme_cache { |
|
my ($uname,$udom)=@_; |
|
if (!$udom) { $udom =$env{'user.domain'}; } |
|
if (!$uname) { $uname=$env{'user.name'}; } |
|
return if ($udom eq 'public' && $uname eq 'public'); |
|
my $id=$uname.':'.$udom; |
|
&Apache::lonnet::devalidate_cache_new('aboutme',$id); |
|
} |
|
|
sub track_student_link { |
sub track_student_link { |
my ($linktext,$sname,$sdom,$target,$start,$only_body) = @_; |
my ($linktext,$sname,$sdom,$target,$start,$only_body) = @_; |
my $link ="/adm/trackstudent?"; |
my $link ="/adm/trackstudent?"; |
Line 17062 sub construct_course {
|
Line 17087 sub construct_course {
|
# |
# |
unless (($args->{'nonstandard'}) || ($args->{'firstres'} eq 'blank') |
unless (($args->{'nonstandard'}) || ($args->{'firstres'} eq 'blank') |
|| ($cloneid)) { |
|| ($cloneid)) { |
use LONCAPA::map; |
|
$outcome .= &mt('Setting first resource').': '; |
$outcome .= &mt('Setting first resource').': '; |
|
|
my $map = '/uploaded/'.$$crsudom.'/'.$$crsunum.'/default.sequence'; |
my $map = '/uploaded/'.$$crsudom.'/'.$$crsunum.'/default.sequence'; |
Line 18369 sub switch_for_update {
|
Line 18393 sub switch_for_update {
|
} |
} |
|
|
sub update_content_constraints { |
sub update_content_constraints { |
my ($cdom,$cnum,$chome,$cid,$keeporder) = @_; |
my ($cdom,$cnum,$chome,$cid) = @_; |
my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired'); |
my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired'); |
my ($reqdmajor,$reqdminor) = split(/\./,$curr_reqd_hash{'internal.releaserequired'}); |
my ($reqdmajor,$reqdminor) = split(/\./,$curr_reqd_hash{'internal.releaserequired'}); |
my (%checkresponsetypes,%checkcrsrestypes); |
my (%checkresponsetypes,%checkcrsrestypes); |
Line 18417 sub update_content_constraints {
|
Line 18441 sub update_content_constraints {
|
} |
} |
undef($navmap); |
undef($navmap); |
} |
} |
my (@resources,@order,@resparms,@zombies); |
|
if ($keeporder) { |
|
use LONCAPA::map; |
|
@resources = @LONCAPA::map::resources; |
|
@order = @LONCAPA::map::order; |
|
@resparms = @LONCAPA::map::resparms; |
|
@zombies = @LONCAPA::map::zombies; |
|
} |
|
if ($keeporder) { |
|
@LONCAPA::map::resources = @resources; |
|
@LONCAPA::map::order = @order; |
|
@LONCAPA::map::resparms = @resparms; |
|
@LONCAPA::map::zombies = @zombies; |
|
} |
|
if (&Apache::lonnet::count_supptools($cnum,$cdom,1)) { |
if (&Apache::lonnet::count_supptools($cnum,$cdom,1)) { |
my ($major,$minor) = split(/\./,$checkcrsrestypes{'exttool'}); |
my ($major,$minor) = split(/\./,$checkcrsrestypes{'exttool'}); |
if (($major > $reqdmajor) || ($major == $reqdmajor && $minor > $reqdminor)) { |
if (($major > $reqdmajor) || ($major == $reqdmajor && $minor > $reqdminor)) { |
Line 18457 sub allmaps_incourse {
|
Line 18467 sub allmaps_incourse {
|
if ($lastchange > $env{'request.course.tied'}) { |
if ($lastchange > $env{'request.course.tied'}) { |
my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum"); |
my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum"); |
unless ($ferr) { |
unless ($ferr) { |
&update_content_constraints($cdom,$cnum,$chome,$cid,1); |
&update_content_constraints($cdom,$cnum,$chome,$cid); |
} |
} |
} |
} |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
Line 18492 sub parse_supplemental_title {
|
Line 18502 sub parse_supplemental_title {
|
return $title; |
return $title; |
} |
} |
|
|
|
sub get_supplemental { |
|
my ($cnum,$cdom,$ignorecache,$possdel)=@_; |
|
my $hashid=$cnum.':'.$cdom; |
|
my ($supplemental,$cached,$set_httprefs); |
|
unless ($ignorecache) { |
|
($supplemental,$cached) = &Apache::lonnet::is_cached_new('supplemental',$hashid); |
|
} |
|
unless (defined($cached)) { |
|
my $chome=&Apache::lonnet::homeserver($cnum,$cdom); |
|
unless ($chome eq 'no_host') { |
|
my @order = @LONCAPA::map::order; |
|
my @resources = @LONCAPA::map::resources; |
|
my @resparms = @LONCAPA::map::resparms; |
|
my @zombies = @LONCAPA::map::zombies; |
|
my ($errors,%ids,%hidden); |
|
$errors = |
|
&recurse_supplemental($cnum,$cdom,'supplemental.sequence', |
|
$errors,$possdel,\%ids,\%hidden); |
|
@LONCAPA::map::order = @order; |
|
@LONCAPA::map::resources = @resources; |
|
@LONCAPA::map::resparms = @resparms; |
|
@LONCAPA::map::zombies = @zombies; |
|
$set_httprefs = 1; |
|
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
|
&Apache::lonnet::appenv({'request.course.suppupdated' => time}); |
|
} |
|
$supplemental = { |
|
ids => \%ids, |
|
hidden => \%hidden, |
|
}; |
|
&Apache::lonnet::do_cache_new('supplemental',$hashid,$supplemental,600); |
|
} |
|
} |
|
return ($supplemental,$set_httprefs); |
|
} |
|
|
sub recurse_supplemental { |
sub recurse_supplemental { |
my ($cnum,$cdom,$suppmap,$errors,$possdel,$suppids,$hiddensupp,$hidden) = @_; |
my ($cnum,$cdom,$suppmap,$errors,$possdel,$suppids,$hiddensupp,$hidden) = @_; |
if (($suppmap) && (ref($suppids) eq 'HASH') && (ref($hiddensupp) eq 'HASH')) { |
if (($suppmap) && (ref($suppids) eq 'HASH') && (ref($hiddensupp) eq 'HASH')) { |
Line 18673 sub validate_folderpath {
|
Line 18719 sub validate_folderpath {
|
my ($supplementalflag,$allowed,$coursenum,$coursedom) = @_; |
my ($supplementalflag,$allowed,$coursenum,$coursedom) = @_; |
if ($env{'form.folderpath'} ne '') { |
if ($env{'form.folderpath'} ne '') { |
my @items = split(/\&/,$env{'form.folderpath'}); |
my @items = split(/\&/,$env{'form.folderpath'}); |
my ($badpath,$got_supp,$supppath,%supphidden,%suppids); |
my ($badpath,$changed,$got_supp,$supppath,%supphidden,%suppids); |
for (my $i=0; $i<@items; $i++) { |
for (my $i=0; $i<@items; $i++) { |
my $odd = $i%2; |
my $odd = $i%2; |
if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) { |
if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) { |
$badpath = 1; |
$badpath = 1; |
} elsif ($odd && $supplementalflag && $allowed) { |
} elsif ($odd && $supplementalflag) { |
my $suffix; |
|
my $idx = $i-1; |
my $idx = $i-1; |
if (($items[$i] !~ /^[^:]*::(|1):::$/) && ($items[$idx] ne 'supplemental')) { |
if ($items[$i] =~ /^([^:]*)::(|1):::$/) { |
|
my $esc_name = $1; |
|
if ((!$allowed) || ($items[$idx] eq 'supplemental')) { |
|
$supppath .= '&'.$esc_name; |
|
$changed = 1; |
|
} else { |
|
$supppath .= '&'.$items[$i]; |
|
} |
|
} elsif (($allowed) && ($items[$idx] ne 'supplemental')) { |
|
$changed = 1; |
my $is_hidden; |
my $is_hidden; |
unless ($got_supp) { |
unless ($got_supp) { |
my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom); |
my ($supplemental) = &get_supplemental($coursenum,$coursedom); |
if (ref($supplemental) eq 'HASH') { |
if (ref($supplemental) eq 'HASH') { |
if (ref($supplemental->{'hidden'}) eq 'HASH') { |
if (ref($supplemental->{'hidden'}) eq 'HASH') { |
%supphidden = %{$supplemental->{'hidden'}}; |
%supphidden = %{$supplemental->{'hidden'}}; |
Line 18701 sub validate_folderpath {
|
Line 18755 sub validate_folderpath {
|
$is_hidden = 1; |
$is_hidden = 1; |
} |
} |
} |
} |
$suffix = '::'.$is_hidden.':::'; |
$supppath .= '&'.$items[$i].'::'.$is_hidden.':::'; |
|
} else { |
|
$supppath .= '&'.$items[$i]; |
} |
} |
$supppath .= '&'.$items[$i].$suffix; |
|
} elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) { |
} elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) { |
$badpath = 1; |
$badpath = 1; |
} elsif (!$odd && $supplementalflag && $allowed) { |
} elsif ($supplementalflag) { |
$supppath .= '&'.$items[$i]; |
$supppath .= '&'.$items[$i]; |
} |
} |
last if ($badpath); |
last if ($badpath); |
} |
} |
if ($badpath) { |
if ($badpath) { |
delete($env{'form.folderpath'}); |
delete($env{'form.folderpath'}); |
} elsif ($supplementalflag && $allowed) { |
} elsif ($changed && $supplementalflag) { |
$supppath =~ s/^\&//; |
$supppath =~ s/^\&//; |
$env{'form.folderpath'} = $supppath; |
$env{'form.folderpath'} = $supppath; |
} |
} |