--- loncom/interface/loncommon.pm 2013/01/01 19:53:26 1.1108 +++ loncom/interface/loncommon.pm 2013/01/15 17:37:45 1.1111 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1108 2013/01/01 19:53:26 raeburn Exp $ +# $Id: loncommon.pm,v 1.1111 2013/01/15 17:37:45 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,6 +68,7 @@ use Apache::loncoursedata(); use Apache::lontexconvert(); use Apache::lonclonecourse(); use Apache::lonuserutils(); +use Apache::lonuserstate(); use LONCAPA qw(:DEFAULT :match); use DateTime::TimeZone; use DateTime::Locale::Catalog; @@ -11625,7 +11626,7 @@ sub cleanup_empty_dirs { my $numitems = 0; foreach my $item (@dircontents) { if (-d "$path/$item") { - &recurse_dirs("$path/$item"); + &cleanup_empty_dirs("$path/$item"); if (-e "$path/$item") { $numitems ++; } @@ -14144,6 +14145,32 @@ sub update_content_constraints { return; } +sub allmaps_incourse { + my ($cdom,$cnum,$chome,$cid) = @_; + if ($cdom eq '' || $cnum eq '' || $chome eq '' || $cid eq '') { + $cid = $env{'request.course.id'}; + $cdom = $env{'course.'.$cid.'.domain'}; + $cnum = $env{'course.'.$cid.'.num'}; + $chome = $env{'course.'.$cid.'.home'}; + } + my %allmaps = (); + my $lastchange = + &Apache::lonnet::get_coursechange($cdom,$cnum); + if ($lastchange > $env{'request.course.tied'}) { + my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum"); + unless ($ferr) { + &update_content_constraints($cdom,$cnum,$chome,$cid); + } + } + my $navmap = Apache::lonnavmaps::navmap->new(); + if (defined($navmap)) { + foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_map() },1,0,1)) { + $allmaps{$res->src()} = 1; + } + } + return \%allmaps; +} + sub parse_supplemental_title { my ($title) = @_; @@ -14353,7 +14380,7 @@ sub check_captcha { output_folder => $captcha_params{'output_dir'}, data_folder => $captcha_params{'db_dir'}, ); - my $captcha_chk = $captcha->check_code($code,$md5sum); + $captcha_chk = $captcha->check_code($code,$md5sum); my %captcha_hash = ( 0 => 'Code not checked (file error)', -1 => 'Failed: code expired', 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.