|
@@ -115,10 +115,10 @@ function readonlySetup(config){
|
|
|
return setup;
|
|
|
}
|
|
|
|
|
|
-function afterFormSetup(config,formConfig,data){
|
|
|
+function afterFormConfig(config,formConfig,data){
|
|
|
|
|
|
let debug=true;
|
|
|
- if (debug) print(config,"afterFormSetup ["+data.rows.length+"]");
|
|
|
+ if (debug) print(config,"afterFormConfig ["+data.rows.length+"]");
|
|
|
formConfig.formSetup=data;
|
|
|
|
|
|
|
|
@@ -1593,7 +1593,7 @@ function afterConfig(config){
|
|
|
function afterCrf(config,formConfig,data){
|
|
|
formConfig.crfEntry=data.rows[0];
|
|
|
|
|
|
- populateBasicData(config,data);
|
|
|
+
|
|
|
|
|
|
let selectRows=new Object();
|
|
|
selectRows.containerPath=config.containerPath;
|
|
@@ -1637,7 +1637,8 @@ function afterFormStatus(config, formConfig, data){
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- print(config,"Generating buttons for formStatus \""+formStatus+"\"");
|
|
|
+ print(config,"Generating buttons for formStatus \""+
|
|
|
+ formConfig.formStatus+"\"");
|
|
|
|
|
|
let done="FALSE";
|
|
|
if (formConfig.formStatus=="Submitted"){
|
|
@@ -1663,7 +1664,9 @@ function afterFormStatus(config, formConfig, data){
|
|
|
}
|
|
|
|
|
|
generateButton(config,"submitDiv","Done","Exit",redirect,config);
|
|
|
-
|
|
|
+ print(config,'Here');
|
|
|
+
|
|
|
+
|
|
|
|
|
|
config.fields=new Object();
|
|
|
config.queryMap=new Object();
|
|
@@ -1679,10 +1682,14 @@ function afterFormStatus(config, formConfig, data){
|
|
|
configSelectRows.queryName=config.setupQueryName;
|
|
|
|
|
|
configSelectRows.queryName="FormSetup";
|
|
|
- configSelectRows.filterArray=[LABKEY.Filter.create("formName",config.formId)];
|
|
|
-
|
|
|
- configSelectRows.success=function(data){afterFormSetup(config,formConfig,data);};
|
|
|
- configSelectRows.failure=onFailure;
|
|
|
+ configSelectRows.filterArray=[
|
|
|
+ LABKEY.Filter.create("formName",config.formId)];
|
|
|
+
|
|
|
+ print(config,'select rows into afterFormConfig id: '+config.formId);
|
|
|
+ configSelectRows.success=function(data){
|
|
|
+ afterFormConfig(config,formConfig,data);};
|
|
|
+ configSelectRows.failure=onFailure;
|
|
|
+
|
|
|
LABKEY.Query.selectRows(configSelectRows);
|
|
|
|
|
|
}
|
|
@@ -1724,13 +1731,17 @@ function afterCRFEntry(config,data){
|
|
|
function afterSite(config,data){
|
|
|
print(config,"afterSite");
|
|
|
config.formConfig.site=data.rows[0];
|
|
|
- print(config,"Setting site name to "+config.formConfig.site["siteName"]+" phone: "+config.formConfig.site["sitePhone"]);
|
|
|
+ print(config,"Setting site name to "+
|
|
|
+ config.formConfig.site["siteName"]
|
|
|
+ +" phone: "+config.formConfig.site["sitePhone"]);
|
|
|
|
|
|
let selectRows=new Object();
|
|
|
selectRows.containerPath=config.containerPath;
|
|
|
selectRows.schemaName='core';
|
|
|
selectRows.queryName='Users';
|
|
|
- selectRows.filterArray=[LABKEY.Filter.create('siteNumber',config.formConfig.crfEntry.UserId)];
|
|
|
+ selectRows.filterArray=[
|
|
|
+ LABKEY.Filter.create('siteNumber',
|
|
|
+ config.formConfig.crfEntry.UserId)];
|
|
|
selectRows.success=function(data){afterUser(config,data)};
|
|
|
LABKEY.Query.selectRows(selectRows);
|
|
|
}
|
|
@@ -1752,7 +1763,8 @@ function afterUser(config,data){
|
|
|
|
|
|
function afterFormSetup(config,data){
|
|
|
config.formConfig.formSetup=data;
|
|
|
- print(config,"Number of datasets for form ["+config.formId+"]: "+config.formConfig.formSetup.rows.length);
|
|
|
+ print(config,"Number of datasets for form ["+config.formId+"]: "+
|
|
|
+ config.formConfig.formSetup.rows.length);
|
|
|
|
|
|
let fields=config.formConfig.formSetup.metaData.fields;
|
|
|
let formQueryName='queryName';
|
|
@@ -1802,35 +1814,35 @@ function afterFormDatasets(config,data){
|
|
|
|
|
|
}
|
|
|
|
|
|
-function loadFile(config){
|
|
|
-
|
|
|
- let file=config.fb.files[0];
|
|
|
- print(config.config,'Y: '+file.name);
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- let server='https://merlin.fmf.uni-lj.si/labkey/_webdav';
|
|
|
- let project='Test';
|
|
|
- let path='@files';
|
|
|
- let url=server+'/'+project+'/'+path+'/'+file.name;
|
|
|
- let connConfig=new Object();
|
|
|
- connConfig.disableCaching=true;
|
|
|
- connConfig.method='PUT';
|
|
|
- connConfig.url=url;
|
|
|
- let conn = new Ext4.data.Connection (connConfig);
|
|
|
- print(config.config,'YY: '+url);
|
|
|
-
|
|
|
- let request=new Object();
|
|
|
- request.headers=new Object();
|
|
|
- headers['Content-Type']='application/octet-stream';
|
|
|
- headers['X-Requested-With']='XMLHttpRequest';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- request.rawData=file;
|
|
|
+
|
|
|
|
|
|
- request.success=function(){print(config.config,'YYY');}
|
|
|
- conn.request(request);
|
|
|
- print(config.config,'YYYY');
|
|
|
-
|
|
|
-}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
function addFileUpload(config, divName){
|
|
|
let el=config.document.getElementById(divName);
|
|
@@ -1844,13 +1856,14 @@ function addFileUpload(config, divName){
|
|
|
let c2=row.insertCell(1);
|
|
|
let sb=config.document.createElement('input');
|
|
|
sb.setAttribute("type", "button");
|
|
|
- sb.id=divName+'_submitFiles');
|
|
|
+ sb.id=divName+'_submitFiles';
|
|
|
sb.value='Submit';
|
|
|
+ el.appendChild(tab);
|
|
|
|
|
|
let loadFileConfig=new Object();
|
|
|
loadFileConfig.fb=fb;
|
|
|
loadFileConfig.config=config;
|
|
|
- sb.addEventListener('click', function(){loadFile(loadFileConfig);});
|
|
|
+
|
|
|
print(config,'X: '+sb);
|
|
|
}
|
|
|
|