Diff for /loncom/publisher/loncfile.pm between versions 1.88 and 1.94

version 1.88, 2008/03/12 02:46:38 version 1.94, 2009/03/26 16:50:12
Line 109  sub Debug { Line 109  sub Debug {
     }      }
 }  }
   
   sub done {
      my ($url)=@_;
      my $done=&mt("Done");
      return(<<ENDDONE);
   <a href="$url">$done</a>
   <script type="text/javascript">
   location.href="$url";
   </script>
   ENDDONE
   }
   
 =pod  =pod
   
 =item URLToPath($url)  =item URLToPath($url)
Line 148  sub URLToPath { Line 159  sub URLToPath {
     my $Url = shift;      my $Url = shift;
     &Debug($r, "UrlToPath got: $Url");      &Debug($r, "UrlToPath got: $Url");
     $Url=~ s/\/+/\//g;      $Url=~ s/\/+/\//g;
     $Url=~ s/^http\:\/\/[^\/]+//;      $Url=~ s/^https?\:\/\/[^\/]+//;
     $Url=~ s/^\///;      $Url=~ s/^\///;
     $Url=~ s/(\~|priv\/)($match_username)\//\/home\/$2\/public_html\//;      $Url=~ s/(\~|priv\/)($match_username)\//\/home\/$2\/public_html\//;
     &Debug($r, "Returning $Url \n");      &Debug($r, "Returning $Url \n");
Line 350  sub cleanDest { Line 361  sub cleanDest {
  my ($newpath)=($dest=~m|(.*)/|);   my ($newpath)=($dest=~m|(.*)/|);
  $newpath=&relativeDest($fn,$newpath,$uname);   $newpath=&relativeDest($fn,$newpath,$uname);
  if (! -d "$newpath") {   if (! -d "$newpath") {
     $request->print("<p><span class=\"LC_error\">".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"'.&display($newpath).'"')."</span></p>");      $request->print('<p><span class="LC_error">'
                              .&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested file name."
                                  ,'"'.&display($newpath).'"')
                              .'</span></p>');
     $dest=~s|.*/||;      $dest=~s|.*/||;
  }   }
     }      }
     if ($dest =~ /\.(\d+)\.(\w+)$/){      if ($dest =~ /\.(\d+)\.(\w+)$/){
  $request->print('<span class="LC_error">'   $request->print('<span class="LC_error">'
  .&mt('Bad filename [_1].<br /> <tt>(name).(number).(extension)</tt> not allowed. <br /> Removing the <tt>.number.</tt> from requested filename.',&display($dest))   .&mt('Bad filename [_1]','<span class="LC_filename">'.&display($dest).'</span>')
                           .'<br />'
                           .&mt('[_1](name).(number).(extension)[_2] not allowed.','<tt>','</tt>')
                           .'<br />'
                           .&mt('Removing the [_1].number.[_2] from requested filename.','<tt>','</tt>')
  .'</span>');   .'</span>');
  $dest =~ s/\.(\d+)(\.\w+)$/$2/;   $dest =~ s/\.(\d+)(\.\w+)$/$2/;
     }      }
Line 435  Parameters: Line 453  Parameters:
   
 sub CloseForm2 {  sub CloseForm2 {
     my ($request, $user, $fn) = @_;      my ($request, $user, $fn) = @_;
     $request->print('<h3><a href="'.&url($fn).'/">'.&mt('Done').'</a></h3>');      $request->print(&done(&url($fn)));
 }  }
   
 =pod  =pod
Line 1256  sub phasetwo { Line 1274  sub phasetwo {
             $r->print('<h3><a href="'.&url($dest).'">'.&mt('Return to Directory').'</a></h3>');              $r->print('<h3><a href="'.&url($dest).'">'.&mt('Return to Directory').'</a></h3>');
             $r->print('<h3><a href="'.&url($dest_newname).'">'.$disp_newname.'</a></h3>');              $r->print('<h3><a href="'.&url($dest_newname).'">'.$disp_newname.'</a></h3>');
         } else {          } else {
     $r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');      $r->print(&done(&url($dest)));
  }   }
     }      }
 }  }
Line 1330  sub handler { Line 1348  sub handler {
  $js = qq|   $js = qq|
 <script type="text/javascript">  <script type="text/javascript">
 function writeDone() {  function writeDone() {
     var winName = window.opener  
     window.focus();      window.focus();
     winName.document.dataForm.newdir.value = "$newdirname"      opener.document.info.newdir.value = "$newdirname";
     setTimeout("self.close()",10000)      setTimeout("self.close()",10000);
 }  }
   </script>    </script>
 |;  |;
Line 1347  function writeDone() { Line 1364  function writeDone() {
     $r->print('<h3>'.&mt('Location').': '.&display($fn).'</h3>');      $r->print('<h3>'.&mt('Location').': '.&display($fn).'</h3>');
       
     if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {      if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
  $r->print('<h3><span class="LC_error">'.&mt('Co-Author').': '.$uname.' at '.$udom.          $r->print('<p class="LC_warning">'
   '</span></h3>');                   .&mt('Co-Author [_1]:[_2]',$uname,$udom)
                    .'</p>'
           );
     }      }
   
   

Removed from v.1.88  
changed lines
  Added in v.1.94


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