Diff for /loncom/interface/lonaboutme.pm between versions 1.56 and 1.63

version 1.56, 2006/09/21 15:50:10 version 1.63, 2007/05/23 21:44:11
Line 57  sub handler { Line 57  sub handler {
       'No user information available');        'No user information available');
         return OK;          return OK;
     } else {      } else {
         $is_course = &check_for_course($cdom,$cnum);          $is_course = &Apache::lonnet::is_course($cdom,$cnum);
     }      }
   
 # --------------------------------------------------------- The syllabus fields  # --------------------------------------------------------- The syllabus fields
Line 74  sub handler { Line 74  sub handler {
 # ----------------------------------------------- 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);
         &display_portfolio_files($r,$is_course);          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());          $r->print(&Apache::loncommon::end_page());
         return OK;          return OK;
     }      }
Line 125  sub handler { Line 131  sub handler {
          '&quot;</h2>');           '&quot;</h2>');
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print('<h3>'.$Apache::lonnet::domaindescription{$cdom}.'</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('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::domain($cdom,'description').'}\\\\');
     }      }
     my %syllabus=&Apache::lonnet::dump('aboutme',$cdom,$cnum);      my %syllabus=&Apache::lonnet::dump('aboutme',$cdom,$cnum);
     my $allowed=0;      my $allowed=0;
Line 171  sub handler { Line 177  sub handler {
  }   }
     }      }
        if (($allowed) && ($env{'form.storesyl'})) {         if (($allowed) && ($env{'form.storesyl'})) {
    foreach (keys %syllabusfields) {     foreach my $syl_field (keys(%syllabusfields)) {
                my $field=$env{'form.'.$_};                 my $field=$env{'form.'.$syl_field};
                $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{$syl_field}=$field;
            }             }
            $syllabus{'uploaded.lastmodified'}=time;             $syllabus{'uploaded.lastmodified'}=time;
            &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);             &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
Line 209  sub handler { Line 215  sub handler {
  '</form><form method="post">');   '</form><form method="post">');
   
        }         }
        foreach (sort keys %syllabusfields) {         foreach my $field (sort(keys(%syllabusfields))) {
           if (($syllabus{$_}) || ($allowed)) {            if (($syllabus{$field}) || ($allowed)) {
               my $message=$syllabus{$_};                my $message=$syllabus{$field};
       &Apache::lonfeedback::newline_to_br(\$message);        &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;
Line 220  sub handler { Line 226  sub handler {
       }        }
       $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{$field}.'</h3><blockquote>'.
                             $message.'</blockquote>');                              $message.'</blockquote>');
       } else {        } else {
      $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.       $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.
        &Apache::lonxml::xmlparse($r,'tex',$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="'.$field.'">'.
    &HTML::Entities::encode($syllabus{$_},'"&<>').     &HTML::Entities::encode($syllabus{$field},'"&<>').
            '</textarea><input type="submit" name="storesyl" value="'.             '</textarea><input type="submit" name="storesyl" value="'.
    &mt('Store').'" />');     &mt('Save').'" />');
       }        }
   }    }
        }         }
Line 246  sub handler { Line 252  sub handler {
         &print_portfiles_link($r,$is_course);          &print_portfiles_link($r,$is_course);
     }      }
   
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}
  if (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) {   && &Apache::lonnet::allowed('srm',$env{'request.course.id'})
     if ($target ne 'tex') {   && &in_course($cdom,$cnum)) {
  $r->print('<a name="coursecomment" />');   if ($target ne 'tex') {
  $r->print('<hr /><h3>'.      $r->print('<a name="coursecomment" />');
                           &mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'</h3>'.      $r->print('<hr /><h3>'.
                           &mt('Shared by course faculty and staff').        &mt('User Notes, Records of Face-To-Face Discussions, and Critical Messages in Course').'</h3>'.
                           &Apache::loncommon::help_open_topic("Course_Face_To_Face_Records,Course_Critical_Message").        &mt('Shared by course faculty and staff').
 '<br />');        &Apache::loncommon::help_open_topic("Course_Face_To_Face_Records,Course_Critical_Message").
                 &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);        '<br />');
                 $r->print('<hr />');      &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);
                 if (&Apache::lonnet::allowed('vsa',      $r->print('<hr />');
                                              $env{'request.course.id'}) ||      if (&Apache::lonnet::allowed('vsa',
                     &Apache::lonnet::allowed('vsa',   $env{'request.course.id'}) ||
                                              $env{'request.course.id'}.'/'.   &Apache::lonnet::allowed('vsa',
                                              $env{'request.course.sec'})) {   $env{'request.course.id'}.'/'.
                     $r->print(&Apache::loncommon::track_student_link   $env{'request.course.sec'})) {
                               ('View recent activity by this student',   $r->print(&Apache::loncommon::track_student_link
                                $cnum,$cdom).('&nbsp;'x2));    ('View recent activity by this student',
                 }     $cnum,$cdom).('&nbsp;'x2));
                 $r->print(&Apache::loncommon::noteswrapper('Add Records',$cnum,$cdom));  
     } 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').'\\\\\\\\');  
  &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);  
     }      }
         }      $r->print(&Apache::loncommon::noteswrapper('Add Records',$cnum,$cdom));
    } 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').'\\\\\\\\');
       &Apache::lonmsgdisplay::disfacetoface($r,$cnum,$cdom);
    }
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print(&Apache::loncommon::end_page());   $r->print(&Apache::loncommon::end_page());
Line 281  sub handler { Line 287  sub handler {
     return OK;      return OK;
 }  }
   
   sub in_course {
       my ($udom,$uname,$cdom,$cnum,$type) = @_;
       $type ||= 'any';
       if (!defined($cdom) || !defined($cnum)) {
    my $cid  = $env{'request.course.id'};
    $cdom = $env{'course.'.$cid.'.domain'};
    $cnum = $env{'course.'.$cid.'.num'};
       }
       my %roles = &Apache::lonnet::dump('roles',$udom,$uname);
       my @course_roles = grep(m{^/\Q$cdom\E/\Q$cnum\E[/_]}, keys(%roles));
       return 0 if (!@course_roles);
       return 1 if ($type eq 'any');
       my $now = time();
       foreach my $role (@course_roles) {
    my (undef,$role_end,$role_start)=split(/\_/,$roles{$role});
    my $status = 'active';
    if ($role_start > 0 && $now < $role_start) {
       $status = 'future';
    }
    if ($role_end > 0 && $now > $role_end) {
       $status = 'previous';
    }
    return 1 if ($status eq $type);
       }
       return 0;
   }
   
 sub aboutme_info {  sub aboutme_info {
     my ($r,$is_course) = @_;      my ($r,$is_course) = @_;
     my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);      my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
Line 629  sub parse_directory { Line 662  sub parse_directory {
     return $output;      return $output;
 }  }
   
 sub check_for_course {  
     my ($cdom,$cnum) = @_;  
     my %courses = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,undef,  
                                                 undef,'.');  
     if (exists($courses{$cdom.'_'.$cnum})) {  
         return 1;  
     }  
     return 0;  
 }  
   
 1;  1;
 __END__  __END__

Removed from v.1.56  
changed lines
  Added in v.1.63


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