Diff for /loncom/interface/lonaboutme.pm between versions 1.34 and 1.42

version 1.34, 2004/12/15 20:00:44 version 1.42, 2006/04/10 19:59:53
Line 34  use Apache::loncommon; Line 34  use Apache::loncommon;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lontexconvert;  use Apache::lontexconvert;
 use Apache::lonfeedback;  use Apache::lonfeedback;
   use Apache::lonrss();
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::lonmsgdisplay();
   
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
     my $target=$ENV{'form.grade_target'};      my $target=$env{'form.grade_target'};
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
     if ($target ne 'tex') {      if ($target eq 'tex') {
  $r->print(<<ENDDOCUMENT);   $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
 <html>  
 <head>  
 <title>The LearningOnline Network with CAPA</title>  
 ENDDOCUMENT  
     } else {  
  $r->print(&Apache::lonprintout::print_latex_header($ENV{'form.latex_type'}));  
     }      }
     my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);      my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
 # Is this even a user?  # Is this even a user?
     if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {      if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
  $r->print('</head><body>'.   &Apache::loncommon::simple_error_page($r,'No info',
   &mt('No user information available').'</body></html>');        'No user information available');
         return OK;          return OK;
     }      }
 # --------------------------------------------------------- The syllabus fields  # --------------------------------------------------------- The syllabus fields
Line 68  ENDDOCUMENT Line 64  ENDDOCUMENT
 # ------------------------------------------------------------ Get Query String  # ------------------------------------------------------------ Get Query String
     &Apache::loncommon::get_unprocessed_cgi      &Apache::loncommon::get_unprocessed_cgi
                             ($ENV{'QUERY_STRING'},['forcestudent','register']);                              ($ENV{'QUERY_STRING'},['forcestudent','register']);
 # ----------------------------------------------------- Force menu registration  
     my $addentries='';  
     if ($ENV{'form.register'}) {  
        $addentries=' onLoad="'.&Apache::lonmenu::loadevents().  
    '" onUnload="'.&Apache::lonmenu::unloadevents().'"';  
        $r->print(&Apache::lonmenu::registerurl(1));  
     }  
 # --------------------------------------------------------------- Force Student  # --------------------------------------------------------------- Force Student
     my $forcestudent='';      my $forcestudent='';
     if ($ENV{'form.forcestudent'}) { $forcestudent='student'; };      if ($env{'form.forcestudent'}) { $forcestudent='student'; };
                 
 # --------------------------------------- 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') {
  $r->print('</head>'.&Apache::loncommon::bodytag   my $start_page = 
                   ("Personal Information",$forcestudent,$addentries,'',$cdom,      &Apache::loncommon::start_page("Personal Information",undef,
                    $ENV{'form.register'}));     {'function'       => $forcestudent,
       'domain'         => $cdom,
       'force_register' =>
    $env{'form.register'},});
    $r->print($start_page);
  $r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');   $r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');
     } else {      } else {
  $r->print('\noindent{\large\textbf{'.&Apache::loncommon::plainname($cnum,$cdom).'}}\\\\\\\\');   $r->print('\noindent{\large\textbf{'.&Apache::loncommon::plainname($cnum,$cdom).'}}\\\\\\\\');
Line 96  ENDDOCUMENT Line 89  ENDDOCUMENT
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print('<h3>'.$Apache::lonnet::domaindescription{$cdom}.'</h3>'.   $r->print('<h3>'.$Apache::lonnet::domaindescription{$cdom}.'</h3>'.
   '<p>'.&Apache::loncommon::messagewrapper('Send me a message',$cnum,$cdom).'</p>');    '<p>'.&Apache::loncommon::messagewrapper('Send me a message',$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom));
     } else {      } else {
  $r->print('\textbf{'.$Apache::lonnet::domaindescription{$cdom}.'}\\\\');   $r->print('\textbf{'.$Apache::lonnet::domaindescription{$cdom}.'}\\\\');
     }      }
