[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Thu, 23 Dec 2004 20:50:36 -0000
raeburn Thu Dec 23 15:50:36 2004 EDT
Modified files:
/loncom/interface londocs.pm
Log:
Fix regexp so IMS export correctly distinguishes items in /res and fix url for retrieval of resources for which user is author.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.161 loncom/interface/londocs.pm:1.162
--- loncom/interface/londocs.pm:1.161 Thu Dec 23 12:50:42 2004
+++ loncom/interface/londocs.pm Thu Dec 23 15:50:35 2004
@@ -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 @@
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 @@
} 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 @@
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 @@
} 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;