Diff for /loncom/publisher/lonpublisher.pm between versions 1.258.2.4 and 1.259

version 1.258.2.4, 2010/01/27 03:44:48 version 1.259, 2009/05/26 16:08:00
Line 1641  sub phasetwo { Line 1641  sub phasetwo {
         my $srcf=$2;          my $srcf=$2;
         my $srct=$3;          my $srct=$3;
         my $srcd=$1;          my $srcd=$1;
         my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'};          unless ($srcd=~/^\/home\/httpd\/html\/res/) {
         unless ($srcd=~/^\Q$docroot\E\/res/) {  
             print $logfile "\nPANIC: Target dir is ".$srcd;              print $logfile "\nPANIC: Target dir is ".$srcd;
             $r->print(              $r->print(
  "<span class=\"LC_error\">".&mt('Invalid target directory, FAIL')."</span>");   "<span class=\"LC_error\">".&mt('Invalid target directory, FAIL')."</span>");
Line 1668  sub phasetwo { Line 1667  sub phasetwo {
                   
         if (copy($target,$copyfile)) {          if (copy($target,$copyfile)) {
     print $logfile "Copied old target to ".$copyfile."\n";      print $logfile "Copied old target to ".$copyfile."\n";
             $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied old target file')));              $r->print('<p>'.&mt('Copied old target file').'</p>');
         } else {          } else {
     print $logfile "Unable to write ".$copyfile.':'.$!."\n";      print $logfile "Unable to write ".$copyfile.':'.$!."\n";
             $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Failed to copy old target').", $!",1));              $r->print("<span class=\"LC_error\">".&mt('Failed to copy old target').
    ", $!, ".&mt('FAIL')."</span>");
     return 0;      return 0;
         }          }
                   
Line 1681  sub phasetwo { Line 1681  sub phasetwo {
                   
         if (copy($target.'.meta',$copyfile)) {          if (copy($target.'.meta',$copyfile)) {
     print $logfile "Copied old target metadata to ".$copyfile."\n";      print $logfile "Copied old target metadata to ".$copyfile."\n";
             $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied old metadata')));              $r->print('<p>'.&mt('Copied old metadata').'</p>')
         } else {          } else {
     print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";      print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";
             if (-e $target.'.meta') {              if (-e $target.'.meta') {
                 $r->print(&Apache::lonhtmlcommon::confirm_success(                  $r->print( 
                            &mt('Failed to write old metadata copy').", $!",1));                      "<span class=\"LC_error\">".
   &mt('Failed to write old metadata copy').", $!, ".&mt('FAIL')."</span>");
  return 0;   return 0;
     }      }
         }          }
Line 1720  sub phasetwo { Line 1720  sub phasetwo {
           
     if (copy($source,$copyfile)) {      if (copy($source,$copyfile)) {
         print $logfile "\nCopied original source to ".$copyfile."\n";          print $logfile "\nCopied original source to ".$copyfile."\n";
         $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied source file')));          $r->print('<p>'.&mt('Copied source file').'</p>');
     } else {      } else {
         print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";          print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";
         $r->print(&Apache::lonhtmlcommon::confirm_success(          $r->print("<span class=\"LC_error\">".
     &mt('Failed to copy source').", $!",1));      &mt('Failed to copy source').", $!, ".&mt('FAIL')."</span>");
  return 0;   return 0;
     }      }
       
 # ---------------------------------------------- Delete local tmp-preview files  
     unlink($copyfile.'.tmp');  
 # --------------------------------------------------------------- Copy Metadata  # --------------------------------------------------------------- Copy Metadata
   
     $copyfile=$copyfile.'.meta';      $copyfile=$copyfile.'.meta';
           
     if (copy($source.'.meta',$copyfile)) {      if (copy($source.'.meta',$copyfile)) {
         print $logfile "\nCopied original metadata to ".$copyfile."\n";          print $logfile "\nCopied original metadata to ".$copyfile."\n";
         $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Copied metadata')));          $r->print('<p>'.&mt('Copied metadata').'</p>');
     } else {      } else {
         print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";          print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";
         $r->print(&Apache::lonhtmlcommon::confirm_success(          $r->print(
                   &mt('Failed to write metadata copy').", $!",1));              "<span class=\"LC_error\">".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL')."</span>");
  return 0;   return 0;
     }      }
     $r->rflush;      $r->rflush;
Line 1748  sub phasetwo { Line 1746  sub phasetwo {
 # ------------------------------------------------------------- Trigger updates  # ------------------------------------------------------------- Trigger updates
     push(@{$modified_urls},[$target,$source]);      push(@{$modified_urls},[$target,$source]);
     unless ($registered_cleanup) {      unless ($registered_cleanup) {
         my $handlers = $r->get_handlers('PerlCleanupHandler');   $r->register_cleanup(\&notify);
         $r->set_handlers('PerlCleanupHandler' => [\&notify,@{$handlers}]);  
  $registered_cleanup=1;   $registered_cleanup=1;
     }      }
   
Line 1771  sub phasetwo { Line 1768  sub phasetwo {
                   
         my $thissrcdir=$thissrc;          my $thissrcdir=$thissrc;
         $thissrcdir=~s/\/[^\/]+$/\//;          $thissrcdir=~s/\/[^\/]+$/\//;
            
           
         $r->print(          $r->print(
            '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.             '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
            &mt('View Published Version').'</font></a>'.             &mt('View Published Version').'</font></a>'.
Line 2165  sub handler { Line 2163  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
           
       # Breadcrumbs
       &Apache::lonhtmlcommon::clear_breadcrumbs();
       &Apache::lonhtmlcommon::add_breadcrumb({
           'text'  => 'Construction Space',
           'href'  => '', # FIXME Add link to /priv/[user]
       });
       &Apache::lonhtmlcommon::add_breadcrumb({
           'text'  => 'Resource Publication',
           'href'  => '',
       });
   
     my $js='<script type="text/javascript">'.      my $js='<script type="text/javascript">'.
  &Apache::loncommon::browser_and_searcher_javascript().   &Apache::loncommon::browser_and_searcher_javascript().
  '</script>';   '</script>';
     $r->print(&Apache::loncommon::start_page('Resource Publication',$js));      $r->print(&Apache::loncommon::start_page('Resource Publication',$js)
                .&Apache::lonhtmlcommon::breadcrumbs()
                .&Apache::loncommon::head_subbox(
                     &Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken?
       );
   
   
     my $thisfn=$fn;      my $thisfn=$fn;

Removed from v.1.258.2.4  
changed lines
  Added in v.1.259


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