Diff for /loncom/interface/lonsyllabus.pm between versions 1.100 and 1.107

version 1.100, 2009/10/23 16:14:43 version 1.107, 2010/03/03 21:33:15
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 383  ENDSCRIPT Line 377  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) {  
                         $r->print('<h3>'.$syllabusfields{$field}.  
                         &Apache::loncommon::help_open_topic('Syllabus_URLs').'</h3>');  
                     } else {  
                         $r->print($message);  
                     }  
                 } else {  
                     &Apache::lonfeedback::newline_to_br(\$message);  
                     $message =~s|(https?\://[^\s]+)|<a href="$1"><tt>$1</tt></a>|g;  
                     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_template($r, $syllabusfields{$field}, $message,$allowed,'LC_Box');  
                     } else {  
                         $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.  
                         &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');  
                     }  
                     push(@htmlids,$field);  
                 }  
                 if ($allowed) {  
                     if ($target ne 'tex') {  
                         &Apache::lontemplate::print_editbox_template($r, $syllabus{$field}, $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.100  
changed lines
  Added in v.1.107


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