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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 25 Sep 2007 23:45:35 -0000


albertel		Tue Sep 25 19:45:35 2007 EDT

  Modified files:              
    /loncom/homework	imageresponse.pm 
  Log:
  - storing the submission data like how option/match etc do it..
  
  
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.85 loncom/homework/imageresponse.pm:1.86
--- loncom/homework/imageresponse.pm:1.85	Tue Sep 25 19:16:13 2007
+++ loncom/homework/imageresponse.pm	Tue Sep 25 19:45:33 2007
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.85 2007/09/25 23:16:13 albertel Exp $
+# $Id: imageresponse.pm,v 1.86 2007/09/25 23:45:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -376,8 +376,8 @@
 
 sub stringify_submission {
     my ($response) = @_;
-    return
-	join("\0",map {$_."\1".$response->{$_}} (sort(keys(%{ $response }))));
+    return &Apache::lonnet::hash2str(%{ $response });
+
     
 }
 
@@ -391,10 +391,10 @@
 	    $Apache::lonhomework::history{"resource.$part.$respid.submission"};
     }
 
-    if ($string !~ /\0/) {
+    if ($string !~ /=/) {
 	return split(':',$string);
     } else {
-	my %response = map { split("\1",$_,2) } (split("\0",$string));
+	my %response = &Apache::lonnet::str2hash($string);
 	return split(':',$response{$name});
     }
 }