--- loncom/publisher/loncfile.pm 2024/09/26 23:04:06 1.129.2.3 +++ loncom/publisher/loncfile.pm 2024/09/03 10:40:04 1.130 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.129.2.3 2024/09/26 23:04:06 raeburn Exp $ +# $Id: loncfile.pm,v 1.130 2024/09/03 10:40:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1686,7 +1686,7 @@ sub phasetwo { } $dest = $dir."/."; } elsif ($env{'form.action'} eq 'archive') { - if (($env{'environment.canarchive'}) && + if (($env{'environment.archive'}) && ($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) { &Archive2($r,$uname,$udom,$fn,$identifier); @@ -2047,9 +2047,19 @@ ENDJS $trailfile =~ s{^/(priv/)}{$londocroot/$1}; # 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::add_breadcrumb({ 'text' => $text, @@ -2072,10 +2082,12 @@ ENDJS } if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { - $r->print('

' - .&mt('Co-Author [_1]',$uname.':'.$udom) - .'

' - ); + unless ($crsauthor) { + $r->print('

' + .&mt('Co-Author [_1]',$uname.':'.$udom) + .'

' + ); + } } @@ -2100,7 +2112,33 @@ ENDJS 'Select Action' => 'New Resource', ); if ($action{$env{'form.action'}}) { - if ($env{'form.action'} eq 'archive') { + 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('

' + .&mt('Creation of a new file of type: [_1] is not permitted in Course Authoring Space',$newtype) + .'

' + .&Apache::loncommon::end_page() + ); + return OK; + } + if ($env{'form.action'} eq 'archive') { + $r->print('

'.&mt('Location').': '.&display($fn).'

'."\n". + '

'. + &mt('Export to an archive file is not permitted in Course Authoring Space'). + '

'."\n". + &Apache::loncommon::end_page()); + return OK; + } + } elsif ($env{'form.action'} eq 'archive') { if ($env{'environment.canarchive'}) { if ($archive_earlyout) { my $fname = &url($fn);