--- loncom/publisher/lonpublisher.pm 2012/01/29 03:08:32 1.278
+++ loncom/publisher/lonpublisher.pm 2024/06/01 22:41:28 1.295.2.1.2.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.278 2012/01/29 03:08:32 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.295.2.1.2.2 2024/06/01 22:41:28 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -102,8 +102,6 @@ to publication space.
Many of the undocumented subroutines implement various magical
parsing shortcuts.
-=over 4
-
=cut
######################################################################
@@ -121,7 +119,6 @@ use HTML::LCParser;
use HTML::Entities;
use Encode::Encoder;
use Apache::lonxml;
-use Apache::loncacc;
use DBI;
use Apache::lonnet;
use Apache::loncommon();
@@ -150,6 +147,8 @@ my $lock;
=pod
+=over 4
+
=item B
Evaluates a string that contains metadata. This subroutine
@@ -201,12 +200,12 @@ sub metaeval {
if (defined($token->[2]->{'name'})) {
$unikey.="\0".$token->[2]->{'name'};
}
- foreach (@{$token->[3]}) {
- $metadatafields{$unikey.'.'.$_}=$token->[2]->{$_};
+ foreach my $item (@{$token->[3]}) {
+ $metadatafields{$unikey.'.'.$item}=$token->[2]->{$item};
if ($metadatakeys{$unikey}) {
- $metadatakeys{$unikey}.=','.$_;
+ $metadatakeys{$unikey}.=','.$item;
} else {
- $metadatakeys{$unikey}=$_;
+ $metadatakeys{$unikey}=$item;
}
}
my $newentry=$parser->get_text('/'.$entry);
@@ -294,8 +293,8 @@ sub coursedependencies {
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$/) {
+ foreach my $item (keys(%evaldata)) {
+ if ($item=~/^([a-zA-Z0-9]+_[a-zA-Z0-9]+)___.+___course$/) {
$courses{$1}=1;
}
}
@@ -319,8 +318,12 @@ string which presents the form field (fo
=item B
+=item B
+
=item B
+=item B
+
=item B
=back
@@ -368,7 +371,7 @@ sub hiddenfield {
sub checkbox {
my ($name,$text)=@_;
- return "\n
');$r->rflush;
}
# ------------------------------------------------------------------- Link back
- $r->print("".&mt('Back to Metadata').'');
+ $r->print("".&mt('Back to Metadata').'');
$r->print(&Apache::loncommon::end_page());
return OK;
}
@@ -2078,7 +2334,7 @@ sub handler {
# -------------------------------------------------------------- Check filename
my $fn=&unescape($env{'form.filename'});
- ($cuname,$cudom)=&Apache::loncacc::constructaccess($fn);
+ ($cuname,$cudom)=&Apache::lonnet::constructaccess($fn);
# ----------------------------------------------------- Do we have permissions?
unless (($cuname) && ($cudom)) {
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
@@ -2143,7 +2399,7 @@ sub handler {
# Breadcrumbs
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({
- 'text' => 'Construction Space',
+ 'text' => 'Authoring Space',
'href' => &Apache::loncommon::authorspace($fn),
});
&Apache::lonhtmlcommon::add_breadcrumb({
@@ -2154,7 +2410,53 @@ sub handler {
my $js='';
- $r->print(&Apache::loncommon::start_page('Resource Publication',$js)
+ my $startargs = {};
+ if ($fn=~/\/$/) {
+ unless ($env{'form.phase'} eq 'two') {
+ $startargs->{'add_entries'} = { onload => 'javascript:setDefaultAccess();' };
+ $js .= <<"END";
+
+
+END
+ }
+ }
+ $r->print(&Apache::loncommon::start_page('Resource Publication',$js,$startargs)
.&Apache::lonhtmlcommon::breadcrumbs()
.&Apache::loncommon::head_subbox(
&Apache::loncommon::CSTR_pageheader($docroot.$fn))
@@ -2168,7 +2470,10 @@ sub handler {
if ($fn=~/\/$/) {
# -------------------------------------------------------- This is a directory
&publishdirectory($r,$docroot.$fn,$thisdisfn);
- $r->print('
'.&mt('Return to Directory').'');
+ $r->print(
+ '
'.
+ &Apache::lonhtmlcommon::actionbox([
+ ''.&mt('Return to Directory').'']));
} else {
# ---------------------- Evaluate individual file, and then output information.
$fn=~/\.(\w+)$/;
@@ -2218,7 +2523,7 @@ ENDCAPTION
$r->print(&Apache::lonhtmlcommon::row_closure()
.&Apache::lonhtmlcommon::row_title(&mt('Diffs')));
$r->print(<
+
ENDDIFF
$r->print(&mt('Diffs with Current Version').'');
}
@@ -2260,7 +2565,5 @@ __END__
=back
-=back
-
=cut