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

raeburn raeburn at source.lon-capa.org
Sun Mar 1 10:39:17 EST 2020


raeburn		Sun Mar  1 15:39:17 2020 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Format of keys used in %pasteurls hash to suppress duplication of items in
    paste buffer is dependent on type of item -- simple problem, published 
    resource or neither. 
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.666 loncom/interface/londocs.pm:1.667
--- loncom/interface/londocs.pm:1.666	Sat Feb 29 16:25:44 2020
+++ loncom/interface/londocs.pm	Sun Mar  1 15:39:17 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.666 2020/02/29 16:25:44 raeburn Exp $
+# $Id: londocs.pm,v 1.667 2020/03/01 15:39:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1217,13 +1217,19 @@
 # Construct identifiers for current contents of user's paste buffer
     if (@currpaste) {
         foreach my $suffix (@currpaste) {
-             my $cid = $env{'docs.markedcopy_crs_'.$suffix};
-             my $url = $env{'docs.markedcopy_url_'.$suffix};
-             my $mapidx = $env{'docs.markedcopy_map_'.$suffix};
-             if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
-                 ($url ne '')) {
-                 $pasteurls{$cid.'_'.$url.'_'.$mapidx} = 1;
-             }
+            my $cid = $env{'docs.markedcopy_crs_'.$suffix};
+            my $url = $env{'docs.markedcopy_url_'.$suffix};
+            my $mapidx = $env{'docs.markedcopy_map_'.$suffix};
+            if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
+                ($url ne '')) {
+                if ($url eq '/res/lib/templates/simpleproblem.problem') {
+                    $pasteurls{$cid.'_'.$mapidx} = 1;
+                } elsif ($url =~ m{^/res/$match_domain/$match_username/}) {
+                    $pasteurls{$url} = 1;
+                } else {
+                     $pasteurls{$cid.'_'.$url} = 1;
+                }
+            }
         }
     }
 
@@ -1245,7 +1251,13 @@
                                           $env{'form.folderpath'},\%curr_groups);
         next if ($denied{'copy'});
         $url=~s{http(:|:)//https(:|:)//}{https$2//};
-        next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$mapidx}));
+        if ($url eq '/res/lib/templates/simpleproblem.problem') {
+            next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$mapidx}));
+        } elsif ($url =~ m{^/res/$match_domain/$match_username/}) {
+            next if (exists($pasteurls{$url}));
+        } else {
+            next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url}));
+        }
         my ($suffix,$errortxt,$locknotfreed) =
             &new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');
         if ($suffix ne '') {




More information about the LON-CAPA-cvs mailing list