Diff for /loncom/interface/lonaboutme.pm between versions 1.64 and 1.70.2.1

version 1.64, 2007/07/20 00:15:06 version 1.70.2.1, 2008/12/11 16:46:50
Line 60  sub handler { Line 60  sub handler {
         $is_course = &Apache::lonnet::is_course($cdom,$cnum);          $is_course = &Apache::lonnet::is_course($cdom,$cnum);
     }      }
   
       my $candisplay = 1;
       if (!$is_course) {
           if ($action ne 'portfolio') {
               $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme');
               if ((!$candisplay) && ($env{'request.course.id'})) {
                   $candisplay = &aboutme_access($cnum,$cdom);
               }
               if (!$candisplay) {
                   if ($target eq 'tex') {
                       $r->print('\noindent{\large\textbf{'.&mt('No user home page available').'}}\\\\\\\\');
                   } else {
                       $r->print(&Apache::loncommon::start_page("Personal Information"));
                       $r->print('<h2>'.&mt('No user home page available') .'</h2>'.
                                 &mt('This is a result of one of the following:').'<ul>'.
                                 '<li>'.&mt('The administrator of this domain has disabled home page functionality for this specific user.').'</li>'.
                                 '<li>'.&mt('The domain has been configured to disable, by default, home page functionality for all users in the domain.').'</li>'.
                                 '</ul>');
                       $r->print(&Apache::loncommon::end_page());
                   }
                   return OK;
               }
           }
       }
   
 # --------------------------------------------------------- The syllabus fields  # --------------------------------------------------------- The syllabus fields
     my %syllabusfields=&Apache::lonlocal::texthash(      my %syllabusfields=&Apache::lonlocal::texthash(
        'aaa_contactinfo'   => 'Contact Information',         'aaa_contactinfo'   => 'Contact Information',
Line 69  sub handler { Line 93  sub handler {
 # ------------------------------------------------------------ Get Query String  # ------------------------------------------------------------ Get Query String
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['forceedit','forcestudent',      ['forceedit','forcestudent',
      'register']);       'register','popup']);
   
 # ----------------------------------------------- Available Portfolio file display   # ----------------------------------------------- Available Portfolio file display 
     if (($target ne 'tex') && ($action eq 'portfolio')) {      if (($target ne 'tex') && ($action eq 'portfolio')) {
         &display_portfolio_header($r,$is_course);          &display_portfolio_header($r,$is_course);
         my ($blocked,$blocktext) =           if ((!$is_course) && (!&Apache::lonnet::usertools_access($cnum,$cdom,'portfolio'))) {
            &Apache::loncommon::blocking_status('port',$cnum,$cdom);              $r->print('<h2>'.&mt('No user portfolio available') .'</h2>'.
         if (!$blocked) {                        &mt('This is a result of one of the following:').'<ul>'.
             &display_portfolio_files($r,$is_course);                        '<li>'.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').'</li>'.
                         '<li>'.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').'</li>'.
                         '</ul>');
         } else {          } else {
             $r->print($blocktext);              my ($blocked,$blocktext) = 
                   &Apache::loncommon::blocking_status('port',$cnum,$cdom);
               if (!$blocked) {
                   &display_portfolio_files($r,$is_course);
               } else {
                   $r->print($blocktext);
               }
               $r->print(&Apache::loncommon::end_page());
               return OK;
         }          }
         $r->print(&Apache::loncommon::end_page());  
         return OK;  
     }      }
   
     if ($is_course) {      if ($is_course) {
Line 114  sub handler { Line 146  sub handler {
 # --------------------------------------- There is such a user, get environment  # --------------------------------------- There is such a user, get environment
     my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);      my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
     if ($target ne 'tex') {      if ($target ne 'tex') {
    my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
           my $args = {'function' => $forcestudent,
                       'domain'   => $cdom,
                       'force_register' => $forceregister};
           if ($env{'form.popup'}) {
               $args->{'no_nav_bar'} = 1;
           }
  my $start_page =    my $start_page = 
     &Apache::loncommon::start_page("Personal Information",undef,      &Apache::loncommon::start_page("Personal Information",$rss_link,$args);
    {'function'       => $forcestudent,  
      'domain'         => $cdom,  
     'force_register' =>  
             $forceregister,});  
  $r->print($start_page);   $r->print($start_page);
  $r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');   $r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');
     } else {      } else {
Line 132  sub handler { Line 167  sub handler {
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print('<h3>'.&Apache::lonnet::domain($cdom,'description').'</h3>'.   $r->print('<h3>'.&Apache::lonnet::domain($cdom,'description').'</h3>'.
   '<p>'.&Apache::loncommon::messagewrapper('Send me a message',$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom));    '<p>'.&Apache::loncommon::messagewrapper(&mt('Send me a message'),$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom));
     } else {      } else {
  $r->print('\textbf{'.&Apache::lonnet::domain($cdom,'description').'}\\\\');   $r->print('\textbf{'.&Apache::lonnet::domain($cdom,'description').'}\\\\');
     }      }
Line 146  sub handler { Line 181  sub handler {
        if ($forcestudent or $target eq 'tex') { $allowed=0; }         if ($forcestudent or $target eq 'tex') { $allowed=0; }
     
        if ($allowed) {         if ($allowed) {
            my $query_string = &build_query_string({'forcestudent' => '1',});             my $query_string = &build_query_string({'forcestudent' => '1','popup' => $env{'form.popup'}});
    $r->print('<p><b>'.&mt('Privacy Note').':</b> '.     $r->print('<p><b>'.&mt('Privacy Note').':</b> '.
      &mt('The information you submit can be viewed by anybody who is logged into LON-CAPA. Do not provide information that you are not ready to share publicly.').       &mt('The information you submit can be viewed by anybody who is logged into LON-CAPA. Do not provide information that you are not ready to share publicly.').
      '</p>'.       '</p>'.
      &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'</p><p><a href="'.$r->uri.$query_string.'">Show Public View</a>'.       &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'</p><p><a href="'.$r->uri.$query_string.'">'.&mt('Show Public View').'</a>'.
      &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');       &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
        } elsif ($privleged && $target ne 'tex') {         } elsif ($privleged && $target ne 'tex') {
            my $query_string = &build_query_string({'forceedit' => '1',});             my $query_string = &build_query_string({'forceedit' => '1','popup' => $env{'form.popup'}});
    $r->print('<p><a href="'.$r->uri.$query_string.'"><font size="+1">'.     $r->print('<p><a href="'.$r->uri.$query_string.'"><font size="+1">'.
      &mt('Edit').'</font></a></p>');       &mt('Edit').'</font></a></p>');
        }         }
Line 206  sub handler { Line 241  sub handler {
        if ($allowed) {         if ($allowed) {
            $r->print(             $r->print(
  '<form method="post">   '<form method="post">
                <input type="submit" name="delupl" value="Delete Photo" />                 <input type="submit" name="delupl" value="'.&mt('Delete Photo').'" />
           </form>'.            </form>'.
  '<form method="post" enctype="multipart/form-data">'.   '<form method="post" enctype="multipart/form-data">'.
          '<h3>'.&mt('Upload a Photo').'</h3>'.           '<h3>'.&mt('Upload a Photo').'</h3>'.
          '<input type="file" name="uploaddoc" size="50">'.           '<input type="file" name="uploaddoc" size="50" />'.
          '<input type="submit" name="storeupl" value="Upload">'.           '<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'.
            '<input type="hidden" name="popup" value="'.$env{'form.popup'}.'" />'.
  '</form><form method="post">');   '</form><form method="post">');
   
        }         }
Line 241  sub handler { Line 277  sub handler {
   }    }
        }         }
        if ($allowed) {         if ($allowed) {
              if ($env{'form.popup'}) {
                  $r->print('<input type="hidden" name="popup" value="'.
                            $env{'form.popup'}.'" />');
              }
    $r->print('</form>');     $r->print('</form>');
        }         }
        if ($target ne 'tex') {$r->print('<br />');} else {$r->print('\\\\');}         if ($target ne 'tex') {$r->print('<br />');} else {$r->print('\\\\');}
Line 280  sub handler { Line 320  sub handler {
  }   }
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
           if ($env{'form.popup'}) {
               $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a>');
           }
  $r->print(&Apache::loncommon::end_page());   $r->print(&Apache::loncommon::end_page());
     } else {      } else {
  $r->print('\end{document}');   $r->print('\end{document}');
Line 609  sub parse_directory { Line 652  sub parse_directory {
   
     my $portfolio_root = &Apache::portfolio::get_portfolio_root($cdom,$cnum,      my $portfolio_root = &Apache::portfolio::get_portfolio_root($cdom,$cnum,
                                                                 $group);                                                                  $group);
       my $getpropath = 1;
     my %dirlist = map {      my %dirlist = map {
     ((split('&',$_,2))[0],1)      ((split('&',$_,2))[0],1)
  } &Apache::lonnet::dirlist($path,$cdom,$cnum,$portfolio_root);   } &Apache::lonnet::dirlist($portfolio_root.$path,$cdom,$cnum,$getpropath);
     foreach my $item (sort(keys(%{$currhash}))) {      foreach my $item (sort(keys(%{$currhash}))) {
         $output .= &portfolio_row_start();          $output .= &portfolio_row_start();
         $output .= '<td style="padding-left: '.($depth*25).'px">';          $output .= '<td style="padding-left: '.($depth*25).'px">';
Line 663  sub parse_directory { Line 707  sub parse_directory {
     return $output;      return $output;
 }  }
   
   sub aboutme_access {
       my ($uname,$udom) = @_;
       my $privcheck = $env{'request.course.id'};
       my $sec;
       if ($env{'request.course.sec'} ne '') {
           $sec = $env{'request.course.sec'};
           $privcheck .= '/'.$sec;
       }
       my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
       if (($cdom eq '') || ($cnum eq '')) {
           my %coursehash = &coursedescription($env{'request.course.id'});
           $cdom = $coursehash{'domain'};
           $cnum = $coursehash{'cnum'};
       }
       if ((&allowed('srm',$privcheck)) || (&allowed('dff',$privcheck))) {
           if (&in_course($uname,$udom,$cnum,$cdom)) {
               return 1;
           }
       }
       return;
   }
   
 1;  1;
 __END__  __END__

Removed from v.1.64  
changed lines
  Added in v.1.70.2.1


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