Diff for /loncom/interface/londocs.pm between versions 1.595 and 1.596

version 1.595, 2015/06/18 20:19:06 version 1.596, 2015/08/20 00:28:52
Line 1164  sub print_paste_buffer { Line 1164  sub print_paste_buffer {
                     if (($srcdom ne $coursedom) || ($srcnum ne $coursenum)) {                      if (($srcdom ne $coursedom) || ($srcnum ne $coursenum)) {
                         $othercourse = 1;                          $othercourse = 1;
                         if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {                          if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
                             if ($canpaste) {                              $othercrs = '<br />'.&mt('(from another course)');
                                 $othercrs = '<br />'.&mt('(from another course)');  
                             }  
                         } else {                          } else {
                             $canpaste = 0;                              $canpaste = 0;
                             $nopaste = &mt('Paste from another course unavailable.');                               $nopaste = &mt('Paste from another course unavailable.'); 
Line 1180  sub print_paste_buffer { Line 1178  sub print_paste_buffer {
                         }                          }
                         $is_uploaded_map = 1;                          $is_uploaded_map = 1;
                     }                      }
                   } elsif ($url =~ m{^/adm/($match_domain)/($match_username)/\d+/(bulletinboard|smppg)$}) {
                       if ($cid ne $env{'request.course.id'}) {
                           my ($srcdom,$srcnum) = split(/_/,$cid);
                           if ($env{"user.priv.cm./$srcdom/$srcnum"} =~ /\Q:mdc&F\E/) {
                               $othercrs = '<br />'.&mt('(from another course)');
                           } else {
                               $canpaste = 0;
                               $nopaste = &mt('Paste from another course unavailable.');
                           }       
                       }
                 }                  }
             }                  if ($canpaste) {
             if ($canpaste) {                      push(@pasteable,$suffix);
                push(@pasteable,$suffix);                  }  
             }              }
             my $buffer;              my $buffer;
             if ($is_external) {              if ($is_external) {
Line 1473  sub do_paste_from_buffer { Line 1481  sub do_paste_from_buffer {
   
     foreach my $suffix (@topaste) {      foreach my $suffix (@topaste) {
         my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});          my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});
           my $cid=&LONCAPA::map::qtescape($env{'docs.markedcopy_crs_'.$suffix});
 # Supplemental content may only include certain types of content  # Supplemental content may only include certain types of content
 # Early out if pasted content is not supported in Supplemental area  # Early out if pasted content is not supported in Supplemental area
         if ($folder =~ /^supplemental/) {          if ($folder =~ /^supplemental/) {
Line 1494  sub do_paste_from_buffer { Line 1503  sub do_paste_from_buffer {
             }              }
             $srcdom{$suffix} = $srcd;              $srcdom{$suffix} = $srcd;
             $srcnum{$suffix} = $srcn;              $srcnum{$suffix} = $srcn;
           } elsif ($url =~ m{^/adm/$match_domain/$match_username/\d+/(bulletinboard|smppg)$}) {
               my ($srcd,$srcn) = split(/_/,$cid);
   # When paste buffer was populated using an active role in a different course
   # check for mdc privilege in the course from which the resource was pasted
               if (($srcd ne $coursedom) || ($srcn ne $coursenum)) {
                   unless ($env{"user.priv.cm./$srcd/$srcn"} =~ /\Q:mdc&F\E/) {
                       $notincrs{$suffix} = 1;
                       next;
                   }
               }
               $srcdom{$suffix} = $srcd;
               $srcnum{$suffix} = $srcn;
         }          }
   
         push(@dopaste,$suffix);          push(@dopaste,$suffix);
         if ($url=~/\.(page|sequence)$/) {          if ($url=~/\.(page|sequence)$/) {
             $is_map{$suffix} = 1;               $is_map{$suffix} = 1; 
Line 1593  sub do_paste_from_buffer { Line 1613  sub do_paste_from_buffer {
         }          }
         my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});          my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});
         my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix});          my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix});
           my $cid=&LONCAPA::map::qtescape($env{'docs.markedcopy_crs_'.$suffix}); 
         my $oldurl = $url;          my $oldurl = $url;
         if ($is_map{$suffix}) {          if ($is_map{$suffix}) {
 # If pasting a map, check if map contains other maps  # If pasting a map, check if map contains other maps
Line 1653  sub do_paste_from_buffer { Line 1674  sub do_paste_from_buffer {
         }          }
         if ($url=~ m{/(bulletinboard|smppg)$}) {          if ($url=~ m{/(bulletinboard|smppg)$}) {
             my $prefix = $1;              my $prefix = $1;
               my $fromothercrs; 
             #need to copy the db contents to a new one, unless this is a move.              #need to copy the db contents to a new one, unless this is a move.
             my %info = (              my %info = (
                          src  => $url,                           src  => $url,
                          cdom => $coursedom,                           cdom => $coursedom,
                          cnum => $coursenum,                           cnum => $coursenum,
             );                         );
             unless ($env{'form.docs.markedcopy_options_'.$suffix} eq 'move') {              if (($srcdom{$suffix} =~ /^$match_domain$/) && ($srcnum{$suffix} =~ /^$match_courseid$/)) {
                   unless (($srcdom{$suffix} eq $coursedom) && ($srcnum{$suffix} eq $coursenum)) {
                       $fromothercrs = 1;
                       $info{'cdom'} = $srcdom{$suffix};
                       $info{'cnum'} = $srcnum{$suffix};
                   }
               }
               unless (($env{'form.docs.markedcopy_options_'.$suffix} eq 'move') && (!$fromothercrs)) {
                 my (%lockerr,$msg);                   my (%lockerr,$msg); 
                 my ($newurl,$result,$errtext) =                  my ($newurl,$result,$errtext) =
                     &dbcopy(\%info,$coursedom,$coursenum,\%lockerr);                      &dbcopy(\%info,$coursedom,$coursenum,\%lockerr);
Line 1920  sub get_newmap_url { Line 1949  sub get_newmap_url {
 sub dbcopy {  sub dbcopy {
     my ($dbref,$coursedom,$coursenum,$lockerrorsref) = @_;      my ($dbref,$coursedom,$coursenum,$lockerrorsref) = @_;
     my ($url,$result,$errtext);      my ($url,$result,$errtext);
     $url = $dbref->{'src'};  
     if (ref($dbref) eq 'HASH') {      if (ref($dbref) eq 'HASH') {
           $url = $dbref->{'src'};
         if ($url =~ m{/(smppg|bulletinboard)$}) {          if ($url =~ m{/(smppg|bulletinboard)$}) {
             my $prefix = $1;              my $prefix = $1;
             if (($dbref->{'cdom'} =~ /^$match_domain$/) &&               if (($dbref->{'cdom'} =~ /^$match_domain$/) && 
Line 1959  sub dbcopy { Line 1988  sub dbcopy {
                         my $photo = $contents{'uploaded.photourl'};                          my $photo = $contents{'uploaded.photourl'};
                         my ($subdir,$fname) =                          my ($subdir,$fname) =
                             ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$});                              ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$});
                         my $newphoto;                           my $newphoto;
                         if ($fname ne '') {                          if ($fname ne '') {
                             my $content = &Apache::lonnet::getfile($photo);                              my $content = &Apache::lonnet::getfile($photo);
                             unless ($content eq '-1') {                              unless ($content eq '-1') {

Removed from v.1.595  
changed lines
  Added in v.1.596


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>