'.&mt('Resources').' | '. + "$lt{'mr'} | ". + "$lt{'ve'} | ". + "$lt{'vu'} | ". + ''.&mt('History').' | '. + ''); foreach my $key (sort(keys(%changes))) { if ($changes{$key}>$starttime) { my ($root,$extension)=($key=~/^(.*)\.(\w+)$/); my $currentversion=&Apache::lonnet::getversion($key); if ($currentversion<0) { - $currentversion=&mt('Could not be determined.'); + $currentversion=''.&mt('Could not be determined.').''; } my $linkurl=&Apache::lonnet::clutter($key); - $r->print( - '||||
---|---|---|---|---|---|---|---|---|
'. - &Apache::lonnet::gettitle($linkurl). - ' | ||||||||
'. - ' | '. - ''.$linkurl. - ' | |||||||
'. - ' | '. - &Apache::lonlocal::locallocaltime( - &Apache::lonnet::metadata($root.'.'.$extension, - 'lastrevisiondate') - ). - ' | '. - 'Most Recent: '. - ''.$currentversion.''. - ' | '. - 'In '.$crstype.': '. - ''); + $r->print( + &Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row(). + ' | '.&Apache::lonnet::gettitle($linkurl).' '. + ''.$linkurl.' | '.
+ ''.$currentversion.' ('. + &Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).') | '.
+ ''); # Used in course my $usedversion=$hash{'version_'.$linkurl}; if (($usedversion) && ($usedversion ne 'mostrecent')) { - $r->print($usedversion); + if($usedversion != $currentversion){ + $r->print(''.$usedversion.''); + }else{ + $r->print($usedversion); + } } else { $r->print($currentversion); } - $r->print(' | '. - 'Use: '); + $r->print(' | '); # Set version $r->print(&Apache::loncommon::select_form($setversions{$linkurl}, 'set_version_'.$linkurl, @@ -1843,7 +1901,6 @@ ENDHEADERS '' => '', 'mostrecent' => &mt('most recent'), map {$_,$_} (1..$currentversion)})); - $r->print(' |
'); my $lastold=1; for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) { my $url=$root.'.'.$prevvers.'.'.$extension; @@ -1857,13 +1914,13 @@ ENDHEADERS # each of the four columns my $entries_per_col = 0; my $num_entries = ($currentversion-$lastold); - if ($num_entries % 4 == 0) { - $entries_per_col = $num_entries/4; + if ($num_entries % $num_ver_col == 0) { + $entries_per_col = $num_entries/$num_ver_col; } else { - $entries_per_col = $num_entries/4 + 1; + $entries_per_col = $num_entries/$num_ver_col + 1; } my $entries_count = 0; - $r->print(' | '); + $r->print(' | ');
my $cols_output = 1;
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -1882,21 +1939,21 @@ ENDHEADERS
}
$r->print(' '); if (++$entries_count % $entries_per_col == 0) { - $r->print(' | ');
- if ($cols_output != 4) {
- $r->print(''); + $r->print(' | '); + if ($cols_output != $num_ver_col) { + $r->print(''); $cols_output++; } } } - while($cols_output++ < 4) { - $r->print(' | ') + while($cols_output++ < $num_ver_col) { + $r->print(' | '); } - $r->print(' |
'.&mt('Done').'
'); + $r->print(''.&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(). + ''); &untiehash(); } @@ -2375,10 +2432,11 @@ sub handler { my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my ($destination,$dir_root) = &embedded_destination(); - $r->print(&Apache::loncommon::modify_html_refs('coursedoc',$destination, - $docuname,$docudom,undef, - $dir_root). - &return_to_editor()); + my $result = + &Apache::loncommon::modify_html_refs('coursedoc',$destination, + $docuname,$docudom,undef, + $dir_root); + $r->print($result.&return_to_editor()); } elsif ($env{'form.phase'} eq 'decompress_uploaded') { $uploadphase = 'decompress_phase_one'; $r->print(&decompression_phase_one(). @@ -2963,18 +3021,20 @@ sub decompression_info { my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'}; my $container='sequence'; - my $hiddenelem; + my ($pathitem,$hiddenelem); + my @hiddens = ('newidx','comment','position'); if ($env{'form.pagepath'}) { $container='page'; - $hiddenelem = ''."\n"; + $pathitem = 'pagepath'; } else { - $hiddenelem = ''."\n"; - } - if ($env{'form.newidx'}) { - $hiddenelem .= ''."\n"; + $pathitem = 'folderpath'; } - if ($env{'form.comment'}) { - $hiddenelem .= ''."\n"; + unshift(@hiddens,$pathitem); + foreach my $item (@hiddens) { + if ($env{'form.'.$item}) { + $hiddenelem .= ''."\n"; + } } return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container, $hiddenelem); @@ -2988,44 +3048,12 @@ sub decompression_phase_one { $error = &mt('Archive file "[_1]" not in the expected location.',$env{'form.archiveurl'}); } else { my $file = $1; - $output = &Apache::loncommon::process_decompression($docudom,$docuname,$file,$destination,$dir_root,$hiddenelem); - if ($env{'form.archivedelete'}) { - my $map = $env{'form.folder'}.'.'.$container; - my ($delwarning,$delresult); - my ($errtext,$fatal) = &mapread($docuname,$docudom,$map); - if ($fatal) { - if ($container eq 'page') { - $delwarning = &mt('An error occurred retrieving the contents of the current page.'); - } else { - $delwarning = &mt('An error occurred retrieving the contents of the current folder.'); - } - $delwarning .= &mt('As a result the archive file has not been removed.'); - } else { - my $currcmd = $env{'form.cmd'}; - $env{'form.cmd'} = 'del_'.$env{'form.position'}; - if (&handle_edit_cmd($docuname,$docudom)) { - ($errtext,$fatal) = &storemap($docuname,$docudom,$map); - if ($fatal) { - if ($container eq 'page') { - $delwarning = &mt('An error occurred updating the contents of the current page.'); - } else { - $delwarning = &mt('An error occurred updating the contents of the current folder.'); - } - } - } - $env{'form.cmd'} = $currcmd; - $delresult = &mt('Archive file removed after extracting files.'); - } - if ($delwarning) { - $output .= ''. - $delwarning. - '
'; - } - if ($delresult) { - $output .= ''. - $delresult. - '
'; - } + $output = + &Apache::loncommon::process_decompression($docudom,$docuname,$file, + $destination,$dir_root, + $hiddenelem); + if ($env{'form.autoextract_camtasia'}) { + $output .= &remove_archive($docudom,$docuname,$container); } } if ($error) { @@ -3041,12 +3069,63 @@ sub decompression_phase_one { sub decompression_phase_two { my ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,$hiddenelem)= &decompression_info(); - my $output = + my $output; + if ($env{'form.archivedelete'}) { + $output = &remove_archive($docudom,$docuname,$container); + } + $output .= &Apache::loncommon::process_extracted_files('coursedocs',$docudom,$docuname, $destination,$dir_root,$hiddenelem); return $output; } +sub remove_archive { + my ($docudom,$docuname,$container) = @_; + my $map = $env{'form.folder'}.'.'.$container; + my ($output,$delwarning,$delresult,$url); + my ($errtext,$fatal) = &mapread($docuname,$docudom,$map); + if ($fatal) { + if ($container eq 'page') { + $delwarning = &mt('An error occurred retrieving the contents of the current page.'); + } else { + $delwarning = &mt('An error occurred retrieving the contents of the current folder.'); + } + $delwarning .= &mt('As a result the archive file has not been removed.'); + } else { + my $currcmd = $env{'form.cmd'}; + my $position = $env{'form.position'}; + if ($position > 0) { + $env{'form.cmd'} = 'del_'.$position; + my ($title,$url,@rrest) = + split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]); + if (&handle_edit_cmd($docuname,$docudom)) { + ($errtext,$fatal) = &storemap($docuname,$docudom,$map); + if ($fatal) { + if ($container eq 'page') { + $delwarning = &mt('An error occurred updating the contents of the current page.'); + } else { + $delwarning = &mt('An error occurred updating the contents of the current folder.'); + } + } else { + $delresult = &mt('Archive file removed.'); + } + } + } + $env{'form.cmd'} = $currcmd; + } + if ($delwarning) { + $output = ''. + $delwarning. + '
'; + } + if ($delresult) { + $output .= ''. + $delresult. + '
'; + } + return $output; +} + sub generate_admin_options { my ($help_ref,$env_ref) = @_; my %lt=&Apache::lonlocal::texthash( @@ -3093,7 +3172,7 @@ sub generate_edit_table { $activetab = $env{'form.active'}; } my $backicon = $iconpath.'clickhere.gif'; - my $backtext = &mt('Back to Overview'); + my $backtext = &mt('To Overview'); $form = '