--- loncom/interface/londocs.pm 2011/01/16 13:29:50 1.448 +++ loncom/interface/londocs.pm 2011/09/09 20:13:17 1.458 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.448 2011/01/16 13:29:50 www Exp $ +# $Id: londocs.pm,v 1.458 2011/09/09 20:13:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -280,6 +280,7 @@ sub exportcourse { 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'). @@ -310,6 +311,7 @@ sub exportcourse { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['archive','discussion']); + my $format = $env{'form.format'}; my @exportitems = &Apache::loncommon::get_env_multiple('form.archive'); my @discussions = &Apache::loncommon::get_env_multiple('form.discussion'); if (@exportitems == 0 && @discussions == 0) { @@ -331,9 +333,10 @@ sub exportcourse { my $imsresources; my $tempexport; my $copyresult; - my $ims_manifest = &create_ims_store($now,\$manifestok,\$outcome,\$tempexport); + my $testbank; + my $ims_manifest = &create_ims_store($now,\$manifestok,\$outcome,\$tempexport,$format,\$testbank); if ($manifestok) { - &build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,$tempexport,\$copyresult,$ims_manifest); + &build_package($now,$navmap,\@exportitems,\@discussions,\$outcome,$tempexport,\$copyresult,$ims_manifest,$format,$testbank); close($ims_manifest); #Create zip file in prtspool @@ -435,6 +438,8 @@ sub exportcourse { if (($curRes->is_sequence()) || ($curRes->is_page())) { $lastcontainer = $currelem; $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"'; + } elsif ($curRes->is_problem()) { + $numprobs ++; } $display .= ' />'."\n"; for (my $i=0; $i<$depth; $i++) { @@ -519,6 +524,16 @@ function containerCheck(item) { $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package', $scripttag)); $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export')); + if ($numprobs > 0) { + $display .= '
'. + &mt('Export format for LON-CAPA problems:'). + ''.(' ' x3). + ''.(' ' x3). + '
'; + } $r->print($display. ''.
''."\n".
' '
+ $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
+ .' '.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').' '.&mt('Unable to save file [_1].',''.$filename.'').' '.$errtext.'
'
;
@@ -580,7 +599,8 @@ sub create_ims_store {
}
sub build_package {
- my ($now,$navmap,$exportitems,$discussions,$outcome,$tempexport,$copyresult,$ims_manifest) = @_;
+ my ($now,$navmap,$exportitems,$discussions,$outcome,$tempexport,$copyresult,
+ $ims_manifest,$format,$testbank) = @_;
# first iterator to look for dependencies
my $it = $navmap->getIterator(undef,undef,undef,1,undef,undef);
my $curRes;
@@ -619,6 +639,7 @@ sub build_package {
$count = 0;
my $imsresources;
my $pkgdepth;
+ my $currdirpath = 'Top';
while ($curRes = $it->next()) {
if ($curRes == $it->BEGIN_MAP()) {
$prevdepth = $depth;
@@ -656,10 +677,28 @@ sub build_package {
'
Incorrect:\E)\Q
Correct:\E(|\Q\E)\Q
\E}) {
+ $line =~ s/^(\s+|\s+)$//g;
+ $line =~ s{^\Q\E([^<]+)\Q\E$}{1};
+ $tosave[$foilcounter] .= $line.' ';
+ }
+ $content = join("\t",@tosave);
+ if ($mc_answer) {
+ $content .= "\t".$mc_answer."\n";
+ }
+ }
+ if (@tosave) {
+ my $qtype;
+ if ($mc_answer) {
+ $qtype = 'MC';
+ }
+ $content = $currdirpath."\t".$title."\t$qtype\t".join("\t",@tosave);
+ if ($mc_answer) {
+ $content .= "\t".$mc_answer;
+ }
+ $content .= "\n";
+ }
+ } else {
+ $content = ''.$content.'';
+ }
+ if (($caller eq 'plaintext') && ($testbank)) {
+ print $testbank $content;
+ }
+ } else {
+ $content = 'Not the owner of this resource';
+ }
+ } else {
+ $content = 'Not the owner of this resource';
+ }
$repstatus = 'ok';
- $content = 'Not the owner of this resource';
}
if ($repstatus eq 'ok') {
print $copiedfile $content;
@@ -905,7 +1011,6 @@ sub extract_media {
$repstatus = 'ok';
}
} elsif ($caller eq 'uploaded') {
-
$repstatus = &Apache::lonnet::getuploaded('GET',$embed_url,$cdom,$cnum,\$embed_content,$rtncode);
}
if ($repstatus eq 'ok') {
@@ -1150,6 +1255,7 @@ sub docs_change_log {
&Apache::loncommon::restore_course_settings('docs_log',
\%saveable_parameters);
if (!$env{'form.show'}) { $env{'form.show'}=10; }
+# FIXME: internationalization seems wrong here
my %lt=('hiddenresource' => 'Resources hidden',
'encrypturl' => 'URL hidden',
'randompick' => 'Randomly pick',
@@ -1238,6 +1344,7 @@ sub docs_change_log {
$r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':');
foreach my $parameter ('randompick','hiddenresource','encrypturl','randomorder') {
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) {
+# FIXME: internationalization seems wrong here
$r->print('
');
- $r->print(''.&mt('Move').' '
.''.&mt('Actions').' '
- .''.&mt('Document').' ');
+ .''.&mt('Document').' ';
if ($folder !~ /^supplemental/) {
- $->print(''.&mt('Settings').' ');
+ $to_show .= ''.&mt('Settings').' ';
}
- $r->print(&Apache::loncommon::end_data_table_header_row());
+ $to_show .= &Apache::loncommon::end_data_table_header_row();
}
- $r->print($output
+ $to_show .= $output.' '
.&Apache::loncommon::end_data_table()
- .&Apache::loncommon::end_scrollbox()
- );
+ .'
'
+ .&Apache::loncommon::end_scrollbox();
} else {
- $r->print('
';
}
+ $$upload_output = '
+
-
$form_start
$form_end
$form_start $rand_order_text $form_end
- $form_start $parameterset $form_end
+ $form_start $parameterset $form_end
ENDPARMS
}
$line.=&Apache::loncommon::end_data_table_row();
@@ -2645,13 +2759,15 @@ sub startContentScreen {
if ($allowed) {
$r->print('
+ $form_start $rand_order_text $form_end