--- loncom/interface/londocs.pm 2025/01/17 14:10:05 1.484.2.93.2.18 +++ loncom/interface/londocs.pm 2017/08/28 03:57:04 1.638 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.93.2.18 2025/01/17 14:10:05 raeburn Exp $ +# $Id: londocs.pm,v 1.638 2017/08/28 03:57:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,14 +43,15 @@ use Apache::lonnavdisplay(); use Apache::lonextresedit(); use Apache::lontemplate(); use Apache::lonsimplepage(); -use Apache::loncourserespicker(); +use Apache::lonhomework(); +use Apache::lonpublisher(); use HTML::Entities; use HTML::TokeParser; use GDBM_File; use File::MMagic; +use File::Copy; use Apache::lonlocal; use Cwd; -use UUID::Tiny ':std'; use LONCAPA qw(:DEFAULT :match); my $iconpath; @@ -87,7 +88,7 @@ sub storemap { if ($map =~ /^default/) { $hadchanges=1; - } elsif ($contentchg) { + } else { $suppchanges=1; } return ($errtext,0); @@ -179,64 +180,6 @@ sub default_folderpath { } } -sub validate_supppath { - my ($coursenum,$coursedom) = @_; - my $backto; - if ($env{'form.supppath'} ne '') { - my @items = split(/\&/,$env{'form.supppath'}); - my ($badpath,$got_supp,$supppath,%supphidden,%suppids); - for (my $i=0; $i<@items; $i++) { - my $odd = $i%2; - if ((!$odd) && ($items[$i] !~ /^supplemental(|_\d+)$/)) { - $badpath = 1; - last; - } elsif ($odd) { - my $suffix; - my $idx = $i-1; - if ($items[$i] =~ /^([^:]*)::(|1):::$/) { - $backto .= '&'.$1; - } elsif ($items[$idx] eq 'supplemental') { - $backto .= '&'.$items[$i]; - } else { - $backto .= '&'.$items[$i]; - my $is_hidden; - unless ($got_supp) { - my ($supplemental) = &Apache::loncommon::get_supplemental($coursenum,$coursedom); - if (ref($supplemental) eq 'HASH') { - if (ref($supplemental->{'hidden'}) eq 'HASH') { - %supphidden = %{$supplemental->{'hidden'}}; - } - if (ref($supplemental->{'ids'}) eq 'HASH') { - %suppids = %{$supplemental->{'ids'}}; - } - } - $got_supp = 1; - } - if (ref($suppids{"/uploaded/$coursedom/$coursenum/$items[$idx].sequence"}) eq 'ARRAY') { - my $mapid = $suppids{"/uploaded/$coursedom/$coursenum/$items[$idx].sequence"}->[0]; - if ($supphidden{$mapid}) { - $is_hidden = 1; - } - } - $suffix = '::'.$is_hidden.':::'; - } - $supppath .= '&'.$items[$i].$suffix; - } else { - $supppath .= '&'.$items[$i]; - $backto .= '&'.$items[$i]; - } - } - if ($badpath) { - delete($env{'form.supppath'}); - } else { - $supppath =~ s/^\&//; - $backto =~ s/^\&//; - $env{'form.supppath'} = $supppath; - } - } - return $backto; -} - sub dumpcourse { my ($r) = @_; my $crstype = &Apache::loncommon::course_type(); @@ -292,7 +235,7 @@ ENDJS } else { &Apache::loncourserespicker::enumerate_course_contents($navmap,\%maps,\%resources,\%titles, 'dumpdocs',$cdom,$cnum); - } + } my @todump = &Apache::loncommon::get_env_multiple('form.archive'); my (%tocopy,%replacehash,%lookup,%deps,%display,%result,%depresult,%simpleproblems,%simplepages, %newcontent,%has_simpleprobs); @@ -303,7 +246,7 @@ ENDJS if ($res =~ m{^uploaded/$cdom/$cnum/\E((?:docs|supplemental)/.+)$}) { $tocopy{$1} = $name; $display{$item} = $1; - $lookup{$1} = $item; + $lookup{$1} = $item; } elsif ($res eq 'lib/templates/simpleproblem.problem') { $simpleproblems{$item} = { symb => $resources{$item}, @@ -403,7 +346,7 @@ $contents{content}.' '; } if ($contents{webreferences}) { - $content .= ' + $content .= '