--- loncom/interface/londocs.pm 2013/04/03 02:41:22 1.484.2.30 +++ loncom/interface/londocs.pm 2013/05/21 13:01:36 1.548 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.30 2013/04/03 02:41:22 raeburn Exp $ +# $Id: londocs.pm,v 1.548 2013/05/21 13:01:36 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 @@ -352,7 +350,7 @@ $initialtext END $env{'form.output'}=$newhtml; - my $result = + my $result = &Apache::lonnet::finishuserfileupload($coursenum,$coursedom, 'output', "$filepath/$residx/$fname.html"); @@ -377,7 +375,7 @@ END removefrommap => \%removefrommap, removeparam => \%removeparam, ); - my ($result,$msgsarray,$lockerror) = + my ($result,$msgsarray,$lockerror) = &apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated); if (keys(%import_errors) > 0) { $fixuperrors = @@ -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 = ''; @@ -1309,7 +1307,7 @@ sub do_paste_from_buffer { next; } if ($lockerr{$prefix}) { - $lockerrs{$suffix} = $lockerr{$prefix}; + $lockerrs{$suffix} = $lockerr{$prefix}; } } } @@ -1348,7 +1346,7 @@ sub do_paste_from_buffer { if ($newdocsdir eq '') { $newdocsdir = 'default'; } - if (($prefixchg{$suffix}) || + if (($prefixchg{$suffix}) || ($srcdom{$suffix} ne $coursedom) || ($srcnum{$suffix} ne $coursenum) || ($env{'form.docs.markedcopy_options_'.$suffix} ne 'move')) { @@ -1555,7 +1553,7 @@ sub dbcopy { if (ref($dbref) eq 'HASH') { if ($url =~ m{/(smppg|bulletinboard)$}) { my $prefix = $1; - if (($dbref->{'cdom'} =~ /^$match_domain$/) && + if (($dbref->{'cdom'} =~ /^$match_domain$/) && ($dbref->{'cnum'} =~ /^$match_courseid$/)) { my $db_name; my $marker = (split(m{/},$url))[4]; @@ -1590,12 +1588,12 @@ sub dbcopy { my $photo = $contents{'uploaded.photourl'}; my ($subdir,$fname) = ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$}); - my $newphoto; + my $newphoto; if ($fname ne '') { my $content = &Apache::lonnet::getfile($photo); unless ($content eq '-1') { $env{'form.'.$suffix.'.photourl'} = $content; - $newphoto = + $newphoto = &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,$suffix.'.photourl',"$subdir/$suffix/$fname"); delete($env{'form.'.$suffix.'.photourl'}); } @@ -1612,11 +1610,11 @@ sub dbcopy { } } if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) { - $lockerrorsref->{$prefix} = + $lockerrorsref->{$prefix} = '
'. &mt('There was a problem removing a lockfile.'); if ($prefix eq 'smppg') { - $lockerrorsref->{$prefix} .= + $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional simple pages in this course.'); } else { $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional bulletin boards in this course.'); @@ -1738,7 +1736,7 @@ sub url_paste_fixups { } next if ($token->[2]->{'type'} eq 'external'); if ($token->[2]->{'type'} eq 'zombie') { - next if ($skip); + next if ($skip); $zombies->{$oldurl}{$id} = $ressrc; $changed = 1; } elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) { @@ -2184,7 +2182,7 @@ sub update_parameter { 'randomorder' => {}, ); foreach my $which (keys(%allchecked)) { - $env{'form.all'.$which} =~ s/,$//; + $env{'form.all'.$which} =~ s/,$//; if ($which eq 'randompick') { foreach my $item (split(/,/,$env{'form.all'.$which})) { my ($res,$value) = split(/:/,$item); @@ -2211,7 +2209,7 @@ sub update_parameter { foreach my $which (keys(%allchecked)) { if (($which eq 'randompick' || $which eq 'randomorder')) { next if (!$is_map); - } + } my $oldvalue = 0; my $newvalue = 0; if ($allchecked{$which}{$res}) { @@ -2332,7 +2330,7 @@ sub editor { my $jumpto; unless ($supplementalflag) { - $jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'"; + $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container"; } unless ($allowed) { @@ -2630,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 = '' @@ -2640,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') @@ -2667,11 +2668,11 @@ sub editor { if (@allidx > 0) { my $path; if ($env{'form.folderpath'}) { - $path = + $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"'); } if (@allidx > 1) { - $to_show .= + $to_show .= &Apache::loncommon::continue_data_table_row(). '
 '. @@ -3265,7 +3266,7 @@ $form_common."\n". $form_param."\n". $form_common."\n". ''. -$form_end; +$form_end; } } elsif ($supplementalflag && !$allowed) { $url .= ($url =~ /\?/) ? '&':'?'; @@ -3469,7 +3470,7 @@ sub new_timebased_suffix { } } if ($freedlock ne 'ok') { - $locknotfreed = + $locknotfreed = '
'. &mt('There was a problem removing a lockfile.').' '; if ($type eq 'paste') { @@ -4028,6 +4029,7 @@ sub startContentScreen { if (($mode eq 'navmaps') || ($mode eq 'supplemental')) { $output .= '    '.&mt('Content Overview').'    '."\n"; $output .= '     '.&mt('Content Search').'     '."\n"; + $output .= '      '.&mt('Content Index').'      '."\n"; $output .= '
  • '.&mt('Supplemental Content').'
  • '; } else { $output .= '
  •       '.&mt('Content Editor').'      
  • '."\n"; @@ -4051,7 +4053,7 @@ sub endContentScreen { } sub supplemental_base { - return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content')); + return 'supplemental&'.&escape(&mt('Supplemental Content')); } sub handler { @@ -4184,7 +4186,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&'. @@ -4229,7 +4231,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'). ':::::'); } } @@ -4255,7 +4257,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 = ''; @@ -4423,7 +4425,7 @@ sub handler { 'navc' => 'Table of Contents', 'sipa' => 'Simple Course Page', 'sipr' => 'Simple Problem', - 'webp' => 'Blank Web Page (editable)', + 'webp' => 'Blank Web Page (editable)', 'drbx' => 'Drop Box', 'scuf' => 'External Scores (handgrade, upload, clicker)', 'bull' => 'Discussion Board', @@ -4580,7 +4582,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 = ''; } @@ -5233,7 +5235,7 @@ sub generate_edit_table { $form = '
    '. '