version 1.302, 2023/07/14 20:16:04
|
version 1.304, 2024/06/01 22:25:23
|
Line 2129 sub phasetwo {
|
Line 2129 sub phasetwo {
|
|
|
# ------------------------------------------------------------- Trigger updates |
# ------------------------------------------------------------- Trigger updates |
push(@{$modified_urls},[$target,$source]); |
push(@{$modified_urls},[$target,$source]); |
unless ($registered_cleanup) { |
¬ify_in_cleanup($r); |
my $handlers = $r->get_handlers('PerlCleanupHandler'); |
|
$r->set_handlers('PerlCleanupHandler' => [\¬ify,@{$handlers}]); |
|
$registered_cleanup=1; |
|
} |
|
|
|
# ---------------------------------------------------------- Clear local caches |
# ---------------------------------------------------------- Clear local caches |
my $thisdistarget=$target; |
my $thisdistarget=$target; |
Line 2189 sub phasetwo {
|
Line 2185 sub phasetwo {
|
} |
} |
} |
} |
|
|
|
sub notify_in_cleanup { |
|
my ($r) = @_; |
|
unless ($registered_cleanup) { |
|
my $handlers = $r->get_handlers('PerlCleanupHandler'); |
|
$r->set_handlers('PerlCleanupHandler' => [\¬ify,@{$handlers}]); |
|
$registered_cleanup=1; |
|
} |
|
} |
|
|
# =============================================================== Notifications |
# =============================================================== Notifications |
sub notify { |
sub notify { |
# --------------------------------------------------- Send update notifications |
# --------------------------------------------------- Send update notifications |
Line 2288 sub batchpublish {
|
Line 2293 sub batchpublish {
|
######################################### |
######################################### |
|
|
sub publishdirectory { |
sub publishdirectory { |
my ($r,$fn,$thisdisfn,$nokeyref)=@_; |
my ($r,$fn,$thisdisfn,$nokeyref,$crsauthor)=@_; |
$fn=~s/\/+/\//g; |
$fn=~s/\/+/\//g; |
$thisdisfn=~s/\/+/\//g; |
$thisdisfn=~s/\/+/\//g; |
my $thisdisresdir=$thisdisfn; |
my $thisdisresdir=$thisdisfn; |
Line 2329 sub publishdirectory {
|
Line 2334 sub publishdirectory {
|
&checkbox('excludemodmeta','exclude files with modified metadata'). |
&checkbox('excludemodmeta','exclude files with modified metadata'). |
'</fieldset>'. |
'</fieldset>'. |
'<fieldset><legend>'.&mt('Actions').'</legend>'. |
'<fieldset><legend>'.&mt('Actions').'</legend>'. |
&checkbox('obsolete','make file(s) obsolete').'<br />'. |
&checkbox('obsolete','make file(s) obsolete').'<br />'); |
&common_access('dist',&mt('apply common copyright/distribution'), |
unless ($crsauthor) { |
['default','domain','public','custom']).'<br />'. |
$r->print(&common_access('dist',&mt('apply common copyright/distribution'), |
&common_access('source',&mt('apply common source availability'), |
['default','domain','public','custom']).'<br />'); |
|
} |
|
$r->print(&common_access('source',&mt('apply common source availability'), |
['closed','open']). |
['closed','open']). |
'</fieldset>' |
'</fieldset>' |
); |
); |
Line 2348 sub publishdirectory {
|
Line 2355 sub publishdirectory {
|
my %commonaccess; |
my %commonaccess; |
map { $commonaccess{$_} = 1; } &Apache::loncommon::get_env_multiple('form.commonaccess'); |
map { $commonaccess{$_} = 1; } &Apache::loncommon::get_env_multiple('form.commonaccess'); |
unless ($lock) { $lock=&Apache::lonnet::set_lock(&mt('Publishing [_1]',$fn)); } |
unless ($lock) { $lock=&Apache::lonnet::set_lock(&mt('Publishing [_1]',$fn)); } |
|
if ($lock) { |
|
¬ify_in_cleanup($r); |
|
} |
# actually publish things |
# actually publish things |
opendir(DIR,$fn); |
opendir(DIR,$fn); |
my @files=sort(readdir(DIR)); |
my @files=sort(readdir(DIR)); |
Line 2356 sub publishdirectory {
|
Line 2366 sub publishdirectory {
|
$cuid,$cgid,$crdev,$csize, |
$cuid,$cgid,$crdev,$csize, |
$catime,$cmtime,$cctime, |
$catime,$cmtime,$cctime, |
$cblksize,$cblocks)=stat($fn.'/'.$filename); |
$cblksize,$cblocks)=stat($fn.'/'.$filename); |
|
|
my $extension=''; |
my $extension=''; |
if ($filename=~/\.(\w+)$/) { $extension=$1; } |
if ($filename=~/\.(\w+)$/) { $extension=$1; } |
if ($cmode&$dirptr) { |
if ($cmode&$dirptr) { |
if (($filename!~/^\./) && ($env{'form.pubrec'})) { |
if (($filename!~/^\./) && ($env{'form.pubrec'})) { |
&publishdirectory($r,$fn.'/'.$filename,$thisdisfn.'/'.$filename,$nokeyref); |
&publishdirectory($r,$fn.'/'.$filename,$thisdisfn.'/'.$filename,$nokeyref,$crsauthor); |
} |
} |
} elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') && |
} elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') && |
($filename!~/^[\#\.]/) && ($filename!~/\~$/)) { |
($filename!~/^[\#\.]/) && ($filename!~/\~$/)) { |
Line 2609 sub handler {
|
Line 2619 sub handler {
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
my $crumbtext = 'Authoring Space'; |
my $crumbtext = 'Authoring Space'; |
my $crumbhref = &Apache::loncommon::authorspace($fn); |
my $crumbhref = &Apache::loncommon::authorspace($fn); |
|
my $crsauthor; |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
if ($crumbhref eq "/priv/$cdom/$cnum/") { |
if ($crumbhref eq "/priv/$cdom/$cnum/") { |
$crumbtext = 'Course Authoring Space'; |
$crumbtext = 'Course Authoring Space'; |
|
$crsauthor = 1; |
} |
} |
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
Line 2688 END
|
Line 2700 END
|
|
|
if ($fn=~/\/$/) { |
if ($fn=~/\/$/) { |
# -------------------------------------------------------- This is a directory |
# -------------------------------------------------------- This is a directory |
&publishdirectory($r,$docroot.$fn,$thisdisfn,$nokeyref); |
&publishdirectory($r,$docroot.$fn,$thisdisfn,$nokeyref,$crsauthor); |
$r->print( |
$r->print( |
'<br /><br />'. |
'<br /><br />'. |
&Apache::lonhtmlcommon::actionbox([ |
&Apache::lonhtmlcommon::actionbox([ |