--- loncom/interface/londocs.pm 2013/04/02 00:07:08 1.541 +++ loncom/interface/londocs.pm 2013/05/25 21:56:23 1.551 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.541 2013/04/02 00:07:08 raeburn Exp $ +# $Id: londocs.pm,v 1.551 2013/05/25 21:56:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -340,10 +340,8 @@ sub group_import { } my $initialtext = &mt('Replace with your own content.'); my $newhtml = < - + - $name @@ -490,7 +488,7 @@ sub docs_change_log { } my $folderpath=$env{'form.folderpath'}; if ($folderpath eq '') { - $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Content').':::::'); + $folderpath = 'default&'.&escape(&mt('Main Content').':::::'); } $pathitem = ''; @@ -1066,7 +1064,6 @@ END } - sub do_paste_from_buffer { my ($coursenum,$coursedom,$folder,$container,$errors) = @_; @@ -2270,7 +2267,9 @@ sub update_parameter { sub handle_edit_cmd { my ($coursenum,$coursedom) =@_; - return if ($env{'form.cmd'} eq ''); + if ($env{'form.cmd'} eq '') { + return 0; + } my ($cmd,$idx)=split('_',$env{'form.cmd'}); my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; @@ -2331,7 +2330,7 @@ sub editor { my $jumpto; unless ($supplementalflag) { - $jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'"; + $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container"; } unless ($allowed) { @@ -2598,9 +2597,13 @@ sub editor { my ($to_show,$output,@allidx,@allmapidx,%filters,%lists,%curr_groups); %filters = ( - canremove => [], - cancut => [], - cancopy => [], + canremove => [], + cancut => [], + cancopy => [], + hiddenresource => [], + encrypturl => [], + randomorder => [], + randompick => [], ); %curr_groups = &Apache::longroup::coursegroups(); &Apache::loncommon::start_data_table_count(); #setup a row counter @@ -2625,7 +2628,9 @@ sub editor { my $need_save; if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) { - my $toolslink = '
' + my $toolslink; + if ($allowed || &Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { + $toolslink = '' @@ -2635,6 +2640,7 @@ sub editor { .'class="LC_toolbarItem" ' .'title="'.&mt('Supplemental Content Editor').'">' .'
' .&Apache::loncommon::help_open_menu('Navigation Screen', 'Navigation_Screen',undef,'RAT') .''.&mt('Tools:').'

'; + } if ($shown) { if ($allowed) { $to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll') @@ -2650,9 +2656,13 @@ sub editor { if ($folder !~ /^supplemental/) { $lists{'canhide'} = join(',',@allidx); $lists{'canrandomlyorder'} = join(',',@allmapidx); - foreach my $item ('canremove','cancut','cancopy') { + my @possfilters = ('canremove','cancut','cancopy','hiddenresource','encrypturl', + 'randomorder','randompick'); + foreach my $item (@possfilters) { if (ref($filters{$item}) eq 'ARRAY') { - $lists{$item} = join(',',@{$filters{$item}}); + if (@{$filters{$item}} > 0) { + $lists{$item} = join(',',@{$filters{$item}}); + } } } if (@allidx > 0) { @@ -2694,7 +2704,7 @@ sub editor { } $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll') .'
' - .&mt('Currently no documents.') + .&mt('Currently empty') .'
' .&Apache::loncommon::end_scrollbox(); } @@ -2707,7 +2717,7 @@ sub editor { .''; } else { $to_show = '
' - .&mt('Currently no documents.') + .&mt('Currently empty') .'
' } } @@ -2774,7 +2784,11 @@ sub multiple_check_form { ''; if ($caller eq 'settings') { $output .= - ''; + ''."\n". + ''."\n". + ''."\n". + ''."\n". + ''."\n"; } elsif ($caller eq 'actions') { $output .= ''. @@ -3057,7 +3071,7 @@ END } if ($denied{'copy'}) { - $copylink=(<$lt{'cp'} ENDCOPY } else { @@ -3083,6 +3097,7 @@ ENDCUT $cutlink=(< $form_common + $lt{'ct'} $form_end ENDCUT @@ -3100,6 +3115,7 @@ ENDREM $removelink=(< $form_common + $lt{'rm'} $form_end ENDREM @@ -3107,11 +3123,9 @@ ENDREM push(@{$filtersref->{'canremove'}},$orderidx); } } - unless ($isexternal) { - $renamelink=(<$lt{'rn'} ENDREN - } $line.=(<
@@ -3222,6 +3236,9 @@ END my $rpckchk; if ($rpicknum) { $rpckchk = ' checked="checked"'; + if (($ishash) && (ref($filtersref->{'randompick'}) eq 'ARRAY')) { + push(@{$filtersref->{'randompick'}},$orderidx.':'.$rpicknum); + } } my $formname = 'edit_randompick_'.$orderidx; $rand_pick_text = @@ -3234,8 +3251,13 @@ $form_common."\n". } $rand_pick_text .= ''. $form_end; - my $ro_set= - ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':''); + my $ro_set; + if ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i) { + $ro_set = 'checked="checked"'; + if (($ishash) && (ref($filtersref->{'randomorder'}) eq 'ARRAY')) { + push(@{$filtersref->{'randomorder'}},$orderidx); + } + } my $formname = 'edit_rorder_'.$orderidx; $rand_order_text = '
'."\n". @@ -3312,10 +3334,19 @@ $form_end; my %lt=&Apache::lonlocal::texthash( 'hd' => 'Hidden', 'ec' => 'URL hidden'); - my $enctext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="checked"':''); - my $hidtext= - ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="checked"':''); + my ($enctext,$hidtext); + if ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) { + $enctext = ' checked="checked"'; + if (($ishash) && (ref($filtersref->{'encrypturl'}) eq 'ARRAY')) { + push(@{$filtersref->{'encrypturl'}},$orderidx); + } + } + if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) { + $hidtext = ' checked="checked"'; + if (($ishash) && (ref($filtersref->{'randomorder'}) eq 'ARRAY')) { + push(@{$filtersref->{'hiddenresource'}},$orderidx); + } + } my $formhidden = 'edit_hiddenresource_'.$orderidx; my $formurlhidden = 'edit_encrypturl_'.$orderidx; $line.=(<print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents')); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents')); + $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Content')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Content')); $r->print(&startContentScreen('tools')); $r->print('

