--- loncom/xml/lonxml.pm 2009/11/30 21:17:41 1.501 +++ loncom/xml/lonxml.pm 2009/11/30 21:29:41 1.502 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.501 2009/11/30 21:17:41 raeburn Exp $ +# $Id: lonxml.pm,v 1.502 2009/11/30 21:29:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1612,7 +1612,7 @@ FULLPAGE } FULLPAGE - if ($filetype eq 'html') { + if ($filetype eq 'html' || $filetype eq 'tex') { $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup'); $dragmath_button = &Apache::lonhtmlcommon::dragmath_button('filecont',1); } @@ -1742,12 +1742,25 @@ sub handler { my $file=&Apache::lonnet::filelocation("",$request->uri); - my $filetype; - if ($file =~ /\.(sty|css|js|txt)$/) { + my ($filetype,$breadcrumbtext); + if ($file =~ /\.(sty|css|js|txt|tex)$/) { $filetype=$1; } else { $filetype='html'; } + if ($filetype eq 'sty') { + $breadcrumbtext = 'Style File Editor'; + } elsif ($filetype eq 'js') { + $breadcrumbtext = 'Javascript Editor'; + } elsif ($filetype eq 'css') { + $breadcrumbtext = 'CSS Editor'; + } elsif ($filetype eq 'txt') { + $breadcrumbtext = 'Text Editor'; + } elsif ($filetype eq 'tex') { + $breadcrumbtext = 'TeX Editor'; + } else { + $breadcrumbtext = 'HTML Editor'; + } # # Edit action? Save file. @@ -1782,7 +1795,7 @@ ENDNOTFOUND $filecontents=&createnewsty(); } elsif ($filetype eq 'js') { $filecontents=&createnewjs(); - } elsif (($filetype ne 'css') && ($filetype ne 'txt')) { + } elsif ($filetype ne 'css' && $filetype ne 'txt' && $filetype ne 'tex') { $filecontents=&createnewhtml(); } $env{'form.editmode'}='Edit'; #force edit mode @@ -1806,6 +1819,8 @@ ENDNOTFOUND # up if it did &Apache::structuretags::reset_problem_globals(); &Apache::lonhomework::finished_parsing(); + } elsif ($filetype eq 'tex') { + $result .= &Apache::lontexconvert::converted(\$filecontents); } else { $result = $filecontents; } @@ -1813,14 +1828,14 @@ ENDNOTFOUND ['rawmode']); if ($env{'form.rawmode'}) { $result = $filecontents; } if ($filetype ne 'html') { - my $nochgview = 1; + my $nochgview = 1; my $controls = ''; if ($env{'request.state'} eq 'construct') { $controls = &Apache::loncommon::head_subbox( &Apache::loncommon::CSTR_pageheader() .&Apache::londefdef::edit_controls($nochgview)); } - if ($filetype ne 'sty') { + if ($filetype ne 'sty' && $filetype ne 'tex') { $result =~ s//>/g; $result = ''. @@ -1833,7 +1848,7 @@ ENDNOTFOUND $brcrum = [{'href' => &Apache::loncommon::authorspace(), 'text' => 'Construction Space'}, {'href' => '', - 'text' => 'Editor'}]; + 'text' => $breadcrumbtext}]; } else { $brcrum = ''; # FIXME: Where are we? } @@ -1873,7 +1888,7 @@ ENDNOTFOUND 'href' => &Apache::loncommon::authorspace(), 'text' => 'Construction Space'}, {'href' => '', - 'text' => 'HTML Editor'}]; + 'text' => $breadcrumbtext}]; $header = &Apache::loncommon::head_subbox( &Apache::loncommon::CSTR_pageheader()); }