[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm /html/res/adm/pages math_example.tex /interface lonpreferences.pm /xml lontex.pm doc/loncapafiles loncapafiles.lpml
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 16 Aug 2005 16:31:17 -0000
albertel Tue Aug 16 12:31:17 2005 EDT
Added files:
/loncom/html/res/adm/pages math_example.tex
Modified files:
/loncom/interface lonpreferences.pm
/doc/loncapafiles loncapafiles.lpml
/loncom/xml lontex.pm
/loncom/homework lonhomework.pm
Log:
- revamping the math preview mechanism to use iframes so the examples don't conflict with each other
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.66 loncom/interface/lonpreferences.pm:1.67
--- loncom/interface/lonpreferences.pm:1.66 Tue Jul 5 11:25:34 2005
+++ loncom/interface/lonpreferences.pm Tue Aug 16 12:31:09 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.66 2005/07/05 15:25:34 albertel Exp $
+# $Id: lonpreferences.pm,v 1.67 2005/08/16 16:31:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -196,25 +196,22 @@
);
my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',
%mathchoices);
- my $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';
- my $jsMath_example=&Apache::lontexconvert::jsMath_converted(\$mathexample);
- $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';
- my $tth_example=&Apache::lontexconvert::tth_converted(\$mathexample);
- $mathexample='$$\int\left(\frac{a+b}{c^6*d}\right)$$';
- my $mimetex_example=&Apache::lontexconvert::mimetex_converted(\$mathexample);
+ my $jsMath_start=&Apache::lontexconvert::jsMath_header();
my $change=&mt('Change');
$r->print(<<ENDLSCREEN);
+<br />
+
<form name="server" action="/adm/preferences" method="post">
<input type="hidden" name="action" value="verify_and_change_texengine" />
<p>$pref: $selectionbox</p>
<p><input type="submit" value="$change" /></p>
</form>
Examples:
-<p> TeX to HTML <br /> $tth_example</p>
-<script type="text/javascript">function NoFontMessage () { }</script>
-<script src="/adm/jsMath/jsMath.js"></script>
+<p> TeX to HTML <br />
+<iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=tth" width="400" hieght="200"></iframe>
+</p>
<p>jsMath <br />
-
+$jsMath_start
<script type="text/javascript">
if (jsMath.nofonts == 1) {
document.writeln
@@ -231,9 +228,13 @@
+'</font></small></div></center>');
}
</script>
+<iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=jsMath" width="400" hieght="200"></iframe>
-$jsMath_example</p>
-<p> Convert to Images <br /> $mimetex_example</p>
+</p>
+<p> Convert to Images <br />
+<br />
+<iframe src="/res/adm/pages/math_example.tex?buttons=no&mode=mimetex" width="400" hieght="200"></iframe>
+</p>
ENDLSCREEN
if ($env{'environment.texengine'} ne 'jsMath') {
$r->print('<script type="text/javascript">jsMath.Process()</script>');
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.447 doc/loncapafiles/loncapafiles.lpml:1.448
--- doc/loncapafiles/loncapafiles.lpml:1.447 Thu Aug 11 10:43:31 2005
+++ doc/loncapafiles/loncapafiles.lpml Tue Aug 16 12:31:12 2005
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.447 2005/08/11 14:43:31 albertel Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.448 2005/08/16 16:31:12 albertel Exp $ -->
<!--
@@ -5675,6 +5675,7 @@
subm.gif;
title.gif;
vbkm.gif;
+math_example.tex;
</filenames>
</fileglob>
<file>
Index: loncom/xml/lontex.pm
diff -u loncom/xml/lontex.pm:1.7 loncom/xml/lontex.pm:1.8
--- loncom/xml/lontex.pm:1.7 Thu Apr 7 02:56:27 2005
+++ loncom/xml/lontex.pm Tue Aug 16 12:31:14 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# TeX Content Handler
#
-# $Id: lontex.pm,v 1.7 2005/04/07 06:56:27 albertel Exp $
+# $Id: lontex.pm,v 1.8 2005/08/16 16:31:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -77,16 +77,24 @@
# --------------------------------------------------------------- Render Output
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['mode',
+ 'buttons']);
+
$r->print(&Apache::lontexconvert::header());
$r->print(
'<body bgcolor="#FFFFFF" onLoad="'.
&Apache::lonmenu::loadevents().
'" onUnload="'.
&Apache::lonmenu::unloadevents().
- '">'.
- &Apache::lonmenu::menubuttons(undef,'web',1)
- );
- $r->print(&Apache::lontexconvert::converted(\$texstring));
+ '">');
+ if ($env{'form.buttons'} ne 'no') {
+ $r->print(&Apache::lonmenu::menubuttons(undef,'web',1));
+ }
+ &Apache::lontexconvert::jsMath_reset();
+ if ($env{'form.mode'} eq 'jsMath') {
+ $r->print(&Apache::lontexconvert::jsMath_header());
+ }
+ $r->print(&Apache::lontexconvert::converted(\$texstring,$env{'form.mode'}));
$r->print('</body>');
$r->print(&Apache::lontexconvert::footer());
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.215 loncom/homework/lonhomework.pm:1.216
--- loncom/homework/lonhomework.pm:1.215 Fri Jul 29 19:51:06 2005
+++ loncom/homework/lonhomework.pm Tue Aug 16 12:31:14 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.215 2005/07/29 23:51:06 raeburn Exp $
+# $Id: lonhomework.pm,v 1.216 2005/08/16 16:31:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -94,9 +94,9 @@
if ( defined($env{'form.submitted'}) &&
( !defined($env{'form.resetdata'})) &&
( !defined($env{'form.newrandomization'}))) {
- return ('grade', 'web');
+ return ('grade', 'web','answer');
} else {
- return ('web');
+ return ('web','answer');
}
} elsif ($env{'request.state'} eq "construct") {
if ( defined($env{'form.grade_target'}) ) {
Index: loncom/html/res/adm/pages/math_example.tex
+++ loncom/html/res/adm/pages/math_example.tex
$$r = \frac{n\sum xy-(\sum \pi)\cdot (\sum \mu)}{\sqrt{\left( n\sum
phi^{2}-\left( \sum x\right) ^{2}\right) \cdot \left( n\sum y^{2}-\left(
\sum y\right) ^{2}\right) }}$$