Diff for /loncom/interface/lonaboutme.pm between versions 1.33 and 1.39

version 1.33, 2004/12/02 18:53:13 version 1.39, 2005/11/18 13:35:30
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;
   
 sub handler {  sub handler {
Line 41  sub handler { Line 42  sub handler {
     &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 ne 'tex') {
    my $html=&Apache::lonxml::xmlbegin();
  $r->print(<<ENDDOCUMENT);   $r->print(<<ENDDOCUMENT);
 <html>  $html
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 ENDDOCUMENT  ENDDOCUMENT
     } else {      } else {
  $r->print(&Apache::lonprintout::print_latex_header($ENV{'form.latex_type'}));   $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?
Line 70  ENDDOCUMENT Line 72  ENDDOCUMENT
                             ($ENV{'QUERY_STRING'},['forcestudent','register']);                              ($ENV{'QUERY_STRING'},['forcestudent','register']);
 # ----------------------------------------------------- Force menu registration  # ----------------------------------------------------- Force menu registration
     my $addentries='';      my $addentries='';
     if ($ENV{'form.register'}) {      if ($env{'form.register'}) {
        $addentries=' onLoad="'.&Apache::lonmenu::loadevents().         $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
    '" onUnload="'.&Apache::lonmenu::unloadevents().'"';     '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
        $r->print(&Apache::lonmenu::registerurl(1));         $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   $r->print('</head>'.&Apache::loncommon::bodytag
                   ("Personal Information",$forcestudent,$addentries,'',$cdom,                    ("Personal Information",$forcestudent,$addentries,'',$cdom,
                    $ENV{'form.register'}));                     $env{'form.register'}));
  $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 98  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 107  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 121  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 133  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 182  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 211  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 221  ENDDOCUMENT Line 223  ENDDOCUMENT
                 &Apache::lonmsg::disfacetoface($r,$cnum,$cdom);                  &Apache::lonmsg::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));

Removed from v.1.33  
changed lines
  Added in v.1.39


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