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

www www at source.lon-capa.org
Thu Aug 16 19:03:02 EDT 2012


www		Thu Aug 16 23:03:02 2012 EDT

  Modified files:              
    /loncom/homework	functionplotresponse.pm 
  Log:
  Further work on HTML5.
  
  TODO: Need to replace "_" in applet-ID, as JavaScript implementation ignores it.
  
  
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.96 loncom/homework/functionplotresponse.pm:1.97
--- loncom/homework/functionplotresponse.pm:1.96	Thu Aug 16 21:02:29 2012
+++ loncom/homework/functionplotresponse.pm	Thu Aug 16 23:03:01 2012
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # Functionplot responses
 #
-# $Id: functionplotresponse.pm,v 1.96 2012/08/16 21:02:29 www Exp $
+# $Id: functionplotresponse.pm,v 1.97 2012/08/16 23:03:01 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,7 +49,7 @@
 # Return a true value if HTML5 should be used.
 
 sub useHTML5 {
-    return 0;
+    return 1;
 }
 
 # Routines to start the applet (Java) or the HTML5/JavaScript
@@ -69,14 +69,18 @@
 }
 
 sub geogebra_endcode {
-    unless (&useHTML5()) {
+    if (&useHTML5()) {
+        return '';
+    } else {
         return &java_geogebra_endcode();
     }
 }
 
 sub geogebra_default_parameters {
     my ($id)=@_;
-    unless (&useHTML5()) {
+    if (&useHTML5()) {
+        return '';
+    } else {
         return &java_geogebra_default_parameters($id);
     }
 }
@@ -107,6 +111,10 @@
 
 sub html5_geogebra_startcode {
     my ($id,$width,$height)=@_;
+    $width=int(1.*$width);
+    $height=int(1.*$height);
+    unless ($width) { $width=700; }
+    unless ($height) { $height=400; }
     my $code=&geogebra_internal_program();
     return (<<ENDSTARTCODE);
 <article class="geogebraweb" data-param-enableLabelDrags="false" data-param-enableShiftDragZoom="false" 
@@ -174,6 +182,7 @@
            '<script type="text/javascript" language="javascript" src="/adm/geogebra/html5/web/test42/web/web.nocache.js"></script>';
       }
       return (<<ENDGGBINIT);
+$html5init
 <script type="text/javascript">
 // <![CDATA[
 // Function that each applet will call when loaded




More information about the LON-CAPA-cvs mailing list