version 1.11, 2006/05/30 12:45:37
|
version 1.14, 2008/03/12 02:46:53
|
Line 26 package Apache::imagechoice;
|
Line 26 package Apache::imagechoice;
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::lonnet; |
use Apache::lonnet; |
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
use LONCAPA; |
|
|
|
|
Line 59 ENDSUBM
|
Line 58 ENDSUBM
|
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
|
|
my $js=<<"ENDSUBM"; |
$r->print(<<"ENDSUBM"); |
$start_page |
$start_page |
<h3>Position Selected</h3> |
<h3>Position Selected</h3> |
$display |
$display |
Line 125 sub getcoord {
|
Line 124 sub getcoord {
|
$heading='Select Second Coordinate on Image'; |
$heading='Select Second Coordinate on Image'; |
#$nextstage='<input type="hidden" name="type" value="pairthree" />'; |
#$nextstage='<input type="hidden" name="type" value="pairthree" />'; |
} else { |
} else { |
$heading='Select Finish to store selection.'; |
$heading='Select Finish to save selection.'; |
$nextstage='<input type="submit" name="finish" value="Finish" />'; |
$nextstage='<input type="submit" name="finish" value="Finish" />'; |
} |
} |
} elsif ($type eq 'polygon') { |
} elsif ($type eq 'polygon') { |
$heading='Enter Coordinate or click finish to close Polygon'; |
$heading='Enter Coordinate or click finish to close Polygon'; |
$nextstage='<input type="submit" name="finish" value="Finish" />'; |
$nextstage='<input type="submit" name="finish" value="Finish" />'; |
} elsif ($type eq 'point') { |
} elsif ($type eq 'point') { |
$heading='Click to select a Coordinate or click Finish to store current selection.'; |
$heading='Click to select a Coordinate or click Finish to save current selection.'; |
$nextstage='<input type="submit" name="finish" value="Finish" />'; |
$nextstage='<input type="submit" name="finish" value="Finish" />'; |
} |
} |
|
|
Line 166 sub savecoord {
|
Line 165 sub savecoord {
|
$data=join(':',($env{"imagechoice.$id.coords"}, |
$data=join(':',($env{"imagechoice.$id.coords"}, |
$env{"form.image.x"},$env{"form.image.y"})); |
$env{"form.image.x"},$env{"form.image.y"})); |
} |
} |
&Apache::lonnet::appenv("imagechoice.$id.coords"=>$data); |
&Apache::lonnet::appenv({"imagechoice.$id.coords"=>$data}); |
} |
} |
return int(scalar(split(':',$env{"imagechoice.$id.coords"}))/2); |
return int(scalar(split(':',$env{"imagechoice.$id.coords"}))/2); |
} |
} |
Line 238 sub drawimage {
|
Line 237 sub drawimage {
|
&drawX(\%data,$imid,$x,$y); |
&drawX(\%data,$imid,$x,$y); |
if ($type eq "polygon") { &drawPolygon(\%data,$id,$imid); } |
if ($type eq "polygon") { &drawPolygon(\%data,$id,$imid); } |
if ($type eq "box") { &drawBox(\%data,$id,$imid); } |
if ($type eq "box") { &drawBox(\%data,$id,$imid); } |
&Apache::lonnet::appenv(%data); |
&Apache::lonnet::appenv(\%data); |
return "/adm/randomlabel.png?token=$imid" |
return "/adm/randomlabel.png?token=$imid" |
} |
} |
|
|