'.
+ $result .= '
'.
'
';
@@ -462,20 +462,39 @@ sub phasefour {
sub handler {
my $r=shift;
-
- my $uname;
- my $udom;
my $javascript = '';
-#
-# phase two: re-attach user
-#
- if ($env{'form.uploaduname'}) {
- $env{'form.filename'}='/priv/'.$env{'form.uploaduname'}.'/'.
- $env{'form.filename'};
+ my $fn=$env{'form.filename'};
+
+ if ($env{'form.filename1'}) {
+ $fn=$env{'form.filename1'}.$env{'form.filename2'};
}
+ $fn=~s/\/+/\//g;
+
+ unless ($fn) {
+ $r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
+ ' unspecified filename for upload', $r->filename);
+ return HTTP_NOT_FOUND;
+ }
+
+ my ($uname,$udom)=&Apache::loncacc::constructaccess($fn);
+
+ unless (($uname) && ($udom)) {
+ $r->log_reason($uname.' at '.$udom.
+ ' trying to publish file '.$env{'form.filename'}.
+ ' - not authorized',
+ $r->filename);
+ return HTTP_NOT_ACCEPTABLE;
+ }
+
+# ----------------------------------------------------------- Start page output
+
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
unless ($env{'form.phase'} eq 'two') {
- $javascript = qq|
+ $javascript = <<"ENDJS";
+
+ENDJS
}
-# ----------------------------------------------------------- Start page output
-
-
- &Apache::loncommon::content_type($r,'text/html');
- $r->send_http_header;
-
- $javascript = "\n";
+ my $londocroot = $r->dir_config('lonDocRoot');
+ my $trailfile = $fn;
+ $trailfile =~ s{^/(priv/)}{$londocroot/$1};
# Breadcrumbs
- my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+ my $brcrum = [{'href' => &Apache::loncommon::authorspace($fn),
'text' => 'Construction Space'},
{'href' => '/adm/upload',
'text' => 'Upload file to Construction Space'}];
@@ -534,11 +526,11 @@ function verifyForm() {
$javascript,
{'bread_crumbs' => $brcrum,})
.&Apache::loncommon::head_subbox(
- &Apache::loncommon::CSTR_pageheader())
+ &Apache::loncommon::CSTR_pageheader($trailfile))
);
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
- $r->print(''
+ $r->print('
'
.&mt('Co-Author [_1]',$uname.':'.$udom)
.'
'
);
@@ -547,13 +539,13 @@ function verifyForm() {
my $output = &phasefour($r,$fn,$uname,$udom,'author');
$r->print($output);
} elsif ($env{'form.phase'} eq 'three') {
- my $output = &phasethree($r,$fn,$uname,$udom,'author');
+ my ($output,$rtnflag) = &phasethree($r,$fn,$uname,$udom,'author');
$r->print($output);
} elsif ($env{'form.phase'} eq 'two') {
- my ($output,$returnflag) = &phasetwo($r,$fn,$uname,$udom);
+ my ($output,$returnflag) = &phasetwo($r,$fn);
$r->print($output);
} else {
- &phaseone($r,$fn,$uname,$udom);
+ &phaseone($r,$fn);
}
$r->print(&Apache::loncommon::end_page());