[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Fri Aug 16 10:21:43 EDT 2019


raeburn		Fri Aug 16 14:21:43 2019 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Re-use information about source folder and new folder for each simple problem
    being copied when copying a folder between courses which has simple problems.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.663 loncom/interface/londocs.pm:1.664
--- loncom/interface/londocs.pm:1.663	Sun Aug 11 15:15:39 2019
+++ loncom/interface/londocs.pm	Fri Aug 16 14:21:43 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.663 2019/08/11 15:15:39 raeburn Exp $
+# $Id: londocs.pm,v 1.664 2019/08/16 14:21:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2803,9 +2803,7 @@
                 }
             }
             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 +2813,18 @@
                                 ($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}/;
-                                }
                                 &copy_templated_files($srcurl,$srcdom,$srcnum,$srcmapinfo,$cdom,
                                                       $cnum,$template,$idx,$newmapname);
                             }




More information about the LON-CAPA-cvs mailing list