--- loncom/interface/londocs.pm 2011/08/15 16:31:55 1.457 +++ loncom/interface/londocs.pm 2011/11/27 21:04:19 1.465 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.457 2011/08/15 16:31:55 raeburn Exp $ +# $Id: londocs.pm,v 1.465 2011/11/27 21:04:19 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -176,7 +176,7 @@ sub dumpcourse { $newfilename=&clean($newfilename); $newfilename.='.'.$ext; my @dirs=split(/\//,$newfilename); - my $path='/home/'.$ca.'/public_html'; + my $path=$r->dir_config('lonDocRoot')."/priv/$cd/$ca"; my $makepath=$path; my $fail=0; for (my $i=0;$i<$#dirs;$i++) { @@ -1577,7 +1577,7 @@ sub handle_edit_cmd { if ($cmd eq 'del') { if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && - ($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) { + ($url!~/$LONCAPA::assess_page_seq_re/)) { &Apache::lonnet::removeuploadedurl($url); } else { &LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); @@ -1613,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'; @@ -1742,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) { @@ -1759,30 +1760,38 @@ sub editor { &Apache::loncommon::end_data_table_count(); if ($shown) { - $r->print(&Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') - .&Apache::loncommon::start_data_table(undef,'contentlist')); + $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; } @@ -2211,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(); @@ -2623,7 +2631,7 @@ ENDHEADERS $r->print(' '.&mt('Diffs').''); + '" target="diffs">'.&mt('Diffs').''); } $r->print('
'); if (++$entries_count % $entries_per_col == 0) { @@ -2760,8 +2768,8 @@ sub startContentScreen { $r->print('
  • '.&mt('Supplemental Documents').'
  • '); $r->print(''); - $r->print('
    ' - .'
    '); + $r->print('
    ' + .'
    '); $r->print('
    '); } @@ -2864,12 +2872,24 @@ sub handler { my $containertag; my $uploadtag; +# Do we directly jump somewhere? + if ($env{'form.command'} eq 'direct') { + (my $mapurl) = &Apache::lonnet::decode_symb($env{'form.symb'}); + my $maptitle = &Apache::lonnet::gettitle($mapurl); + $mapurl=~s{^.*/([^/]+)\.\w+$}{$1}; + $env{'form.folderpath'}= + 'default&'.&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). + '&default&...::::&'. + &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. + &Apache::lonhtmlcommon::entity_encode($maptitle).'::::'; + } + # Where do we store these for when we come back? my $stored_folderpath='docs_folderpath'; if ($supplementalflag) { $stored_folderpath='docs_sup_folderpath'; } - + # No folderpath, no pagepath, see if we have something stored if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'})) { &Apache::loncommon::restore_course_settings($stored_folderpath, @@ -2961,11 +2981,21 @@ sub handler { $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/"); if ($allowed) { + 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(); + &resize_contentdiv_js($tabidstr); $addentries = { - onload => "javascript:resize_contentdiv('contentscroll');", - onresize => "javascript:resize_contentdiv('contentscroll');", + onload => "javascript:resize_contentdiv('contentscroll','1','1');", }; } # -------------------------------------------------------------------- Body tag @@ -3093,22 +3123,22 @@ FIUP CHBO - my $fileuploada = " $help{'Uploading_From_Harddrive'}"; + my $fileuploada = "
    $help{'Uploading_From_Harddrive'}"; my $fileuploadform=(< $fileupload
    $lt{'title'}:
    - + $uploadtag
    - + $checkbox FUFORM - $fileuploadform .= &create_form_ul(&Apache::lonhtmlcommon::htmltag('li',$fileuploada,{class => 'LC_menubuttons_inline_text'})).''; + $fileuploadform .= $fileuploada.''; my $simpleeditdefaultform=(< @@ -3121,10 +3151,10 @@ SEDFFORM ); $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma)); $simpleeditdefaultform .=(< +
    $lt{'copm'}

    - $help{'Load_Map'} @@ -3374,7 +3404,7 @@ NGFFORM my @importdoc = ( {''.$lt{extr}.''=>$extresourcesform}, {''.$lt{imsf}.''=>$imspform},); - $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . '
    ' . $fileuploadform; + $fileuploadform = &create_form_ul(&create_list_elements(@importdoc)) . '
    ' . $fileuploadform; @gradingforma=( {''.$lt{sipr}.''=>$newsmpproblemform}, @@ -3415,7 +3445,8 @@ unless ($env{'form.pagepath'}) { $hadchanges=0; unless ($supplementalflag) { - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, + $supplementalflag,\%orderhash); if ($error) { $r->print('

    '.$error.'

    '); } @@ -3424,10 +3455,8 @@ unless ($env{'form.pagepath'}) { } &changewarning($r,''); - $r->print(&generate_edit_table('1',\%orderhash)); } - - } + } # Supplemental documents start here @@ -3521,21 +3550,22 @@ my @supimportdoc = ( {''.$lt{extr}.'' =>$supnewextform}, ); -$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . '
    ' . $supupdocform; +$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)) . '
    ' . $supupdocform; my %suporderhash = ( '00' => ['Supnewfolder', $supnewfolderform], 'ee' => ['Import Documents',$supupdocform], 'ff' => ['Special Documents',&create_form_ul(&create_list_elements(@specialdocs))] ); if ($supplementalflag) { - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, + $supplementalflag,\%suporderhash); if ($error) { $r->print('

    '.$error.'

    '); } - $r->print(&generate_edit_table('2',\%suporderhash)); } } elsif ($supplementalflag) { - my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype); + my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, + $supplementalflag); if ($error) { $r->print('

    '.$error.'

    '); } @@ -3638,7 +3668,7 @@ sub generate_admin_options { sub generate_edit_table { - my ($tid,$orderhash_ref) = @_; + my ($tid,$orderhash_ref,$to_show) = @_; return unless(ref($orderhash_ref) eq 'HASH'); my %orderhash = %{$orderhash_ref}; my $form; @@ -3647,31 +3677,35 @@ sub generate_edit_table { if($env{'form.active'} ne ''){ $activetab = $env{'form.active'}; } - $form = '
    '; - $form .= '