--- loncom/publisher/lonpublisher.pm 2003/12/29 21:17:00 1.158 +++ loncom/publisher/lonpublisher.pm 2004/01/04 00:28:22 1.160 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.158 2003/12/29 21:17:00 www Exp $ +# $Id: lonpublisher.pm,v 1.160 2004/01/04 00:28:22 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -127,6 +127,7 @@ use Apache::lonmysql; use Apache::lonlocal; use Apache::loncfile; use Apache::lonmeta; +use Apache::lonmsg; use vars qw(%metadatafields %metadatakeys); my %addid; @@ -1016,6 +1017,9 @@ 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'); @@ -1026,9 +1030,6 @@ sub publish { delete $metadatafields{$_}; } } -# ------------------------------------------ See if anything new in file itself - - $allmeta=&parseformeta($source,$style); } @@ -1434,7 +1435,10 @@ sub phasetwo { $r->print($error); print $logfile "\n".$error; } - +# --------------------------------------------- Delete author resource messages + my $delresult=&Apache::lonmsg::del_url_author_res_msg($target); + $r->print('
'.&mt('Removing error messages:').' '.$delresult.'
'); + print $logfile "\nRemoving error messages: $delresult"; # ----------------------------------------------------------- Copy old versions if (-e $target) { @@ -1693,6 +1697,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.'