--- loncom/interface/londocs.pm 2025/01/04 01:34:57 1.717 +++ loncom/interface/londocs.pm 2025/02/03 22:52:36 1.723 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.717 2025/01/04 01:34:57 raeburn Exp $ +# $Id: londocs.pm,v 1.723 2025/02/03 22:52:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -884,7 +884,7 @@ ENDJS if (keys(%tocopy)) { my (%resdirs,%resfiles); &Apache::lonnet::recursedirs($is_course_home,1,undef,$res_exclude,0,0,$resurl,'',\%resdirs,\%resfiles); - my ($notopdir,%newdir,%newfile,%checkdeps); + my ($notopdir,%newdir,%newfile,%checkdeps,%newresfile); $r->print('

'.&mt('Copy to: [_1]', ''.$desturl.'/'.$subdir.''). '

'."\n"); @@ -1026,7 +1026,7 @@ ENDJS } } else { if (&File::Copy::copy($src,$dest)) { - $newfile{$file} = 1; + $newfile{$file} = $desturl.'/'.$subdir.'/'.$file; if ($embstyle eq 'ssi') { &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir); } @@ -1055,6 +1055,9 @@ ENDJS my $destresfile = $docroot.$destresurl.'/'.$subdir.'/'.$file; if (-e $dest) { my $output = &Apache::lonpublisher::batchpublish($r,$dest,$destresfile,$nokeyref,1); + if (-e $destresfile) { + $newresfile{$file} = $destresurl.'/'.$subdir.'/'.$file; + } } } } else { @@ -1065,7 +1068,7 @@ ENDJS } if ($needpriv) { if (&File::Copy::copy($src,$dest)) { - $newfile{$file} = 1; + $newfile{$file} = $desturl.'/'.$subdir.'/'.$file; if ($embstyle eq 'ssi') { &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir); } @@ -1099,7 +1102,7 @@ ENDJS if ($embstyle eq 'ssi') { &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir); } - $newfile{$file} = 1; + $newfile{$file} = $desturl.'/'.$subdir.'/'.$file; } } } else { @@ -1127,7 +1130,9 @@ ENDJS my $destresfile = $docroot.$destresurl.'/'.$subdir.'/'.$file; if (-e $dest) { my $output = &Apache::lonpublisher::batchpublish($r,$dest,$destresfile,$nokeyref,1); -#FIXME publish meta file also? + if (-e $destresfile) { + $newresfile{$file} = $destresurl.'/'.$subdir.'/'.$file; + } } } } else { @@ -1141,7 +1146,7 @@ ENDJS if ($embstyle eq 'ssi') { &crsres_fixup($dest,$coursenum,$coursedom,$ca,$cd,$subdir); } - $newfile{$file} = 1; + $newfile{$file} = $desturl.'/'.$subdir.'/'.$file; } } if ($needprivmeta) { @@ -1172,6 +1177,16 @@ ENDJS $r->print('

'.&mt('Copied the following files to [_1]:',''.$desturl.'/'.$subdir.''). '

'."\n". '

'."\n"); + foreach my $file (keys(%newfile)) { + my %storehash = ( + 'priv' => $newfile{$file}, + 'who' => $env{'user.name'}.':'.$env{'user.domain'}, + ); + if (exists($newresfile{$file})) { + $storehash{'res'} = 1; + } + &Apache::lonnet::store_userdata(\%storehash,$file,'copycourseauthor',$coursedom,$coursenum); + } } if (keys(%checkdeps)) { my %missingdep; @@ -1262,7 +1277,32 @@ ENDJS &mt('Choose the files and/or folders to copy from Course Authoring to User Authoring'). '

