version 1.93, 2012/02/28 22:42:31
|
version 1.95, 2012/02/29 01:46:52
|
Line 551 sub start_plotvector {
|
Line 551 sub start_plotvector {
|
$label=~s/\W//gs; |
$label=~s/\W//gs; |
$label=ucfirst($label); |
$label=ucfirst($label); |
unless ($label) { $label="NewVector"; } |
unless ($label) { $label="NewVector"; } |
|
if ($Apache::functionplotresponse::vectorlabels{$label}) { |
|
&Apache::lonxml::warning(&mt('Vector labels must be unique: [_1]',$label)); |
|
} |
|
$Apache::functionplotresponse::vectorlabels{$label}=1; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my ($xmin,$xmax,$ymin,$ymax)=&boundaries($parstack,$safeeval,-3); |
my ($xmin,$xmax,$ymin,$ymax)=&boundaries($parstack,$safeeval,-3); |
unless (defined($tailx)) { $tailx=$xmin; } |
unless (defined($tailx)) { $tailx=$xmin; } |
Line 602 sub start_drawvectorsum {
|
Line 606 sub start_drawvectorsum {
|
my $internalid = $Apache::inputtags::part.'_'.$Apache::inputtags::response[-1]; |
my $internalid = $Apache::inputtags::part.'_'.$Apache::inputtags::response[-1]; |
my $tailx=&Apache::lonxml::get_param('tailx',$parstack,$safeeval); |
my $tailx=&Apache::lonxml::get_param('tailx',$parstack,$safeeval); |
my $taily=&Apache::lonxml::get_param('taily',$parstack,$safeeval); |
my $taily=&Apache::lonxml::get_param('taily',$parstack,$safeeval); |
|
my $showvalue=&Apache::lonxml::get_param('showvalue',$parstack,$safeeval); |
my $vectorlist=&Apache::lonxml::get_param('vectorlist',$parstack,$safeeval); |
my $vectorlist=&Apache::lonxml::get_param('vectorlist',$parstack,$safeeval); |
my $label=&Apache::lonxml::get_param('label',$parstack,$safeeval); |
my $label=&Apache::lonxml::get_param('label',$parstack,$safeeval); |
$label=~s/\W//gs; |
$label=~s/\W//gs; |
Line 620 sub start_drawvectorsum {
|
Line 625 sub start_drawvectorsum {
|
$thisvector=~s/\W//gs; |
$thisvector=~s/\W//gs; |
$thisvector=ucfirst($thisvector); |
$thisvector=ucfirst($thisvector); |
unless ($thisvector) { next; } |
unless ($thisvector) { next; } |
|
unless ($Apache::functionplotresponse::vectorlabels{$thisvector}) { |
|
&Apache::lonxml::warning(&mt('Vectors must be defined before using them for drawing vector sums: [_1]',$thisvector)); |
|
next; |
|
} |
my $vectorx=$thisvector.'X'; |
my $vectorx=$thisvector.'X'; |
my $vectory=$thisvector.'Y'; |
my $vectory=$thisvector.'Y'; |
$result.=(<<ENDADDVEC); |
$result.=(<<ENDADDVEC); |
Line 632 ENDADDVEC
|
Line 641 ENDADDVEC
|
} |
} |
$result.="document.ggbApplet_$internalid.evalCommand(".'"'."xTot$label=".join('+',@sumx).'");'."\n"; |
$result.="document.ggbApplet_$internalid.evalCommand(".'"'."xTot$label=".join('+',@sumx).'");'."\n"; |
$result.="document.ggbApplet_$internalid.evalCommand(".'"'."yTot$label=".join('+',@sumy).'");'."\n"; |
$result.="document.ggbApplet_$internalid.evalCommand(".'"'."yTot$label=".join('+',@sumy).'");'."\n"; |
|
my $show=0; |
|
if ($showvalue=~/yes/i) { |
|
$show=1; |
|
} |
$result.=(<<ENDMAKEVECTOR); |
$result.=(<<ENDMAKEVECTOR); |
document.ggbApplet_$internalid.evalCommand("$label=Vector[($tailx,$taily),($tailx+xTot$label,$taily+yTot$label)]"); |
document.ggbApplet_$internalid.evalCommand("$label=Vector[($tailx,$taily),($tailx+xTot$label,$taily+yTot$label)]"); |
document.ggbApplet_$internalid.setLabelVisible("$label",true); |
document.ggbApplet_$internalid.setLabelVisible("$label",true); |
document.ggbApplet_$internalid.setLineThickness("$label",8); |
document.ggbApplet_$internalid.setLineThickness("$label",8); |
document.ggbApplet_$internalid.setColor("$label",255,0,0); |
document.ggbApplet_$internalid.setColor("$label",255,0,0); |
|
document.ggbApplet_$internalid.setLabelStyle("$label",VALUE=$show); |
ENDMAKEVECTOR |
ENDMAKEVECTOR |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
Line 646 ENDMAKEVECTOR
|
Line 660 ENDMAKEVECTOR
|
&Apache::edit::text_arg('Tail x:','tailx', |
&Apache::edit::text_arg('Tail x:','tailx', |
$token,'8'). |
$token,'8'). |
&Apache::edit::text_arg('Tail y:','taily', |
&Apache::edit::text_arg('Tail y:','taily', |
$token,'8').'<br />'. |
$token,'8'). |
|
&Apache::edit::select_arg('Show Value:','showvalue', |
|
['yes','no'],$token).'<br />'. |
&Apache::edit::text_arg('Vector List:','vectorlist', |
&Apache::edit::text_arg('Vector List:','vectorlist', |
$token,'40'). |
$token,'40'). |
&Apache::edit::end_row(); |
&Apache::edit::end_row(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$env{'form.'.&Apache::edit::html_element_name('label')}=ucfirst($env{'form.'.&Apache::edit::html_element_name('label')}); |
$env{'form.'.&Apache::edit::html_element_name('label')}=ucfirst($env{'form.'.&Apache::edit::html_element_name('label')}); |
my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'label','tailx','taily','vectorlist'); |
my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'label','tailx','taily','showvalue','vectorlist'); |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); } |
} |
} |
return $result; |
return $result; |
Line 1296 sub start_functionplotresponse {
|
Line 1312 sub start_functionplotresponse {
|
undef %Apache::functionplotresponse::previous; |
undef %Apache::functionplotresponse::previous; |
$Apache::functionplotresponse::inputfields=''; |
$Apache::functionplotresponse::inputfields=''; |
$Apache::functionplotresponse::counter=0; |
$Apache::functionplotresponse::counter=0; |
|
# Remember vectors |
|
undef %Apache::functionplotresponse::vectorlabels; |
# Remember rules |
# Remember rules |
undef @Apache::functionplotresponse::functionplotrules; |
undef @Apache::functionplotresponse::functionplotrules; |
undef @Apache::functionplotresponse::functionplotvectorrules; |
undef @Apache::functionplotresponse::functionplotvectorrules; |