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

version 1.42.2.1, 2011/11/07 13:38:45 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 292  sub handler { Line 292  sub handler {
   
   my $r=shift;    my $r=shift;
   
   my ($fn,$trailfile);    my $fn;
   
   
 # Get query string for limited number of parameters  # Get query string for limited number of parameters
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}{};
   $trailfile = "/home/$uname/public_html".$fn;  
   
   &Apache::loncommon::content_type($r,'text/html');    &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;    $r->send_http_header;
Line 349  sub handler { Line 347  sub handler {
   $r->print(&Apache::loncommon::start_page('Retrieve Published Resources')    $r->print(&Apache::loncommon::start_page('Retrieve Published Resources')
            .&Apache::lonhtmlcommon::breadcrumbs()             .&Apache::lonhtmlcommon::breadcrumbs()
            .&Apache::loncommon::head_subbox(             .&Apache::loncommon::head_subbox(
                 &Apache::loncommon::CSTR_pageheader($trailfile))                  &Apache::loncommon::CSTR_pageheader()) # FIXME crumbs broken?
     );      );
   
   $r->print('<p>'    $r->print('<p>'

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


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