Diff for /loncom/publisher/lonretrieve.pm between versions 1.41 and 1.45

version 1.41, 2009/08/11 15:15:01 version 1.45, 2011/10/31 01:30:38
Line 121  sub phaseone { Line 121  sub phaseone {
           
     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="/priv/'.$udom.'/'.$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().
   &Apache::loncommon::start_data_table_header_row().    &Apache::loncommon::start_data_table_header_row().
Line 162  sub phaseone { Line 162  sub phaseone {
  if ($is_meta   if ($is_meta
     || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') {      || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') {
     $r->print(      $r->print(
       '<td><a target="cat" href="/adm/diff?filename=/~'.        '<td><a target="cat" href="/adm/diff?filename=/priv/'.
       $uname.$fn.        $udom,'/'.$uname.$fn.
       '&amp;versiontwo=priv&amp;versionone='.$version.        '&amp;versiontwo=priv&amp;versionone='.$version.
       '">'.&mt('Diffs with Version').' '.$version.        '">'.&mt('Diffs with Version').' '.$version.
       '</a></td>');        '</a></td>');
Line 185  sub phaseone { Line 185  sub phaseone {
  if ($is_meta    if ($is_meta 
     || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') {      || &Apache::loncommon::fileembstyle($suffix) eq 'ssi') {
     $r->print(      $r->print(
       '<td><a target="cat" href="/adm/diff?filename=/~'.        '<td><a target="cat" href="/adm/diff?filename=/priv/'.
       $uname.$fn.        $udom.'/'.$uname.$fn.
       '&amp;versiontwo=priv'.        '&amp;versiontwo=priv'.
       '">'.&mt('Diffs with current Version').'</a></td>');        '">'.&mt('Diffs with current Version').'</a></td>');
  }   }
Line 209  sub phaseone { Line 209  sub phaseone {
               .'/';                .'/';
     $r->print(&Apache::lonhtmlcommon::start_funclist()      $r->print(&Apache::lonhtmlcommon::start_funclist()
              .&Apache::lonhtmlcommon::add_item_funclist(               .&Apache::lonhtmlcommon::add_item_funclist(
                   '<a href="/priv/'.$uname.$fn.'">'                    '<a href="/priv/'.$udom.'/'.$uname.$fn.'">'
                  .&mt('Back to Resource')                   .&mt('Back to Resource')
                  .'</a>')                   .'</a>')
              .&Apache::lonhtmlcommon::add_item_funclist(               .&Apache::lonhtmlcommon::add_item_funclist(
Line 233  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 266  sub phasetwo { Line 266  sub phasetwo {
             print $logfile "Copy failed: $error\n\n";              print $logfile "Copy failed: $error\n\n";
         }          }
         $r->print('</p>'          $r->print('</p>'
                  .'<p><a href="/priv/'.$uname.$fn.'">'                   .'<p><a href="/priv/'.$udom.'/'.$uname.$fn.'">'
                  .&mt('Back to Resource')                   .&mt('Back to Resource')
                  .'</a></p>');                   .'</a></p>');
     } else {      } else {
Line 319  sub handler { Line 319  sub handler {
   my $uname;    my $uname;
   my $udom;    my $udom;
   
   ($uname,$udom)=    ($uname,$udom) = &Apache::loncacc::constructaccess($fn);
     &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));    unless (($uname ne '') && ($udom ne '')) {
   unless (($uname) && ($udom)) {  
      $r->log_reason($uname.' at '.$udom.       $r->log_reason($uname.' at '.$udom.
          ' trying to publish file '.$env{'form.filename'}.           ' trying to publish file '.$env{'form.filename'}.
          ' ('.$fn.') - not authorized',            ' ('.$fn.') - not authorized', 
Line 329  sub handler { Line 328  sub handler {
      return HTTP_NOT_ACCEPTABLE;       return HTTP_NOT_ACCEPTABLE;
   }    }
   
   $fn=~s{/~($LONCAPA::username_re)}{};    $fn=~s{/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{};
   
   &Apache::loncommon::content_type($r,'text/html');    &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;    $r->send_http_header;
Line 357  sub handler { Line 356  sub handler {
            .'</p>');             .'</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('<p><span class="LC_warning">'            $r->print('<p><span class="LC_info">'
                    .&mt('Co-Author [_1]'                     .&mt('Co-Author [_1]'
                        ,&Apache::loncommon::plainname($uname,$udom)                         ,&Apache::loncommon::plainname($uname,$udom)
                        .' ('.$uname.':'.$udom.')')                         .' ('.$uname.':'.$udom.')')

Removed from v.1.41  
changed lines
  Added in v.1.45


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