소스 검색

Harmonizing database calls throughout crfVisit, splitting off sub-projects to separate files

Andrej Studen 2 년 전
부모
커밋
5da96bb977
6개의 변경된 파일776개의 추가작업 그리고 803개의 파일을 삭제
  1. 1 0
      views/visit.view.xml
  2. 155 0
      web/crfTecant/crfPrint.js
  3. 403 0
      web/crfTecant/crfReviewSection.js
  4. 158 759
      web/crfTecant/crfVisit.js
  5. 46 36
      web/crfTecant/formGenerator.js
  6. 13 8
      web/crfTecant/formPortal.js

+ 1 - 0
views/visit.view.xml

@@ -1,5 +1,6 @@
 <view xmlns="http://labkey.org/data/xml/view" title="CRF Form (Tecant)">
 	<dependencies>
+      <dependency path="crfTecant/crfPrint.js"/>
       <dependency path="crfTecant/runQuery.js"/>
       <dependency path="crfTecant/generateRegistration.js"/>
       <dependency path="crfTecant/participantIdManager.js"/>

+ 155 - 0
web/crfTecant/crfPrint.js

@@ -0,0 +1,155 @@
+//printing section
+
+function checkBlob(){
+	print("checkBlob: "+config.blob);
+	if (config.blob) {
+		clearInterval(config.blobInterval);
+		config.a.href = config.window.URL.createObjectURL(config.blob);
+		print("HREF: "+config.a.href);
+		config.a.download = 'test.pdf';
+		config.a.click();
+		config.window.URL.revokeObjectURL(config.a.href);
+	}
+	config.count=config.count+1;
+	print("Eval: "+config.count);
+	if (config.count>100){
+		clearInterval(config.blobInterval);
+	}
+
+}
+
+function printForm(){
+
+	config.doc=new PDFDocument();
+	//config.doc.end();
+	let stream = config.doc.pipe(blobStream()).on("finish",function(){
+			config.blob=stream.toBlob("application/pdf");});
+	
+	print("BLob: "+config.blob);
+	config.a = config.document.createElement("a");
+	config.document.body.appendChild(config.a);
+	config.a.innerHTML="Download PDF";
+	config.a.style = "display: none";
+	config.count=0;
+	//run until blob is set
+	config.blobInterval=setInterval(checkBlob,1000);
+
+	//pick data from crfForm list
+        print("Printing form");
+	printHeader();
+	setData(formatPrintData);
+}
+
+function printHeader(){
+	config.doc.fontSize(25).text(config.formConfig.form['formName']);
+	config.doc.moveDown();
+	let crfEntry=config.formConfig.crfEntry;
+	let site=config.formConfig.currentSite;
+	let val=new Object();
+	let user=config.formConfig.user;
+	val['A']={o:crfEntry,f:'EudraCTNumber',t:'Eudra CT Number'};
+	val['B']={o:crfEntry,f:'StudyCoordinator',t:'Study Coordinator'};
+	val['C']={o:crfEntry,f:'StudySponsor',t:'Study Sponsor'};
+	val['D']={o:site,f:'siteName',t:'Site'};
+	val['E']={o:site,f:'sitePhone',t:'Phone'};
+	val['F']={o:user,f:'DisplayName',t:'Investigator'};
+
+	for (let f in val){
+		print('Printing for '+f);
+		let e=val[f];
+		let entry=new Object();
+		entry[f]=e.o[e.f];
+		printPDF(entry,
+			{name:f,caption:e.t,type:'string'},null);
+	}
+	config.doc.moveDown();
+}
+
+function formatPrintData(){
+	qS=config.formConfig.dataQueries;
+	for (let q in qS){
+		print('Setting up '+q);
+		let qData=qS[q];
+		print('Number of rows: '+qData.rows.length);
+		if (qData.rows.length>0){
+			config.doc.fontSize(20).text(qData.title);
+		}
+		for (let i=0;i<qData.rows.length;i++){
+			let entry=qData.rows[i];
+		       	for (let f in qData.fields){
+				let field=qData.fields[f];
+				let lookup=null;
+				if (field.lookup){
+					lookup=config.formConfig.lookup[field.lookup.queryName];
+				}
+				if (field.hidden) continue;
+				printPDF(entry,field,lookup);
+			}
+		}
+		config.doc.moveDown();
+	}
+	print("All done");
+	config.doc.end();
+}
+
+function printPDF(entry,field,lookup){
+	//object field should have a name, type, caption
+	//entry should have field.name
+	//lookup is null or has a lookup table LUT 
+	//for value v of entry[field.name]
+	//
+	//the total width of a A4 page is 598 px, 
+	//left margin is 72. With a right margin of 50,
+	//the total available with is 476 px.
+	
+	let w=476;
+	let spacing=25;
+	let w1=(w-spacing)*0.5;
+	let fontSize=14;	
+	
+	print('printPDF: entry['+field.name+']='+entry[field.name]);
+	let v=entry[field.name];
+	if (lookup!=null){
+		v=lookup.LUT[v];
+	}
+	print('printPDF: field type:'+field.type);
+	if (field.type=="date"){
+		let d=new Date(v);
+		v=d.getDate()+'/'+(d.getMonth()+1)+'/'+d.getFullYear();
+	}	
+	if (v===null) v=' / ';
+	if (v===undefined) v=' / ';
+
+	//measure text
+	let label=field.caption;
+	let opt={width:w1};
+	config.doc.fontSize(fontSize);
+	
+	//for more eloquent display the height of the text
+	//can be measured prior to output
+	//use currentLineHeight to scale height
+	//let lineH=config.doc.currentLineHeight(1);
+	//let h=config.doc.heightOfString(label,opt)/lineH;
+
+
+	//print label
+	config.doc.font('Courier').text(label,opt);
+	
+	//align last row of description w/ first row of value
+	config.doc.moveUp();
+
+	//store x value for later use
+	let tx=config.doc.x;
+	let ty=config.doc.y;
+
+	//shift for value output
+	config.doc.x+=w1+spacing;
+	
+	config.doc.font('Courier-Bold').text(v,opt);
+
+	//restore x value
+	config.doc.x=tx;
+	
+}
+
+

