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

version 1.105, 2010/01/28 17:22:34 version 1.106, 2010/01/31 06:03:55
Line 58  sub handler { Line 58  sub handler {
     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 383  ENDSCRIPT Line 383  ENDSCRIPT
             '<input type="hidden" name="forceedit" value="edit" />');              '<input type="hidden" name="forceedit" value="edit" />');
         }          }
         my @htmlids=();          my @htmlids=();
    my $url_include_handler = sub {
    my ($r, $field, $message, $group, $data_ref, $fields_ref, $target, $allowed) = @_;
    my %data = %{$data_ref};
    my %fields = %{$fields_ref};
    my $urls=$message;
    $message='';
    foreach my $filelink (split(/\n/,$urls)) {
    my $output='';
      # embed style?
    my ($curfext)=($filelink=~/\.([^\.]+)$/);
    my $embstyle=&Apache::loncommon::fileembstyle($curfext);
    if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {# make ssi call and remove everything but the body contents
    $output=&Apache::lonnet::ssi_body($filelink);
    } elsif ($embstyle eq 'img') {# embed as an image
    $output='<img src="'.$filelink.'" />';
    }
    if ($output ne '') {
      if ($target ne 'tex') {
      $message.='<p>'.$output.'</p>';
      } else {
      $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';
      }
    }
    }
    if ($allowed) {
    &Apache::lonfeedback::newline_to_br(\$urls);
    &Apache::lontemplate::print_start_template($r,$fields{$field}.
     &Apache::loncommon::help_open_topic('Syllabus_URLs'),'LC_Box');
    $r->print($urls);
    $r->print("<br /><div>");
    &Apache::lontemplate::print_textarea_template($r, $data{$field},
    $field, Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);
    &Apache::lontemplate::print_saveall_template($r);                         
    $r->print("</div>");
    &Apache::lontemplate::print_end_template($r);
   
         foreach my $field (sort(keys(%syllabusfields))) {   } else {
             if (($syllabus{$field}=~/\w/) || ($allowed)) {   $r->print($message);
                 my $message=$syllabus{$field};   }
                 if ($field eq 'lll_includeurl') { # this is the "included" field   };
                     my $urls=$message;   my %custom_hash = ( 'lll_includeurl' => $url_include_handler );
                     $message='';   @htmlids = &Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, 
                     foreach my $filelink (split(/\n/,$urls)) {   $target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_hash);
                         my $output='';  
                        # embed style?  
                         my ($curfext)=($filelink=~/\.([^\.]+)$/);  
                         my $embstyle=&Apache::loncommon::fileembstyle($curfext);  
                         if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {# make ssi call and remove everything but the body contents  
                             $output=&Apache::lonnet::ssi_body($filelink);  
                         } elsif ($embstyle eq 'img') {# embed as an image  
                             $output='<img src="'.$filelink.'" />';  
                         }  
                         if ($output ne '') {  
                                if ($target ne 'tex') {  
                                    $message.='<p>'.$output.'</p>';  
                                } else {  
                                    $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';  
                                }  
                         }  
                     }  
                     if ($allowed) {  
                          &Apache::lonfeedback::newline_to_br(\$urls);  
                          &Apache::lontemplate::print_start_template($r,$syllabusfields{$field}.  
                            &Apache::loncommon::help_open_topic('Syllabus_URLs'),'LC_Box');  
                          $r->print($urls);  
                          $r->print("<br /><div>");  
  &Apache::lontemplate::print_textarea_template($r, $syllabus{$field},  
  $field, Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);  
  &Apache::lontemplate::print_saveall_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) {  
                         $message=&Apache::lonspeller::markeduptext($message);  
                     }  
                     $message=&Apache::lontexconvert::msgtexconverted($message);  
                     if ($target ne 'tex') {  
  #output of syllabusfields will be generated here.   
  &Apache::lontemplate::print_start_template($r,$syllabusfields{$field},'LC_Box');  
                         $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(@htmlids));
         }          }
       # 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>');} else {$r->print('\par ');}
         $r->print(&mt('No syllabus information provided.'));          $r->print(&mt('No syllabus information provided.'));

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


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