--- loncom/publisher/lonpublisher.pm 2002/09/16 13:05:50 1.95 +++ loncom/publisher/lonpublisher.pm 2002/09/17 15:01:36 1.96 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.95 2002/09/16 13:05:50 www Exp $ +# $Id: lonpublisher.pm,v 1.96 2002/09/17 15:01:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1164,7 +1164,7 @@ the server's attempts at publication. ######################################### sub phasetwo { - my ($source,$target,$style,$distarget)=@_; + my ($source,$target,$style,$distarget,$batch)=@_; my $logfile; my $scrout=''; unless ($logfile=Apache::File->new('>>'.$source.'.log')) { @@ -1368,7 +1368,7 @@ if (-e $target) { } # ------------------------------------------------ Provide link to new resource - + unless ($batch) { my $thisdistarget=$target; $thisdistarget=~s/^$docroot//; @@ -1385,7 +1385,7 @@ if (-e $target) { '

Back to Source'. '

Back to Source Directory'; - + } } ######################################### @@ -1395,14 +1395,29 @@ sub batchpublish { my $thisdisfn=$srcfile; $thisdisfn=~s/\/home\/korte\/public_html\///; $srcfile=~s/\/+/\//g; + + + undef %metadatafields; + undef %metadatakeys; + %metadatafields=(); + %metadatakeys=(); + $r->print('

Publishing '.$thisdisfn.'

'); +# phase two takes +# my ($source,$target,$style,$distarget,batch)=@_; +# $ENV{'form.allmeta'} + } ######################################### sub publishdirectory { my ($r,$fn,$thisdisfn)=@_; - $r->print('

Directory '.$thisdisfn.'/

'); + my $resdir= + $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname. + $thisdisfn; + $r->print('

Directory '.$thisdisfn.'/

'. + 'Target: '.$resdir.'
'); my $dirptr=16384; # Mask indicating a directory in stat.cmode. @@ -1422,7 +1437,26 @@ sub publishdirectory { } } elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') && ($filename!~/^[\#\.]/) && ($filename!~/\~$/)) { - &batchpublish($r,$fn.'/'.$filename); +# find out publication status and/or exiting metadata + my $publishthis=0; + if (-e $resdir.'/'.$filename) { + my ($rdev,$rino,$rmode,$rnlink, + $ruid,$rgid,$rrdev,$rsize, + $ratime,$rmtime,$rctime, + $rblksize,$rblocks)=stat($resdir.'/'.$filename); + if ($rmtime<$cmtime) { +# previously published, modified now + $publishthis=1; + } + } else { +# never published + $publishthis=1; + } + if ($publishthis) { + &batchpublish($r,$fn.'/'.$filename); + } else { + $r->print('
Skipping '.$filename.'
'); + } $r->rflush(); } }