'."\n"; my $count = 0; - my $startcount = 4 + $home; +# +# Warning to developers: +# +# If you add or remove form elements which precede the table of items to copy +# you will need to modify the value for startcount. Form elements include both: +# and
tags. +# $startcount (set to 9) contains the following: +# fieldsets with following legends: (a) Folder in Authoring Space, (b) Distribution to set in metadata +# (c) Content to copy +# inputs: textbox for destination folder; dropdown lists: (a) Copyright, (b) Source +# hidden: customrights file; buttons: (a) check all, (b) uncheck all. +# authorspace: if more than 1: a fieldset with legend: Select the Authoring Space, +# or if 1: an input (hidden) with available author/coauthor role. +# if there are multiple possible author/coauthor roles (i.e., $home > 1), +# incerement startcount by 1 for the dropdown list uses to select the target. +# +# If there are published files, increment startcount by 3: +# fieldset (legend: Published Resources), and two radio buttons (Yes/No). +# + my $startcount = 9; + if ($home > 1) { + $startcount ++; + } + if ($numpub) { + $startcount += 3; + } my $lastcontainer = $startcount; $display .= &Apache::loncommon::start_data_table()."\n". &Apache::loncommon::start_data_table_header_row(). @@ -2486,6 +2526,15 @@ sub print_paste_buffer { &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}); } else { my $icon = &Apache::loncommon::icon($extension); + my $icontext; + if ($extension eq 'sequence') { + $icontext = &mt('folder icon'); + } elsif ($extension eq 'page') { + $icontext = &mt('composite page icon'); + } else { + $icontext = &mt('file icon'); + } + $icontext = &HTML::Entities::encode($icontext); if ($extension eq 'sequence' && $url =~ m{/default_\d+\.sequence$}x) { $icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); @@ -2495,7 +2544,7 @@ sub print_paste_buffer { if ($title eq '') { ($title) = ($url =~ m{/([^/]+)$}); } - $buffer = ''. + $buffer = ''.$icontext.''. ': '. &Apache::loncommon::parse_supplemental_title( &LONCAPA::map::qtescape($title)); @@ -4931,16 +4980,18 @@ sub editor { if (!$allowed) { $helpitem = 'Supplemental_Navigation'; } - $toolslink = '' - .'
' + $toolslink = '
' + .'
' .&Apache::loncommon::help_open_menu('Navigation Screen', $helpitem,undef,'RAT') - .'
'.&mt('Tools:').'
    ' + .'
    '.&mt('Tools:').'
    ' + .'
    '."\n".'

'; + .''."\n" + .'

'."\n"; } if ($shown) { if ($allowed) { @@ -5443,7 +5494,7 @@ ENDCOPY $copylink=(< $form_common -$lt{'cp'} + $form_end ENDCOPY if (($ishash) && (ref($filtersref->{'cancopy'}) eq 'ARRAY')) { @@ -5461,7 +5512,7 @@ ENDCUT
$form_common -$lt{'ct'} + $form_end ENDCUT if (($ishash) && (ref($filtersref->{'cancut'}) eq 'ARRAY')) { @@ -5480,7 +5531,7 @@ ENDREM $form_common -$lt{'rm'} + $form_end ENDREM if (($ishash) && (ref($filtersref->{'canremove'}) eq 'ARRAY')) { @@ -5525,8 +5576,17 @@ $copylink END } + my $icontext; # Figure out what kind of a resource this is my ($extension)=($url=~/\.(\w+)$/); + if ($extension eq 'sequence') { + $icontext = &mt('folder icon'); + } elsif ($extension eq 'page') { + $icontext = &mt('composite page icon'); + } else { + $icontext = &mt('file icon'); + } + $icontext = &HTML::Entities::encode($icontext); my $uploaded=($url=~/^\/*uploaded\//); my $icon=&Apache::loncommon::icon($url); my $isfolder; @@ -5868,9 +5928,9 @@ $form_end; } } if ($nolink) { - $line .= ''; + $line .= ''.$icontext.''; } else { - $line.=''; + $line.=''.$icontext.''; } } elsif ($url) { if ($anchor ne '') { @@ -5900,16 +5960,16 @@ $form_end; } } if ($nolink) { - $line.=''; + $line.=''.$icontext.''; } elsif ($nomodal) { $line.=''. - ''; + ''.$icontext.''; } else { $line.=&Apache::loncommon::modal_link($link, - '',600,500); + ''.$icontext.'',600,500); } } else { - $line.=''; + $line.=''.$icontext.''; } $line.=''; if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) { @@ -7551,10 +7611,6 @@ sub handler { my $quotainfo = '

'.&mt('Currently using [_1] of the [_2] available.', $percent.'%',$quota.' MB').'

'; - my $fileupload=(< -FIUP my $checkbox=(<$lt{'parse'}? @@ -7573,8 +7629,9 @@ CHBO