Andrej Studen пре 5 година
родитељ
комит
391d9493b8
5 измењених фајлова са 76 додато и 55 уклоњено
  1. 0 48
      views/smokingHabits.html
  2. 0 5
      views/smokingHabits.view.xml
  3. 47 0
      views/test.html
  4. 5 0
      views/test.view.xml
  5. 24 2
      web/tecant/test.js

+ 0 - 48
views/smokingHabits.html

@@ -1,48 +0,0 @@
-<style>
-table {margin-bottom:20px;table-layout:fixed; border-collapse:collapse; border-spacing:10px}
-table.t1 {width:400px; border:1px solid black}
-table.t1 th {border:1px solid black;padding:4px;background-color:#e0e0e0}
-table.t1 td {text-align:center}
-table.t2 {width:800px; border:1px solid black;}
-table.t2 th {border:1px solid black;padding:4px;background-color:#e0e0e0}
-table.t2 td {border:1px solid black; text-align:center}
-
-div.d1 {text-align:center; width=400px; background-color:#e0e0e0;
-        font-size:      20px; margin-bottom:20px}
-</style>
-
-<table cellspacing="2" cellpadding="5" border="0">
-<tr><td>CRF ID: </td><td><strong id="crfRefId">1583163135258</strong></td></tr>
-</table>
-
-<form name="smokingHabitsForm" id="smokingHabitsForm">
-
-<div id="smokingHabitsDiv"></div>
-
-<textarea cols="30" rows="2" name="formStatus" id="formStatus">
-Loading
-</textarea>
-
-</form>
-
-<script type="application/javascript">
-
-
-window.onload = init();
-//var generateTable=require("tecant/generateTable.js");
-
-function init(){
-    //LABKEY.requiresScript("/tecant/scripts/tecant/generateTable.js", function() {
-            // Called back when all the scripts are loaded onto the page
-    //        document.getElementById('formStatus').value+="\n Adding scripts";
-    //    });
-    //generateTable("existingCondition","smokingHabitsDiv",true);
-    document.getElementById('formStatus').value+="\n Adding scripts";
-    if (typeof generateTable === "function")    
-        document.getElementById('formStatus').value+="\n generateTable defined";
-    document.getElementById('formStatus').value+="\n Obj:"+obj;
-    
-
-}
-
-</script>

+ 0 - 5
views/smokingHabits.view.xml

@@ -1,5 +0,0 @@
-<view xmlns="http://labkey.org/data/xml/view" title="Smoking Habits and Alcohol consumption">
-	<dependencies>
-			<dependency path="tecant/test.js"/>
-	</dependencies>
-</view>

+ 47 - 0
views/test.html

@@ -0,0 +1,47 @@
+<style>
+table {margin-bottom:20px;table-layout:fixed; border-collapse:collapse; border-spacing:10px}
+table.t1 {width:400px; border:1px solid black}
+table.t1 th {border:1px solid black;padding:4px;background-color:#e0e0e0}
+table.t1 td {text-align:center}
+table.t2 {width:800px; border:1px solid black;}
+table.t2 th {border:1px solid black;padding:4px;background-color:#e0e0e0}
+table.t2 td {border:1px solid black; text-align:center}
+
+div.d1 {text-align:center; width=400px; background-color:#e0e0e0;
+        font-size:      20px; margin-bottom:20px}
+</style>
+
+
+<textarea cols="90" rows="20" name="formStatus" id="formStatus">
+Loading
+</textarea>
+
+
+<script type="application/javascript">
+
+
+window.onload = init();
+
+
+function report(data){
+	myprint(this.config,"Got "+data.rows.length+" events");
+}
+
+function init(){
+    
+	let config=new Object();
+	config.document=document;
+	config.debugId='formStatus';
+	let setup=new Object();
+	setup.containerPath="TECANT/Data";
+	setup.schemaName="lists";
+	setup.queryName="alcoholConsumption";
+	setup.config=config;
+	setup.callback=report;
+	listQuery(config,setup);
+    	document.getElementById('formStatus').value+="\n Obj:"+obj;
+    
+
+}
+
+</script>

+ 5 - 0
views/test.view.xml

@@ -0,0 +1,5 @@
+<view xmlns="http://labkey.org/data/xml/view" title="Test">
+	<dependencies>
+			<dependency path="tecant/test.js"/>
+	</dependencies>
+</view>

+ 24 - 2
web/tecant/test.js

@@ -1,6 +1,28 @@
 var obj=new Object();
 obj.message='Andrej';
 
-function print(){
-    return this.message;
+function myprint(config,msg){
+   config.document.getElementById(config.debugId).value+="\n"+msg;
+}
+
+function generateQConfig(setup){
+   let qConfig=new Object();
+   qConfig.containerPath=setup.containerPath;
+   qConfig.schemaName=setup.schemaName;
+   qConfig.queryName=setup.queryName;
+   return qConfig;
+}
+
+
+function listQuery(config,setup){
+   let debug=true;
+   if (debug)
+   	myprint(config,"listQuery");
+   let qConfig=generateQConfig(setup);
+   qConfig.success=function(data){setup.callback(data)};
+   qConfig.failure=function(errorInfo){
+	myprint(config,"selectRows error: "+errorInfo.exception);
+   };
+   myprint(config,"selectRows");
+   LABKEY.Query.selectRows(qConfig);
 }