Diff for /loncom/publisher/lonpublisher.pm between versions 1.185 and 1.189

version 1.185, 2005/02/28 21:28:18 version 1.189, 2005/03/15 16:09:20
Line 548  sub get_max_ids_indices { Line 548  sub get_max_ids_indices {
     my $counter;      my $counter;
     if ($counter=$addid{$token->[1]}) {      if ($counter=$addid{$token->[1]}) {
  if ($counter eq 'id') {   if ($counter eq 'id') {
     if (defined($token->[2]->{'id'})) {      if (defined($token->[2]->{'id'}) &&
    $token->[2]->{'id'} !~ /^\s*$/) {
  $maxid=($token->[2]->{'id'}>$maxid)?$token->[2]->{'id'}:$maxid;   $maxid=($token->[2]->{'id'}>$maxid)?$token->[2]->{'id'}:$maxid;
  if (exists($allids{$token->[2]->{'id'}})) {   if (exists($allids{$token->[2]->{'id'}})) {
     $duplicateids=1;      $duplicateids=1;
Line 560  sub get_max_ids_indices { Line 561  sub get_max_ids_indices {
  $needsfixup=1;   $needsfixup=1;
     }      }
  } else {   } else {
     if (defined($token->[2]->{'index'})) {      if (defined($token->[2]->{'index'}) &&
    $token->[2]->{'index'} !~ /^\s*$/) {
  $maxindex=($token->[2]->{'index'}>$maxindex)?$token->[2]->{'index'}:$maxindex;   $maxindex=($token->[2]->{'index'}>$maxindex)?$token->[2]->{'index'}:$maxindex;
     } else {      } else {
  $needsfixup=1;   $needsfixup=1;
Line 674  sub fix_ids_and_indices { Line 676  sub fix_ids_and_indices {
  if (!$counter) { $counter=$addid{$lctag}; }   if (!$counter) { $counter=$addid{$lctag}; }
  if ($counter) {   if ($counter) {
     if ($counter eq 'id') {      if ($counter eq 'id') {
  unless (defined($parms{'id'})) {   unless (defined($parms{'id'}) &&
    $parms{'id'}!~/^\s*$/) {
     $maxid++;      $maxid++;
     $parms{'id'}=$maxid;      $parms{'id'}=$maxid;
     print $logfile 'ID: '.$tag.':'.$maxid."\n";      print $logfile 'ID: '.$tag.':'.$maxid."\n";
  }   }
     } elsif ($counter eq 'index') {      } elsif ($counter eq 'index') {
  unless (defined($parms{'index'})) {   unless (defined($parms{'index'}) &&
    $parms{'index'}!~/^\s*$/) {
     $maxindex++;      $maxindex++;
     $parms{'index'}=$maxindex;      $parms{'index'}=$maxindex;
     print $logfile 'Index: '.$tag.':'.$maxindex."\n";      print $logfile 'Index: '.$tag.':'.$maxindex."\n";
Line 846  sub store_metadata { Line 850  sub store_metadata {
   
 sub checkonthis {  sub checkonthis {
     my ($r,$source)=@_;      my ($r,$source)=@_;
     my $oldpath=$ENV{'request.filename'};      my $uri=&Apache::lonnet::hreflocation($source);
     $ENV{'request.filename'}=$source;      $uri=~s/\/$//;
     &Apache::lonxml::xmlparse($r,'web',      my ($errorcount,$warningcount)=split(/:/,
       &Apache::lonnet::getfile($source));         &Apache::lonnet::ssi_body($uri,
     undef($Apache::lonhomework::parsing_a_problem);   ('return_only_error_and_warning_counts' => 1)));
     $ENV{'request.filename'}=$oldpath;      if (($errorcount) || ($warningcount)) {
     if (($Apache::lonxml::errorcount) ||          $r->print('<br /><tt>'.$uri.'</tt>: ');
  ($Apache::lonxml::warningcount)) {   if ($errorcount) {
  if ($Apache::lonxml::errorcount) {  
     $r->print('<img src="/adm/lonMisc/bomb.gif" /><font color="red"><b>'.      $r->print('<img src="/adm/lonMisc/bomb.gif" /><font color="red"><b>'.
       $Apache::lonxml::errorcount.' '.        $errorcount.' '.
       &mt('error(s)').'</b></font> ');        &mt('error(s)').'</b></font> ');
  }   }
  if ($Apache::lonxml::warningcount) {   if ($warningcount) {
     $r->print('<font color="blue">'.      $r->print('<font color="blue">'.
       $Apache::lonxml::warningcount.' '.        $warningcount.' '.
       &mt('warning(s)').'</font>');        &mt('warning(s)').'</font>');
  }   }
     } else {      } else {
  $r->print('<font color="green">'.&mt('ok').'</font>');   $r->print('<font color="green">'.&mt('ok').'</font>');
     }      }
     $r->rflush();      $r->rflush();
     return ($Apache::lonxml::warningcount,$Apache::lonxml::errorcount);      return ($warningcount,$errorcount);
 }  }
   
 # ============================================== Parse file itself for metadata  # ============================================== Parse file itself for metadata
Line 1285  END Line 1288  END
  }   }
  my $copyright_help =   my $copyright_help =
     Apache::loncommon::help_open_topic('Publishing_Copyright');      Apache::loncommon::help_open_topic('Publishing_Copyright');
  $intr_scrout =~ s/DISTRIBUTION:/'DISTRIBUTION: ' . $copyright_help/ge;   $intr_scrout =~ s/Distribution:/'Distribution: ' . $copyright_help/ge;
  $intr_scrout.=&text_with_browse_field('Custom Distribution File','customdistributionfile',$metadatafields{'customdistributionfile'},'rights').$copyright_help;   $intr_scrout.=&text_with_browse_field('Custom Distribution File','customdistributionfile',$metadatafields{'customdistributionfile'},'rights').$copyright_help;
  $intr_scrout.=&selectbox('Source Distribution','sourceavail',   $intr_scrout.=&selectbox('Source Distribution','sourceavail',
  $defaultsourceoption,   $defaultsourceoption,
Line 2009  ENDDIFF Line 2012  ENDDIFF
   
  unless ($ENV{'form.phase'} eq 'two') {   unless ($ENV{'form.phase'} eq 'two') {
 # ---------------------------------------------------------- Parse for problems  # ---------------------------------------------------------- Parse for problems
     &checkonthis($r,$thisfn);      my ($warningcount,$errorcount);
     my ($outstring,$error)=&publish($thisfn,$thistarget,$thisembstyle);      if ($thisembstyle eq 'ssi') {
     $r->print('<hr />'.$outstring);   ($warningcount,$errorcount)=&checkonthis($r,$thisfn);
       }
       unless ($errorcount) {
    my ($outstring,$error)=
       &publish($thisfn,$thistarget,$thisembstyle);
    $r->print('<hr />'.$outstring);
       } else {
    $r->print('<h3>'.
     &mt('The document contains errors and cannot be published.').
     '</h3>');
       }
  } else {   } else {
     $r->print('<hr />'.      $r->print('<hr />'.
     &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget));       &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget)); 

Removed from v.1.185  
changed lines
  Added in v.1.189


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