--- loncom/imspackages/imsexport.pm 2012/01/29 19:51:01 1.8
+++ loncom/imspackages/imsexport.pm 2013/11/12 04:54:57 1.11
@@ -1,6 +1,6 @@
# The LearningOnline Network
#
-# $Id: imsexport.pm,v 1.8 2012/01/29 19:51:01 raeburn Exp $
+# $Id: imsexport.pm,v 1.11 2013/11/12 04:54:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,6 +32,8 @@ use Apache::lonnet;
use Apache::loncommon;
use Apache::lonhtmlcommon;
use Apache::lonnavmaps;
+use Apache::loncourserespicker;
+use Apache::londocs;
use Apache::lonlocal;
use Cwd;
use LONCAPA qw(:DEFAULT :match);
@@ -39,40 +41,18 @@ use LONCAPA qw(:DEFAULT :match);
sub exportcourse {
my $r=shift;
my $crstype = &Apache::loncommon::course_type();
- my %discussiontime = &Apache::lonnet::dump('discussiontimes',
- $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
- my $numdisc = keys(%discussiontime);
- my $numprobs = 0;
- my $navmap = Apache::lonnavmaps::navmap->new();
- if (!defined($navmap)) {
- $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
- '
'.&mt('IMS Export Failed').'
'.
- '');
- if ($crstype eq 'Community') {
- $r->print(&mt('Unable to retrieve information about community contents'));
- } else {
- $r->print(&mt('Unable to retrieve information about course contents'));
- }
- $r->print('
');
- if ($crstype eq 'Community') {
- $r->print(&mt('Return to Community Editor'));
- } else {
- $r->print(&mt('Return to Course Editor'));
- }
- $r->print('');
- &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
+ my ($navmap,$errormsg) =
+ &Apache::loncourserespicker::get_navmap_object($crstype,'imsexport');
+ unless (ref($navmap)) {
+ $r->print($errormsg);
return;
}
- my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
- my $curRes;
- my $outcome;
-
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['finishexport']);
if ($env{'form.finishexport'}) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['archive','discussion']);
-
+ my $outcome;
my $format = $env{'form.format'};
my @exportitems = &Apache::loncommon::get_env_multiple('form.archive');
my @discussions = &Apache::loncommon::get_env_multiple('form.discussion');
@@ -135,184 +115,15 @@ sub exportcourse {
}
$r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
+ $r->print(&Apache::londocs::startContentScreen('tools'));
$r->print($outcome);
+ $r->print(&Apache::londocs::endContentScreen());
$r->print(&Apache::loncommon::end_page());
} else {
- my $display='');
- }
-}
-
-sub export_javascript {
- my ($startcount,$numitems,%children) = @_;
- my $scripttag = <<"START";
-
-
-END
- return $scripttag;
+ return;
}
sub create_ims_store {
@@ -862,6 +673,7 @@ sub simpleproblem {
%values = &evaloptionhash($options);
$output .= qq|
+ $qtext
|;
@@ -890,8 +702,9 @@ sub simpleproblem {
} else {
$output .= qq|
+ $qtext
-
+
|;
for (my $k=0; $k<10; $k++) {
my $iter = $k+1;
@@ -916,14 +729,14 @@ sub simpleproblem {
|;
}
- } elsif ($qtype eq 'stringanswer') {
+ } elsif ($qtype eq 'string') {
my $stringanswer = $qparms{$prefix.'stringanswer'};
my $stringtype=$qparms{$prefix.'stringtype'};
$output .= qq|
-
-
+ $qtext
+
|;
if ($hint) {
$output .= '
@@ -937,6 +750,55 @@ sub simpleproblem {
|;
+ } elsif ($qtype eq 'numerical') {
+ my $sigfigs = $qparms{$prefix.'numericalsigfigs'};
+ my $unit = $qparms{$prefix.'numericalunit'};
+ my $answer = $qparms{$prefix.'numericalanswer'};
+ my $tolerance = $qparms{$prefix.'numericaltolerance'};
+ my $format = $qparms{$prefix.'numericalformat'};
+ my $scriptblock = $qparms{$prefix.'numericalscript'};
+ $output .= qq|
+
+|;
+ if ($scriptblock) {
+ $output .= qq|
+|;
+ }
+ $output .= qq|
+$qtext
+|;
+ }
+ if ($sigfigs) {
+ $output .= qq|
+ |;
+ }
+ $output .= qq|
+ |;
+ if ($hint) {
+ $output .= qq|
+
+
+ '.$hint.'
+
+ |;
+ }
+ $output .= qq|
+
+
+|;
} else {
$output .= qq|
@@ -1075,8 +937,6 @@ described at http://www.lon-capa.org.
=item exportcourse()
-=item export_javascript()
-
=item create_ims_store()
=item build_package()