Diff for /loncom/interface/londocs.pm between versions 1.484.2.52 and 1.484.2.58

version 1.484.2.52, 2014/04/02 22:21:28 version 1.484.2.58, 2015/03/11 01:59:25
Line 977  sub docs_change_log { Line 977  sub docs_change_log {
   
 sub update_paste_buffer {  sub update_paste_buffer {
     my ($coursenum,$coursedom,$folder) = @_;      my ($coursenum,$coursedom,$folder) = @_;
     my (@possibles,%removals,%cuts);      my (@possibles,%removals,%cuts,$output);
     if ($env{'form.multiremove'}) {      if ($env{'form.multiremove'}) {
         $env{'form.multiremove'} =~ s/,$//;          $env{'form.multiremove'} =~ s/,$//;
         map { $removals{$_} = 1; } split(/,/,$env{'form.multiremove'});          map { $removals{$_} = 1; } split(/,/,$env{'form.multiremove'});
Line 1045  sub update_paste_buffer { Line 1045  sub update_paste_buffer {
         next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url}));          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');
         push(@newpaste,$suffix);          if ($suffix ne '') {
         if ($locknotfreed) {              push(@newpaste,$suffix);
             return $locknotfreed;          } else {
             last;              if ($locknotfreed) {
                   return $locknotfreed;
               }
         }          }
         if (&is_supplemental_title($title)) {          if (&is_supplemental_title($title)) {
             &Apache::lonnet::appenv({'docs.markedcopy_supplemental_'.$suffix => $title});              &Apache::lonnet::appenv({'docs.markedcopy_supplemental_'.$suffix => $title});
Line 1082  sub update_paste_buffer { Line 1084  sub update_paste_buffer {
                 }                  }
             }              }
         }          }
           if ($locknotfreed) {
               $output = $locknotfreed;
               last;
           }
     }      }
     if (@newpaste) {      if (@newpaste) {
         $addtoenv{'docs.markedcopies'} = join(',',(@currpaste,@newpaste));          $addtoenv{'docs.markedcopies'} = join(',',(@currpaste,@newpaste));
     }      }
     &Apache::lonnet::appenv(\%addtoenv);      &Apache::lonnet::appenv(\%addtoenv);
     delete($env{'form.markcopy'});      delete($env{'form.markcopy'});
     return;      return $output;
 }  }
   
 sub recurse_uploaded_maps {  sub recurse_uploaded_maps {
Line 1191  sub print_paste_buffer { Line 1197  sub print_paste_buffer {
                     $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));                      $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
                     $icon .= '/navmap.folder.closed.gif';                      $icon .= '/navmap.folder.closed.gif';
                 }                  }
                   my $title = $env{'docs.markedcopy_title_'.$suffix};
                   if ($title eq '') {
                       ($title) = ($url =~ m{/([^/]+)$});
                   }
                 $buffer = '<img src="'.$icon.'" alt="" class="LC_icon" />'.                  $buffer = '<img src="'.$icon.'" alt="" class="LC_icon" />'.
                           ': '.                            ': '.
                           &Apache::loncommon::parse_supplemental_title(                            &Apache::loncommon::parse_supplemental_title(
                              &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}));                               &LONCAPA::map::qtescape($title));
             }              }
             $pasteitems .= '<div class="LC_left_float">';              $pasteitems .= '<div class="LC_left_float">';
             my ($options,$onclick);              my ($options,$onclick);
