--- loncom/imspackages/imsexport.pm 2013/11/12 04:54:57 1.11
+++ loncom/imspackages/imsexport.pm 2016/06/20 16:39:26 1.13
@@ -1,6 +1,6 @@
# The LearningOnline Network
#
-# $Id: imsexport.pm,v 1.11 2013/11/12 04:54:57 raeburn Exp $
+# $Id: imsexport.pm,v 1.13 2016/06/20 16:39:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -395,17 +395,17 @@ sub process_content {
}
} elsif ($symb =~ m-\.(sequence|page)___\d+___uploaded/$cdom/$cnum/-) {
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'uploaded');
- } elsif ($symb =~ m-\.(sequence|page)___\d+___([^/]+)/([^/]+)-) {
- my $canedit = 0;
- if ($2 eq $env{'user.domain'} && $3 eq $env{'user.name'}) {
- $canedit= 1;
- }
-# only include problem code where current user is author
+ } elsif ($symb =~ m-\.(?:sequence|page)___\d+___($match_domain/$match_name/.+)$-) {
+ my $url = &Apache::lonnet::clutter($1);
+ $url =~ s{^/res/}{/priv/};
if (($format eq 'html') || ($format eq 'plaintext')) {
my $title = $curRes->title;
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,$format,$currdirpath,$title,$testbank);
} elsif ($format eq 'xml') {
- if ($canedit) {
+# only include problem code where current user is author or co-author,
+# or this is a course "author" resource.
+ my ($ownername,$ownerdom,$ownerhome) = &Apache::lonnet::constructaccess($url);
+ if (($ownername ne '') && ($ownerdom ne '') && ($ownerhome ne '')) {
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'resource');
} else {
$$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'noedit');
@@ -897,7 +897,7 @@ sub templatedpage {
$udom
|;
}
- foreach (sort keys %syllabusfields) {
+ foreach (sort(keys(%syllabusfields))) {
$output .= qq|
<$_>
$syllabusfields{$_}