Diff for /loncom/interface/lonsyllabus.pm between versions 1.105 and 1.112

version 1.105, 2010/01/28 17:22:34 version 1.112, 2012/10/04 13:41:10
Line 52  sub handler { Line 52  sub handler {
     my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);      my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
 # ------------------------------------------------------------ Get query string  # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi      &Apache::loncommon::get_unprocessed_cgi
                         ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit','wrapperdisplay']);                          ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit']);
 # ----------------------------------------------------- Is this even a course?  # ----------------------------------------------------- Is this even a course?
     my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom);      my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom);
     if ($homeserver eq 'no_host') {      if ($homeserver eq 'no_host') {
         &Apache::loncommon::content_type($r,'text/html');          &Apache::loncommon::content_type($r,'text/html');
         $r->send_http_header;          $r->send_http_header;
           &Apache::loncommon::simple_error_page($r,'No syllabus available',          &Apache::loncommon::simple_error_page($r,'No syllabus available',
                           'No syllabus available');                            'No syllabus available');
         return OK;          return OK;
     }      }
Line 74  sub handler { Line 74  sub handler {
     my $externalsyllabus=$courseenv{'externalsyllabus'};      my $externalsyllabus=$courseenv{'externalsyllabus'};
   
     if ($externalsyllabus=~/\w/) {      if ($externalsyllabus=~/\w/) {
           $r->print( Apache::lonwrapper::wrapper($externalsyllabus) );
        if ($env{'form.wrapperdisplay'} eq 'menu') {          return OK;
            $r->print(&Apache::lonwrapper::simple_menu());  
        } else {  
            $r->print(&Apache::lonwrapper::wrapper("/public/$cdom/$cnum/syllabus?wrapperdisplay=menu",  
                            $externalsyllabus));  
        }  
        return OK;  
     }      }
   
 # ------------------------------ The buck stops here: internal syllabus display  # ------------------------------ The buck stops here: internal syllabus display
Line 288  ENDSCRIPT Line 282  ENDSCRIPT
 #----------Print last update  #----------Print last update
     my $lastmod=$syllabus{'uploaded.lastmodified'};      my $lastmod=$syllabus{'uploaded.lastmodified'};
     $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));      $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));
     my $who = &Apache::loncommon::aboutmewrapper(      my $who;
         &Apache::loncommon::plainname($syllabus{'uploaded.name'},      if (($env{'user.name'} ne 'public') && ($env{'user.domain'} ne 'public')) {
         $syllabus{'uploaded.domain'}),$syllabus{'uploaded.name'},          $who = &Apache::loncommon::aboutmewrapper(
         $syllabus{'uploaded.domain'});                     &Apache::loncommon::plainname($syllabus{'uploaded.name'},
                      $syllabus{'uploaded.domain'}),$syllabus{'uploaded.name'},
                      $syllabus{'uploaded.domain'});
       } else {
           # Public user?
           # Only display name of user, but no link to personal information page
           $who = &Apache::loncommon::plainname(
                      $syllabus{'uploaded.name'},
                      $syllabus{'uploaded.domain'});
       }
   
     if ($target ne 'tex') {      if ($target ne 'tex') {
         $r->print('<div class="LC_info">'.&mt('Last updated').': '.          $r->print('<div class="LC_info">'.&mt('Last updated').': '.
             $lastmod . ' '.              $lastmod . ' '.
Line 329  ENDSCRIPT Line 333  ENDSCRIPT
         } else {          } else {
             $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & ');              $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & ');
         }          }
           my @coursepersonlist;
         foreach (split(/\,/,$coursepersonnel{$element})) {          foreach (split(/\,/,$coursepersonnel{$element})) {
             my ($puname,$pudom)=split(/\:/,$_);              my ($puname,$pudom)=split(/\:/,$_);
             if ($target ne 'tex') {              if ($target ne 'tex') {
                 my $courseperson = &Apache::loncommon::plainname($puname,$pudom);                  my $courseperson = &Apache::loncommon::plainname($puname,$pudom);
                 if (($env{'user.name'} eq '') || ($env{'user.name'} eq 'public') ||                  if (($env{'user.name'} eq '') || ($env{'user.name'} eq 'public') ||
                     ($env{'user.domain'} eq '') || ($env{'user.domain'} eq 'public')) {                      ($env{'user.domain'} eq '') || ($env{'user.domain'} eq 'public')) {
                     $r->print(' '.$courseperson);                      push(@coursepersonlist,$courseperson);
                 } else {                  } else {
                     $r->print(' '.&Apache::loncommon::aboutmewrapper($courseperson,                      push(@coursepersonlist,&Apache::loncommon::aboutmewrapper($courseperson,
                               $puname,$pudom));                                $puname,$pudom));
                 }                  }
             } else {              } else {
                 $r->print(' '.&Apache::loncommon::plainname($puname,                  push(@coursepersonlist,&Apache::loncommon::plainname($puname,
                               $pudom).' ');                                $pudom).' ');
             }              }
         }          }
           $r->print(join(", ",@coursepersonlist));
         if ($target ne 'tex') {          if ($target ne 'tex') {
             my $lastclose=$element eq $lastpers?1:0;              my $lastclose=$element eq $lastpers?1:0;
             $r->print(&Apache::lonhtmlcommon::row_closure($lastclose));              $r->print(&Apache::lonhtmlcommon::row_closure($lastclose));
Line 362  ENDSCRIPT Line 368  ENDSCRIPT
              &Apache::lonannounce::readcalendar($cdom.'_'.$cnum));               &Apache::lonannounce::readcalendar($cdom.'_'.$cnum));
     if ($target ne 'tex') {      if ($target ne 'tex') {
         if ($allowed) {          if ($allowed) {
             &Apache::lontemplate::print_start_template($r,'RSS Feeds and Blogs','LC_Box');              &Apache::lontemplate::print_start_template($r,&mt('RSS Feeds and Blogs'),'LC_Box');
             $r->print(&Apache::lonrss::advertisefeeds($cnum,$cdom,$forceedit));              $r->print(&Apache::lonrss::advertisefeeds($cnum,$cdom,$forceedit));
             my $editurl= &Apache::lonnet::absolute_url().'/adm/'.$cdom.'/'.$cnum.'/_rss.html';              my $editurl= &Apache::lonnet::absolute_url().'/adm/'.$cdom.'/'.$cnum.'/_rss.html';
             $r->print( '<a href="'.$editurl.'">'.&mt('New RSS Feed or Blog').'</a>');              $r->print( '<a href="'.$editurl.'">'.&mt('New RSS Feed or Blog').'</a>');
             &Apache::lontemplate::print_end_template($r);              &Apache::lontemplate::print_end_template($r);
         } elsif (&Apache::lonrss::advertisefeeds($cnum,$cdom) ne '') {          } elsif (&Apache::lonrss::advertisefeeds($cnum,$cdom) ne '') {
             &Apache::lontemplate::print_start_template($r,'RSS Feeds and Blogs','LC_Box');              &Apache::lontemplate::print_start_template($r,&mt('RSS Feeds and Blogs'),'LC_Box');
             $r->print(&Apache::lonrss::advertisefeeds($cnum,$cdom,$forceedit));              $r->print(&Apache::lonrss::advertisefeeds($cnum,$cdom,$forceedit));
             &Apache::lontemplate::print_end_template($r);              &Apache::lontemplate::print_end_template($r);
         }          }
Line 382  ENDSCRIPT Line 388  ENDSCRIPT
             $r->print('<form method="post" action="">'.              $r->print('<form method="post" action="">'.
             '<input type="hidden" name="forceedit" value="edit" />');              '<input type="hidden" name="forceedit" value="edit" />');
         }          }
         my @htmlids=();   my $url_include_handler = sub {
    my ($r, $field, $message, $group, $data_ref, $fields_ref, $target, $allowed) = @_;
         foreach my $field (sort(keys(%syllabusfields))) {   my %data = %{$data_ref};
             if (($syllabus{$field}=~/\w/) || ($allowed)) {   my %fields = %{$fields_ref};
                 my $message=$syllabus{$field};   my $urls=$message;
                 if ($field eq 'lll_includeurl') { # this is the "included" field   $message='';
                     my $urls=$message;   foreach my $filelink (split(/\n/,$urls)) {
                     $message='';   my $output='';
                     foreach my $filelink (split(/\n/,$urls)) {     # embed style?
                         my $output='';   my ($curfext)=($filelink=~/\.([^\.]+)$/);
                        # embed style?   my $embstyle=&Apache::loncommon::fileembstyle($curfext);
                         my ($curfext)=($filelink=~/\.([^\.]+)$/);   if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {# make ssi call and remove everything but the body contents
                         my $embstyle=&Apache::loncommon::fileembstyle($curfext);   $output=&Apache::lonnet::ssi_body($filelink);
                         if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {# make ssi call and remove everything but the body contents   } elsif ($embstyle eq 'img') {# embed as an image
                             $output=&Apache::lonnet::ssi_body($filelink);   $output='<img src="'.$filelink.'" />';
                         } elsif ($embstyle eq 'img') {# embed as an image   }
                             $output='<img src="'.$filelink.'" />';   if ($output ne '') {
                         }     if ($target ne 'tex') {
                         if ($output ne '') {     $message.='<p>'.$output.'</p>';
                                if ($target ne 'tex') {     } else {
                                    $message.='<p>'.$output.'</p>';     $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';
                                } else {     }
                                    $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';   }
                                }   }
                         }   if ($allowed) {
                     }   &Apache::lonfeedback::newline_to_br(\$urls);
                     if ($allowed) {   &Apache::lontemplate::print_start_template($r,$fields{$field}.
                          &Apache::lonfeedback::newline_to_br(\$urls);    &Apache::loncommon::help_open_topic('Syllabus_URLs'),'LC_Box');
                          &Apache::lontemplate::print_start_template($r,$syllabusfields{$field}.   $r->print($urls);
                            &Apache::loncommon::help_open_topic('Syllabus_URLs'),'LC_Box');   $r->print("<br /><div>");
                          $r->print($urls);   &Apache::lontemplate::print_textarea_template($r, $data{$field},
                          $r->print("<br /><div>");   $field, Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);
  &Apache::lontemplate::print_textarea_template($r, $syllabus{$field},   &Apache::lontemplate::print_saveall_template($r);                         
  $field, Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);   $r->print("</div>");
  &Apache::lontemplate::print_saveall_template($r);                            &Apache::lontemplate::print_end_template($r);
  $r->print("</div>");  
  &Apache::lontemplate::print_end_template($r);  
   
                     } else {  
                         $r->print($message);  
                     }  
                 } else {  
                     if (!&Apache::lonfeedback::contains_block_html($message)) {  
                     &Apache::lonfeedback::newline_to_br(\$message);  
                     } else {  
                     $message = &Apache::lonfeedback::tidy_html($message);  
                     }  
                     $message=&Apache::lonhtmlcommon::raw_href_to_link($message);  
   
                     if ($allowed) {   } else {
                         $message=&Apache::lonspeller::markeduptext($message);   $r->print($message);
                     }   }
                     $message=&Apache::lontexconvert::msgtexconverted($message);   };
                     if ($target ne 'tex') {   my %custom_hash = ( 'lll_includeurl' => $url_include_handler );
  #output of syllabusfields will be generated here.    &Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, 
  &Apache::lontemplate::print_start_template($r,$syllabusfields{$field},'LC_Box');   $target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_hash);
                         $r->print($message);  
                         if ($allowed) {  
                             $r->print("<br /><div>");  
                             &Apache::lontemplate::print_textarea_template($r, $syllabus{$field},  
                             $field, Apache::lontemplate->RICH_TEXT_DETECT_HTML);  
                             &Apache::lontemplate::print_saveall_template($r);  
  $r->print("</div>");  
  }   
                     &Apache::lontemplate::print_end_template($r);  
                     } else {  
                         $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.  
                         &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');  
                     }  
                     push(@htmlids,$field);  
                 }  
             }  
         }  
         if ($allowed) {          if ($allowed) {
             $r->print('</form>'.              $r->print('</form>'.
             &Apache::lonhtmlcommon::htmlareaselectactive(@htmlids));              &Apache::lonhtmlcommon::htmlareaselectactive());
         }          }
       # if ($target ne 'tex') {$r->print('</p>');} else {$r->print('\\\\');}  
     } else {      } else {
         if ($target ne 'tex') {$r->print('<p>');} else {$r->print('\par ');}          if ($target ne 'tex') {$r->print('<p class="LC_info">');} else {$r->print('\par ');}
         $r->print(&mt('No syllabus information provided.'));          $r->print(&mt('No syllabus information provided.'));
         if ($target ne 'tex') {$r->print('</p>');}          if ($target ne 'tex') {$r->print('</p>');}
     }      }

Removed from v.1.105  
changed lines
  Added in v.1.112


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