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

version 1.70.2.1, 2008/12/11 16:46:50 version 1.77, 2008/12/08 23:13:52
Line 26 Line 26
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
   =pod
   
   =head1 NAME
   
   pache::lonaboutme
   
   =head1 SYNOPSIS
   
   (empty)
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   =head1 OVERVIEW
   
   (empty)
   
   
   =head1 SUBROUTINES
   
   =over
   
   =item handler()
   
   =item in_course()
   
   =item aboutme_info()
   
   =item print_portfiles_link()
   
   =item build_query_string()
   
   =item display_portfolio_header()
   
   =item display_portfolio_files()
   
   =item portfolio_files()
   
   =item build_hierarchy()
   
   =item parse_directory()
   
   =back
   
   =cut
   
   
 package Apache::lonaboutme;  package Apache::lonaboutme;
   
 use strict;  use strict;
Line 37  use Apache::lonfeedback; Line 84  use Apache::lonfeedback;
 use Apache::lonrss();  use Apache::lonrss();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonmsgdisplay();  use Apache::lonmsgdisplay();
   use Apache::lontemplate;
 use HTML::Entities();  use HTML::Entities();
   
 sub handler {  sub handler {
Line 62  sub handler { Line 110  sub handler {
   
     my $candisplay = 1;      my $candisplay = 1;
     if (!$is_course) {      if (!$is_course) {
         if ($action ne 'portfolio') {          $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme');
             $candisplay = &Apache::lonnet::usertools_access($cnum,$cdom,'aboutme');          if ((!$candisplay) && ($env{'request.course.id'})) {
             if ((!$candisplay) && ($env{'request.course.id'})) {              $candisplay = &aboutme_access($cnum,$cdom);
                 $candisplay = &aboutme_access($cnum,$cdom);          }
             }          if (!$candisplay) {
             if (!$candisplay) {              if ($target eq 'tex') {
                 if ($target eq 'tex') {                  $r->print('\noindent{\large\textbf{'.&mt('No user home page available').'}}\\\\\\\\');
                     $r->print('\noindent{\large\textbf{'.&mt('No user home page available').'}}\\\\\\\\');              } else {
                 } else {                  $r->print(&Apache::loncommon::start_page("Personal Information"));
                     $r->print(&Apache::loncommon::start_page("Personal Information"));                  $r->print('<h2>'.&mt('No user home page available') .'</h2>'.
                     $r->print('<h2>'.&mt('No user home page available') .'</h2>'.                            &mt('This is a result of one of the following:').'<ul>'.
                               &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 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>'.
                               '<li>'.&mt('The domain has been configured to disable, by default, home page functionality for all users in the domain.').'</li>'.                            '</ul>');
                               '</ul>');                  $r->print(&Apache::loncommon::end_page());
                     $r->print(&Apache::loncommon::end_page());  
                 }  
                 return OK;  
             }              }
               return OK;
         }          }
     }      }
   
Line 98  sub handler { Line 144  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);
         if ((!$is_course) && (!&Apache::lonnet::usertools_access($cnum,$cdom,'portfolio'))) {          my ($blocked,$blocktext) = 
             $r->print('<h2>'.&mt('No user portfolio available') .'</h2>'.             &Apache::loncommon::blocking_status('port',$cnum,$cdom);
                       &mt('This is a result of one of the following:').'<ul>'.          if (!$blocked) {
                       '<li>'.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').'</li>'.              &display_portfolio_files($r,$is_course);
                       '<li>'.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').'</li>'.  
                       '</ul>');  
         } else {          } else {
             my ($blocked,$blocktext) =               $r->print($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 156  sub handler { Line 194  sub handler {
  my $start_page =    my $start_page = 
     &Apache::loncommon::start_page("Personal Information",$rss_link,$args);      &Apache::loncommon::start_page("Personal Information",$rss_link,$args);
  $r->print($start_page);   $r->print($start_page);
  $r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');   $r->print('<h2>'.&Apache::loncommon::plainname($cnum,$cdom).'</h2>');
     } else {      } else {
  $r->print('\noindent{\large\textbf{'.&Apache::loncommon::plainname($cnum,$cdom).'}}\\\\\\\\');   $r->print('\noindent{\large\textbf{'.&Apache::loncommon::plainname($cnum,$cdom).'}}\\\\\\\\');
     }      }
Line 166  sub handler { Line 204  sub handler {
          '&quot;</h2>');           '&quot;</h2>');
     }      }
     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>');#OLD SendMessage POS
   '<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 189  sub handler { Line 226  sub handler {
      &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','popup' => $env{'form.popup'}});             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.'">'.
      &mt('Edit').'</font></a></p>');       &mt('Edit').'</a></p>');
        }         }
       if (($env{'form.uploaddoc.filename'}) &&        if (($env{'form.uploaddoc.filename'}) &&
           ($env{'form.storeupl'}) && ($allowed)) {            ($env{'form.storeupl'}) && ($allowed)) {
Line 223  sub handler { Line 260  sub handler {
            &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);             &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
        }         }
   
   my $lastmod;
   my $image; 
 # ---------------------------------------------------------------- Get syllabus  # ---------------------------------------------------------------- Get syllabus
     if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {      if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
        my $lastmod=$syllabus{'uploaded.lastmodified'};         $lastmod=$syllabus{'uploaded.lastmodified'};
        $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));         $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));
        $r->print(&mt('Last updated').': '.$lastmod);         # $r->print(&mt('Last updated').': '.$lastmod); #Old Last Modifi Pos
        if ($syllabus{'uploaded.photourl'}) {         if ($syllabus{'uploaded.photourl'}) {
    &Apache::lonnet::allowuploaded('/adm/aboutme',     &Apache::lonnet::allowuploaded('/adm/aboutme',
   $syllabus{'uploaded.photourl'});    $syllabus{'uploaded.photourl'});
    my $image=     $image=
                qq{<img src="$syllabus{'uploaded.photourl'}" align="right" />};                 qq{<img name="userPhoto" src="$syllabus{'uploaded.photourl'}" />};
   
    if ($target eq 'tex') {     if ($target eq 'tex') {
        $image=&Apache::lonxml::xmlparse($r,'tex',$image);         $image=&Apache::lonxml::xmlparse($r,'tex',$image);
    }     }
    $r->print($image);    # $r->print($image); #Print old Image
        }         }
        if ($allowed) {         if ($allowed) {
            $r->print(             $r->print(
Line 251  sub handler { Line 291  sub handler {
  '</form><form method="post">');   '</form><form method="post">');
   
        }         }
        foreach my $field (sort(keys(%syllabusfields))) {   &Apache::lontemplate::print_content_template($r,$allowed,$target,\%syllabusfields,\%syllabus);
           if (($syllabus{$field}) || ($allowed)) {         if($target ne 'tex')
               my $message=$syllabus{$field};         {
       &Apache::lonfeedback::newline_to_br(\$message);  
               $message    &print_portfiles_link($r,$is_course);
              =~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;   $r->print('<div class="ContentBox">');
       if ($allowed) {   $r->print($image); 
   $message=&Apache::lonspeller::markeduptext($message);   $r->print('</div>');
       }        $r->print('</div>');
       $message=&Apache::lontexconvert::msgtexconverted($message);   $r->print('<p>');
       if ($target ne 'tex') {          
   $r->print('<h3>'.$syllabusfields{$field}.'</h3><blockquote>'.  
                             $message.'</blockquote>');   $r->print('Kontakt');
       } else {   $r->print(&Apache::loncommon::messagewrapper(&mt('Send me a message'),$cnum,$cdom).'</p>'.&Apache::lonrss::advertisefeeds($cnum,$cdom));
      $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.  
        &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');  
       }  
               if ($allowed) {  
                  $r->print('<br /><textarea cols="80" rows="6" name="'.$field.'">'.  
    &HTML::Entities::encode($syllabus{$field},'"&<>').  
            '</textarea><input type="submit" name="storesyl" value="'.  
    &mt('Save').'" />');  
       }  
   }  
        }         }
   
        if ($allowed) {         if ($allowed) {
            if ($env{'form.popup'}) {             if ($env{'form.popup'}) {
                $r->print('<input type="hidden" name="popup" value="'.                 $r->print('<input type="hidden" name="popup" value="'.
Line 289  sub handler { Line 322  sub handler {
     }      }
   
     if ($target ne 'tex') {      if ($target ne 'tex') {
         &print_portfiles_link($r,$is_course);          # &print_portfiles_link($r,$is_course); #old Print files
   
     }      }
   
     if ($env{'request.course.id'}      if ($env{'request.course.id'}
Line 323  sub handler { Line 357  sub handler {
         if ($env{'form.popup'}) {          if ($env{'form.popup'}) {
             $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a>');              $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a>');
         }          }
    $r->print('<br />'.&mt('Last updated').': '.$lastmod);
   
  $r->print(&Apache::loncommon::end_page());   $r->print(&Apache::loncommon::end_page());
     } else {      } else {
  $r->print('\end{document}');   $r->print('\end{document}');
     }      }
   
     
   
     return OK;      return OK;
 }  }
   
Line 380  sub print_portfiles_link { Line 419  sub print_portfiles_link {
                          difl => 'Display file listing',                           difl => 'Display file listing',
              );                                    );                     
     if ($filecounts->{'both'} > 0) {      if ($filecounts->{'both'} > 0) {
         $output = '<h3>'.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'</h3>';   $output = '<div class="ContentBoxSpecial"><h4 class="hcell">';
    $output .= ($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'</h4>';
           
    #$output = '<h4>'.($is_course?$lt{'vgpf'}:$lt{'vpfi'}).'</h4>';
         $output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme/portfolio'.          $output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme/portfolio'.
                    $query_string.'">'.$lt{'difl'}.                     $query_string.'">'.$lt{'difl'}.
                    '</a><br /><br />';                     '</a><br /><br />';
Line 404  sub print_portfiles_link { Line 446  sub print_portfiles_link {
     $output .= '<li>'.&mt('[quant,_1,file requires,files require] a passphrase for access.',$filecounts->{'withpass'}).'</li>';      $output .= '<li>'.&mt('[quant,_1,file requires,files require] a passphrase for access.',$filecounts->{'withpass'}).'</li>';
         }          }
         $output .= '</ul>';          $output .= '</ul>';
    $output .='</p>';
     }      }
     $r->print($output);      $r->print($output);
     return;      return;

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


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