--- loncom/interface/londocs.pm 2004/12/23 17:50:42 1.161 +++ 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.161 2004/12/23 17:50:42 albertel Exp $ +# $Id: londocs.pm,v 1.162 2004/12/23 20:50:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -705,12 +705,9 @@ 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; @@ -720,6 +717,8 @@ sub process_content { } 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) { @@ -761,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') { @@ -778,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;