--- loncom/imspackages/imsexport.pm 2004/12/23 14:00:58 1.1
+++ loncom/imspackages/imsexport.pm 2006/05/30 12:45:50 1.4
@@ -27,13 +27,14 @@ use strict;
use Apache::lonnet;
sub simpleproblem {
- my ($symb,$output) = @_;
+ my ($symb) = @_;
+ my $output;
my %qparms = &Apache::lonnet::dump('resourcedata',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
- $ENV{'request.course.id'}.'.'.$symb);
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ $env{'course.'.$env{'request.course.id'}.'.num'},
+ $env{'request.course.id'}.'.'.$symb);
if ($symb) {
- my $prefix=$ENV{'request.course.id'}.'.'.$symb.'.0.';
+ my $prefix=$env{'request.course.id'}.'.'.$symb.'.0.';
my $qtype=$qparms{$prefix.'questiontype'};
my $qtext=$qparms{$prefix.'questiontext'};
my $hint=$qparms{$prefix.'hinttext'};
@@ -45,58 +46,58 @@ sub simpleproblem {
if ($qtype eq 'option') {
my $options=$qparms{$prefix.'options'};
%values = &evaloptionhash($options);
- $$output .= qq|
+ $output .= qq|
|;
for (my $k=0; $k<10; $k++) {
my $iter = $k+1;
- $$output .= ' '."\n";
+ $output .= ' '."\n";
}
- chomp($$output);
- $$output .= qq|
+ chomp($output);
+ $output .= qq|
|;
if ($hint) {
- $$output .= '
+ $output .= '
'.$hint.'
';
}
- $$output .= qq|
+ $output .= qq|
|;
} else {
- $$output .= qq|
+ $output .= qq|
|;
for (my $k=0; $k<10; $k++) {
my $iter = $k+1;
- $$output .= ' '."\n";
+ $output .= ' '."\n";
}
- chomp($$output);
- $$output .= qq|
+ chomp($output);
+ $output .= qq|
|;
if ($hint) {
- $$output .= '
+ $output .= '
'.$hint.'
';
}
- $$output .= qq|
+ $output .= qq|
|;
@@ -104,26 +105,26 @@ sub simpleproblem {
} elsif ($qtype eq 'stringanswer') {
my $stringanswer = $qparms{$prefix.'stringanswer'};
my $stringtype=$qparms{$prefix.'stringtype'};
- $$output .= qq|
+ $output .= qq|
|;
if ($hint) {
- $$output .= '
+ $output .= '
'.$hint.'
';
}
- $$output .= qq|
+ $output .= qq|
|;
} else {
- $$output .= qq|
+ $output .= qq|
$qtext
@@ -133,7 +134,7 @@ sub simpleproblem {
|;
}
}
- return;
+ return $output;
}
sub evaloptionhash {
@@ -150,15 +151,15 @@ sub evaloptionhash {
sub external {
my ($symb,$title) = @_;
my $output;
- if ($symb =~ m-\.sequence___\d+___ext$-) {
- my $exturl = &Apache::lonnet::escape($1);
+ if ($symb =~ m-\.sequence___\d+___ext(.+)$-) {
+ my $exturl = &unescape($1);
$output = qq|
$title
|;
@@ -168,8 +169,8 @@ sub external {
sub templatedpage {
my ($content_type,$timestamp,$count,$uploads,$udom,$uname) = @_;
- my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
- my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $output = '
<'.$content_type.'>';
my %syllabusdata=();
@@ -228,8 +229,8 @@ sub templatedpage {
$_>|;
}
if (defined($syllabusdata{'uploaded.photourl'})) {
- if ($syllabusdata{'uploaded.photourl'} =~ m-^/uploaded/$cdom/$cnum/$content_type/(.+)$-) {
- push @{$$uploads}, $syllabusdata{'uploaded.photourl'};
+ if ($syllabusdata{'uploaded.photourl'} =~ m-/([^/]+)$-) {
+ push @$uploads, $syllabusdata{'uploaded.photourl'};
}
$output .= '