Diff for /loncom/publisher/loncfile.pm between versions 1.123 and 1.124

version 1.123, 2015/01/19 15:36:11 version 1.124, 2016/05/22 01:09:54
Line 279  sub exists { Line 279  sub exists {
     $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/};      $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/};
     my ($type,$result);      my ($type,$result);
     if ( -d $construct ) {      if ( -d $construct ) {
  return ('error','<p><span class="LC_error">'.&mt('Error: destination for operation is an existing directory.').'</span></p>');   return ('error','<p class="LC_error">'.&mt('Error: destination for operation is an existing directory.').'</p>');
   
     }      }
   
     if ( -e $published) {      if ( -e $published) {
  if ( -e $construct ) {   if ( -e $construct ) {
     $type = 'warning';      $type = 'warning';
     $result.='<p><span class="LC_warning">'.&mt('Warning: target file exists, and has been published!').'</span></p>';      $result.='<p class="LC_warning">'.&mt('Warning: target file exists, and has been published!').'</p>';
  } else {   } else {
     my $published_type = (-d $published) ? 'directory' : 'file';      my $published_type = (-d $published) ? 'directory' : 'file';
   
     if ($published_type eq $creating) {      if ($published_type eq $creating) {
  $type = 'warning';   $type = 'warning';
  $result.='<p><span class="LC_warning">'.&mt("Warning: a published $published_type of this name exists.").'</span></p>';   $result.='<p class="LC_warning">'.&mt("Warning: a published $published_type of this name exists.").'</p>';
     } else {      } else {
  $type = 'error';   $type = 'error';
  $result.='<p><span class="LC_error">'.&mt("Error: a published $published_type of this name exists.").'</span></p>';   $result.='<p class="LC_error">'.&mt("Error: a published $published_type of this name exists.").'</p>';
     }      }
  }   }
     } elsif ( -e $construct) {      } elsif ( -e $construct) {
  $type = 'warning';   $type = 'warning';
  $result.='<p><span class="LC_warning">'.&mt('Warning: target file exists!').'</span></p>';   $result.='<p class="LC_warning">'.&mt('Warning: target file exists!').'</p>';
     }      }
   
     return ($type,$result);      return ($type,$result);
Line 344  sub checksuffix { Line 344  sub checksuffix {
     if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; }      if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; }
     if (lc($oldsuffix) ne lc($newsuffix)) {      if (lc($oldsuffix) ne lc($newsuffix)) {
  $result.=   $result.=
             '<p><span class="LC_warning">'.&mt('Warning: change of MIME type!').'</span></p>';              '<p class="LC_warning">'.&mt('Warning: change of MIME type!').'></p>';
     }      }
     return $result;      return $result;
 }  }
Line 367  sub cleanDest { Line 367  sub cleanDest {
  my ($newpath)=($dest=~m|(.*)/|);   my ($newpath)=($dest=~m|(.*)/|);
  ($newpath,$error)=&relativeDest($fn,$newpath,$uname,$udom);   ($newpath,$error)=&relativeDest($fn,$newpath,$uname,$udom);
  if (! -d "$newpath") {   if (! -d "$newpath") {
     $request->print('<p><span class="LC_warning">'      $request->print('<p class="LC_warning">'
                            .&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested filename."                             .&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested filename."
                                ,&display($newpath))                                 ,&display($newpath))
                            .'</span></p>');                             .'</p>');
     $dest=~s|.*/||;      $dest=~s|.*/||;
  }   }
     }      }
     if ($dest =~ /\.(\d+)\.(\w+)$/){      if ($dest =~ /\.(\d+)\.(\w+)$/){
  $request->print('<p><span class="LC_warning">'   $request->print('<p class="LC_warning">'
  .&mt('Bad filename [_1]',&display($dest))   .&mt('Bad filename [_1]',&display($dest))
                         .'<br />'                          .'<br />'
                         .&mt('[_1](name).(number).(extension)[_2] not allowed.','<tt>','</tt>')                          .&mt('[_1](name).(number).(extension)[_2] not allowed.','<tt>','</tt>')
                         .'<br />'                          .'<br />'
                         .&mt('Removing the [_1].number.[_2] from requested filename.','<tt>','</tt>')                          .&mt('Removing the [_1].number.[_2] from requested filename.','<tt>','</tt>')
  .'</span></p>');   .'</p>');
  $dest =~ s/\.(\d+)(\.\w+)$/$2/;   $dest =~ s/\.(\d+)(\.\w+)$/$2/;
     }      }
     if ($foundbad) {      if ($foundbad) {
         $request->print('<p><span class="LC_warning">'          $request->print('<p class="LC_warning">'
                        .&mt('Invalid characters in requested name have been removed.')                         .&mt('Invalid characters in requested name have been removed.')
                         .'</span></p>'                          .'</p>'
         );          );
     }      }
     return ($dest,$error);      return ($dest,$error);

Removed from v.1.123  
changed lines
  Added in v.1.124


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