--- loncom/publisher/lonretrieve.pm 2006/09/13 21:43:26 1.31 +++ loncom/publisher/lonretrieve.pm 2006/09/19 21:47:29 1.32 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to retrieve an old version of a file # -# $Id: lonretrieve.pm,v 1.31 2006/09/13 21:43:26 albertel Exp $ +# $Id: lonretrieve.pm,v 1.32 2006/09/19 21:47:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -54,78 +54,84 @@ sub phaseone { my ($main,$suffix,$is_meta) = &get_file_info($fn); if (-e $resfn) { - $r->print('
'. - ''. - ''. - ''. - ''); - if (!$is_meta) { - $r->print(''); - } - if ($is_meta - || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { - $r->print(''); - } - $r->print(''); - - opendir(DIR,$resdir); - my @files = grep(/^\Q$main\E\.(\d+)\.\Q$suffix\E$/,readdir(DIR)); - @files = sort { - my ($aver) = ($a=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/); - my ($bver) = ($b=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/); - return $aver <=> $bver; - } (@files); - closedir(DIR); - - foreach my $filename (@files) { - if ($filename=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/) { - my $version=$1; - my $rmtime=&Apache::lonnet::metadata($resdir.'/'.$filename,'lastrevisiondate'); - $r->print(''); - - if (!$is_meta) { - $r->print(''); - } - if ($is_meta - || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { - $r->print( - ''); - } - $r->print(''); - } - } - closedir(DIR); - my $rmtime=&Apache::lonnet::metadata($resfn,'lastrevisiondate'); - $r->print(''. - ''); - if (!$is_meta) { - $r->print(''); + $r->print(''. + ''. + ''. + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row(). + ''. + ''. + ''); + if (!$is_meta) { + $r->print(''); + } + if ($is_meta + || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { + $r->print(''); + } + $r->print(&Apache::loncommon::end_data_table_header_row()); + + opendir(DIR,$resdir); + my @files = grep(/^\Q$main\E\.(\d+)\.\Q$suffix\E$/,readdir(DIR)); + @files = sort { + my ($aver) = ($a=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/); + my ($bver) = ($b=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/); + return $aver <=> $bver; + } (@files); + closedir(DIR); + + foreach my $filename (@files) { + if ($filename=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/) { + my $version=$1; + my $rmtime=&Apache::lonnet::metadata($resdir.'/'.$filename,'lastrevisiondate'); + $r->print(&Apache::loncommon::start_data_table_row(). + ''); + + if (!$is_meta) { + $r->print(''); + } + if ($is_meta + || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { + $r->print( + ''); + } + $r->print(&Apache::loncommon::end_data_table_row()); + } + } + closedir(DIR); + my $rmtime=&Apache::lonnet::metadata($resfn,'lastrevisiondate'); + $r->print(&Apache::loncommon::start_data_table_row(). + ''. + ''); + if (!$is_meta) { + $r->print(''); + } + if ($is_meta + || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { + $r->print( + ''); + } + $r->print(&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(). + '

'. + ''. + &mt('Retrieval of an old version will overwrite the file currently in construction space').'

'. + ''); + } else { + $r->print('

'.&mt('No previous versions published.').'

'); } - if ($is_meta - || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { - $r->print( - ''); - } - $r->print('
'.&mt('Select').''. - &mt('Version').''.&mt('Published on ...').''.&mt('Metadata').''.&mt('Diffs').'
'.&mt('Previously published version').' '.$version.''. - localtime($rmtime).''. - &mt('Metadata Version').' '.$version.''.&mt('Diffs with Version').' '.$version. - '
'.&mt('Currently published version').''.localtime($rmtime). - ''. - &mt('Metadata current version').''.&mt('Select').''.&mt('Version').''.&mt('Published on ...').''.&mt('Metadata').''.&mt('Diffs').''.&mt('Previously published version').' '.$version.''. + localtime($rmtime).''. + &mt('Metadata Version').' '.$version.''.&mt('Diffs with Version').' '.$version. + ''.&mt('Currently published version').''.localtime($rmtime). + ''. + &mt('Metadata current version').''.&mt('Diffs with current Version').''.&mt('Diffs with current Version').'

'. - ''. -&mt('Retrieval of an old version will overwrite the file currently in construction space').'

'. - ''); -} else { - $r->print('

'.&mt('No previous versions published.').'

'); -} $r->print('

'.&mt('Back to').' '.$fn. '

'); } @@ -173,8 +179,7 @@ sub phasetwo { $r->print(''.&mt('Back to').' '.$fn.''); } else { - $r->print( - ''.&mt('Please pick a version to retrieve').'

'); + $r->print(''.&mt('Please pick a version to retrieve').'

'); &phaseone($r,$fn,$uname,$udom); } } @@ -244,9 +249,9 @@ sub handler { $r->print('

'.&mt('Retrieve previous versions of').' '.$fn.'

'); if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { - $r->print('

'.&mt('Co-Author').': '.$uname. + $r->print('

'.&mt('Co-Author').': '.$uname. &mt(' at ').$udom. - '

'); + '

'); }