Line 2778  sub editor { Line 2788  sub editor {
 # Rename, cut, copy or remove a single resource  # Rename, cut, copy or remove a single resource
  if (&handle_edit_cmd()) {   if (&handle_edit_cmd()) {
             my $contentchg;              my $contentchg;
             if ($env{'form.cmd'} =~ m{^(del|cut)_}) {              if ($env{'form.cmd'} =~ m{^(remove|cut)_}) {
                 $contentchg = 1;                  $contentchg = 1;
             }              }
     ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,$contentchg);      ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,$contentchg);
Line 2810  sub editor { Line 2820  sub editor {
                     my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);                      my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
                     $name=&LONCAPA::map::qtescape($name);                      $name=&LONCAPA::map::qtescape($name);
                     $url=&LONCAPA::map::qtescape($url);                      $url=&LONCAPA::map::qtescape($url);
                     next unless ($name && $url);                      next unless $url;
                     my %denied =                      my %denied =
                         &action_restrictions($coursenum,$coursedom,$url,                          &action_restrictions($coursenum,$coursedom,$url,
                                              $env{'form.folderpath'},\%curr_groups);                                               $env{'form.folderpath'},\%curr_groups);
Line 3358  sub entryline { Line 3368  sub entryline {
   
     $renametitle=~s/\\/\\\\/g;      $renametitle=~s/\\/\\\\/g;
     $renametitle=~s/\&quot\;/\\\"/g;      $renametitle=~s/\&quot\;/\\\"/g;
       $renametitle=~s/"/%22/g;
     $renametitle=~s/ /%20/g;      $renametitle=~s/ /%20/g;
     $oldtitle = $renametitle;      $oldtitle = $renametitle;
     $renametitle=~s/\&#39\;/\\\'/g;      $renametitle=~s/\&#39\;/\\\'/g;
Line 3825  sub new_timebased_suffix { Line 3836  sub new_timebased_suffix {
     if ($type eq 'paste') {      if ($type eq 'paste') {
         $prefix = $type;          $prefix = $type;
         $namespace = 'courseeditor';          $namespace = 'courseeditor';
           $idtype = 'addcode';
     } elsif ($type eq 'map') {      } elsif ($type eq 'map') {
         $prefix = 'docs';          $prefix = 'docs';
         if ($area eq 'supplemental') {          if ($area eq 'supplemental') {
Line 3836  sub new_timebased_suffix { Line 3848  sub new_timebased_suffix {
         $prefix = $type;          $prefix = $type;
         $namespace = 'templated';          $namespace = 'templated';
     }      }
     $idtype = 'concat';  
     my ($suffix,$freedlock,$error) =      my ($suffix,$freedlock,$error) =
         &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num);          &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num,$idtype);
     if (!$suffix) {      if (!$suffix) {
         if ($type eq 'paste') {          if ($type eq 'paste') {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix when adding to the paste buffer.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix when adding to the paste buffer.');
Line 3858  sub new_timebased_suffix { Line 3869  sub new_timebased_suffix {
             '<div class="LC_error">'.              '<div class="LC_error">'.
             &mt('There was a problem removing a lockfile.').' ';              &mt('There was a problem removing a lockfile.').' ';
         if ($type eq 'paste') {          if ($type eq 'paste') {
             &mt('This will prevent use of the paste buffer until th next log-in.');              if ($freedlock eq 'nolock') {
                   $locknotfreed =
                       '<div class="LC_error">'.
                       &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') {          } 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') {          } elsif ($type eq 'smppg') {
             $locknotfreed .=              $locknotfreed .=
                 &mt('This will prevent creation of additional simple pages in this course.');                  &mt('This will prevent creation of additional simple pages in this course.');
Line 4505  sub handler { Line 4526  sub handler {
         $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});          $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
     }      }
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver',      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
                                             'inhibitmenu']);    if ($allowed && $env{'form.verify'}) {
   if ($allowed && $env{'form.chooseserver'}) {  
       &choose_dump_server($r);  
       return OK;  
   } elsif ($allowed && $env{'form.verify'}) {  
       &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');        &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');
       &verifycontent($r);        &verifycontent($r);
   } elsif ($allowed && $env{'form.listsymbs'}) {    } elsif ($allowed && $env{'form.listsymbs'}) {
Line 5463  sub decompression_info { Line 5480  sub decompression_info {
     my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};      my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $container='sequence';      my $container='sequence';
     my ($pathitem,$hiddenelem);      my ($pathitem,$hiddenelem);
     my @hiddens = ('newidx','comment','position','folderpath');      my @hiddens = ('newidx','comment','position','folderpath','archiveurl');
     if ($env{'form.folderpath'} =~ /\:1$/) {      if ($env{'form.folderpath'} =~ /\:1$/) {
         $container='page';          $container='page';
     }      }
Line 5471  sub decompression_info { Line 5488  sub decompression_info {
     foreach my $item (@hiddens) {      foreach my $item (@hiddens) {
         if ($env{'form.'.$item}) {          if ($env{'form.'.$item}) {
             $hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.              $hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.
                            $env{'form.'.$item}.'" />'."\n";                             &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n";
         }          }
     }      }
     return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,      return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,
Line 5528  sub remove_archive { Line 5545  sub remove_archive {
         } else {          } else {
             $delwarning = &mt('An error occurred retrieving the contents of the current folder.');              $delwarning = &mt('An error occurred retrieving the contents of the current folder.');
         }          }
         $delwarning .= &mt('As a result the archive file has not been removed.');          $delwarning .= ' '.&mt('As a result the archive file has not been removed.');
     } else {      } else {
         my $currcmd = $env{'form.cmd'};          my $currcmd = $env{'form.cmd'};
         my $position = $env{'form.position'};          my $position = $env{'form.position'};
         if ($position > 0) {           my $archiveidx = $position;
             $env{'form.cmd'} = 'remove_'.$position;          if ($position > 0) {
             my ($title,$url,@rrest) =               if (($env{'form.autoextract_camtasia'}) && (scalar(@LONCAPA::map::order) == 2)) {
                 split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);                  $archiveidx = $position-1;
             if (&handle_edit_cmd($docuname,$docudom)) {              }
                 ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);              $env{'form.cmd'} = 'remove_'.$archiveidx;
                 if ($fatal) {              my ($title,$url,@rrest) =
                     if ($container eq 'page') {                  split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$archiveidx]]);
                         $delwarning = &mt('An error occurred updating the contents of the current page.');              if ($url eq $env{'form.archiveurl'}) {
                   if (&handle_edit_cmd($docuname,$docudom)) {
                       ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);
                       if ($fatal) {
                           if ($container eq 'page') {
                               $delwarning = &mt('An error occurred updating the contents of the current page.');
                           } else {
                               $delwarning = &mt('An error occurred updating the contents of the current folder.');
                           }
                     } else {                      } else {
                         $delwarning = &mt('An error occurred updating the contents of the current folder.');                          $delresult = &mt('Archive file removed.');
                     }                      }
                 } else {  
                     $delresult = &mt('Archive file removed.');  
                 }                  }
               } else {
                   $delwarning .=  &mt('Archive file had unexpected item number in folder.').
                                   ' '.&mt('As a result the archive file has not been removed.');
             }              }
         }          }
         $env{'form.cmd'} = $currcmd;          $env{'form.cmd'} = $currcmd;
Line 5809  sub editing_js { Line 5835  sub editing_js {
             if (&Apache::lonnet::is_on_map($res)) {              if (&Apache::lonnet::is_on_map($res)) {
                 $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.                  $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.
                              &HTML::Entities::encode($caller,'<>&"');                               &HTML::Entities::encode($caller,'<>&"');
                   $backtourl = &Apache::loncommon::escape_single($backtourl); 
             } else {              } else {
                 $backtourl = '/adm/navmaps';                  $backtourl = '/adm/navmaps';
             }              }

Removed from v.1.484.2.52  
changed lines
  Added in v.1.484.2.58


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