--- loncom/interface/londocs.pm 2019/04/11 14:22:35 1.660 +++ loncom/interface/londocs.pm 2020/02/29 16:25:44 1.666 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.660 2019/04/11 14:22:35 raeburn Exp $ +# $Id: londocs.pm,v 1.666 2020/02/29 16:25:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1232,7 +1232,7 @@ sub update_paste_buffer { my @pathitems = split(/\&/,$env{'form.folderpath'}); my @folderconf = split(/\:/,$pathitems[-1]); - my $ispage = $folderconf[4]; + my $ispage = $folderconf[5]; foreach my $item (@possibles) { my ($orderidx,$cmd) = split(/:/,$item); @@ -1790,7 +1790,7 @@ sub do_paste_from_buffer { %msgs = &Apache::lonlocal::texthash ( notinsupp => 'Paste failed: content type is not supported within Supplemental Content', notincrs => 'Paste failed: Item is from a different course which you do not have rights to edit.', - notindom => 'Paste failed: Item is an external tool from a course in a different donain.', + notindom => 'Paste failed: Item is an external tool from a course in a different domain.', duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.', ); @@ -2329,7 +2329,9 @@ sub copy_templated_files { my @simpleprobqtypes = qw(radio option string essay numerical); my $qtype=$srcparms{$srcprefix.'questiontype'}; if (grep(/^\Q$qtype\E$/,@simpleprobqtypes)) { - my %newdata; + my %newdata = ( + $newprefix.'questiontype' => $qtype, + ); foreach my $type (@simpleprobqtypes) { if ($type eq $qtype) { $newdata{"$weightprefix.$type.weight"}=1; @@ -2803,9 +2805,7 @@ sub apply_fixups { } } if (ref($resdatacopy{$key}) eq 'HASH') { - if ($newsubdir{$key}) { - - } + my ($gotnewmapname,$newmapname,$srcfolder,$srccontainer); foreach my $idx (keys(%{$resdatacopy{$key}})) { if (ref($resdatacopy{$key}{$idx}) eq 'HASH') { my $srcurl = $resdatacopy{$key}{$idx}{'src'}; @@ -2815,15 +2815,18 @@ sub apply_fixups { ($resdatacopy{$key}{$idx}{'cnum'} =~ /^$match_courseid$/)) { my $srcdom = $resdatacopy{$key}{$idx}{'cdom'}; my $srcnum = $resdatacopy{$key}{$idx}{'cnum'}; - my ($newmapname) = ($key =~ m{/([^/]+)$}); - my ($srcfolder,$srccontainer) = split(/\./,$newmapname); + unless ($gotnewmapname) { + ($newmapname) = ($key =~ m{/([^/]+)$}); + ($srcfolder,$srccontainer) = split(/\./,$newmapname); + if ($newsubdir{$key}) { + $newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/; + } + $gotnewmapname = 1; + } my $srcmapinfo = $srcfolder.':'.$idx; if ($srccontainer eq 'page') { $srcmapinfo .= ':1'; } - if ($newsubdir{$key}) { - $newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/; - } ©_templated_files($srcurl,$srcdom,$srcnum,$srcmapinfo,$cdom, $cnum,$template,$idx,$newmapname); } @@ -5634,7 +5637,7 @@ sub handler { undef($env{'form.folderpath'}); } else { $folderurl = "uploaded/$coursedom/$coursenum/$folder"; - if ((split(/\:/,$pathitems[-1]))[4]) { + if ((split(/\:/,$pathitems[-1]))[5]) { $folderurl .= '.page'; } else { $folderurl .= '.sequence'; @@ -5967,8 +5970,8 @@ sub handler { my $fileupload=(< - - + + FIUP my $checkbox=(<