'.&mt($crstype.' content verification').'

'); $hashtied=0; @@ -3721,7 +3752,7 @@ sub checkversions { &changewarning($r,''); if ($env{'form.timerange'} eq 'all') { # show all documents - $header=&mt('All Documents in '.$crstype); + $header=&mt('All content in '.$crstype); $allsel=' selected="selected"'; foreach my $key (keys(%hash)) { if ($key=~/^ids\_(\/res\/.+)$/) { @@ -3999,7 +4030,7 @@ sub startContentScreen { $output .= '      '.&mt('Content Index').'      '."\n"; $output .= '
  • '.&mt('Supplemental Content').'
  • '; } else { - $output .= '
  •       '.&mt('Content Editor').'      
  • '."\n"; + $output .= '
  •       '.&mt('Main Content Editor').'      
  • '."\n"; $output .= '
  • '.&mt('Supplemental Content Editor').'
  • '."\n"; $output .= '
  •       '.&mt('Content Utilities').'      
  • '."\n"; '>      '.&mt('Content Utilities').'      '; @@ -4020,7 +4051,7 @@ sub endContentScreen { } sub supplemental_base { - return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content')); + return 'supplemental&'.&escape(&mt('Supplemental Content')); } sub handler { @@ -4153,7 +4184,7 @@ sub handler { } } elsif ($env{'form.command'} eq 'editdocs') { $env{'form.folderpath'} = 'default&'. - &escape(&mt('Main '.$crstype.' Content').':::::'); + &escape(&mt('Main Content').':::::'); &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => $env{'form.command'}}); } elsif ($env{'form.command'} eq 'editsupp') { $env{'form.folderpath'} = 'supplemental&'. @@ -4198,7 +4229,7 @@ sub handler { if ($supplementalflag) { $env{'form.folderpath'}=&supplemental_base(); } else { - $env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Content'). + $env{'form.folderpath'}='default&'.&escape(&mt('Main Content'). ':::::'); } } @@ -4224,7 +4255,7 @@ sub handler { if ($env{'form.folder'} eq '' || $env{'form.folder'} eq 'supplemental') { $folderpath='default&'. - &escape(&mt('Main '.$crstype.' Content').':::::'); + &escape(&mt('Main Content').':::::'); } } $containertag = ''; @@ -4549,7 +4580,7 @@ HIDDENFORM if ($folder eq '' || $supplementalflag) { $folder='default'; $savefolderpath = $env{'form.folderpath'}; - $env{'form.folderpath'}='default&'.&escape(&mt('Content')); + $env{'form.folderpath'}='default&'.&escape(&mt('Main Content')); $pathitem = ''; } @@ -5202,7 +5233,7 @@ sub generate_edit_table { $form = '
    '. '