Diff for /loncom/homework/chemresponse.pm between versions 1.87 and 1.93

version 1.87, 2010/02/28 23:35:53 version 1.93, 2014/02/13 18:13:22
Line 87  JMESECTION Line 87  JMESECTION
     my $insert_answer;      my $insert_answer;
     if ($shown_text eq '') {       if ($shown_text eq '') { 
  $insert_answer=   $insert_answer=
     '<input type="button" name="submit" value="Insert Answer" onclick="javascript:submitSmiles();" />';      '<input type="button" name="submit" value="'.&mt('Insert Answer').'" onclick="javascript:submitSmiles();" />';
     }      }
   
     my $js = <<CHEMJS;      my $js = <<CHEMJS;
Line 116  CHEMJS Line 116  CHEMJS
  'bgcolor'   => '#FFFFFF',});   'bgcolor'   => '#FFFFFF',});
     my $end_page =      my $end_page =
   &Apache::loncommon::end_page({'js_ready' => 1,});    &Apache::loncommon::end_page({'js_ready' => 1,});
       my $java_not_enabled=&Apache::lonhtmlcommon::java_not_enabled();
       my %lt = &Apache::lonlocal::texthash(
           'seltext' => 'Select substituent...',
           'close'   => 'Close',
           'help'    => 'Help',
          );
     my $body=<<CHEMPAGE;      my $body=<<CHEMPAGE;
 $js  $js
 <center>  <center>
 <form>  <form action="">
   <table width="440"><tr>    <table width="440"><tr>
     <td></td>      <td></td>
     <td align="right">      <td align="right">
       <select onchange="javascript:substituent(options[selectedIndex].text)">        <select onchange="javascript:substituent(options[selectedIndex].text)">
         <option>Select substituent</option>          <option>$lt{'seltext'}</option>
         <option>-C(=O)OH</option>          <option>-C(=O)OH</option>
         <option>-C(=O)OMe</option>          <option>-C(=O)OMe</option>
         <option>-OC(=O)Me</option>          <option>-OC(=O)Me</option>
Line 143  $js Line 148  $js
     </td></tr>      </td></tr>
   </table>    </table>
 <applet code="JME.class" name="JME" archive="/adm/jme/JME.jar" width="440" height="390" mayscript>  <applet code="JME.class" name="JME" archive="/adm/jme/JME.jar" width="440" height="390" mayscript>
 You have to enable Java and JavaScript on your machine.  $java_not_enabled
 $molecule  $molecule
 <param name="options" value="$options" />  <param name="options" value="$options" />
 </applet><br />  </applet><br />
Line 151  $molecule Line 156  $molecule
 <br />  <br />
 $insert_answer  $insert_answer
 <br />  <br />
 <input type="button" value="  Close  " onclick = "javascript:window.close()" />  <input type="button" value="$lt{'close'}" onclick="javascript:window.close()" />
 &nbsp;&nbsp;  &nbsp;&nbsp;
 <input type="button" value="  Help  " onclick = "javascript:openHelpWindow()" />  <input type="button" value="$lt{'help'}" onclick="javascript:openHelpWindow()" />
 </form>  </form>
 </center>  </center>
 CHEMPAGE  CHEMPAGE
Line 165  CHEMPAGE Line 170  CHEMPAGE
     if (defined($shown_text)) { $display=&mt($shown_text); }      if (defined($shown_text)) { $display=&mt($shown_text); }
     my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};      my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
     my $function =       my $function = 
  'LONCAPA_draw_molecule_'.&Apache::lonhtmlcommon::get_uniq_name();   'LONCAPA_draw_molecule_'.&get_uniq_name();
     my $result=<<CHEMINPUT;      my $result=<<CHEMINPUT;
 <script type="text/javascript">  <script type="text/javascript">
     function $function() {      function $function() {
Line 337  sub end_organicresponse { Line 342  sub end_organicresponse {
   
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||       if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
  &Apache::lonxml::increment_counter(&Apache::response::repetition(),           my $repetition = &Apache::response::repetition();
    "$partid.$id"); # part.response   &Apache::lonxml::increment_counter($repetition,"$partid.$id"); # part.response
  if ($target eq 'analyze') {   if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$partid.$id.type"} = 'organicresponse';              $Apache::lonhomework::analyze{"$partid.$id.type"} = 'organicresponse';
             push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");              push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
Line 377  sub end_organicresponse { Line 382  sub end_organicresponse {
   
 sub format_prior_answer_organic {  sub format_prior_answer_organic {
     my ($mode,$answer,$other_data) = @_;      my ($mode,$answer,$other_data) = @_;
     my $result=&mt('Smile representation: "[_1]"','<tt>'.$answer.'</tt>');      my $result=&mt('Smile representation: [_1]','"<tt>'.$answer.'</tt>"');
     my $jme=$other_data->[0];      my $jme=$other_data->[0];
     $result.=&jme_img($jme,$answer,400);      $result.=&jme_img($jme,$answer,400);
     return $result;      return $result;
Line 417  sub start_organicstructure { Line 422  sub start_organicstructure {
  $id=&escape($id);   $id=&escape($id);
  &Apache::lonxml::register_ssi("/cgi-bin/convertjme.pl?$id");   &Apache::lonxml::register_ssi("/cgi-bin/convertjme.pl?$id");
  if ($options =~ /border/) { $result.= '\fbox{'; }   if ($options =~ /border/) { $result.= '\fbox{'; }
  $result .= '\graphicspath{{/home/httpd/perl/tmp/}}\includegraphics[width='.$texwidth.' mm]{'.$filename.'.eps}';   $result .= '\graphicspath{{'.LONCAPA::tempdir().
       '}}\includegraphics[width='.$texwidth.' mm]{'.$filename.'.eps}';
  if ($options =~ /border/) { $result.= '} '; }   if ($options =~ /border/) { $result.= '} '; }
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result .=&Apache::edit::tag_start($target,$token);   $result .=&Apache::edit::tag_start($target,$token);
Line 598  sub end_reactionresponse { Line 604  sub end_reactionresponse {
   
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||       if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
  &Apache::lonxml::increment_counter(&Apache::response::repetition(), "$partid.$id");   my $repetition = &Apache::response::repetition();
           &Apache::lonxml::increment_counter($repetition,"$partid.$id");
         if ($target eq 'analyze') {          if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$partid.$id.type"} = 'reactionresponse';              $Apache::lonhomework::analyze{"$partid.$id.type"} = 'reactionresponse';
             push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");              push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
Line 642  sub end_chem { Line 649  sub end_chem {
     return $result;      return $result;
 }  }
   
   my $uniq=0;
   sub get_uniq_name {
       $uniq++;
       return 'uniquename'.$uniq;
   }
   
 1;  1;
 __END__  __END__

Removed from v.1.87  
changed lines
  Added in v.1.93


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>