Fix two bugs in mctx.gui.js ++
authorJeremy Tan <[email protected]>
Sat, 19 Oct 2013 06:49:42 +0000 (14:49 +0800)
committerJeremy Tan <[email protected]>
Sat, 19 Oct 2013 06:49:42 +0000 (14:49 +0800)
testing/MCTXWeb/public_html/control.html
testing/MCTXWeb/public_html/static/mctx.control.js [new file with mode: 0644]
testing/MCTXWeb/public_html/static/mctx.graph.js
testing/MCTXWeb/public_html/static/mctx.gui.js

index 86a7f82..61157b6 100644 (file)
@@ -9,19 +9,15 @@
     <script type="text/javascript" src="static/jquery-1.10.1.min.js"></script>
     <script type="text/javascript" src="static/jquery.flot.min.js"></script>
     <script type="text/javascript" src="static/mctx.gui.js"></script>
+    <script type="text/javascript" src="static/mctx.control.js"></script>
     
     <link rel="stylesheet" type="text/css" href="static/style.css">
     <link rel="stylesheet" type="text/css" href="static/nav-menu.css">
     <script type="text/javascript">
       runBeforeLoad().done(function () {
         $(document).ready(function () {
-         $("#main_controls").submit(function () {
-           //Validate!
-           return false;
-         });
        });       
       })
-
     </script>
   </head>
   
                   <input id="experiment-stop" type="button" value="Stop">
                 </td>
               </tr>
-              <tr id="state-software-r">
-                <th>Software status</th>
-                <td id="state-software"></td>
-                <td></td>
-              </tr>
             </table>
             
             <div class="sub-title">Error and warning messages</div>
             <form id="start-controls" class="nice" action="#">
               <p>
                 <label for="experiment_name">Experiment name</label>
-                <input id="experiment_name" type="text" name="experiment_name">
+                <input id="experiment_name" type="text">
               </p>
               <p id="start-result">
                 &nbsp;
diff --git a/testing/MCTXWeb/public_html/static/mctx.control.js b/testing/MCTXWeb/public_html/static/mctx.control.js
new file mode 100644 (file)
index 0000000..cf67629
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Code for the controls page.
+ * @date 19-10-2013
+ */
+
+mctx.control = {};
+mctx.control.api = mctx.api + 'control'
+
+$(document).ready(function () {
+  $.ajax({
+    url : mctx.control.api,
+    data : {'action' : 'identify'}
+  }).done(function () {
+    
+  });
+});
+
index e79b6a8..4bb3e06 100644 (file)
@@ -23,6 +23,15 @@ mctx.graph.chart = null;
  * Appends each value pair to the result
  * @returns result
  */
+/**
+ * Helper - Calculate pairs of (dependent, independent) values
+ * Given input as (time, value) pairs for dependent and independent
+ * Appends each value pair to the result
+ * @param {array[][]} dependent Dependent data to be correlated with independent
+ * @param {array[][]} independent Independent data
+ * @param {array[][]} result Storage location
+ * @returns {dataMerge.result}
+ */
 function dataMerge(dependent, independent, result) {
        var j = 0;
        for (var i = 0; i < dependent.length-1; ++i) {
index 48737b5..3198055 100644 (file)
@@ -71,7 +71,14 @@ function debugLog () {
                 alert(arguments[i]);
             }
         } else {
-            console.log.apply(this, arguments);
+            try {
+              console.log.apply(this, arguments);
+            } catch (e) {
+              //Chromie
+              for (var i = 0; i < arguments.length; i++) {
+                console.log(arguments[i]);
+              }
+            }
         }
     }
 }
@@ -265,11 +272,16 @@ $.fn.setErrorLog = function () {
     var url = mctx.api + "errorlog";
     var outdiv = this;
 
+    if ($(this).length <= 0) {
+      //No error log, so do nothing.
+      return;
+    }
+
     var updater = function () {
         $.ajax({url : url}).done(function (data) {
             outdiv.text(data);
             outdiv.scrollTop(
-            outdiv[0].scrollHeight - outdiv.height()
+              outdiv[0].scrollHeight - outdiv.height()
             );
             setTimeout(updater, 3000);
         }).fail(function (jqXHR) {

UCC git Repository :: git.ucc.asn.au