--- loncom/interface/londocs.pm 2011/07/04 13:01:53 1.454 +++ loncom/interface/londocs.pm 2011/09/10 19:00:07 1.460 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.454 2011/07/04 13:01:53 raeburn Exp $ +# $Id: londocs.pm,v 1.460 2011/09/10 19:00:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -681,7 +681,8 @@ sub build_package { $currdirpath = 'Top'; my $pcslist = $curRes->map_hierarchy(); if ($pcslist ne '') { - foreach my $pc (split(/,/,$pcslist)) { + foreach my $pc (split(/,/,$pcslist),$curRes->map_pc()) { + next if ($pc <= 1); my $res = $navmap->getByMapPc($pc); if (ref($res)) { my $encloser = $res->title(); @@ -896,7 +897,8 @@ sub replicate_content { grade_courseid => $cdom.'_'.$cnum, grade_domain => $env{'user.domain'}, grade_username => $env{'user.name'}, - grade_imsexport => 1, + grade_imsexport => 1, + instructor_comments => 'hide', ); my $feedurl=&Apache::lonnet::clutter($url); my ($userview,$response)=&Apache::lonnet::ssi_body($feedurl,%form); @@ -917,11 +919,11 @@ sub replicate_content { $foilcounter ++; } elsif ($line =~ m{(|\Q\E)\Q
Correct:
}) { + $mc_answer = $alphabet[$foilcounter-1]; + } elsif ($line !~ m{\Q\E(|\Q
\E)\Q
\E}) { $line =~ s/^(\s+|\s+)$//g; $line =~ s{^\Q\E([^<]+)\Q\E$}{1}; - push(@tosave,$line); + $tosave[$foilcounter] .= $line.' '; } $content = join("\t",@tosave); if ($mc_answer) { @@ -929,10 +931,15 @@ sub replicate_content { } } if (@tosave) { - $content = $currdirpath."\t".$title."\t".join("\t",@tosave); + my $qtype; if ($mc_answer) { - $content .= "\t".$mc_answer."\n"; + $qtype = 'MC'; } + $content = $currdirpath."\t".$title."\t$qtype\t".join("\t",@tosave); + if ($mc_answer) { + $content .= "\t".$mc_answer; + } + $content .= "\n"; } } else { $content = ''.$content.''; @@ -1606,7 +1613,8 @@ sub handle_edit_cmd { } sub editor { - my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype)=@_; + my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, + $supplementalflag,$orderhash)=@_; my $container= ($env{'form.pagepath'}) ? 'page' : 'sequence'; @@ -1735,7 +1743,7 @@ sub editor { $r->print(''); } - my $output; + my ($to_show,$output); &Apache::loncommon::start_data_table_count(); #setup a row counter foreach my $res (@LONCAPA::map::order) { @@ -1752,30 +1760,38 @@ sub editor { &Apache::loncommon::end_data_table_count(); if ($shown) { - $r->print(&Apache::loncommon::start_scrollbox('900px','880px','400px') - .&Apache::loncommon::start_data_table()); + $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') + .&Apache::loncommon::start_data_table(undef,'contentlist'); if ($allowed) { - $r->print(&Apache::loncommon::start_data_table_header_row() + $to_show .= &Apache::loncommon::start_data_table_header_row() .''.&mt('Move').'' .''.&mt('Actions').'' - .''.&mt('Document').''); + .''.&mt('Document').''; if ($folder !~ /^supplemental/) { - $r->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('

' + $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') + .'

' .&mt('Currently no documents.') - .'

' - ); + .'
' + .&Apache::loncommon::end_scrollbox(); + } + my $tid = 1; + if ($supplementalflag) { + $tid = 2; } if ($allowed) { + $r->print(&generate_edit_table($tid,$orderhash,$to_show)); &print_paste_buffer($r,$container); + } else { + $r->print($to_show); } return; } @@ -1805,7 +1821,7 @@ sub process_file_upload { $LONCAPA::map::resources[1]=''; } if ($fatal) { - $$upload_output = '

'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'

'; + $$upload_output = '
'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'
'; return; } my $destination = 'docs/'; @@ -1831,7 +1847,7 @@ sub process_file_upload { } else { my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$}); - $$upload_output = '

'.&mt('Unable to save file [_1].',''.$filename.'').'

'; + $$upload_output = '
'.&mt('Unable to save file [_1].',''.$filename.'').'
'; return; } my $ext='false'; @@ -1850,7 +1866,7 @@ sub process_file_upload { ($errtext,$fatal)=&storemap($coursenum,$coursedom, $folder.'.'.$container); if ($fatal) { - $$upload_output = '

'.$errtext.'

'; + $$upload_output = '
'.$errtext.'
'; return; } else { if ($parseaction eq 'parse' && $mimetype eq 'text/html') { @@ -1877,6 +1893,7 @@ sub process_file_upload { } else { $$upload_output .= &mt('No embedded items identified').'
'; } + $$upload_output = '
'.$$upload_output.'
'; } } } @@ -2203,14 +2220,13 @@ END $form_start $form_end - - +
$form_start $form_end - $form_start $rand_order_text $form_end - $form_start $parameterset $form_end + $form_start $parameterset $form_end
+ $form_start $rand_order_text $form_end ENDPARMS } $line.=&Apache::loncommon::end_data_table_row(); @@ -2745,15 +2761,15 @@ sub startContentScreen { if ($allowed) { $r->print('
  •       '.&mt('Content Editor').'      
  • '); + ' id="tabbededitor">      '.&mt('Content Editor').'      '); } $r->print('     '.&mt('Content Search').'     '); $r->print('      '.&mt('Content Index').'      '); $r->print('
  • '.&mt('Supplemental Documents').'
  • '); $r->print(''); - $r->print('
    ' - .'
    '); + $r->print('
    ' + .'
    '); $r->print('
    '); } @@ -2852,6 +2868,7 @@ sub handler { my $script=''; my $showdoc=0; + my $addentries = {}; my $containertag; my $uploadtag; @@ -2952,7 +2969,22 @@ sub handler { $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/"); if ($allowed) { - $script .= &editing_js($udom,$uname); + my @tabids; + if ($supplementalflag) { + @tabids = ('002','ee2','ff2'); + } else { + @tabids = ('aa1','bb1','cc1','ff1'); + unless ($env{'form.pagepath'}) { + unshift(@tabids,'001'); + push(@tabids,('dd1','ee1')); + } + } + my $tabidstr = join("','",@tabids); + $script .= &editing_js($udom,$uname). + &resize_contentdiv_js($tabidstr); + $addentries = { + onload => "javascript:resize_contentdiv('contentscroll','1','1');", + }; } # -------------------------------------------------------------------- Body tag $script = '