[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm
raeburn
raeburn at source.lon-capa.org
Mon Oct 31 15:35:03 EDT 2011
raeburn Mon Oct 31 19:35:03 2011 EDT
Modified files:
/loncom/homework lonhomework.pm
Log:
- Bug 1320.
- Use lonDocRoot perlvar in place of static string: '/home/httpd/html'.
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.328 loncom/homework/lonhomework.pm:1.329
--- loncom/homework/lonhomework.pm:1.328 Fri Sep 9 16:56:35 2011
+++ loncom/homework/lonhomework.pm Mon Oct 31 19:35:03 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.328 2011/09/09 16:56:35 bisitz Exp $
+# $Id: lonhomework.pm,v 1.329 2011/10/31 19:35:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1099,6 +1099,7 @@
my $count = 0;
my $currentcategory='';
my $first = 1;
+ my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
foreach my $file (@files) {
next if ($file->[1] !~ /\S/);
if ($file->[2] ne $currentcategory) {
@@ -1122,7 +1123,7 @@
$result.=&Apache::loncommon::help_open_topic($file->[3]);
}
my $filename=$file->[0];
- $filename=~s/^\/home\/httpd\/html//;
+ $filename=~s{^\Q$londocroot\E}{};
$result.=' <span class="LC_fontsize_small">'
.'<a href="'.$filename.'?inhibitmenu=yes" target="sample">'.&mt('Example').'</a>'
.'</span><br />'."\n";
@@ -1158,8 +1159,6 @@
&renderpage($request,$dest);
} else {
my $url=&HTML::Entities::encode($request->uri,'<>&"');
- my $shownurl=$url;
- $shownurl=~s-^/~-/priv/-;
my $dest = &Apache::lonnet::filelocation("",$request->uri);
my $errormsg;
my $instructions;
@@ -1178,7 +1177,7 @@
.'<h1>'.&mt("Creating a new $extension resource.")."</h1>
$errormsg
".&mt("The requested file [_1] currently does not exist.",
- '<span class="LC_filename">'.$shownurl.'</span>').'
+ '<span class="LC_filename">'.$url.'</span>').'
<p class="LC_info">
'.&mt("To create a new $extension, select a template from the".
" list below. Then click on the \"Create $extension\" button.").'
More information about the LON-CAPA-cvs
mailing list