--- loncom/homework/chemresponse.pm 2003/07/01 21:10:43 1.11 +++ loncom/homework/chemresponse.pm 2003/09/08 22:08:37 1.12 @@ -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 @@ SMILESECTION JMESECTION } + if ($molecule) { $molecule=""; } my $body=< @@ -75,7 +76,7 @@ function openHelpWindow() {
You have to enable Java and JavaScript on your machine. - +$molecule
JME Editor courtesy of Peter Ertl, Novartis @@ -123,6 +124,9 @@ sub start_organicresponse { $result.= ''; } 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 .=''. &Apache::edit::text_arg('Starting Molecule:','molecule', $token,40); @@ -130,7 +134,7 @@ sub start_organicresponse { $safeeval); $result .=&seperate_jme_window(undef, &Apache::edit::html_element_name('molecule'), - $molecule,'multipart'); + $molecule,$options); $result .='
'; $result .=&Apache::edit::text_arg('Correct Answer:','answer', $token,40); @@ -140,16 +144,23 @@ sub start_organicresponse { $result .=&seperate_jme_window( &Apache::edit::html_element_name('answer'), &Apache::edit::html_element_name('jmeanswer'), - $jmeanswer,'multipart'); - $result .=''. - &Apache::edit::select_arg('Multipart:','multipart', - ['no','yes'],$token); + $jmeanswer,$options); + $result .='
'; + $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 @@ sub start_organicstructure { 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 @@ -202,17 +214,31 @@ CHEMOUTPUT $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 .=''; $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.="
"; + $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;