--- loncom/xml/lonxml.pm 2009/11/30 21:17:41 1.501 +++ loncom/xml/lonxml.pm 2010/02/08 00:35:06 1.505 @@ -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.505 2010/02/08 00:35:06 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -244,7 +244,7 @@ sub tokeninputfield { document.tokeninput.barcode.value=''; } -
+ +onchange="updatetoken()"/>* +onchange="this.value=this.value.toUpperCase()" />
DocID Checkin
@@ -252,7 +252,7 @@ sub tokeninputfield {
Scan in Barcode
or Type in DocID @@ -261,7 +261,7 @@ onChange="updatetoken()"/>
@@ -1549,22 +1549,27 @@ sub renderingoptions { } my $output; unless ($env{'form.forceedit'}) { - $output .= ' - '. + $output .= + ''. &mt('Language:').' '. - &Apache::loncommon::select_form($env{'form.languages'},'languages', - %langchoices).' - '; + &Apache::loncommon::select_form( + $env{'form.languages'}, + 'languages', + &Apache::lonlocal::texthash(%langchoices)). + ''; } - $output .= ' - '. + $output .= + ' '. &mt('Math Rendering:').' '. - &Apache::loncommon::select_form($env{'form.texengine'},'texengine', - ('' => '', - 'tth' => 'tth (TeX to HTML)', - 'jsMath' => 'jsMath', - 'mimetex' => 'mimetex (Convert to Images)')).' - '; + &Apache::loncommon::select_form( + $env{'form.texengine'}, + 'texengine', + &Apache::lonlocal::texthash + ('' => '', + 'tth' => 'tth (TeX to HTML)', + 'jsMath' => 'jsMath', + 'mimetex' => 'mimetex (Convert to Images)')). + ''; return $output; } @@ -1612,7 +1617,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 +1747,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 +1800,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,21 +1824,31 @@ ENDNOTFOUND # up if it did &Apache::structuretags::reset_problem_globals(); &Apache::lonhomework::finished_parsing(); + } elsif ($filetype eq 'tex') { + $result = &Apache::lontexconvert::converted(\$filecontents, + $env{'form.texengine'}); + if ($env{'form.return_only_error_and_warning_counts'}) { + if (&verify_html(''.$result.'')) { + $errorcount++; + } + $result = "$errorcount:$warningcount"; + } } else { $result = $filecontents; } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['rawmode']); if ($env{'form.rawmode'}) { $result = $filecontents; } - if ($filetype ne 'html') { - my $nochgview = 1; + if (($filetype ne 'html') && + (!$env{'form.return_only_error_and_warning_counts'})) { + 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 +1861,7 @@ ENDNOTFOUND $brcrum = [{'href' => &Apache::loncommon::authorspace(), 'text' => 'Construction Space'}, {'href' => '', - 'text' => 'Editor'}]; + 'text' => $breadcrumbtext}]; } else { $brcrum = ''; # FIXME: Where are we? } @@ -1873,7 +1901,7 @@ ENDNOTFOUND 'href' => &Apache::loncommon::authorspace(), 'text' => 'Construction Space'}, {'href' => '', - 'text' => 'HTML Editor'}]; + 'text' => $breadcrumbtext}]; $header = &Apache::loncommon::head_subbox( &Apache::loncommon::CSTR_pageheader()); }