version 1.82, 2002/05/23 21:12:44
|
version 1.85, 2002/07/26 19:35:20
|
Line 235 sub set_allow {
|
Line 235 sub set_allow {
|
return $return_url |
return $return_url |
} |
} |
|
|
|
sub get_subscribed_hosts { |
|
my ($target)=@_; |
|
my @subscribed; |
|
my $filename; |
|
$target=~/(.*)\/([^\/]+)$/; |
|
my $srcf=$2; |
|
opendir(DIR,$1); |
|
while ($filename=readdir(DIR)) { |
|
if ($filename=~/$srcf\.(\w+)$/) { |
|
my $subhost=$1; |
|
if ($subhost ne 'meta' && $subhost ne 'subscription') { |
|
push(@subscribed,$subhost); |
|
} |
|
} |
|
} |
|
closedir(DIR); |
|
my $sh; |
|
if ( $sh=Apache::File->new("$target.subscription") ) { |
|
&Apache::lonnet::logthis("opened $target.subscription"); |
|
while (my $subline=<$sh>) { |
|
&Apache::lonnet::logthis("Trying $subline"); |
|
if ($subline =~ /(^\w+):/) { push(@subscribed,$1); } else { |
|
&Apache::lonnet::logthis("No Match for $subline"); |
|
} |
|
} |
|
} else { |
|
&Apache::lonnet::logthis("Un able to open $target.subscription"); |
|
} |
|
&Apache::lonnet::logthis("Got list of ".join(':',@subscribed)); |
|
return @subscribed; |
|
} |
|
|
sub publish { |
sub publish { |
|
|
my ($source,$target,$style)=@_; |
my ($source,$target,$style)=@_; |
Line 444 sub publish {
|
Line 476 sub publish {
|
} |
} |
} |
} |
} |
} |
$allowstr=~s/\n+/\n/g; |
$outstring=~s/\n*(\<\/[^\>]+\>)\s*$/$allowstr\n$1\n/s; |
$outstring=~s/(\<\/[^\>]+\>\s*)$/$allowstr$1/s; |
|
|
|
#Encode any High ASCII characters |
#Encode any High ASCII characters |
$outstring=&HTML::Entities::encode($outstring,"\200-\377"); |
$outstring=&HTML::Entities::encode($outstring,"\200-\377"); |
Line 479 sub publish {
|
Line 510 sub publish {
|
|
|
my %oldparmstores=(); |
my %oldparmstores=(); |
|
|
$scrout.='<h3>Metadata Information</h3>'; |
|
|
$scrout.='<h3>Metadata Information ' . |
|
Apache::loncommon::help_open_topic("Metadata_Description") |
|
. '</h3>'; |
|
|
# ------------------------------------------------ First, check out environment |
# ------------------------------------------------ First, check out environment |
unless (-e $source.'.meta') { |
unless (-e $source.'.meta') { |
Line 586 sub publish {
|
Line 620 sub publish {
|
|
|
# --------------------------------------------------- Scan content for keywords |
# --------------------------------------------------- Scan content for keywords |
|
|
|
my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords"); |
my $keywordout=<<"END"; |
my $keywordout=<<"END"; |
<script> |
<script> |
function checkAll(field) |
function checkAll(field) |
Line 600 function uncheckAll(field)
|
Line 635 function uncheckAll(field)
|
field[i].checked = false ; |
field[i].checked = false ; |
} |
} |
</script> |
</script> |
<p><b>Keywords:</b> |
<p><b>Keywords: $keywords_help</b> |
<input type="button" value="check all" onclick="javascript:checkAll(document.pubform.keywords)"> |
<input type="button" value="check all" onclick="javascript:checkAll(document.pubform.keywords)"> |
<input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.pubform.keywords)"> |
<input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.pubform.keywords)"> |
<br /> |
<br /> |
Line 680 END
|
Line 715 END
|
$scrout.=&textfield('Publisher/Owner','owner', |
$scrout.=&textfield('Publisher/Owner','owner', |
$metadatafields{'owner'}); |
$metadatafields{'owner'}); |
# --------------------------------------------------- Correct copyright for rat |
# --------------------------------------------------- Correct copyright for rat |
|
|
if ($style eq 'rat') { |
if ($style eq 'rat') { |
if ($metadatafields{'copyright'} eq 'public') { |
if ($metadatafields{'copyright'} eq 'public') { |
delete $metadatafields{'copyright'}; |
delete $metadatafields{'copyright'}; |
Line 695 END
|
Line 731 END
|
\&Apache::loncommon::copyrightdescription, |
\&Apache::loncommon::copyrightdescription, |
(&Apache::loncommon::copyrightids)); |
(&Apache::loncommon::copyrightids)); |
} |
} |
|
|
|
my $copyright_help = Apache::loncommon::help_open_topic("Publishing_Copyright"); |
|
$scrout =~ s/DISTRIBUTION:/'DISTRIBUTION: ' . $copyright_help/ge; |
return $scrout. |
return $scrout. |
'<p><input type="submit" value="Finalize Publication" /></p></form>'; |
'<p><input type="submit" value="Finalize Publication" /></p></form>'; |
} |
} |
Line 924 if (-e $target) {
|
Line 963 if (-e $target) {
|
|
|
# --------------------------------------------------- Send update notifications |
# --------------------------------------------------- Send update notifications |
|
|
{ |
my @subscribed=&get_subscribed_hosts($target); |
|
foreach my $subhost (@subscribed) { |
my $filename; |
$scrout.='<p>Notifying host '.$subhost.':'; |
|
print $logfile "\nNotifying host ".$subhost.':'; |
$target=~/(.*)\/([^\/]+)$/; |
my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); |
my $srcf=$2; |
$scrout.=$reply; |
opendir(DIR,$1); |
print $logfile $reply; |
while ($filename=readdir(DIR)) { |
|
if ($filename=~/$srcf\.(\w+)$/) { |
|
my $subhost=$1; |
|
if ($subhost ne 'meta') { |
|
$scrout.='<p>Notifying host '.$subhost.':'; |
|
print $logfile "\nNotifying host '.$subhost.':'"; |
|
my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); |
|
$scrout.=$reply; |
|
print $logfile $reply; |
|
} |
|
} |
|
} |
} |
closedir(DIR); |
|
|
|
} |
|
|
|
# ---------------------------------------- Send update notifications, meta only |
# ---------------------------------------- Send update notifications, meta only |
|
|
{ |
my @subscribedmeta=&get_subscribed_hosts("$target.meta"); |
|
foreach my $subhost (@subscribedmeta) { |
my $filename; |
$scrout.='<p>Notifying host for metadata only '.$subhost.':'; |
|
print $logfile "\nNotifying host for metadata only ".$subhost.':'; |
$target=~/(.*)\/([^\/]+)$/; |
my $reply=&Apache::lonnet::critical('update:'.$target.'.meta', |
my $srcf=$2.'.meta'; |
$subhost); |
opendir(DIR,$1); |
$scrout.=$reply; |
while ($filename=readdir(DIR)) { |
print $logfile $reply; |
if ($filename=~/$srcf\.(\w+)$/) { |
|
my $subhost=$1; |
|
if ($subhost ne 'meta') { |
|
$scrout.= |
|
'<p>Notifying host for metadata only '.$subhost.':'; |
|
print $logfile |
|
"\nNotifying host for metadata only '.$subhost.':'"; |
|
my $reply=&Apache::lonnet::critical( |
|
'update:'.$target.'.meta',$subhost); |
|
$scrout.=$reply; |
|
print $logfile $reply; |
|
} |
|
} |
|
} |
} |
closedir(DIR); |
|
|
|
} |
|
|
|
# ------------------------------------------------ Provide link to new resource |
# ------------------------------------------------ Provide link to new resource |
|
|