version 1.125, 2019/03/06 02:31:16
|
version 1.126, 2023/07/14 14:32:57
|
Line 1477 sub handler {
|
Line 1477 sub handler {
|
return HTTP_NOT_FOUND; |
return HTTP_NOT_FOUND; |
} |
} |
|
|
unless ($fn) { |
unless ($fn) { |
&Debug($r, "loncfile::handler - doctored url is empty"); |
&Debug($r, "loncfile::handler - doctored url is empty"); |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}. |
' trying to cfile non-existing file', $r->filename); |
' trying to cfile non-existing file', $r->filename); |
Line 1520 function writeDone() {
|
Line 1520 function writeDone() {
|
my $londocroot = $r->dir_config('lonDocRoot'); |
my $londocroot = $r->dir_config('lonDocRoot'); |
my $trailfile = $fn; |
my $trailfile = $fn; |
$trailfile =~ s{^/(priv/)}{$londocroot/$1}; |
$trailfile =~ s{^/(priv/)}{$londocroot/$1}; |
|
|
# Breadcrumbs |
# Breadcrumbs |
|
my $crsauthor; |
|
my $text = 'Authoring Space'; |
|
my $title = 'Authoring Space File Operation', |
|
my $href = &Apache::loncommon::authorspace(&url($fn)); |
|
if ($env{'request.course.id'}) { |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
if ($href eq "/priv/$cdom/$cnum/") { |
|
$text = 'Course Authoring Space'; |
|
$title = 'Course Authoring Space File Operation', |
|
$crsauthor = 1; |
|
} |
|
} |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Authoring Space', |
'text' => $text, |
'href' => &Apache::loncommon::authorspace($fn), |
'href' => $href, |
}); |
}); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'File Operation', |
'text' => 'File Operation', |
'title' => 'Authoring Space File Operation', |
'title' => $title, |
'href' => '', |
'href' => '', |
}); |
}); |
|
|
$r->print(&Apache::loncommon::start_page('Authoring Space File Operation', |
$r->print(&Apache::loncommon::start_page($title, |
$js, |
$js, |
{'add_entries' => \%loaditem,}) |
{'add_entries' => \%loaditem,}) |
.&Apache::lonhtmlcommon::breadcrumbs() |
.&Apache::lonhtmlcommon::breadcrumbs() |
Line 1544 function writeDone() {
|
Line 1557 function writeDone() {
|
$r->print('<p>'.&mt('Location').': '.&display($fn).'</p>'); |
$r->print('<p>'.&mt('Location').': '.&display($fn).'</p>'); |
|
|
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
$r->print('<p class="LC_info">' |
unless ($crsauthor) { |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
$r->print('<p class="LC_info">' |
.'</p>' |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
); |
.'</p>' |
|
); |
|
} |
} |
} |
|
|
|
|
Line 1571 function writeDone() {
|
Line 1586 function writeDone() {
|
'Select Action' => 'New Resource', |
'Select Action' => 'New Resource', |
); |
); |
if ($action{$env{'form.action'}}) { |
if ($action{$env{'form.action'}}) { |
|
if ($crsauthor) { |
|
my @disallowed = qw(page sequence rights library); |
|
my $newtype; |
|
if ($env{'form.action'} =~ /^new(\w+)file$/) { |
|
$newtype = $1; |
|
} elsif ($env{'form.action'} eq 'newfile') { |
|
($newtype) = ($env{'form.newfilename'} =~ m{\.([^/.]+)$}); |
|
$newtype = lc($newtype); |
|
} |
|
if (($newtype ne '') && |
|
(grep(/^\Q$newtype\E$/,@disallowed))) { |
|
$r->print('<p class="LC_error">' |
|
.&mt('Creation of a new file of type: [_1] is not permitted in Course Authoring Space',$newtype) |
|
.'</p>' |
|
.&Apache::loncommon::end_page() |
|
); |
|
return OK; |
|
} |
|
} |
$r->print('<h2>'.$action{$env{'form.action'}}.'</h2>'); |
$r->print('<h2>'.$action{$env{'form.action'}}.'</h2>'); |
} else { |
} else { |
$r->print('<p class="LC_error">' |
$r->print('<p class="LC_error">' |