--- loncom/publisher/lonpublisher.pm 2003/12/31 03:02:49 1.159 +++ loncom/publisher/lonpublisher.pm 2004/01/27 22:54:59 1.163 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.159 2003/12/31 03:02:49 www Exp $ +# $Id: lonpublisher.pm,v 1.163 2004/01/27 22:54:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -204,7 +204,11 @@ sub metaeval { if ($newentry !~m|^/res|) { $newentry=$prefix.$newentry; } } # actually store - $metadatafields{$unikey}=$newentry; + if ( $entry eq 'rule' && exists($metadatafields{$unikey})) { + $metadatafields{$unikey}.=','.$newentry; + } else { + $metadatafields{$unikey}=$newentry; + } } } } @@ -1017,9 +1021,6 @@ sub publish { } } else { -# ------------------------------------------ See if anything new in file itself - - $allmeta=&parseformeta($source,$style); # ---------------------- Read previous metafile, remember parameters and stores $scrout.=&metaread($logfile,$source.'.meta'); @@ -1030,6 +1031,10 @@ sub publish { delete $metadatafields{$_}; } } +# ------------------------------------------ See if anything new in file itself + + $allmeta=&parseformeta($source,$style); + } @@ -1697,6 +1702,63 @@ sub publishdirectory { } closedir(DIR); } + +######################################### +# publish a default.meta file + +sub defaultmetapublish { + my ($r,$fn,$cuname,$cudom)=@_; + $fn=~s/^\/\~$cuname\//\/home\/$cuname\/public_html\//; + unless (-e $fn) { + return HTTP_NOT_FOUND; + } + my $target=$fn; + $target=~s/^\/home\/$cuname\/public_html\//$Apache::lonnet::perlvar{'lonDocRoot'}\/res\/$cudom\/$cuname\//; + + + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + + $r->print('
'.&mt('Created directory').' '.$parts[$count].'
'); + mkdir($path,0777); + } + } + + if (copy($fn,$copyfile)) { + $r->print(''.&mt('Copied source file').'
'); + } else { + return "". + &mt('Failed to copy source').", $!, ".&mt('FAIL').""; + } + +# --------------------------------------------------- Send update notifications + + my @subscribed=&get_subscribed_hosts($target); + foreach my $subhost (@subscribed) { + $r->print(''.&mt('Notifying host').' '.$subhost.':');$r->rflush; + my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); + $r->print($reply.'