--- loncom/interface/londocs.pm 2004/12/23 16:31:27 1.159
+++ loncom/interface/londocs.pm 2004/12/23 20:50:35 1.162
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.159 2004/12/23 16:31:27 raeburn Exp $
+# $Id: londocs.pm,v 1.162 2004/12/23 20:50:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -242,6 +242,7 @@ sub dumpcourse {
# ------------------------------------------------------ Generate "export" button
sub exportbutton {
+ return '';
return '
'.
''.
@@ -658,7 +659,6 @@ sub process_content {
my $content_type;
my $message;
# find where user is author or co-author
- my %roleshash = &Apache::lonnet::get_my_roles();
my @uploads = ();
if ($curRes->is_sequence()) {
$content_type = 'sequence';
@@ -705,29 +705,20 @@ sub process_content {
if ($contents) {
$$content_file = &store_template($contents,$tempexport,$count,$content_type);
}
- } elsif ($symb =~ m-uploaded/$cdom/$cnum-) {
- $$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'uploaded');
} 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 $coauth = $3.':'.$2.':ca';
+ } elsif ($symb =~ m-\.(sequence|page)___\d+___([^/]+)/([^/]+)-) {
my $canedit = 0;
if ($2 eq $ENV{'user.domain'} && $3 eq $ENV{'user.name'}) {
$canedit= 1;
- } elsif (defined($roleshash{$coauth})) {
- if ($roleshash{$coauth} =~ /(\d+):(\d+)/) {
- if (($1 < time || $1 == 0) && ($2 == 0 || $2 >= time)) {
- $canedit = 1;
- }
- } elsif ($roleshash{$coauth} eq ':') {
- $canedit = 1;
- }
}
if ($canedit) {
$$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');
}
+ } elsif ($symb =~ m-uploaded/$cdom/$cnum-) {
+ $$content_file = &replicate_content($cdom,$cnum,$tempexport,$symb,$count,\$message,$href,'uploaded');
}
if (@uploads > 0) {
foreach my $item (@uploads) {
@@ -769,14 +760,14 @@ sub replicate_content {
if ($copiedfile = Apache::File->new('>'.$destination)) {
my $content;
if ($caller eq 'resource') {
- $content = &Apache::lonnet::getfile($url);
+ $content = &Apache::lonnet::getfile('/home/httpd/html/res/'.$url);
if ($content eq -1) {
$$message = 'Could not copy file '.$filename;
} else {
&extract_media($content,$count,$tempexport,$href,'resource');
$repstatus = 'ok';
}
- } elsif ($caller eq 'noedit' || $caller eq 'uploaded' || $caller eq 'templateupload') {
+ } elsif ($caller eq 'uploaded' || $caller eq 'templateupload') {
my $rtncode;
$repstatus = &Apache::lonnet::getuploaded('GET',$url,$cdom,$cnum,\$content,$rtncode);
if ($repstatus eq 'ok') {
@@ -786,6 +777,10 @@ sub replicate_content {
} else {
$$message = 'Could not render '.$url.' server message - '.$rtncode;
}
+ } elsif ($caller eq 'noedit') {
+# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this.
+ $repstatus = 'ok';
+ $content = 'Not the owner of this resource';
}
if ($repstatus eq 'ok') {
print $copiedfile $content;
|