version 1.17, 2009/05/11 16:51:22
|
version 1.18, 2014/02/14 17:01:30
|
Line 59 ENDSUBM
|
Line 59 ENDSUBM
|
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
|
|
$r->print(<<"ENDSUBM"); |
$r->print( |
$start_page |
$start_page |
<h3>Position Selected</h3> |
.'<h1>'.&mt('Position Selected').'</h1>' |
$display |
.$display |
$needimage |
.$needimage |
$end_page |
.$end_page); |
ENDSUBM |
|
} |
} |
|
|
sub storedata { |
sub storedata { |
Line 89 sub storedata {
|
Line 88 sub storedata {
|
my (undef,$x,$y)=split(':',$env{"imagechoice.$id.coords"}); |
my (undef,$x,$y)=split(':',$env{"imagechoice.$id.coords"}); |
if ($env{"imagechoice.$id.formx"}) { |
if ($env{"imagechoice.$id.formx"}) { |
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formx"}.'.value='.$x.';'; |
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formx"}.'.value='.$x.';'; |
$display.="<p>The X coordinate is $x</p>\n"; |
$display.='<p>'.&mt('The X coordinate is [_1]',$x)."</p>\n"; |
} |
} |
if ($env{"imagechoice.$id.formy"}) { |
if ($env{"imagechoice.$id.formy"}) { |
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formy"}.'.value='.$y.';'; |
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formy"}.'.value='.$y.';'; |
$display.="<p>The Y coordinate is $y</p>\n"; |
$display.='<p>'.&mt('The Y coordinate is [_1]',$y)."</p>\n"; |
} |
} |
} elsif ($type eq 'polygon' or $type eq 'box') { |
} elsif ($type eq 'polygon' or $type eq 'box') { |
my $coordstr; |
my $coordstr; |
Line 101 sub storedata {
|
Line 100 sub storedata {
|
$coordstr.='('.shift(@coords).','.shift(@coords).')-'; |
$coordstr.='('.shift(@coords).','.shift(@coords).')-'; |
} |
} |
chop($coordstr); |
chop($coordstr); |
$display.="<p>The selected coordinates are <tt>$coordstr</tt></p>\n"; |
$display.='<p>'.&mt('The selected coordinates are [_1]',"<tt>$coordstr</tt>")."</p>\n"; |
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formcoord"}.'.value="'.$coordstr.'";'; |
$output.='opener.document.forms.'.$env{"imagechoice.$id.formname"}.'.'.$env{"imagechoice.$id.formcoord"}.'.value="'.$coordstr.'";'; |
} |
} |
if ($display) { |
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"; |
$display.='<p class="LC_info">' |
|
.&mt('If this window fails to close you may need to manually replace the old coordinates with the above value.') |
|
."</p>\n"; |
} |
} |
&deletedata($id); |
&deletedata($id); |
&closewindow($r,$output,$filename,$needimage,$display); |
&closewindow($r,$output,$filename,$needimage,$display); |
Line 119 sub getcoord {
|
Line 120 sub getcoord {
|
my (undef,@coords)=split(':',$env{"imagechoice.$id.coords"}); |
my (undef,@coords)=split(':',$env{"imagechoice.$id.coords"}); |
my $step=scalar(@coords)/2; |
my $step=scalar(@coords)/2; |
if ($step == 0) { |
if ($step == 0) { |
$heading=&mt('Select First Coordinate on Image'); |
$heading=&mt('Select First Coordinate on Image.'); |
#$nextstage='<input type="hidden" name="type" value="pairtwo" />'; |
#$nextstage='<input type="hidden" name="type" value="pairtwo" />'; |
} elsif ($step == 1) { |
} elsif ($step == 1) { |
$heading=&mt('Select Second Coordinate on Image'); |
$heading=&mt('Select Second Coordinate on Image.'); |
#$nextstage='<input type="hidden" name="type" value="pairthree" />'; |
#$nextstage='<input type="hidden" name="type" value="pairthree" />'; |
} else { |
} else { |
$heading=&mt('Select Finish to save selection'); |
$heading=&mt('Select [_1] to save selection.','"'.&mt('Save').'"'); |
$nextstage='<input type="submit" name="finish" value="'.&mt('Finish').'" />'; |
$nextstage='<input type="submit" name="finish" value="'.&mt('Save').'" />'; |
} |
} |
} elsif ($type eq 'polygon') { |
} elsif ($type eq 'polygon') { |
$heading=&mt('Enter Coordinate or click finish to close Polygon'); |
$heading=&mt('Click to select a Coordinate or click [_1] to close Polygon.', |
$nextstage='<input type="submit" name="finish" value="'.&mt('Finish').'" />'; |
'"'.&mt('Save').'"'); |
|
$nextstage='<input type="submit" name="finish" value="'.&mt('Save').'" />'; |
} elsif ($type eq 'point') { |
} elsif ($type eq 'point') { |
$heading=&mt('Click to select a Coordinate or click Finish to save current selection'); |
$heading=&mt('Click to select a Coordinate or click [_1] to save current selection.', |
$nextstage='<input type="submit" name="finish" value="'.&mt('Finish').'" />'; |
'"'.&mt('Save').'"'); |
|
$nextstage='<input type="submit" name="finish" value="'.&mt('Save').'" />'; |
} |
} |
|
|
|
my $headline = 'Get Coordinates'; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Get Coordinates',undef, |
&Apache::loncommon::start_page($headline,undef, |
{'bgcolor' => '#FFFFFF', |
{'bgcolor' => '#FFFFFF', |
'only_body' => 1,}); |
'only_body' => 1,}); |
|
|
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
|
$headline = &mt($headline); |
my $canceltext=&mt('Cancel'); |
my $canceltext=&mt('Cancel'); |
$r->print(<<"END"); |
$r->print(<<"END"); |
$start_page |
$start_page |
<h3>$heading</h3> |
<h1>$headline</h1> |
|
<p>$heading</p> |
<form method="post" action="/adm/imagechoice?token=$id"> |
<form method="post" action="/adm/imagechoice?token=$id"> |
$nextstage |
$nextstage |
<input type="submit" name="cancel" value="$canceltext" /> |
<input type="submit" name="cancel" value="$canceltext" /> |
Line 251 sub handler {
|
Line 256 sub handler {
|
my (undef,$id) = split(/=/,$ENV{'QUERY_STRING'}); |
my (undef,$id) = split(/=/,$ENV{'QUERY_STRING'}); |
my $filename = &unescape($env{"imagechoice.$id.file"}); |
my $filename = &unescape($env{"imagechoice.$id.file"}); |
my $formname = $env{"imagechoice.$id.formname"}; |
my $formname = $env{"imagechoice.$id.formname"}; |
if ($env{'form.cancel'} eq &mt('Cancel')) { |
if ($env{'form.cancel'}) { # eq &mt('Cancel')) { |
&deletedata($id); |
&deletedata($id); |
&closewindow($r,'',$filename); |
&closewindow($r,'',$filename); |
return OK; |
return OK; |
Line 260 sub handler {
|
Line 265 sub handler {
|
if (defined($env{'form.type'})) { $type=$env{'form.type'}; } |
if (defined($env{'form.type'})) { $type=$env{'form.type'}; } |
my $numcoords=&savecoord($id,$type); |
my $numcoords=&savecoord($id,$type); |
my $imurl=&drawimage($r,$type,$filename,$id); |
my $imurl=&drawimage($r,$type,$filename,$id); |
if ($env{'form.finish'} eq &mt('Finish')) { |
if ($env{'form.finish'}) { # eq &mt('Save')) { |
&storedata($r,$type,$imurl,$id); |
&storedata($r,$type,$imurl,$id); |
} else { |
} else { |
&getcoord($r,$type,$imurl,$id); |
&getcoord($r,$type,$imurl,$id); |