[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 21 Sep 2008 20:09:14 -0000


raeburn		Sun Sep 21 16:09:14 2008 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  - In &start_reactionresponse() - definition of $reaction no longer needed inside block for web target.
  - In &end_reactionresponse: 
     - set $reaction to initial value if no submission history before &edit_reaction_button() is called
  - Style (indentation)     
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.80 loncom/homework/chemresponse.pm:1.81
--- loncom/homework/chemresponse.pm:1.80	Fri Sep  5 16:23:57 2008
+++ loncom/homework/chemresponse.pm	Sun Sep 21 16:09:06 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.80 2008/09/05 20:23:57 riegler Exp $
+# $Id: chemresponse.pm,v 1.81 2008/09/21 20:09:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -491,8 +491,6 @@
     } elsif ($target eq 'web') {
 	my $partid = $Apache::inputtags::part;
 	my $id = $Apache::inputtags::response['-1'];
-	my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"};
-	if ($reaction eq '') {  $reaction=&Apache::lonxml::get_param('initial',$parstack,$safeeval); }
 	if (  &Apache::response::show_answer() ) {
 	    my $ans=&Apache::lonxml::get_param('answer',$parstack,$safeeval);
 	    if (!$Apache::lonxml::default_homework_loaded) {
@@ -510,7 +508,6 @@
 	my $initial=&Apache::lonxml::get_param('initial',$parstack,$safeeval);
 	$result.='<nobr>'.
 	    &Apache::edit::text_arg('Initial Reaction:','initial',$token,40);
-	
 	$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     }  elsif ($target eq 'modified') {
 	my $constructtag=&Apache::edit::get_new_args($token,$parstack,
@@ -584,14 +581,12 @@
             &Apache::lonhomework::set_bubble_lines();
         }
     }
-     my $status=$Apache::inputtags::status['-1'];
-        if  (($target eq 'web') && ($Apache::lonhomework::type ne 'exam') && ($status eq 'CAN_ANSWER')) {
-             my $partid = $Apache::inputtags::part;
-             my $id = $Apache::inputtags::response['-1'];
-             my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"};
-             $result.=&edit_reaction_button($id,"HWVAL_$id",$reaction);
-
-        }  
+    my $status=$Apache::inputtags::status['-1'];
+    if  (($target eq 'web') && ($Apache::lonhomework::type ne 'exam') && ($status eq 'CAN_ANSWER')) {
+        my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"};
+        if ($reaction eq '') {  $reaction=&Apache::lonxml::get_param('initial',$parstack,$safeeval); }
+        $result.=&edit_reaction_button($id,"HWVAL_$id",$reaction);
+    }
     &Apache::response::end_response();
     return $result;
 }