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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 25 Aug 2005 19:33:16 -0000


albertel		Thu Aug 25 15:33:16 2005 EDT

  Modified files:              
    /loncom/homework	imagechoice.pm 
  Log:
  - BUG#4277 work around bug in safari
  
  
Index: loncom/homework/imagechoice.pm
diff -u loncom/homework/imagechoice.pm:1.8 loncom/homework/imagechoice.pm:1.9
--- loncom/homework/imagechoice.pm:1.8	Thu Apr  7 02:56:21 2005
+++ loncom/homework/imagechoice.pm	Thu Aug 25 15:33:14 2005
@@ -1,4 +1,4 @@
-# $Id: imagechoice.pm,v 1.8 2005/04/07 06:56:21 albertel Exp $
+# $Id: imagechoice.pm,v 1.9 2005/08/25 19:33:14 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,7 +33,7 @@
 }
 
 sub closewindow {
-    my ($r,$output,$filename,$needimage)=@_;
+    my ($r,$output,$filename,$needimage,$display)=@_;
     if ($needimage) {
 	$needimage="<img name=\"pickimg\" src=\"$filename\" />";
     }
@@ -47,6 +47,7 @@
 </script>
 <body bgcolor="#FFFFFF" onLoad="submitthis()">
 <h3>Position Selected</h3>
+$display
 $needimage
 </body>
 </html>
@@ -69,13 +70,16 @@
 	$needimage=1;
     }
 
+    my $display;
     if ($type eq 'point') {
 	my (undef,$x,$y)=split(':',$env{"imagechoice.$id.coords"});
 	if ($env{"imagechoice.$id.formx"}) {
 	    $output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formx"}.'.value='.$x.';';
+	    $display.="<p>The X coordinate is $x</p>\n";
 	}
 	if ($env{"imagechoice.$id.formy"}) {
 	    $output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formy"}.'.value='.$y.';';
+	    $display.="<p>The Y coordinate is $y</p>\n";
 	}
     } elsif ($type eq 'polygon' or $type eq 'box') {
 	my $coordstr;
@@ -83,11 +87,14 @@
 	    $coordstr.='('.shift(@coords).','.shift(@coords).')-';
 	}
 	chop($coordstr);
+	$display.="<p>The selected coordinates are <tt>$coordstr</tt></p>\n";
 	$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formcoord"}.'.value="'.$coordstr.'";';
     }
-
+    if ($display) {
+	$display.="<p>If this window fails to close you may need to manually replace the old coordinates with the above value.</p>\n";
+    }
     &deletedata($id);
-    &closewindow($r,$output,$filename,$needimage);
+    &closewindow($r,$output,$filename,$needimage,$display);
 }
 
 sub getcoord {