[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm /homework/templates functionplotvector.problem

www www at source.lon-capa.org
Tue Feb 28 20:24:50 EST 2012


www		Wed Feb 29 01:24:50 2012 EDT

  Modified files:              
    /loncom/homework	functionplotresponse.pm 
    /loncom/homework/templates	functionplotvector.problem 
  Log:
  Make it so the components of the sum vector can be shown
  
  
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.93 loncom/homework/functionplotresponse.pm:1.94
--- loncom/homework/functionplotresponse.pm:1.93	Tue Feb 28 22:42:31 2012
+++ loncom/homework/functionplotresponse.pm	Wed Feb 29 01:24:47 2012
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # Functionplot responses
 #
-# $Id: functionplotresponse.pm,v 1.93 2012/02/28 22:42:31 www Exp $
+# $Id: functionplotresponse.pm,v 1.94 2012/02/29 01:24:47 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -602,6 +602,7 @@
     my $internalid = $Apache::inputtags::part.'_'.$Apache::inputtags::response[-1];
     my $tailx=&Apache::lonxml::get_param('tailx',$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 $label=&Apache::lonxml::get_param('label',$parstack,$safeeval);
     $label=~s/\W//gs;
@@ -632,11 +633,16 @@
             }
             $result.="document.ggbApplet_$internalid.evalCommand(".'"'."xTot$label=".join('+', at sumx).'");'."\n";
             $result.="document.ggbApplet_$internalid.evalCommand(".'"'."yTot$label=".join('+', at sumy).'");'."\n";
+            my $show=0;
+            if ($showvalue=~/yes/i) {
+                $show=1;
+            }
             $result.=(<<ENDMAKEVECTOR);
 document.ggbApplet_$internalid.evalCommand("$label=Vector[($tailx,$taily),($tailx+xTot$label,$taily+yTot$label)]");
 document.ggbApplet_$internalid.setLabelVisible("$label",true);
 document.ggbApplet_$internalid.setLineThickness("$label",8);
 document.ggbApplet_$internalid.setColor("$label",255,0,0);
+document.ggbApplet_$internalid.setLabelStyle("$label",VALUE=$show);
 ENDMAKEVECTOR
         }
     } elsif ($target eq 'edit') {
@@ -646,13 +652,15 @@
              &Apache::edit::text_arg('Tail x:','tailx',
                                      $token,'8').
              &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',
                                      $token,'40').
              &Apache::edit::end_row();
     } elsif ($target eq 'modified') {
         $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); }
     }
     return $result;
Index: loncom/homework/templates/functionplotvector.problem
diff -u loncom/homework/templates/functionplotvector.problem:1.2 loncom/homework/templates/functionplotvector.problem:1.3
--- loncom/homework/templates/functionplotvector.problem:1.2	Tue Feb 28 22:42:34 2012
+++ loncom/homework/templates/functionplotvector.problem	Wed Feb 29 01:24:50 2012
@@ -19,7 +19,7 @@
 <plotvector label="KineticFriction" tailx="7" taily="2" tipx="8" tipy="2" />
 <plotvector label="StaticFriction" tailx="7" taily="3" tipx="8" tipy="3" />
 <plotvector label="NormalForce" tailx="7" taily="4" tipx="8" tipy="4" />
-<drawvectorsum label="Sum" tailx="$massx" taily="$massy" vectorlist="Gravity,KineticFriction,StaticFriction,NormalForce" />
+<drawvectorsum label="Sum" tailx="$massx" taily="$massy" showvalue="no" vectorlist="Gravity,KineticFriction,StaticFriction,NormalForce" />
 </functionplotelements>
 <functionplotruleset>
 <functionplotvectorrule index="Grav" vector="Gravity" attachpoint="Mass" angle="270" angleerror="2" />




More information about the LON-CAPA-cvs mailing list