version 1.12, 2012/07/21 20:18:37
|
version 1.18, 2014/06/07 03:07:06
|
Line 85 my @ids=&Apache::lonnet::current_machine
|
Line 85 my @ids=&Apache::lonnet::current_machine
|
$env{'allowed.bre'} = 'F'; |
$env{'allowed.bre'} = 'F'; |
|
|
foreach my $dom (@domains) { |
foreach my $dom (@domains) { |
|
$env{'user.domain'} = $dom; |
|
$env{'user.name'} = &Apache::lonnet::get_domainconfiguser($dom); |
my %courseshash; |
my %courseshash; |
my %currhash = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@ids,'.'); |
my %currhash = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@ids,'.'); |
my %lastaccess = &Apache::lonnet::courselastaccess($dom,undef,\@ids); |
my %lastaccess = &Apache::lonnet::courselastaccess($dom,undef,\@ids); |
Line 101 foreach my $dom (@domains) {
|
Line 103 foreach my $dom (@domains) {
|
} |
} |
} |
} |
} |
} |
|
delete($env{'user.name'}); |
|
delete($env{'user.domain'}); |
} |
} |
|
|
delete($env{'allowed.bre'}); |
delete($env{'allowed.bre'}); |
Line 180 sub recurse_courses {
|
Line 184 sub recurse_courses {
|
my $creationcontext = $courseinfo{'internal.creationcontext'}; |
my $creationcontext = $courseinfo{'internal.creationcontext'}; |
my $inst_code = $courseinfo{'internal.coursecode'}; |
my $inst_code = $courseinfo{'internal.coursecode'}; |
my $releaserequired = $courseinfo{'internal.releaserequired'}; |
my $releaserequired = $courseinfo{'internal.releaserequired'}; |
|
my $uniquecode = $courseinfo{'internal.uniquecode'}; |
$inst_code = '' if (!defined($inst_code)); |
$inst_code = '' if (!defined($inst_code)); |
$owner = '' if (!defined($owner)); |
$owner = '' if (!defined($owner)); |
|
$uniquecode = '' if (!defined($uniquecode)); |
if ($created eq '') { |
if ($created eq '') { |
if (ref($currhash->{$cid}) eq 'HASH') { |
if (ref($currhash->{$cid}) eq 'HASH') { |
$created = $currhash->{$cid}{'created'}; |
$created = $currhash->{$cid}{'created'}; |
Line 242 sub recurse_courses {
|
Line 248 sub recurse_courses {
|
} |
} |
|
|
unless ($chome eq 'no_host') { |
unless ($chome eq 'no_host') { |
|
if (($lastaccess->{$cid} eq '') || |
|
($lastaccess->{$cid} > $twodaysago)) { |
|
my $contentchange; |
|
if ($courseinfo{'internal.created'} eq '') { |
|
$contentchange = &last_map_update($cnum,$cdom); |
|
} else { |
|
unless ($courseinfo{'internal.created'} > $lastaccess->{$cid}) { |
|
$contentchange = &last_map_update($cnum,$cdom); |
|
} |
|
} |
|
if (($contentchange) && ($contentchange > $courseinfo{'internal.contentchange'})) { |
|
$changes{'internal.contentchange'} = $contentchange; |
|
} |
|
} |
$courseshash->{$chome}{$cid} = { |
$courseshash->{$chome}{$cid} = { |
description => $courseinfo{'description'}, |
description => $courseinfo{'description'}, |
inst_code => $inst_code, |
inst_code => $inst_code, |
Line 308 sub recurse_courses {
|
Line 328 sub recurse_courses {
|
$courseshash->{$chome}{$cid}{$item} = $courseinfo{$item}; |
$courseshash->{$chome}{$cid}{$item} = $courseinfo{$item}; |
} |
} |
} |
} |
foreach my $item ('selfenroll_types','selfenroll_start_date','selfenroll_end_date') { |
foreach my $item ('selfenroll_types','selfenroll_start_date','selfenroll_end_date','uniquecode') { |
if ($courseinfo{'internal.'.$item} ne '') { |
if ($courseinfo{'internal.'.$item} ne '') { |
$courseshash->{$chome}{$cid}{$item} = |
$courseshash->{$chome}{$cid}{$item} = |
$courseinfo{'internal.'.$item}; |
$courseinfo{'internal.'.$item}; |
Line 358 sub parameter_constraints {
|
Line 378 sub parameter_constraints {
|
if ($key =~ /(\Q$item\E)$/) { |
if ($key =~ /(\Q$item\E)$/) { |
if (ref($checkparms{$item}) eq 'ARRAY') { |
if (ref($checkparms{$item}) eq 'ARRAY') { |
my $value = $resourcedata->{$key}; |
my $value = $resourcedata->{$key}; |
|
if ($item eq 'examcode') { |
|
if (&Apache::lonnet::validCODE($value)) { |
|
$value = 'valid'; |
|
} else { |
|
$value = ''; |
|
} |
|
} |
if (grep(/^\Q$value\E$/,@{$checkparms{$item}})) { |
if (grep(/^\Q$value\E$/,@{$checkparms{$item}})) { |
my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value}); |
my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value}); |
($reqdmajor,$reqdminor) = |
($reqdmajor,$reqdminor) = |
Line 383 sub coursetype_constraints {
|
Line 410 sub coursetype_constraints {
|
|
|
sub commblock_constraints { |
sub commblock_constraints { |
my ($cnum,$cdom,$reqdmajor,$reqdminor) = @_; |
my ($cnum,$cdom,$reqdmajor,$reqdminor) = @_; |
my %comm_blocks = &Apache::lonnet::dump('commblock',$cdom,$cnum); |
my %comm_blocks = &Apache::lonnet::dump('comm_block',$cdom,$cnum); |
my $now = time; |
my $now = time; |
if (keys(%comm_blocks) > 0) { |
if (keys(%comm_blocks) > 0) { |
foreach my $block (keys(%comm_blocks)) { |
foreach my $block (keys(%comm_blocks)) { |
if ($block =~ /^firstaccess____(.+)$/) { |
if ($block =~ /^firstaccess____(.+)$/) { |
my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course.commblock.timer'}); |
my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:timer'}); |
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor); |
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor); |
last; |
last; |
} elsif ($block =~ /^(\d+)____(\d+)$/) { |
} elsif ($block =~ /^(\d+)____(\d+)$/) { |
Line 399 sub commblock_constraints {
|
Line 426 sub commblock_constraints {
|
if (ref($comm_blocks{$block}{'blocks'}) eq 'HASH') { |
if (ref($comm_blocks{$block}{'blocks'}) eq 'HASH') { |
if (ref($comm_blocks{$block}{'blocks'}{'docs'}) eq 'HASH') { |
if (ref($comm_blocks{$block}{'blocks'}{'docs'}) eq 'HASH') { |
if (keys(%{$comm_blocks{$block}{'blocks'}{'docs'}}) > 0) { |
if (keys(%{$comm_blocks{$block}{'blocks'}{'docs'}}) > 0) { |
my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course.commblock.docs'}); |
my ($major,$minor) = split(/\./,$Apache::lonnet::needsrelease{'course:commblock:docs'}); |
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor); |
($reqdmajor,$reqdminor) = &update_reqd_loncaparev($major,$minor,$reqdmajor,$reqdminor); |
last; |
last; |
} |
} |
Line 489 sub read_paramdata {
|
Line 516 sub read_paramdata {
|
return $resourcedata; |
return $resourcedata; |
} |
} |
|
|
|
sub last_map_update { |
|
my ($cnum,$cdom) = @_; |
|
my $lastupdate = 0; |
|
my $path = &LONCAPA::propath($cdom,$cnum); |
|
if (-d "$path/userfiles") { |
|
if (opendir(my $dirh, "$path/userfiles")) { |
|
my @maps = grep(/^default_?\d*\.(?:sequence|page)$/,readdir($dirh)); |
|
foreach my $map (@maps) { |
|
my $mtime = (stat("$path/userfiles/$map"))[9]; |
|
if ($mtime > $lastupdate) { |
|
$lastupdate = $mtime; |
|
} |
|
} |
|
} |
|
} |
|
return $lastupdate; |
|
} |
|
|