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

raeburn raeburn at source.lon-capa.org
Sat Jul 15 23:50:54 EDT 2023


raeburn		Sun Jul 16 03:50:54 2023 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Pasting of published resources created in a course's Authoring Space, via 
    the Course Editor clipboard to a different course is not supported.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.702 loncom/interface/londocs.pm:1.703
--- loncom/interface/londocs.pm:1.702	Tue Jul 11 22:24:29 2023
+++ loncom/interface/londocs.pm	Sun Jul 16 03:50:54 2023
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.702 2023/07/11 22:24:29 raeburn Exp $
+# $Id: londocs.pm,v 1.703 2023/07/16 03:50:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1485,6 +1485,14 @@
                             $nopaste = &mt('Paste from another course unavailable.');
                         }
                     }
+                } elsif ($url =~ m{/res/($match_domain)/($match_username)/}) {
+                    my ($audom,$auname) = ($1,$2);
+                    unless (($auname eq $coursenum) && ($audom eq $coursedom)) {
+                        if (&Apache::lonnet::is_course($audom,$auname)) {
+                            $canpaste = 0;
+                            $nopaste = &mt('Paste from another course unavailable.');
+                        }
+                    }
                 }
                 if ($canpaste) {
                     push(@pasteable,$suffix);
@@ -1825,6 +1833,16 @@
             }
             $srcdom{$suffix} = $srcd;
             $srcnum{$suffix} = $srcn;
+        } elsif ($url =~ m{^/res/($match_domain)/($match_courseid)/}) {
+            my ($audom,$auname) = ($1,$2);
+# When buffer was populated using an active role in a different course
+# disallow pasting of published resources from Course Authoring Space
+            unless (($auname eq $coursenum) && ($audom eq $coursedom)) {
+                if (&Apache::lonnet::is_course($audom,$auname)) {
+                    $othcrsres{$suffix} = 1;
+                    next;
+                }
+            }
         }
         $srcmapidx{$suffix} = $mapidx;
         push(@dopaste,$suffix);
@@ -1876,6 +1894,7 @@
                 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 domain.',
+                othcrsres => 'Paste failed: Item is a course-authored resource from a different course',
                 duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.',
             );
 
@@ -2522,6 +2541,15 @@
                         next;
                     }
                 }
+                if ($ressrc =~ m{^/res/($match_domain)/($match_courseid)/}) {
+                    my ($srcdom,$srcnum) = ($1,$2);
+                    unless (($srcnum eq $coursenum) && ($srcdom eq $coursedom)) {
+                        if (&Apache::lonnet::is_course($srcdom,$srcnum)) {
+                            $removefrommap->{$url}{$token->[2]->{'id'}} = $ressrc;
+                            next;
+                        }
+                    }
+                }
                 if ($ressrc =~ m{^/(res|uploaded)/.+\.(sequence|page)$}) {
                     if ($1 eq 'uploaded') {
                         $hierarchy->{$url}{$token->[2]->{'id'}} = $ressrc;
@@ -9148,7 +9176,7 @@
 <sourceavail></sourceavail>
 <standards></standards>
 <subject></subject>
-<title></title>
+<title>Course Authoring Rights</title>
 END
                                     close($fh);
                                 }




More information about the LON-CAPA-cvs mailing list