--- loncom/publisher/lonpublisher.pm 2011/10/22 23:09:44 1.271
+++ loncom/publisher/lonpublisher.pm 2013/06/04 22:20:16 1.282
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.271 2011/10/22 23:09:44 www Exp $
+# $Id: lonpublisher.pm,v 1.282 2013/06/04 22:20:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,10 +66,10 @@ invocation by F:
=head1 OVERVIEW
-Authors can only write-access the C~authorname/> space. They can
-copy resources into the resource area through the publication step,
-and move them back through a recover step. Authors do not have direct
-write-access to their resource space.
+Authors can only write-access the C space.
+They can copy resources into the resource area through the
+publication step, and move them back through a recover step.
+Authors do not have direct write-access to their resource space.
During the publication step, several events will be
triggered. Metadata is gathered, where a wizard manages default
@@ -121,7 +121,6 @@ use HTML::LCParser;
use HTML::Entities;
use Encode::Encoder;
use Apache::lonxml;
-use Apache::loncacc;
use DBI;
use Apache::lonnet;
use Apache::loncommon();
@@ -1017,6 +1016,11 @@ sub publish {
$outdep.= ' - '.&mt('Currently not available').
'';
} else {
+#
+# Store the fact that the dependency has been used by the target file
+# Unfortunately, usage is erroneously named sequsage in lonmeta.pm
+# The translation happens in lonmetadata.pm
+#
my %temphash=(&Apache::lonnet::declutter($target).'___'.
&Apache::lonnet::declutter($thisdep).'___usage'
=> time);
@@ -1878,15 +1882,15 @@ sub publishdirectory {
my ($r,$fn,$thisdisfn)=@_;
$fn=~s/\/+/\//g;
$thisdisfn=~s/\/+/\//g;
- my $resdir=
- $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname.'/'.
- $thisdisfn;
+ my $thisdisresdir=$thisdisfn;
+ $thisdisresdir=~s/^\/priv\//\/res\//;
+ my $resdir = $r->dir_config('lonDocRoot').$thisdisresdir;
$r->print(&Apache::lonhtmlcommon::start_pick_box()
.&Apache::lonhtmlcommon::row_title(&mt('Directory'))
.''.$thisdisfn.''
.&Apache::lonhtmlcommon::row_closure()
.&Apache::lonhtmlcommon::row_title(&mt('Target'))
- .''.$resdir.''
+ .''.$thisdisresdir.''
);
my $dirptr=16384; # Mask indicating a directory in stat.cmode.
@@ -1925,7 +1929,7 @@ sub publishdirectory {
if ($filename=~/\.(\w+)$/) { $extension=$1; }
if ($cmode&$dirptr) {
if (($filename!~/^\./) && ($env{'form.pubrec'})) {
- &publishdirectory($r,$fn.'/'.$filename,$thisdisfn.'/'.$filename);
+ &publishdirectory($r,$docroot.$fn.'/'.$filename,$thisdisfn.'/'.$filename);
}
} elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') &&
($filename!~/^[\#\.]/) && ($filename!~/\~$/)) {
@@ -2014,7 +2018,7 @@ sub defaultmetapublish {
$r->print($reply.'
');$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 +2082,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,8 +2147,8 @@ sub handler {
# Breadcrumbs
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({
- 'text' => 'Construction Space',
- 'href' => &Apache::loncommon::authorspace(),
+ 'text' => 'Authoring Space',
+ 'href' => &Apache::loncommon::authorspace($fn),
});
&Apache::lonhtmlcommon::add_breadcrumb({
'text' => 'Resource Publication',
@@ -2157,7 +2161,7 @@ sub handler {
$r->print(&Apache::loncommon::start_page('Resource Publication',$js)
.&Apache::lonhtmlcommon::breadcrumbs()
.&Apache::loncommon::head_subbox(
- &Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken?
+ &Apache::loncommon::CSTR_pageheader($docroot.$fn))
);
my $thisdisfn=&HTML::Entities::encode($fn,'<>&"');
@@ -2167,7 +2171,7 @@ sub handler {
if ($fn=~/\/$/) {
# -------------------------------------------------------- This is a directory
- &publishdirectory($r,$fn,$thisdisfn);
+ &publishdirectory($r,$docroot.$fn,$thisdisfn);
$r->print('
'.&mt('Return to Directory').'');
} else {
# ---------------------- Evaluate individual file, and then output information.
@@ -2237,7 +2241,7 @@ ENDDIFF
}
unless ($errorcount) {
my ($outstring,$error)=
- &publish($docroot.$fn,$thistarget,$thisembstyle);
+ &publish($docroot.$fn,$docroot.$thistarget,$thisembstyle);
$r->print($outstring);
} else {
$r->print(''.
@@ -2245,7 +2249,7 @@ ENDDIFF
'
');
}
} else {
- &phasetwo($r,$fn,$thistarget,$thisembstyle,$thisdistarget);
+ &phasetwo($r,$docroot.$fn,$docroot.$thistarget,$thisembstyle,$thisdistarget);
}
}
$r->print(&Apache::loncommon::end_page());