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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 25 Sep 2007 22:56:49 -0000


albertel		Tue Sep 25 18:56:49 2007 EDT

  Modified files:              
    /loncom/homework	randomlylabel.pm 
  Log:
  - some cleanups to hadnling of the query string (parse it correctly now)
  
  
Index: loncom/homework/randomlylabel.pm
diff -u loncom/homework/randomlylabel.pm:1.28 loncom/homework/randomlylabel.pm:1.29
--- loncom/homework/randomlylabel.pm:1.28	Tue May 30 08:45:37 2006
+++ loncom/homework/randomlylabel.pm	Tue Sep 25 18:56:48 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # randomlabel.png: composite together text and images into 1 image
 #
-# $Id: randomlylabel.pm,v 1.28 2006/05/30 12:45:37 www Exp $
+# $Id: randomlylabel.pm,v 1.29 2007/09/25 22:56:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -271,20 +271,24 @@
     my $r = shift;
     $r->content_type('image/png');
     $r->send_http_header;
-    my (undef,$id) = split(/=/,$ENV{'QUERY_STRING'});
-    my $image;
-    my $prefix="cgi.$id.";
+
+    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
+
+    my $prefix;
     if ($ENV{'QUERY_STRING'}=~/OBJCOUNT\=/) {
-	&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
 	$prefix='form.';
+    } else {
+	$prefix="cgi.$env{'form.token'}.";
     }
+
+    my $image;
     if (defined($env{$prefix."BGIMG"})) {
 	my $bgimg=&unescape($env{$prefix."BGIMG"});
 	#&Apache::lonnet::logthis("BGIMG is ".$bgimg);
 	$image=&get_image($bgimg,0);
 	if (! defined($image)) {
 	    &Apache::lonnet::logthis('Unable to create image object for -'.
-				     $id.'-'.$bgimg);
+				     $env{'form.token'}.'-'.$bgimg);
 	    return OK;
 	}
     } elsif (defined($env{$prefix."SIZE"})) {
@@ -301,7 +305,7 @@
 	    $image->transparent($bgcolor);
 	}
     } else {
-	&Apache::lonnet::logthis('Unable to create image object, no info');
+	&Apache::lonnet::logthis('Unable to create image object, no info '.$prefix);
 	return OK;
     }
     #binmode(STDOUT);