Diff for /loncom/interface/londocs.pm between versions 1.288 and 1.289

version 1.288, 2007/07/12 01:04:36 version 1.289, 2007/07/12 23:56:29
Line 1242  ENDPASTE Line 1242  ENDPASTE
     $r->print('</p></form>');      $r->print('</p></form>');
 }  }
   
   sub do_paste_from_buffer {
       my ($coursenum,$coursedom,$folder,$container) = @_;
   # paste resource to end of list
       my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'});
       my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title'});
   # Maps need to be copied first
       if (($url=~/\.(page|sequence)$/) && ($url=~/^\/uploaded\//)) {
    $title=&mt('Copy of').' '.$title;
    my $newid=$$.time;
    $url=~/^(.+)\.(\w+)$/;
    my $newurl=$1.$newid.'.'.$2;
    my $storefn=$newurl;
    $storefn=~s{^/\w+/$match_domain/$match_username/}{};
    &Apache::lonclonecourse::writefile($env{'request.course.id'},$storefn,
      &Apache::lonnet::getfile($url));
    $url = $newurl;
       }
       if (($url=~/\.(page|sequence)$/) && ($url=~m {^/res/})) {
    &Apache::lonnet::delenv('docs\\.markedcopy');
       }
       $title = &LONCAPA::map::qtunescape($title);
       my $ext='false';
       if ($url=~m{^http(|s)://}) { $ext='true'; }
       $url       = &LONCAPA::map::qtunescape($url);
   # Now insert the URL at the bottom
       my $newidx = &LONCAPA::map::getresidx($url);
       $LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res';
       push(@LONCAPA::map::order, $newidx);
   # Store the result
       return &storemap($coursenum,$coursedom,$folder.'.'.$container);
   }
   
 sub editor {  sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_;      my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_;
     my $errtext='';      my $errtext='';
Line 1348  sub editor { Line 1380  sub editor {
     }      }
           
     if ($env{'form.pastemarked'}) {      if ($env{'form.pastemarked'}) {
 # paste resource to end of list   my ($errtext,$fatal) =
                 my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url'});      &do_paste_from_buffer($coursenum,$coursedom,$folder,
  my $title=&LONCAPA::map::qtescape($env{'docs.markedcopy_title'});    $container);
 # Maps need to be copied first  
  if (($url=~/\.(page|sequence)$/) || ($url=~/^\/uploaded\//)) {  
     $title=&mt('Copy of').' '.$title;  
                     my $newid=$$.time;  
     $url=~/^(.+)\.(\w+)$/;  
     my $newurl=$1.$newid.'.'.$2;  
     my $storefn=$newurl;  
                     $storefn=~s{^/\w+/$match_domain/$match_username/}{};  
     &Apache::lonclonecourse::writefile  
  ($env{'request.course.id'},$storefn,  
  &Apache::lonnet::getfile($url));  
     $url=$newurl;  
  }  
  $title = &LONCAPA::map::qtunescape($title);  
  my $ext='false';  
  if ($url=~m{^http(|s)://}) { $ext='true'; }  
  $url   = &LONCAPA::map::qtunescape($url);  
 # Now insert the URL at the bottom  
                 my $newidx=&LONCAPA::map::getresidx($url);  
  $LONCAPA::map::resources[$newidx]=  
     $title.':'.$url.':'.$ext.':normal:res';  
  $LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx;  
 # Store the result  
  ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);  
  if ($fatal) {   if ($fatal) {
     $r->print('<p><span class="LC_error">'.$errtext.'</span></p>');      $r->print('<p><span class="LC_error">'.$errtext.'</span></p>');
     return;      return;
  }   }
   
     }      }
             $r->print($upload_output);              $r->print($upload_output);
     if ($env{'form.cmd'}) {      if ($env{'form.cmd'}) {
Line 1771  sub entryline { Line 1778  sub entryline {
  my $nocopy=0;   my $nocopy=0;
         my $nocut=0;          my $nocut=0;
         if ($url=~/\.(page|sequence)$/) {          if ($url=~/\.(page|sequence)$/) {
     foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) {      if ($url =~ m{/res/}) {
  my ($title,$url,$ext,$type)=split(/\:/,$_);   # no copy for published maps
  if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) {   $nocopy = 1;
     $nocopy=1;      } else {
     last;   foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) {
       my ($title,$url,$ext,$type)=split(/\:/,$_);
       if (($url=~/\.(page|sequence)/) && ($type ne 'zombie')) {
    $nocopy=1;
    last;
       }
  }   }
     }      }
  }   }

Removed from v.1.288  
changed lines
  Added in v.1.289


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