--- loncom/publisher/lonretrieve.pm 2011/11/14 00:20:31 1.47 +++ loncom/publisher/lonretrieve.pm 2023/07/23 12:24:16 1.53 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to retrieve an old version of a file # -# $Id: lonretrieve.pm,v 1.47 2011/11/14 00:20:31 raeburn Exp $ +# $Id: lonretrieve.pm,v 1.53 2023/07/23 12:24:16 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -99,7 +99,6 @@ use strict; use Apache::File; use File::Copy; use Apache::Constants qw(:common :http :methods); -use Apache::loncacc; use Apache::loncommon(); use Apache::lonlocal; use Apache::lonnet; @@ -118,7 +117,7 @@ sub phaseone { my ($main,$suffix,$is_meta) = &get_file_info($fn); if (-e $resfn) { - $r->print('
'. + $r->print(''. ''. ''. &Apache::loncommon::start_data_table(). @@ -154,17 +153,18 @@ sub phaseone { ''.&Apache::lonlocal::locallocaltime($rmtime).''); if (!$is_meta) { - $r->print(''. - &mt('Metadata Version').' '.$version.''); + $r->print(''. + &Apache::loncommon::modal_link($urldir.$filename.'.meta', + &mt('Metadata Version [_1]',$version),550,450).''); } if ($is_meta || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { - $r->print( - ''.&mt('Diffs with Version').' '.$version. - ''); + $r->print(''. + &Apache::loncommon::modal_link( + '/adm/diff?filename=/priv/'.$udom.'/'.$uname.$fn. + '&versiontwo=priv&versionone='.$version, + &mt('Diffs with Version [_1]',$version),550,450). + ''); } $r->print(&Apache::loncommon::end_data_table_row()); } @@ -177,21 +177,24 @@ sub phaseone { ''.&Apache::lonlocal::locallocaltime($rmtime).'' ); if (!$is_meta) { - $r->print(''. - &mt('Metadata current version').''); + $r->print('', + &Apache::loncommon::modal_link($urldir.$main.'.'.$suffix.'.meta', + &mt('Metadata current version'),550,450).''); } if ($is_meta || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') { - $r->print( - ''.&mt('Diffs with current Version').''); + '&versiontwo=priv', + &mt('Diffs with current Version'),550,450). + ''); } $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.').'

'); + &mt('Retrieval of an old version will overwrite the file currently in Authoring Space.').'

'); if (!$is_meta) { $r->print('

'.''. &mt('This will only retrieve the resource. If you want to retrieve the metadata, you will need to do that separately.'). @@ -202,23 +205,6 @@ sub phaseone { $r->print('

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

'); } - my $dir = &Apache::loncommon::authorspace($fn) - .&File::Basename::dirname($fn) - .'/'; - $r->print('
' - .&Apache::loncommon::head_subbox( - &Apache::lonhtmlcommon::start_funclist() - .&Apache::lonhtmlcommon::add_item_funclist( - '' - .&mt('Back to Resource') - .'') - .&Apache::lonhtmlcommon::add_item_funclist( - '' - .&mt('Back to Directory') - .'') - .&Apache::lonhtmlcommon::end_funclist() - ) - ); } # ---------------------------------- Interface for presenting specified version @@ -259,6 +245,7 @@ sub phasetwo { .&mt('ok') .''); print $logfile "Copied sucessfully.\n\n"; + $r->print(&Apache::lonhtmlcommon::scripttag('parent.location.reload();')); } else { my $error=$!; $r->print('' @@ -266,10 +253,6 @@ sub phasetwo { .''); print $logfile "Copy failed: $error\n\n"; } - $r->print('

' - .'

' - .&mt('Back to Resource') - .'

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

'.&mt('Please pick a version to retrieve:').'

'); &phaseone($r,$fn,$uname,$udom); @@ -319,8 +302,9 @@ sub handler { # ----------------------------------------------------------- Start page output my $uname; my $udom; + my $crsauthor; - ($uname,$udom) = &Apache::loncacc::constructaccess($fn); + ($uname,$udom) = &Apache::lonnet::constructaccess($fn); unless (($uname ne '') && ($udom ne '')) { $r->log_reason($uname.' at '.$udom. ' trying to publish file '.$env{'form.filename'}. @@ -333,10 +317,20 @@ sub handler { $r->send_http_header; # Breadcrumbs + my $text = 'Authoring Space'; + my $href = &Apache::loncommon::authorspace($fn); + if ($env{'request.course.id'}) { + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + if ($href eq "/priv/$cdom/$cnum/") { + $text = 'Course Authoring Space'; + $crsauthor = 1; + } + } &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({ - 'text' => 'Construction Space', - 'href' => &Apache::loncommon::authorspace($fn), + 'text' => $text, + 'href' => $href, }); &Apache::lonhtmlcommon::add_breadcrumb({ 'text' => 'Retrieve previous version', @@ -359,13 +353,15 @@ sub handler { .&mt('Retrieve previous versions of [_1]' ,''.$fn.'') .'

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

' .&mt('Co-Author [_1]' ,&Apache::loncommon::plainname($uname,$udom) .' ('.$uname.':'.$udom.')') .'

'); + } }