--- loncom/publisher/lonpublisher.pm 2002/10/07 21:07:08 1.100 +++ loncom/publisher/lonpublisher.pm 2002/10/08 13:24:36 1.101 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.100 2002/10/07 21:07:08 matthew Exp $ +# $Id: lonpublisher.pm,v 1.101 2002/10/08 13:24:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -309,6 +309,27 @@ sub sqltime { ######################################### ######################################### +sub coursedependencies { + my $url=&Apache::lonnet::declutter(shift); + $url=~s/\.meta$//; + my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); + my $regexp=$url; + $regexp=~s/(\W)/\\$1/g; + $regexp='___'.$regexp.'___course'; + my %evaldata=&Apache::lonnet::dump('nohist_resevaldata',$adomain, + $aauthor,$regexp); + my %courses=(); + foreach (keys %evaldata) { + if ($_=~/^([a-zA-Z0-9]+_[a-zA-Z0-9]+)___.+___course$/) { + $courses{$1}=1; + } + } + return %courses; +} +######################################### +######################################### + + =pod =item Form-field-generating subroutines. @@ -492,7 +513,6 @@ sub get_subscribed_hosts { } else { &Apache::lonnet::logthis("Unable to open $target.subscription"); } - &Apache::lonnet::logthis("Got list of ".join(':',@subscribed)); return @subscribed; } @@ -1396,7 +1416,7 @@ sub phasetwo { $r->print('
Notifying host '.$subhost.':');$r->rflush;
print $logfile "\nNotifying host ".$subhost.':';
my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);
- $r->print($reply);$r->rflush;
+ $r->print($reply.'
');$r->rflush;
print $logfile $reply;
}
@@ -1408,10 +1428,22 @@ sub phasetwo {
print $logfile "\nNotifying host for metadata only ".$subhost.':';
my $reply=&Apache::lonnet::critical('update:'.$target.'.meta',
$subhost);
- $r->print($reply);$r->rflush;
+ $r->print($reply.'
');$r->rflush;
print $logfile $reply;
}
+# --------------------------------------------------- Notify subscribed courses
+ my %courses=&coursedependencies($target);
+ my $now=time;
+ foreach (keys %courses) {
+ $r->print('
Notifying course '.$_.':');$r->rflush;
+ print $logfile "\nNotifying host ".$_.':';
+ my ($cdom,$cname)=split(/\_/,$_);
+ my $reply=&Apache::lonnet::cput
+ ('versionupdate',{$target => $now},$cdom,$cname);
+ $r->print($reply.'
');$r->rflush;
+ print $logfile $reply;
+ }
# ------------------------------------------------ Provide link to new resource
unless ($batch) {
my $thisdistarget=$target;
@@ -1665,6 +1697,8 @@ unless ($ENV{'form.phase'} eq 'two') {
$r->print('