Diff for /loncom/interface/lonaboutme.pm between versions 1.24 and 1.37

version 1.24, 2004/05/04 14:34:25 version 1.37, 2005/04/07 06:56:22
Line 41  sub handler { Line 41  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 71  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 105  ENDDOCUMENT Line 106  ENDDOCUMENT
   
 # does this user have privileges to post, etc?  # does this user have privileges to post, etc?
   
        $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) {
    if ($target ne 'tex') {     $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.'?forcestudent=1">Show Public View</a>'.
                          &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'</p><p><a href="'.$r->uri.'?forcestudent=1">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') {
    } else {     $r->print('<p><a href="'.$r->uri.'?forceedit=1"><font size="+1">'.
        $r->print(' \textbf{'.&mt('Privacy Note').'}: '.       &mt('Edit').'</font></a></p>');
                          &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.').'\\\\\\\\');         }
    }        if (($env{'form.uploaddoc.filename'}) &&
       }            ($env{'form.storeupl'}) && ($allowed)) {
       if (($ENV{'form.uploaddoc.filename'}) &&     if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
           ($ENV{'form.storeupl'}) && ($allowed)) {  
    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 133  ENDDOCUMENT Line 132  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.storesyl'})) {      if ($allowed && $env{'form.delupl'}) {
    if ($syllabus{'uploaded.photourl'}) {
       &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
       delete($syllabus{'uploaded.photourl'});
       &Apache::lonnet::del('aboutme',['uploaded.photourl'],$cdom,$cnum);
    }
       }
          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 153  ENDDOCUMENT Line 159  ENDDOCUMENT
        if ($syllabus{'uploaded.photourl'}) {         if ($syllabus{'uploaded.photourl'}) {
    &Apache::lonnet::allowuploaded('/adm/aboutme',     &Apache::lonnet::allowuploaded('/adm/aboutme',
   $syllabus{'uploaded.photourl'});    $syllabus{'uploaded.photourl'});
    $r->print('<img src="'.$syllabus{'uploaded.photourl'}.     my $image=
              '" align="right" />');                 qq{<img src="$syllabus{'uploaded.photourl'}" align="right" />};
      if ($target eq 'tex') {
          $image=&Apache::lonxml::xmlparse($r,'tex',$image);
      }
      $r->print($image);
        }         }
        if ($allowed) {         if ($allowed) {
            $r->print(             $r->print(
    '<form method="post">
                  <input type="submit" name="delupl" value="Delete Photo" />
             </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="Upload">'.
  '</form><form method="post">');   '</form><form method="post">');
   
        }         }
        foreach (sort keys %syllabusfields) {         foreach (sort keys %syllabusfields) {
           if (($syllabus{$_}) || ($allowed)) {            if (($syllabus{$_}) || ($allowed)) {
Line 170  ENDDOCUMENT Line 184  ENDDOCUMENT
               $message=~s/\n/\<br \/\>/g;                $message=~s/\n/\<br \/\>/g;
               $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) {
     $message=&Apache::lonspeller::markeduptext($message);
         }
       $message=&Apache::lontexconvert::msgtexconverted($message);        $message=&Apache::lontexconvert::msgtexconverted($message);
       if ($target ne 'tex') {        if ($target ne 'tex') {
   $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.    $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.
                             $message.'</blockquote>');                              $message.'</blockquote>');
       } else {        } else {
      $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.       $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.
        &Apache::lonxml::xmlparse($r,' ',$message).'\\\\');         &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');
       }        }
               if ($allowed) {                if ($allowed) {
                  $r->print('<br /><textarea cols="80" rows="6" name="'.$_.'">'.                   $r->print('<br /><textarea cols="80" rows="6" name="'.$_.'">'.
Line 193  ENDDOCUMENT Line 210  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('<hr /><h3>'.   $r->print('<hr /><h3>'.
                           &mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'</h3>'.                            &mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'</h3>'.
                           &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::lonmsg::disfacetoface($r,$cnum,$cdom);
             $r->print(&Apache::loncommon::noteswrapper('Add Records',$cnum,$cdom));                  $r->print('<hr />');
                   if (&Apache::lonnet::allowed('vsa',
                                                $env{'request.course.id'}) ||
                       &Apache::lonnet::allowed('vsa',
                                                $env{'request.course.id'}.'/'.
                                                $env{'request.course.sec'})) {
                       $r->print(&Apache::loncommon::track_student_link
                                 ('View recent activity by this student',
                                  $cnum,$cdom).('&nbsp;'x2));
                   }
                   $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::lonmsg::disfacetoface($r,$cnum,$cdom);

Removed from v.1.24  
changed lines
  Added in v.1.37


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