Diff for /loncom/cgi/imagechoice.pl between versions 1.3 and 1.4

version 1.3, 2003/05/06 11:54:08 version 1.4, 2003/05/10 22:59:04
Line 37  my $filename = $data{'file'}; Line 37  my $filename = $data{'file'};
 my $formname = $data{'formname'};  my $formname = $data{'formname'};
 my $formx = $data{'formx'};  my $formx = $data{'formx'};
 my $formy = $data{'formy'};  my $formy = $data{'formy'};
   my $mode=$data{'mode'};
 my $formwidth = $data{'formwidth'};  my $formwidth = $data{'formwidth'};
 my $formheight = $data{'formheight'};  my $formheight = $data{'formheight'};
   my $formcoord=$data{'formcoord'};
 # unescape filename  # unescape filename
 $filename =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;  $filename =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
   
   #
 if ((defined($data{'x'})) && (defined($data{'y'}))) {  # Single coordinate, defined - store it
   #
   if ((defined($data{'x'})) && (defined($data{'y'})) && 
       ($mode ne 'pairtwo') && ($mode ne 'pairthree')) {
     my $output='';      my $output='';
     if ($data{'formwidth'}) {      if ($data{'formwidth'}) {
  $output.='opener.document.forms.'.$data{'formname'}.'.'.$data{'formwidth'}.   $output.='opener.document.forms.'.$data{'formname'}.'.'.$data{'formwidth'}.
Line 77  Content-type: text/html Line 82  Content-type: text/html
 </body>  </body>
 </html>  </html>
 ENDSUBM  ENDSUBM
   #
   # Coordinate Pair, Second Coordinate
   #
   } elsif ($mode eq 'pairthree') {
       my $output='';
       my $outputpair="($data{'selx'},$data{'sely'})-($data{'x'},$data{'y'})";
       if ($data{'formwidth'}) {
    $output.='opener.document.forms.'.$data{'formname'}.'.'.$data{'formwidth'}.
       '.value=document.pickimg.width;';
       }
       if ($data{'formheight'}) {
    $output.='opener.document.forms.'.$data{'formname'}.'.'.$data{'formheight'}.
       '.value=document.pickimg.height;';
       }
       if ($data{'formcoord'}) {
    $output.='opener.document.forms.'.$data{'formname'}.'.'.$data{'formcoord'}.
       '.value="'.$outputpair.'";';
       }
       print <<"ENDCOORDSUB";
   Content-type: text/html
   
   <html>
   <script>
       function submitthis() {
    $output
    self.close();
       }
   </script>
   <body bgcolor="#FFFFFF" onLoad="submitthis()">
   <h3>Coordinates Selected</h3>
   <img name="pickimg" src="$filename" />
   </body>
   </html>
   ENDCOORDSUB
   #
   # First and second call
   #
 } else {  } else {
       my $heading='Position';
       my $nextstage='';
       if ($mode eq 'pair') {
          $heading='First Coordinate';
          $nextstage='<input type="hidden" name="mode" value="pairtwo" />';
      } elsif ($mode eq 'pairtwo') {
          $heading='Second Coordinate';
          $nextstage=<<ENDNEXTSTAGE;
   <input type="hidden" name="mode" value="pairthree" />
   <input type="hidden" name="selx" value="$data{'x'}" />
   <input type="hidden" name="sely" value="$data{'y'}" />
   ENDNEXTSTAGE
      }
     print <<"END";      print <<"END";
 Content-type: text/html  Content-type: text/html
   
 <html>  <html>
 <body bgcolor="#FFFFFF">  <body bgcolor="#FFFFFF">
 <h3>Select Position on Image</h3>  <h3>Select $heading on Image</h3>
 <form>  <form>
 <input type="hidden" name="formname" value="$formname" />  <input type="hidden" name="formname" value="$formname" />
 <input type="hidden" name="formx" value="$formx" />  <input type="hidden" name="formx" value="$formx" />
 <input type="hidden" name="formy" value="$formy" />  <input type="hidden" name="formy" value="$formy" />
   <input type="hidden" name="formcoord" value="$formcoord" />
 <input type="hidden" name="formwidth" value="$formwidth" />  <input type="hidden" name="formwidth" value="$formwidth" />
 <input type="hidden" name="formheight" value="$formheight" />  <input type="hidden" name="formheight" value="$formheight" />
 <input type="hidden" name="file" value="$filename" />  <input type="hidden" name="file" value="$filename" />
   $nextstage
 <input type="image" src="$filename" />  <input type="image" src="$filename" />
 </form>  </form>
 </body>  </body>

Removed from v.1.3  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>