--- loncom/interface/londocs.pm 2008/09/04 17:50:47 1.310 +++ loncom/interface/londocs.pm 2008/09/05 00:08:46 1.311 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.310 2008/09/04 17:50:47 raeburn Exp $ +# $Id: londocs.pm,v 1.311 2008/09/05 00:08:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1208,7 +1208,10 @@ sub update_paste_buffer { # Mark for copying my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]); if (&is_supplemental_title($title)) { + &Apache::lonnet::appenv({'docs.markedcopy_supplemental' => $title}); ($title) = &parse_supplemental_title($title); + } elsif ($env{'docs.markedcopy_supplemental'}) { + &Apache::lonnet::delenv('docs\\.markedcopy_supplemental'); } $url=~s{http(:|:)//https(:|:)//}{https$2//}; @@ -1257,7 +1260,7 @@ ENDPASTE } sub do_paste_from_buffer { - my ($coursenum,$coursedom) = @_; + my ($coursenum,$coursedom,$folder) = @_; return 0 if (!$env{'form.pastemarked'}); @@ -1299,6 +1302,20 @@ sub do_paste_from_buffer { $url = &LONCAPA::map::qtunescape($url); # Now insert the URL at the bottom my $newidx = &LONCAPA::map::getresidx($url); + if ($env{'docs.markedcopy_supplemental'}) { + if ($folder =~ /^supplemental/) { + $title = $env{'docs.markedcopy_supplemental'}; + } else { + (undef,undef,$title) = + &parse_supplemental_title($env{'docs.markedcopy_supplemental'}); + } + } else { + if ($folder=~/^supplemental/) { + $title=time.'___&&&___'.$env{'user.name'}.'___&&&___'. + $env{'user.domain'}.'___&&&___'.$title; + } + } + $LONCAPA::map::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; push(@LONCAPA::map::order, $newidx); # Store the result @@ -1419,7 +1436,7 @@ sub editor { } if ($env{'form.pastemarked'}) { - &do_paste_from_buffer($coursenum,$coursedom); + &do_paste_from_buffer($coursenum,$coursedom,$folder); ($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container); return $errtext if ($fatal); }