--- loncom/interface/londocs.pm 2014/10/24 00:25:12 1.484.2.56 +++ loncom/interface/londocs.pm 2014/12/21 19:20:41 1.484.2.57 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.56 2014/10/24 00:25:12 raeburn Exp $ +# $Id: londocs.pm,v 1.484.2.57 2014/12/21 19:20:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -977,7 +977,7 @@ sub docs_change_log { sub update_paste_buffer { my ($coursenum,$coursedom,$folder) = @_; - my (@possibles,%removals,%cuts); + my (@possibles,%removals,%cuts,$output); if ($env{'form.multiremove'}) { $env{'form.multiremove'} =~ s/,$//; map { $removals{$_} = 1; } split(/,/,$env{'form.multiremove'}); @@ -1045,10 +1045,12 @@ sub update_paste_buffer { next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url})); my ($suffix,$errortxt,$locknotfreed) = &new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste'); - push(@newpaste,$suffix); - if ($locknotfreed) { - return $locknotfreed; - last; + if ($suffix ne '') { + push(@newpaste,$suffix); + } else { + if ($locknotfreed) { + return $locknotfreed; + } } if (&is_supplemental_title($title)) { &Apache::lonnet::appenv({'docs.markedcopy_supplemental_'.$suffix => $title}); @@ -1082,13 +1084,17 @@ sub update_paste_buffer { } } } + if ($locknotfreed) { + $output = $locknotfreed; + last; + } } if (@newpaste) { $addtoenv{'docs.markedcopies'} = join(',',(@currpaste,@newpaste)); } &Apache::lonnet::appenv(\%addtoenv); delete($env{'form.markcopy'}); - return; + return $output; } sub recurse_uploaded_maps { @@ -1191,10 +1197,14 @@ sub print_paste_buffer { $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); $icon .= '/navmap.folder.closed.gif'; } + my $title = $env{'docs.markedcopy_title_'.$suffix}; + if ($title eq '') { + ($title) = ($url =~ m{/([^/]+)$}); + } $buffer = ''. ': '. &Apache::loncommon::parse_supplemental_title( - &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix})); + &LONCAPA::map::qtescape($title)); } $pasteitems .= '
'; my ($options,$onclick); @@ -2810,7 +2820,7 @@ sub editor { my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); $name=&LONCAPA::map::qtescape($name); $url=&LONCAPA::map::qtescape($url); - next unless ($name && $url); + next unless $url; my %denied = &action_restrictions($coursenum,$coursedom,$url, $env{'form.folderpath'},\%curr_groups); @@ -3859,9 +3869,19 @@ sub new_timebased_suffix { '
'. &mt('There was a problem removing a lockfile.').' '; if ($type eq 'paste') { - &mt('This will prevent use of the paste buffer until th next log-in.'); + if ($freedlock eq 'nolock') { + $locknotfreed = + '
'. + &mt('A lockfile was not released when you added content to the clipboard earlier in this session.').' '. + + &mt('As a result addition of items to the clipboard wll be unavailable until your next log-in.'); + } else { + $locknotfreed .= + &mt('This will prevent addition of items to the clipboard until your next log-in.'); + } } elsif ($type eq 'map') { - &mt('This will prevent creation of additional folders or composite pages in this course.'); + $locknotfreed .= + &mt('This will prevent creation of additional folders or composite pages in this course.'); } elsif ($type eq 'smppg') { $locknotfreed .= &mt('This will prevent creation of additional simple pages in this course.'); @@ -5815,6 +5835,7 @@ sub editing_js { if (&Apache::lonnet::is_on_map($res)) { $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='. &HTML::Entities::encode($caller,'<>&"'); + $backtourl = &Apache::loncommon::escape_single($backtourl); } else { $backtourl = '/adm/navmaps'; }