Line 105  ENDDOCUMENT Line 98  ENDDOCUMENT
   
 # does this user have privileges to post, etc?  # does this user have privileges to post, etc?
   
        my $privleged=$allowed=(($ENV{'user.name'} eq $cnum) &&          my $privleged=$allowed=(($env{'user.name'} eq $cnum) && 
        ($ENV{'user.domain'} eq $cdom));         ($env{'user.domain'} eq $cdom));
        if ($forcestudent or $target eq 'tex') { $allowed=0; }         if ($forcestudent or $target eq 'tex') { $allowed=0; }
     
        if ($allowed) {         if ($allowed) {
Line 119  ENDDOCUMENT Line 112  ENDDOCUMENT
    $r->print('<p><a href="'.$r->uri.'?forceedit=1"><font size="+1">'.     $r->print('<p><a href="'.$r->uri.'?forceedit=1"><font size="+1">'.
      &mt('Edit').'</font></a></p>');       &mt('Edit').'</font></a></p>');
        }         }
       if (($ENV{'form.uploaddoc.filename'}) &&        if (($env{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {            ($env{'form.storeupl'}) && ($allowed)) {
    if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {     if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
       if ($syllabus{'uploaded.photourl'}) {        if ($syllabus{'uploaded.photourl'}) {
   &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});    &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
       }        }
Line 131  ENDDOCUMENT Line 124  ENDDOCUMENT
           $syllabus{'uploaded.lastmodified'}=time;            $syllabus{'uploaded.lastmodified'}=time;
           &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);            &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
        }         }
     if ($allowed && $ENV{'form.delupl'}) {      if ($allowed && $env{'form.delupl'}) {
  if ($syllabus{'uploaded.photourl'}) {   if ($syllabus{'uploaded.photourl'}) {
     &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});      &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
     delete($syllabus{'uploaded.photourl'});      delete($syllabus{'uploaded.photourl'});
     &Apache::lonnet::del('aboutme',['uploaded.photourl'],$cdom,$cnum);      &Apache::lonnet::del('aboutme',['uploaded.photourl'],$cdom,$cnum);
  }   }
     }      }
        if (($allowed) && ($ENV{'form.storesyl'})) {         if (($allowed) && ($env{'form.storesyl'})) {
    foreach (keys %syllabusfields) {     foreach (keys %syllabusfields) {
                my $field=$ENV{'form.'.$_};                 my $field=$env{'form.'.$_};
                $field=~s/\s+$//s;                 $field=~s/\s+$//s;
                $field=&Apache::lonfeedback::clear_out_html($field,                 $field=&Apache::lonfeedback::clear_out_html($field,
                                                            $ENV{'user.adv'});                                                             $env{'user.adv'});
        $syllabus{$_}=$field;         $syllabus{$_}=$field;
            }             }
            $syllabus{'uploaded.lastmodified'}=time;             $syllabus{'uploaded.lastmodified'}=time;
Line 180  ENDDOCUMENT Line 173  ENDDOCUMENT
        foreach (sort keys %syllabusfields) {         foreach (sort keys %syllabusfields) {
           if (($syllabus{$_}) || ($allowed)) {            if (($syllabus{$_}) || ($allowed)) {
               my $message=$syllabus{$_};                my $message=$syllabus{$_};
               $message=~s/\n/\<br \/\>/g;        &Apache::lonfeedback::newline_to_br(\$message);
               $message                $message
              =~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;               =~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
       if ($allowed) {        if ($allowed) {
Line 209  ENDDOCUMENT Line 202  ENDDOCUMENT
     } else {      } else {
        $r->print('<p>'.&mt('No personal information provided').'.</p>');         $r->print('<p>'.&mt('No personal information provided').'.</p>');
     }      }
     if ($ENV{'request.course.id'}) {      if ($env{'request.course.id'}) {
  if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {   if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) {
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print('<a name="coursecomment" />');   $r->print('<a name="coursecomment" />');
  $r->print('<hr /><h3>'.   $r->print('<hr /><h3>'.
Line 218  ENDDOCUMENT Line 211  ENDDOCUMENT
                           &mt('Shared by course faculty and staff').                            &mt('Shared by course faculty and staff').
                           &Apache::loncommon::help_open_topic("Course_Face_To_Face_Records,Course_Critical_Message").                            &Apache::loncommon::help_open_topic("Course_Face_To_Face_Records,Course_Critical_Message").
 '<br />');  '<br />');
                 &Apache::lonmsg::disfacetoface($r,$cnum,$cdom);                  &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);
                 $r->print('<hr />');                  $r->print('<hr />');
                 if (&Apache::lonnet::allowed('vsa',                  if (&Apache::lonnet::allowed('vsa',
                                              $ENV{'request.course.id'}) ||                                               $env{'request.course.id'}) ||
                     &Apache::lonnet::allowed('vsa',                      &Apache::lonnet::allowed('vsa',
                                              $ENV{'request.course.id'}.'/'.                                               $env{'request.course.id'}.'/'.
                                              $ENV{'request.course.sec'})) {                                               $env{'request.course.sec'})) {
 #                    $r->print(&Apache::loncommon::track_student_link                      $r->print(&Apache::loncommon::track_student_link
 #                              ('View recent activity by this student',                                ('View recent activity by this student',
 #                               $cnum,$cdom).('&nbsp;'x2));                                 $cnum,$cdom).('&nbsp;'x2));
                 }                  }
                 $r->print(&Apache::loncommon::noteswrapper('Add Records',$cnum,$cdom));                  $r->print(&Apache::loncommon::noteswrapper('Add Records',$cnum,$cdom));
     } else {      } else {
  $r->print('\\\\\textbf{'.&mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'}\\\\'.&mt('Shared by course faculty and staff').'\\\\\\\\');   $r->print('\\\\\textbf{'.&mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'}\\\\'.&mt('Shared by course faculty and staff').'\\\\\\\\');
  &Apache::lonmsg::disfacetoface($r,$cnum,$cdom);   &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);
     }      }
         }          }
     }      }
     if ($target ne 'tex') {$r->print('</body></html>');} else {$r->print('\end{document}');}      if ($target ne 'tex') {
    $r->print(&Apache::loncommon::end_page());
       } else {
    $r->print('\end{document}');
       }
     return OK;      return OK;
 }   } 
   

Removed from v.1.34  
changed lines
  Added in v.1.42


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