Diff for /loncom/publisher/lonretrieve.pm between versions 1.36 and 1.43

version 1.36, 2008/11/20 18:03:55 version 1.43, 2011/10/23 01:27:34
Line 120  sub phaseone { Line 120  sub phaseone {
     my ($main,$suffix,$is_meta) = &get_file_info($fn);      my ($main,$suffix,$is_meta) = &get_file_info($fn);
           
     if (-e $resfn) {        if (-e $resfn) {  
  $r->print('<form action="/adm/retrieve" method="POST">'.   $r->print('<form action="/adm/retrieve" method="post">'.
   '<input type="hidden" name="filename" value="/~'.$uname.$fn.'" />'.    '<input type="hidden" name="filename" value="/~'.$uname.$fn.'" />'.
   '<input type="hidden" name="phase" value="two" />'.    '<input type="hidden" name="phase" value="two" />'.
   &Apache::loncommon::start_data_table().    &Apache::loncommon::start_data_table().
Line 152  sub phaseone { Line 152  sub phaseone {
  my $rmtime=&Apache::lonnet::metadata($resdir.'/'.$filename,'lastrevisiondate');   my $rmtime=&Apache::lonnet::metadata($resdir.'/'.$filename,'lastrevisiondate');
  $r->print(&Apache::loncommon::start_data_table_row().   $r->print(&Apache::loncommon::start_data_table_row().
   '<td><input type="radio" name="version" value="'.    '<td><input type="radio" name="version" value="'.
   $version.'" /></td><td>'.&mt('Previously published version').' '.$version.'</td><td>'.    $version.'" /></td><td>'.&mt('Previously published version').' '.$version.'</td>'.
   localtime($rmtime).'</td>');                '<td>'.&Apache::lonlocal::locallocaltime($rmtime).'</td>');
   
  if (!$is_meta) {   if (!$is_meta) {
     $r->print('<td><a href="'.$urldir.$filename.'.meta" target=cat>'.      $r->print('<td><a href="'.$urldir.$filename.'.meta" target="cat">'.
       &mt('Metadata Version').' '.$version.'</a></td>');        &mt('Metadata Version').' '.$version.'</a></td>');
  }   }
  if ($is_meta   if ($is_meta
Line 175  sub phaseone { Line 175  sub phaseone {
  my $rmtime=&Apache::lonnet::metadata($resfn,'lastrevisiondate');   my $rmtime=&Apache::lonnet::metadata($resfn,'lastrevisiondate');
  $r->print(&Apache::loncommon::start_data_table_row().   $r->print(&Apache::loncommon::start_data_table_row().
   '<td><input type="radio" name="version" value="new" /></td>'.    '<td><input type="radio" name="version" value="new" /></td>'.
   '<td><b>'.&mt('Currently published version').'</b></td><td>'.localtime($rmtime).    '<td><b>'.&mt('Currently published version').'</b></td>'.
   '</td>');            '<td>'.&Apache::lonlocal::locallocaltime($rmtime).'</td>'
       );
  if (!$is_meta) {   if (!$is_meta) {
     $r->print('<td><a href="'.$urldir.$main.'.'.$suffix.'.meta" target=cat>'.      $r->print('<td><a href="'.$urldir.$main.'.'.$suffix.'.meta" target="cat">'.
       &mt('Metadata current version').'</a></td>');                   &mt('Metadata current version').'</a></td>');           
  }   }
  if ($is_meta    if ($is_meta 
Line 198  sub phaseone { Line 199  sub phaseone {
       &mt('This will only retrieve the resource. If you want to retrieve the metadata, you will need to do that separately.').        &mt('This will only retrieve the resource. If you want to retrieve the metadata, you will need to do that separately.').
       '</span></p>');        '</span></p>');
  }   }
  $r->print('<input type="submit" value="'.&mt('Retrieve version').'" /></form>');   $r->print('<input type="submit" value="'.&mt('Retrieve selected Version').'" /></form>');
     } else {      } else {
  $r->print('<p class="LC_warning">'.&mt('No previous versions published.').'</p>');   $r->print('<p class="LC_warning">'.&mt('No previous versions published.').'</p>');
     }      }
     $r->print('<p><a href="/priv/'.$uname.$fn.'">'  
              .&mt('Back to [_1]','<span class="LC_filename">'.$fn.'</span>')      my $dir =  &Apache::loncommon::authorspace()
              .'</a></p>');                 .&File::Basename::dirname($fn)
                 .'/';
       $r->print(&Apache::lonhtmlcommon::start_funclist()
                .&Apache::lonhtmlcommon::add_item_funclist(
                     '<a href="/priv/'.$uname.$fn.'">'
                    .&mt('Back to Resource')
                    .'</a>')
                .&Apache::lonhtmlcommon::add_item_funclist(
                     '<a href="'.$dir.'">'
                    .&mt('Back to Directory')
                    .'</a>')
                .&Apache::lonhtmlcommon::end_funclist()
       );
 }  }
   
 # ---------------------------------- Interface for presenting specified version  # ---------------------------------- Interface for presenting specified version
Line 220  sub phasetwo { Line 233  sub phasetwo {
  my ($main,$suffix,$is_meta) = &get_file_info($fn);   my ($main,$suffix,$is_meta) = &get_file_info($fn);
   
         my $logfile;          my $logfile;
         my $ctarget='/home/'.$uname.'/public_html'.$fn;          my $ctarget=$r->dir_config('lonDocRoot').'/priv/'.$udom.'/'.$uname.$fn;
         my $vfn=$fn;          my $vfn=$fn;
         if ($version ne 'new') {          if ($version ne 'new') {
     $vfn=~s/\.(\Q$suffix\E)$/\.$version\.$1/;      $vfn=~s/\.(\Q$suffix\E)$/\.$version\.$1/;
Line 254  sub phasetwo { Line 267  sub phasetwo {
         }          }
         $r->print('</p>'          $r->print('</p>'
                  .'<p><a href="/priv/'.$uname.$fn.'">'                   .'<p><a href="/priv/'.$uname.$fn.'">'
                  .&mt('Back to [_1]',$fn)                   .&mt('Back to Resource')
                  .'</a></p>');                   .'</a></p>');
     } else {      } else {
        $r->print('<p class="LC_info">'.&mt('Please pick a version to retrieve:').'</p>');         $r->print('<p class="LC_info">'.&mt('Please pick a version to retrieve:').'</p>');
Line 289  sub handler { Line 302  sub handler {
   
   if ($env{'form.filename'}) {    if ($env{'form.filename'}) {
       $fn=$env{'form.filename'};        $fn=$env{'form.filename'};
       $fn=~s/^http\:\/\/[^\/]+//;        $fn=~s/^https?\:\/\/[^\/]+//;
   } else {    } else {
      $r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.       $r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
          ' unspecified filename for retrieval', $r->filename);            ' unspecified filename for retrieval', $r->filename); 
Line 321  sub handler { Line 334  sub handler {
   &Apache::loncommon::content_type($r,'text/html');    &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;    $r->send_http_header;
   
   $r->print(&Apache::loncommon::start_page('Retrieve Published Resources'));      # Breadcrumbs
       &Apache::lonhtmlcommon::clear_breadcrumbs();
       &Apache::lonhtmlcommon::add_breadcrumb({
           'text'  => 'Construction Space',
           'href'  => &Apache::loncommon::authorspace(),
       });
       &Apache::lonhtmlcommon::add_breadcrumb({
           'text'  => 'Retrieve previous version',
           'href'  => '',
       });
   
     $r->print(&Apache::loncommon::start_page('Retrieve Published Resources')
              .&Apache::lonhtmlcommon::breadcrumbs()
              .&Apache::loncommon::head_subbox(
                   &Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken?
       );
   
       $r->print('<p>'
   $r->print('<h1>'  
            .&mt('Retrieve previous versions of [_1]'             .&mt('Retrieve previous versions of [_1]'
                    ,'<span class="LC_filename">'.$fn.'</span>')                     ,'<span class="LC_filename">'.$fn.'</span>')
            .'</h1>');             .'</p>');
       
   if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {    if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
           $r->print('<h3><span class="LC_diff_coauthor">'.&mt('Co-Author').': '.$uname.            $r->print('<p><span class="LC_info">'
     &mt(' at ').$udom.                     .&mt('Co-Author [_1]'
                '</span></h3>');                         ,&Apache::loncommon::plainname($uname,$udom)
                          .' ('.$uname.':'.$udom.')')
                      .'</span></p>');
   }    }
   
   

Removed from v.1.36  
changed lines
  Added in v.1.43


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>