+ 403 - 0
web/crfTecant/crfReviewSection.js

@@ -0,0 +1,403 @@
+function generateReviewSection(listName,id,callback){
+	//callback should be generateReviewSectionCB and it takes no arguments
+	print("generateReviewSection");
+	//need base path
+
+
+	config.loadFileConfig=new Object();
+	
+	
+	config.loadFileConfig.cb=callback;
+	config.loadFileConfig.id=id;
+	config.loadFileConfig.url=getBasePath()+'/@files/reportSetup/'+listName+'.json';
+	loadFile();
+	//load file and continue in the next function
+}
+
+function getParticipantCode(pid){
+
+	let filters=[LABKEY.Filter.create("crfRef",getCRFref())];
+	let mfId=config.formConfig.form['masterQuery'];
+   let queryName=config.formConfig.queryMap[mfId];
+	pid.afterId=setParticipantCode;
+	pid.participantField=config.formConfig.studyData["SubjectColumnName"];
+	let cb=function(data){afterRegistration(pid,data);}
+   //untested
+   cvSelectRows('lists',queryName,filters,cb,getContainer('data'));
+}
+
+function visitCodeFromVisitId(visitId){
+	if (visitId<0) return "NONE";
+	let project=getContainer('data');
+	print('visitCodeFromVisitId: '+project.search('retro'));
+	if (project.search('retro')>-1)
+		visitId-=1;
+	return 'VISIT_'+visitId.toString();
+}
+
+function replaceSlash(x){
+	return x.replace(/\//,'_');
+}
+
+function setParticipantCode(pid){
+	let fName='[setParticipantCode]';
+	let rows=pid.registration.rows;
+	//pick from study
+	let participantField=config.formConfig.studyData["SubjectColumnName"];
+	if (rows.length==1){
+		print(fName+': '+rows[0][participantField]+'/'+rows[0].visitId);
+		let visitCode=visitCodeFromVisitId(rows[0].visitId);
+		print('setParticipantCode: '+pid.participantId+'/'+visitCode);
+		pid.participantCode=replaceSlash(pid.participantId);
+		pid.visitCode=visitCode;
+	}
+	generateReviewSection2(pid);
+}
+
+function generateReviewSectionCB(){
+
+	let listName=config.loadFileConfig.listName;
+	let id=config.loadFileConfig.id;
+
+	clearErrorMessage(listName);
+
+	let pid=new Object();
+	pid.participantCode="NONE";
+	pid.visitCode="NONE";
+	getParticipantCode(pid);
+	print('Get participant code sent');
+	//involves database search, continue after callback
+}
+
+function getValueFromElement(id,defaultValue){
+	let e=config.document.getElementById(id);
+	if (e!=null){
+		defaultValue=e.innerHTML;
+	}
+	return defaultValue;
+}
+
+function pickParticipantCodeFromPage(){
+	let pid=new Object();
+	pid.participantCode=getValueFromElement("participantCode","NIX-LJU-D2002-IRAE-A000");
+	pid.visitCode=getValueFromElement("visitCode","VISIT_1");
+	generateReviewSection2(pid);
+}
+
+function patternReplace(src,replacements,values){
+
+	for (rep in replacements){
+		let txt1=src.replace(new RegExp(rep),values[replacements[rep]]);
+		src=txt1;
+	}
+	return src;
+
+}
+
+function plotImage(cell,k,row,rowVariable,obj,pid){
+	let baseDir=patternReplace(obj.imageDir,obj.replacements,pid);
+	print('Base dir: '+pid.basePath);
+	pid[obj.variable]=obj.values[k];
+	cell.id=pid[obj.variable]+"_"+rowVariable+pid[rowVariable];
+	let img=null;
+	let imgId=cell.id+'_img_';
+	img=config.document.getElementById(imgId);
+	if (img===null){
+		img=config.document.createElement('img');
+		img.id=imgId;
+		cell.appendChild(img);
+	}
+	let imgSrc=patternReplace(obj.file,obj.replacements,pid);
+	print('Image: '+imgSrc);
+	let imagePath=pid.basePath+'/'+baseDir+'/'+imgSrc;
+			
+	img.src=imagePath;
+	img.width="300";
+
+	
+}
+
+function showReport(cell,k,row,rowVariable,obj,pid){
+
+	cell.width="300px";
+	cell.id='report_'+obj.values[k]+"_"+rowVariable+pid[rowVariable];
+	let reportConfig=new Object();
+	reportConfig.partName="Report";
+	reportConfig.renderTo=cell.id;
+	//reportConfig.showFrame=false;
+	//reportConfig.width="300";
+	reportConfig.frame="none";
+	reportConfig.partConfig=new Object();
+	reportConfig.partConfig.width="300";
+	reportConfig.partConfig.title="R Report";
+	reportConfig.partConfig.reportName=obj.values[k];
+	for (f in obj.parameters){
+		reportConfig.partConfig[f]=pid[f];
+	}
+	reportConfig.partConfig.showSection="myscatterplot";
+	let reportWebPartRenderer = new LABKEY.WebPart(reportConfig);
+	print('Render to: '+reportConfig.renderTo);
+	reportWebPartRenderer.render();
+}
+
+
+function showProbability(cell,k,row,rowSetup,j,obj,pid){
+	print('showProbability: '+rowSetup);
+	let rowVariable=rowSetup.variable;	
+	cell.id='prob_'+obj.values[k]+"_"+rowVariable+pid[rowVariable];
+
+	let probDensity=new Object();
+	probDensity.mean=rowSetup.mean[j];
+	probDensity.sigma=rowSetup.sigma[j];
+
+	print('showProbability: mean '+probDensity.mean+' sigma '+probDensity.sigma);
+
+
+	probDensity.func=obj.values[k];
+	probDensity.organCode=pid.organCode;
+	pid[obj.variable]=rowSetup[obj.variable][j];
+	probDensity.percentile=pid.percentile;
+	let selectRows=new Object();
+	selectRows.queryName=obj.queryName;
+	selectRows.schemaName="study";
+	selectRows.filterArray=[];
+	selectRows.containerPath=getContainer('data');
+	for (let f in obj.filters){
+		selectRows.filterArray.push(
+				LABKEY.Filter.create(f,pid[obj.filters[f]]));
+		print('Filter ['+f+']: '+pid[obj.filters[f]]);
+	}
+	selectRows.success=function(data){
+		drawProbability(data,cell,obj,pid,probDensity);}
+	LABKEY.Query.selectRows(selectRows);
+}
+
+function erf(x){
+	let fx=[0,0.02,0.04,0.06,0.08,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,
+		1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2,
+		2.1,2.2,2.3,2.4,2.5,3,3.5];
+	let fy=[0,0.222702589,0.328626759,0.428392355,0.520499878,
+		0.603856091,0.677801194,0.742100965,0.796908212,
+	 	0.842700793,0.880205070,0.910313978,0.934007945,
+		0.952285120,0.966105146,0.976348383,
+		0.983790459,0.989090502,0.992790429,0.995322265,
+		0.997020533,0.998137154,0.998856823,0.999311486,
+		0.999593048,0.999977910,0.999999257];
+	let n=32;
+	let i0=n-1;
+
+	for (let i=1;i<n;i++){
+		if (Math.abs(x)>fx[i]) continue;
+		i0=i-1;
+		break;
+	}
+	let fval=1;
+	if (i0<n-1){
+		//interpolate
+		let y1=fy[i0+1];
+		let y0=fy[i0];
+		let x1=fx[i0+1];
+		let x0=fx[i0];
+		fval=y0+(y1-y0)/(x1-x0)*(Math.abs(x)-x0);
+	}
+	print('Erf: '+fval);
+	if (x<0) return -fval;
+	return fval;
+}
+
+
+function setLine(fbox,name,value,fontSize){
+	let fpId=fbox.id+name;
+	let fp=config.document.getElementById(fpId);
+	if (fp===null){
+		fp=config.document.createElement("p");
+		fp.id=fpId;
+		fbox.appendChild(fp);
+	}
+	fp.classList.add("center");
+	fp.style.textAlign="center";
+	fp.style.fontSize=fontSize;
+	fp.innerText=value;
+}	
+
+function drawProbability(data,cell,obj,pid,probDensity){
+	print('drawProbability');
+	if (data.rows.length!=1){
+		print("drawProbability row length mismatch: "+data.rows.length);
+		return;
+	}
+	//possible mismatch; I assume the dataset will have a field called value
+	let val=data.rows[0].value;
+
+	let prob=0;
+	let fz=-100;
+
+	if (probDensity.func=="gaus"){
+		fz=(val-probDensity.mean)/probDensity.sigma/Math.sqrt(2);
+		prob=0.5+0.5*erf(fz);
+	}
+	let color="red";
+	let fzx=fz*Math.sqrt(2);
+	print('drawProbability '+fzx);
+
+	for (let i=1;i<obj.intervals.n;i++){
+		if (fzx>obj.intervals.zlimits[i]) continue;
+		color=obj.intervals.colors[i-1];
+		break;
+	}
+	
+	let fboxId=cell.id+'_fbox_';
+	let fbox=config.document.getElementById(fboxId);
+	if (fbox===null){
+		fbox=config.document.createElement("div");
+		fbox.id=fboxId;
+		cell.appendChild(fbox);
+	}
+	fbox.style.backgroundColor=color;
+	fbox.style.width="180px";
+	fbox.style.height="180px";
+	
+
+	print('organCode '+probDensity.organCode);
+	let organName="Lung";
+
+	if (probDensity.organCode==4){
+		organName="Thyroid";
+	}
+	if (probDensity.organCode==5){
+		organName="Bowel";
+	}
+
+	setLine(fbox,'_fp4_',organName,"16px");
+	setLine(fbox,'_fp_',val.toPrecision(3),"25px");
+	setLine(fbox,'_fp1_',"SUV("+probDensity.percentile+"%)","16px");
+	setLine(fbox,'_fp2_',fzx.toPrecision(3),"25px");
+	setLine(fbox,'_fp3_',"z-value","16px");
+
+
+}
+
+function generateReviewSection2(pid){ 
+	
+	let listName=config.loadFileConfig.listName;
+	let id=config.loadFileConfig.id;
+	
+	print('generateReviewSection2: '+pid.participantCode+'/'+
+		pid.visitCode);
+	if (pid.participantCode=="NONE" || pid.visitCode=="NONE"){
+		generateErrorMessage(id,listName,
+			"ParticipantId/visitId not set");
+		return;
+	}
+	
+
+	print('JSON: '+config.loadFileConfig.json);
+
+	let json=config.loadFileConfig.json;
+	let nrows=json.rows.values.length;
+	let ncol=json.columns.length;
+
+	pid.basePath=getBasePath()+"/@files";
+	
+	
+	let el=config.document.getElementById(id);
+	let tableId=id+'_Table';
+	let table=config.document.getElementById(tableId);
+	if (table==null){
+		table=config.document.createElement('table');
+		table.id=tableId;
+		el.appendChild(table);
+	}
+	table.style.tableLayout="fixed";
+	table.style.columnWidth="300px";
+	
+	for (let i=0;i<nrows;i++){
+		pid[json.rows.variable]=json.rows.values[i];
+		//let organ=organs[i];
+		let row=null;
+		if (i<table.rows.length)
+			row=table.rows[i];
+		else
+			row=table.insertRow();
+
+		let ic=0;
+		for (let j=0;j<ncol;j++){
+			let obj=json.columns[j];
+			let nv=obj.values.length;
+			for (let k=0;k<nv;k++){
+				let cell=null;
+				if (ic<row.cells.length)
+					cell=row.cells[ic];
+				else
+					cell=row.insertCell();
+				if (obj.display=="image") 
+					plotImage(cell,k,row,json.rows.variable,obj,pid);
+				if (obj.display=="report") 
+					showReport(cell,k,row,json.rows.variable,obj,pid);
+				if (obj.display=="probability"){ 
+					showProbability(cell,k,row,json.rows,i,obj,pid);
+				}	
+				ic++;
+			}
+
+
+		}
+		
+
+	}
+}
+
+///>>>>>>>>>>>>>>end of reviewSection(REPORT)
+
+function afterRegistration(data,fc){
+	let fName='[afterRegistration/'+data.queryName+']';
+	print(fName+": rows:"+data.rows.length);
+	fc.registration=data;
+	let registrationData=fc.registration;
+	clearErr();
+	if (registrationData.rows.length!=1){
+		let msg=fName+": ERROR: Found "+registrationData.rows.length;
+		msg+=" registration entries for crfrefid "+getCRFref();
+		print(msg);
+		fc.afterId(fc);
+		return;
+	}
+	print(fName+'registration participant field: '+fc.participantField);
+	fc.participantId=registrationData.rows[0][fc.participantField];
+	//could be a lookup field (particularly for studies)
+	print('ID: '+fc.participantId);	
+	let fields=registrationData.metaData.fields;
+	let field="NONE";
+	for (f in fields){
+		if (fields[f]["name"]==fc.participantField)
+			field=fields[f];
+	}
+	if ("lookup" in field){
+		let pid=fc.participantId;
+		print("Using lookup for participantId: "+pid);
+		let lookup=field["lookup"];
+		print("Lookup: ["+lookup.schemaName+','+lookup.queryName+']');
+
+      //load lookup
+		let cb=function(data){afterRegistrationLookup(data,lookup.displayColumn,fc)};
+		let filters=[LABKEY.Filter.create(lookup.keyColumn,pid)];
+      cvSelectRows(lookup.schemaName,lookup.queryName,filters,cb,lookup.containerPath);
+
+	}
+	else{
+		//afterParticipantId(configUpload);
+		fc.afterId(fc);
+	}
+}
+
+function afterRegistrationLookup(data,displayColumn,fc){
+	print("afterRegistrationLookup");
+	let entry=data.rows[0];
+	fc.participantId=entry[displayColumn];
+	print('Setting to '+fc.participantId);
+	fc.afterId(fc);
+	//afterParticipantId(configUpload);
+}
+
+
+

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 158 - 759
web/crfTecant/crfVisit.js


+ 46 - 36
web/crfTecant/formGenerator.js

@@ -1,3 +1,34 @@
+function addFormGenerator(){
+      
+   let fName='[addFormGenerator]';
+   print(fName);
+   //layout
+   let table=config.document.createElement("table");
+   table.className="t2";
+   config.document.getElementById(config.div).appendChild(table);
+   let formGenerator=new Object();
+   formGenerator.formSelect=addInputRow(table,'Select form',"select");
+   formGenerator.crfSelect=addInputRow(table,'Select CRF',"select");
+   formGenerator.comment=addInputRow(table,'Enter comment','text');
+   formGenerator.details=addInputRow(table,'Details','label');
+   formGenerator.warnings=addInputRow(table,'Warnings','label');
+   formGenerator.warnings.innerHTML='formGenerator version 1.1.0';
+   addOption(formGenerator.formSelect,'<Select>',-1);
+   let formRows=config.formConfig.generateConfigData.rows;
+   for (let i=0;i<formRows.length;i++){
+      let formId=formRows[i]["formId"];
+      let formName=getFormName(formId);
+      print(fName+' '+formRows[i]["formId"]+'/'+formName);
+      addOption(formGenerator.formSelect,formName,formId);
+   }
+   formGenerator.formSelect.onchange=function(){updateIdList(formGenerator);};
+   formGenerator.crfSelect.onchange=function(){updateLabel(formGenerator);};
+   formGenerator.generateButton=addInputRow(table,'Generate Form','button');
+   formGenerator.generateButton.value="Generate Form";
+   formGenerator.generateButton.onclick=function(){createFormWithId(formGenerator);};
+      
+}
+
 function fgInsertRow(schemaName,queryName,row,cb=null,containerPath=null){
    let fName='[fgInsertRow]';
    print(fName);
@@ -7,8 +38,9 @@ function fgInsertRow(schemaName,queryName,row,cb=null,containerPath=null){
       qconfig.containerPath=containerPath;
 	qconfig.schemaName=schemaName;
 	qconfig.queryName=queryName;
-	qconfig.success=cb;
-	qconfig.rows=[row];
+	qconfig.success=function(data){;};
+   if (cb) qconfig.success=cb;
+   qconfig.rows=[row];
    print(fName+' qconfig '+qconfig);
 	LABKEY.Query.insertRows(qconfig);
 }
@@ -97,39 +129,6 @@ function clearOptions(input){
    }
 }
 	
-
-   
-function addFormGenerator(){
-      
-   let fName='[addFormGenerator]';
-   print(fName);
-   //layout
-   let table=config.document.createElement("table");
-   table.className="t2";
-   config.document.getElementById(config.div).appendChild(table);
-   let formGenerator=new Object();
-   formGenerator.formSelect=addInputRow(table,'Select form',"select");
-   formGenerator.crfSelect=addInputRow(table,'Select CRF',"select");
-   formGenerator.comment=addInputRow(table,'Enter comment','text');
-   formGenerator.details=addInputRow(table,'Details','label');
-   formGenerator.warnings=addInputRow(table,'Warnings','label');
-   formGenerator.warnings.innerHTML='None';
-   addOption(formGenerator.formSelect,'<Select>',-1);
-   let formRows=config.formConfig.generateConfigData.rows;
-   for (let i=0;i<formRows.length;i++){
-      let formId=formRows[i]["formId"];
-      let formName=getFormName(formId);
-      print(fName+' '+formRows[i]["formId"]+'/'+formName);
-      addOption(formGenerator.formSelect,formName,formId);
-   }
-   formGenerator.formSelect.onchange=function(){updateIdList(formGenerator);};
-   formGenerator.crfSelect.onchange=function(){updateLabel(formGenerator);};
-   formGenerator.generateButton=addInputRow(table,'Generate Form','button');
-   formGenerator.generateButton.value="Generate Form";
-   formGenerator.generateButton.onclick=function(){createFormWithId(formGenerator);};
-      
-}
-      
 function createFormWithId(formGenerator){
    //get form id and entry id from select and create form as above
    let fName='[createFormWithId]';
@@ -182,8 +181,19 @@ function createFormWithId(formGenerator){
    reviewComment['reviewComment']=formGenerator.comment.value;
    reviewComment['queryName']=configRow['queryId'];
 
+   let crfStatus=new Object();
+   crfStatus.entryId=crfEntry.entryId;
+   crfStatus.submissionDate=new Date();
+   crfStatus.FormStatus=crfEntry.formStatus;
+   crfStatus.User=crfEntry.UserId;
+   crfStatus.Form=crfEntry.Form;
+   crfStatus.operator=config.role;
+   crfStatus.action='createFormWithId';
+
+
    let rd=function(data){redirect();};
-   let pass=function(data){fgInsertRow('lists','reviewComments',reviewComment,rd,getContainer('data'));}
+   let pass1=function(data){fgInsertRow('lists','crfStatus',crfStatus,rd,getContainer('data'));}
+   let pass=function(data){fgInsertRow('lists','reviewComments',reviewComment,pass1,getContainer('data'));}
    fgInsertRow('lists','crfEntry',crfEntry,pass,getContainer('data'));
 }
 

+ 13 - 8
web/crfTecant/formPortal.js

@@ -117,7 +117,7 @@ function generateFormArray(){
 	print("generateFormArray "+getMode());
 	
 	config.formConfig=new Object();
-	config.formConfig.softwareVersion='T.1.13';
+	config.formConfig.softwareVersion='T.1.15';
 	//report software version
 	config.document.getElementById('version').innerText=config.formConfig.softwareVersion;	
 	
@@ -535,13 +535,18 @@ function createForm(formId){
 	//from argument list
 	crfEntry.Form=formId;
 
-	let qconfig=new Object();
-	qconfig.containerPath=getContainer('data');
-	qconfig.schemaName='lists';
-	qconfig.queryName='crfEntry';
-	qconfig.success=function(data){openForm(crfEntry)};
-	qconfig.rows=[crfEntry];
-	LABKEY.Query.insertRows(qconfig);
+   let crfStatus=new Object();
+   crfStatus.entryId=crfEntry.entryId;
+   crfStatus.submissionDate=new Date();
+   crfStatus.FormStatus=crfEntry.formStatus;
+   crfStatus.User=crfEntry.UserId;
+   crfStatus.Form=crfEntry.Form;
+   crfStatus.operator=config.role;
+   crfStatus.action='createForm';
+
+   let cb=function(data){openForm(crfEntry);};
+   let pass=function(data){fgInsertRow('lists','crfStatus',crfStatus,cb,getContainer('data'));};
+   fgInsertRow('lists','crfEntry',crfEntry,pass,getContainer('data'));
 }
 
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.