[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 08 Sep 2003 22:08:37 -0000
albertel Mon Sep 8 18:08:37 2003 EDT
Modified files:
/loncom/homework chemresponse.pm
Log:
- Fixes #2041,2053, organic structure/response have access to all of the various options to jme that make sense.
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.11 loncom/homework/chemresponse.pm:1.12
--- loncom/homework/chemresponse.pm:1.11 Tue Jul 1 17:10:43 2003
+++ loncom/homework/chemresponse.pm Mon Sep 8 18:08:37 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# chemical equation style response
#
-# $Id: chemresponse.pm,v 1.11 2003/07/01 21:10:43 albertel Exp $
+# $Id: chemresponse.pm,v 1.12 2003/09/08 22:08:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,6 +51,7 @@
JMESECTION
}
+ if ($molecule) { $molecule="<param name='jme' value='$molecule' />"; }
my $body=<<CHEMPAGE;
<html>
<head>
@@ -75,7 +76,7 @@
<center>
<applet code="JME.class" name="JME" archive="/adm/jme/JME.jar" width="97%" height="78%">
You have to enable Java and JavaScript on your machine.
-<param name="jme" value="$molecule" />
+$molecule
<param name="options" value="$options" />
</applet><br />
<font face="arial,helvetica,sans-serif" size=-1><a href="http://www.molinspiration.com/jme/index.html">JME Editor</a> courtesy of Peter Ertl, Novartis</font>
@@ -123,6 +124,9 @@
$result.= '<input type="hidden" name="MOLECULE_'.$id.'" value="" />';
} elsif ($target eq 'edit') {
$result .=&Apache::edit::tag_start($target,$token);
+ my $options=&Apache::lonxml::get_param('options',$parstack,
+ $safeeval);
+ if ($options !~ /multipart/) { $options.=',multipart'; }
$result .='<nobr>'.
&Apache::edit::text_arg('Starting Molecule:','molecule',
$token,40);
@@ -130,7 +134,7 @@
$safeeval);
$result .=&seperate_jme_window(undef,
&Apache::edit::html_element_name('molecule'),
- $molecule,'multipart');
+ $molecule,$options);
$result .='</nobr><br /><nobr>';
$result .=&Apache::edit::text_arg('Correct Answer:','answer',
$token,40);
@@ -140,16 +144,23 @@
$result .=&seperate_jme_window(
&Apache::edit::html_element_name('answer'),
&Apache::edit::html_element_name('jmeanswer'),
- $jmeanswer,'multipart');
- $result .='</nobr>'.
- &Apache::edit::select_arg('Multipart:','multipart',
- ['no','yes'],$token);
+ $jmeanswer,$options);
+ $result .='</nobr><br />';
+ $result .=&Apache::edit::checked_arg('Options:','options',
+ [ ['autoez','Auto E,Z sterochemistry'],
+ ['multipart','MultiPart Structures'],
+ ['hydrogens','Show Hydrogens'],
+ ['nostereo','No stereochemistry'],
+ ['reaction','Is a reaction'],
+ ['number','Able to number atoms'],
+ ['border','Draw a border'] ],
+ ,$token);
$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
$safeeval,'molecule',
'answer','jmeanswer',
- 'multipart');
+ 'options');
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
}
return $result;
@@ -192,9 +203,10 @@
my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval);
my $height=&Apache::lonxml::get_param('height',$parstack,$safeeval);
my $molecule=&Apache::lonxml::get_param('molecule',$parstack,$safeeval);
+ my $options=&Apache::lonxml::get_param('options',$parstack,$safeeval);
$result=<<CHEMOUTPUT;
<applet code="JME.class" archive="/adm/jme/JME.jar" width="$width" height="$height">
-<param name="options" value="depict border" />
+<param name="options" value="depict,$options" />
<param name="jme" value="$molecule" />
</applet>
CHEMOUTPUT
@@ -202,17 +214,31 @@
$result .=&Apache::edit::tag_start($target,$token);
$result .=&Apache::edit::text_arg('Width:','width',$token,5);
$result .=&Apache::edit::text_arg('Height:','height',$token,5);
+ $result .='<nobr>';
$result .=&Apache::edit::text_arg('Molecule:','molecule',$token,40);
my $molecule=&Apache::lonxml::get_param('molecule',$parstack,
$safeeval);
+ my $options=&Apache::lonxml::get_param('options',$parstack,
+ $safeeval);
+ if ($options !~ /reaction/) {
+ $options.= ',multipart,number';
+ }
+
$result .=&seperate_jme_window(undef,
- &Apache::edit::html_element_name('molecule'),
- $molecule,'multipart');
+ &Apache::edit::html_element_name('molecule'),
+ $molecule,$options);
+ $result.="</nobr><br />";
+ $result .=&Apache::edit::checked_arg('Options:','options',
+ [ ['hydrogens','Show Hydrogens'],
+ ['reaction','Is a reaction'],
+ ['border','Draw a border'] ],
+ $token);
$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
$safeeval,'molecule',
- 'width','height');
+ 'width','height',
+ 'options');
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
}
return $result;