Annotation of loncom/cgi/imagechoice.pl, revision 1.1
1.1 ! www 1: #!/usr/bin/perl
! 2: #
! 3: # $Id: plot.gif,v 1.9 2002/03/01 14:03:50 matthew Exp $
! 4: #
! 5: # Copyright Michigan State University Board of Trustees
! 6: #
! 7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
! 8: #
! 9: # LON-CAPA is free software; you can redistribute it and/or modify
! 10: # it under the terms of the GNU General Public License as published by
! 11: # the Free Software Foundation; either version 2 of the License, or
! 12: # (at your option) any later version.
! 13: #
! 14: # LON-CAPA is distributed in the hope that it will be useful,
! 15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 17: # GNU General Public License for more details.
! 18: #
! 19: # You should have received a copy of the GNU General Public License
! 20: # along with LON-CAPA; if not, write to the Free Software
! 21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! 22: #
! 23: # /home/httpd/cgi-bin/plot.gif
! 24: #
! 25: # http://www.lon-capa.org/
! 26: #
! 27: use strict;
! 28:
! 29: $|=1;
! 30:
! 31: my %data;
! 32: foreach (split/&/,$ENV{'QUERY_STRING'}) {
! 33: my ($name,$value)=split/=/;
! 34: $data{$name}=$value;
! 35: }
! 36: my $filename = $data{'file'};
! 37: my $formname = $data{'formname'};
! 38: my $formx = $data{'formx'};
! 39: my $formy = $data{'formy'};
! 40: my $formwidth = $data{'formwidth'};
! 41: my $formheight = $data{'formheight'};
! 42: # unescape filename
! 43: $filename =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
! 44:
! 45:
! 46: if ((defined($data{'x'})) && (defined($data{'y'}))) {
! 47: print <<"ENDSUBM";
! 48: Content-type: text/html
! 49:
! 50: <html>
! 51: <script>
! 52: function submitthis() {
! 53: alert('Submitting '+document.pickimg.height+' '+document.pickimg.width);
! 54: }
! 55: </script>
! 56: <body bgcolor="#FFFFFF" onLoad="submitthis()">
! 57: <h3>Position Selected</h3>
! 58: <img name="pickimg" src="$filename" />
! 59: </body>
! 60: </html>
! 61: ENDSUBM
! 62: } else {
! 63: print <<"END";
! 64: Content-type: text/html
! 65:
! 66: <html>
! 67: <body bgcolor="#FFFFFF">
! 68: <h3>Select Position on Image</h3>
! 69: <form>
! 70: <input type="hidden" name="formname" value="$formname" />
! 71: <input type="hidden" name="formx" value="$formx" />
! 72: <input type="hidden" name="formy" value="$formy" />
! 73: <input type="hidden" name="formwidth" value="$formwidth" />
! 74: <input type="hidden" name="formheight" value="$formheight" />
! 75: <input type="hidden" name="file" value="$filename" />
! 76: <input type="image" src="$filename" />
! 77: </form>
! 78: </body>
! 79: </html>
! 80: END
! 81: }
! 82:
! 83:
! 84:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>