Diff for /loncom/interface/londocs.pm between versions 1.660 and 1.668

version 1.660, 2019/04/11 14:22:35 version 1.668, 2020/03/03 01:16:35
Line 1217  sub update_paste_buffer { Line 1217  sub update_paste_buffer {
 # Construct identifiers for current contents of user's paste buffer  # Construct identifiers for current contents of user's paste buffer
     if (@currpaste) {      if (@currpaste) {
         foreach my $suffix (@currpaste) {          foreach my $suffix (@currpaste) {
              my $cid = $env{'docs.markedcopy_crs_'.$suffix};              my $cid = $env{'docs.markedcopy_crs_'.$suffix};
              my $url = $env{'docs.markedcopy_url_'.$suffix};              my $url = $env{'docs.markedcopy_url_'.$suffix};
              my $mapidx = $env{'docs.markedcopy_map_'.$suffix};              my $mapidx = $env{'docs.markedcopy_map_'.$suffix};
              if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&              if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
                  ($url ne '')) {                  ($url ne '')) {
                  $pasteurls{$cid.'_'.$url.'_'.$mapidx} = 1;                  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;
                   }
               }
         }          }
     }      }
   
Line 1232  sub update_paste_buffer { Line 1238  sub update_paste_buffer {
   
     my @pathitems = split(/\&/,$env{'form.folderpath'});      my @pathitems = split(/\&/,$env{'form.folderpath'});
     my @folderconf = split(/\:/,$pathitems[-1]);      my @folderconf = split(/\:/,$pathitems[-1]);
     my $ispage = $folderconf[4];      my $ispage = $folderconf[5];
   
     foreach my $item (@possibles) {      foreach my $item (@possibles) {
         my ($orderidx,$cmd) = split(/:/,$item);          my ($orderidx,$cmd) = split(/:/,$item);
Line 1245  sub update_paste_buffer { Line 1251  sub update_paste_buffer {
                                           $env{'form.folderpath'},\%curr_groups);                                            $env{'form.folderpath'},\%curr_groups);
         next if ($denied{'copy'});          next if ($denied{'copy'});
         $url=~s{http(:|:)//https(:|:)//}{https$2//};          $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) =          my ($suffix,$errortxt,$locknotfreed) =
             &new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');              &new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');
         if ($suffix ne '') {          if ($suffix ne '') {
Line 1790  sub do_paste_from_buffer { Line 1802  sub do_paste_from_buffer {
     %msgs = &Apache::lonlocal::texthash (      %msgs = &Apache::lonlocal::texthash (
                 notinsupp => 'Paste failed: content type is not supported within Supplemental Content',                  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.',                  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.',                  duplicate => 'Paste failed: only one instance of a particular published sequence or page is allowed within each course.',
             );              );
   
Line 2329  sub copy_templated_files { Line 2341  sub copy_templated_files {
         my @simpleprobqtypes = qw(radio option string essay numerical);          my @simpleprobqtypes = qw(radio option string essay numerical);
         my $qtype=$srcparms{$srcprefix.'questiontype'};          my $qtype=$srcparms{$srcprefix.'questiontype'};
         if (grep(/^\Q$qtype\E$/,@simpleprobqtypes)) {          if (grep(/^\Q$qtype\E$/,@simpleprobqtypes)) {
             my %newdata;              my %newdata = (
                   $newprefix.'questiontype' => $qtype,
               );
             foreach my $type (@simpleprobqtypes) {              foreach my $type (@simpleprobqtypes) {
                 if ($type eq $qtype) {                  if ($type eq $qtype) {
                     $newdata{"$weightprefix.$type.weight"}=1;                      $newdata{"$weightprefix.$type.weight"}=1;
Line 2803  sub apply_fixups { Line 2817  sub apply_fixups {
                 }                  }
             }              }
             if (ref($resdatacopy{$key}) eq 'HASH') {              if (ref($resdatacopy{$key}) eq 'HASH') {
                 if ($newsubdir{$key}) {                  my ($gotnewmapname,$newmapname,$srcfolder,$srccontainer);
   
                 }  
                 foreach my $idx (keys(%{$resdatacopy{$key}})) {                  foreach my $idx (keys(%{$resdatacopy{$key}})) {
                     if (ref($resdatacopy{$key}{$idx}) eq 'HASH') {                      if (ref($resdatacopy{$key}{$idx}) eq 'HASH') {
                         my $srcurl = $resdatacopy{$key}{$idx}{'src'};                          my $srcurl = $resdatacopy{$key}{$idx}{'src'};
Line 2815  sub apply_fixups { Line 2827  sub apply_fixups {
                                 ($resdatacopy{$key}{$idx}{'cnum'} =~ /^$match_courseid$/)) {                                  ($resdatacopy{$key}{$idx}{'cnum'} =~ /^$match_courseid$/)) {
                                 my $srcdom = $resdatacopy{$key}{$idx}{'cdom'};                                  my $srcdom = $resdatacopy{$key}{$idx}{'cdom'};
                                 my $srcnum = $resdatacopy{$key}{$idx}{'cnum'};                                  my $srcnum = $resdatacopy{$key}{$idx}{'cnum'};
                                 my ($newmapname) = ($key =~ m{/([^/]+)$});                                  unless ($gotnewmapname) {
                                 my ($srcfolder,$srccontainer) = split(/\./,$newmapname);                                      ($newmapname) = ($key =~ m{/([^/]+)$});
                                       ($srcfolder,$srccontainer) = split(/\./,$newmapname);
                                       if ($newsubdir{$key}) {
                                           $newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;
                                       }
                                       $gotnewmapname = 1;
                                   }
                                 my $srcmapinfo = $srcfolder.':'.$idx;                                  my $srcmapinfo = $srcfolder.':'.$idx;
                                 if ($srccontainer eq 'page') {                                  if ($srccontainer eq 'page') {
                                     $srcmapinfo .= ':1';                                      $srcmapinfo .= ':1';
                                 }                                  }
                                 if ($newsubdir{$key}) {  
                                     $newmapname =~ s/^((?:default|supplemental)_)(\d+)/$1$newsubdir{$key}/;  
                                 }  
                                 &copy_templated_files($srcurl,$srcdom,$srcnum,$srcmapinfo,$cdom,                                  &copy_templated_files($srcurl,$srcdom,$srcnum,$srcmapinfo,$cdom,
                                                       $cnum,$template,$idx,$newmapname);                                                        $cnum,$template,$idx,$newmapname);
                             }                              }
Line 4142  END Line 4157  END
     my ($editlink,$extresform,$anchor,$hiddenres,$nomodal);      my ($editlink,$extresform,$anchor,$hiddenres,$nomodal);
     my $orig_url = $url;      my $orig_url = $url;
     $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};      $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};
     $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};      if ($container eq 'page') {
           $url=~s{^http(|s)(:|:)//}{/ext/};
       } else {
           $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
       }
     if (!$supplementalflag && $residx && $symb) {      if (!$supplementalflag && $residx && $symb) {
         if ((!$isfolder) && (!$ispage)) {          if ((!$isfolder) && (!$ispage)) {
     (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);      (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
     $url=&Apache::lonnet::clutter($url);              if (($url =~ m{^ext/}) && ($container eq 'page')) {
                   $url=&Apache::lonnet::clutter_with_no_wrapper($url);
               } else {
                   $url=&Apache::lonnet::clutter($url);
               } 
     if ($url=~/^\/*uploaded\//) {      if ($url=~/^\/*uploaded\//) {
         $url=~/\.(\w+)$/;          $url=~/\.(\w+)$/;
         my $embstyle=&Apache::loncommon::fileembstyle($1);          my $embstyle=&Apache::loncommon::fileembstyle($1);
Line 4160  END Line 4183  END
     } elsif ($url=~m{^(|/adm/wrapper)/ext/([^#]+)}) {      } elsif ($url=~m{^(|/adm/wrapper)/ext/([^#]+)}) {
                 my $wrapped = $1;                  my $wrapped = $1;
                 my $exturl = $2;                  my $exturl = $2;
                 if ($wrapped eq '') {                  if (($wrapped eq '') && ($container ne 'page')) { 
                     $url='/adm/wrapper'.$url;                      $url='/adm/wrapper'.$url;
                 }                  }
                 if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {                  if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
Line 4186  END Line 4209  END
                         my $escan = &escape('#');                          my $escan = &escape('#');
                         $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/;                          $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/;
                     }                      }
                       if ($container eq 'page') {
                           $url = &Apache::lonnet::clutter($url);
                       }
                 }                  }
                 unless ($env{'request.role.adv'}) {                  unless ($env{'request.role.adv'}) {
                     if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {                      if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {
Line 5634  sub handler { Line 5660  sub handler {
             undef($env{'form.folderpath'});              undef($env{'form.folderpath'});
         } else {          } else {
             $folderurl = "uploaded/$coursedom/$coursenum/$folder";              $folderurl = "uploaded/$coursedom/$coursenum/$folder";
             if ((split(/\:/,$pathitems[-1]))[4]) {              if ((split(/\:/,$pathitems[-1]))[5]) {
                 $folderurl .= '.page';                  $folderurl .= '.page';
             } else {              } else {
                 $folderurl .= '.sequence';                  $folderurl .= '.sequence';
Line 5967  sub handler { Line 5993  sub handler {
  my $fileupload=(<<FIUP);   my $fileupload=(<<FIUP);
         $quotainfo          $quotainfo
  $lt{'file'}:<br />   $lt{'file'}:<br />
  <input type="file" name="uploaddoc" class="flUpload" size="40" $disabled />   <input type="file" name="uploaddoc" class="LC_flUpload" size="40" $disabled />
         <input type="hidden" id="free_space" value="$free_space" />          <input type="hidden" id="LC_free_space" value="$free_space" />
 FIUP  FIUP
   
  my $checkbox=(<<CHBO);   my $checkbox=(<<CHBO);

Removed from v.1.660  
changed lines
  Added in v.1.668


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