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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 13 Feb 2004 21:12:54 -0000


albertel		Fri Feb 13 16:12:54 2004 EDT

  Modified files:              
    /loncom/homework	edit.pm 
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - handle checked_args when nothing is checked.
  
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.78 loncom/homework/edit.pm:1.79
--- loncom/homework/edit.pm:1.78	Wed Jan 14 22:24:52 2004
+++ loncom/homework/edit.pm	Fri Feb 13 16:12:54 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.78 2004/01/15 03:24:52 www Exp $
+# $Id: edit.pm,v 1.79 2004/02/13 21:12:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -531,6 +531,9 @@
 	    } else {
 		$token->[2]->{$arg}=$newvalue;
 	    }
+	    $rebuild=1;
+	} elsif (!defined($newvalue) && defined($value)) {
+	    delete($token->[2]->{$arg});
 	    $rebuild=1;
 	}
     }
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.130 loncom/homework/caparesponse/caparesponse.pm:1.131
--- loncom/homework/caparesponse/caparesponse.pm:1.130	Fri Feb 13 16:05:34 2004
+++ loncom/homework/caparesponse/caparesponse.pm	Fri Feb 13 16:12:54 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.130 2004/02/13 21:05:34 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.131 2004/02/13 21:12:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -535,16 +535,14 @@
 					    [['inline','Inline']],$token);
 	$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     } elsif ($target eq 'modified') {
-	&Apache::edit::get_new_args($token,$parstack,
-				    $safeeval,'answer','type');
-	my $answerdisplay=$ENV{'form.'.&Apache::edit::html_element_name('answerdisplay')};
-	if ($answerdisplay) {
-	    $token->[2]->{'answerdisplay'}=$answerdisplay;
-	} else {
-	    delete $token->[2]->{'answerdisplay'};
-	}
-	$result = &Apache::edit::rebuild_tag($token);
-	$result.=&Apache::edit::handle_insert();
+       my $constructtag;
+       $constructtag=&Apache::edit::get_new_args($token,$parstack,
+                                                 $safeeval,'answer',
+                                                 'type','answerdisplay');
+       if ($constructtag) {
+           $result = &Apache::edit::rebuild_tag($token);
+           $result.=&Apache::edit::handle_insert();
+       }
     } elsif ($target eq 'answer' || $target eq 'grade') {
 	&Apache::response::reset_params();
     }