Diff for /loncom/publisher/lonpublisher.pm between versions 1.196 and 1.197

version 1.196, 2005/05/30 16:56:46 version 1.197, 2005/05/30 17:10:44
Line 1383  Returns: Line 1383  Returns:
   
 =over 4  =over 4
   
 =item Scalar string  =item integer
   
 String contains status (errors and warnings) and information associated with  0: fail
 the server's attempts at publication.       1: success
   
 =cut  =cut
   
Line 1481  sub phasetwo { Line 1481  sub phasetwo {
     if ($metadatafields{'copyright'} eq 'custom') {      if ($metadatafields{'copyright'} eq 'custom') {
  my $file=$metadatafields{'customdistributionfile'};   my $file=$metadatafields{'customdistributionfile'};
  unless ($file=~/\.rights$/) {   unless ($file=~/\.rights$/) {
             return               $r->print(
                 '<font color="red">'.&mt('No valid custom distribution rights file specified, FAIL').                  '<font color="red">'.&mt('No valid custom distribution rights file specified, FAIL').
  '</font>';   '</font>');
       return 0;
         }          }
     }      }
     {      {
         print $logfile "\nWrite metadata file for ".$source;          print $logfile "\nWrite metadata file for ".$source;
         my $mfh;          my $mfh;
         unless ($mfh=Apache::File->new('>'.$source.'.meta')) {          unless ($mfh=Apache::File->new('>'.$source.'.meta')) {
             return               $r->print( 
                 '<font color="red">'.&mt('Could not write metadata, FAIL').                  '<font color="red">'.&mt('Could not write metadata, FAIL').
  '</font>';   '</font>');
       return 0;
         }          }
         foreach (sort keys %metadatafields) {          foreach (sort keys %metadatafields) {
             unless ($_=~/\./) {              unless ($_=~/\./) {
Line 1543  sub phasetwo { Line 1545  sub phasetwo {
         my $srcd=$1;          my $srcd=$1;
         unless ($srcd=~/^\/home\/httpd\/html\/res/) {          unless ($srcd=~/^\/home\/httpd\/html\/res/) {
             print $logfile "\nPANIC: Target dir is ".$srcd;              print $logfile "\nPANIC: Target dir is ".$srcd;
             return "<font color=\"red\">Invalid target directory, FAIL</font>";              $r->print(
    "<font color=\"red\">Invalid target directory, FAIL</font>");
       return 0;
         }          }
         opendir(DIR,$srcd);          opendir(DIR,$srcd);
         while ($filename=readdir(DIR)) {          while ($filename=readdir(DIR)) {
Line 1568  sub phasetwo { Line 1572  sub phasetwo {
             $r->print('<p>'.&mt('Copied old target file').'</p>');              $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";
             return "<font color=\"red\">".&mt('Failed to copy old target').              $r->print("<font color=\"red\">".&mt('Failed to copy old target').
  ", $!, ".&mt('FAIL')."</font>";   ", $!, ".&mt('FAIL')."</font>");
       return 0;
         }          }
                   
 # --------------------------------------------------------------- Copy Metadata  # --------------------------------------------------------------- Copy Metadata
Line 1582  sub phasetwo { Line 1587  sub phasetwo {
         } 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') {
                 return                   $r->print( 
                     "<font color=\"red\">".                      "<font color=\"red\">".
 &mt('Failed to write old metadata copy').", $!, ".&mt('FAIL')."</font>";  &mt('Failed to write old metadata copy').", $!, ".&mt('FAIL')."</font>");
    return 0;
     }      }
         }          }
                   
Line 1615  sub phasetwo { Line 1621  sub phasetwo {
         $r->print('<p>'.&mt('Copied source file').'</p>');          $r->print('<p>'.&mt('Copied source file').'</p>');
     } else {      } else {
         print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";          print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";
         return "<font color=\"red\">".          $r->print("<font color=\"red\">".
     &mt('Failed to copy source').", $!, ".&mt('FAIL')."</font>";      &mt('Failed to copy source').", $!, ".&mt('FAIL')."</font>");
    return 0;
     }      }
           
 # --------------------------------------------------------------- Copy Metadata  # --------------------------------------------------------------- Copy Metadata
Line 1628  sub phasetwo { Line 1635  sub phasetwo {
         $r->print('<p>'.&mt('Copied metadata').'</p>');          $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";
         return           $r->print(
             "<font color=\"red\">".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL')."</font>";              "<font color=\"red\">".&mt('Failed to write metadata copy').", $!, ".&mt('FAIL')."</font>");
    return 0;
     }      }
     $r->rflush;      $r->rflush;
   
Line 1661  sub phasetwo { Line 1669  sub phasetwo {
   &mt('Back to Source Directory').'</font></a></p>');    &mt('Back to Source Directory').'</font></a></p>');
     }      }
     $logfile->close();      $logfile->close();
     return '<p><font color="green">'.&mt('Done').'</font></p>';      $r->print('<p><font color="green">'.&mt('Done').'</font></p>');
       return 1;
 }  }
   
 # =============================================================== Notifications  # =============================================================== Notifications
Line 2093  ENDDIFF Line 2102  ENDDIFF
   '</h3>');    '</h3>');
     }      }
  } else {   } else {
     $r->print('<hr />'.      &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget); 
     &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget));       $r->print('<hr />');
  }   }
     }      }
     $r->print('</body></html>');      $r->print('</body></html>');

Removed from v.1.196  
changed lines
  Added in v.1.197


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