浏览代码

Adding the settings list and sensitivity to sendMail variable to block email sending after submission; troubles related to high level of security associated with email sending

Andrej Studen @ ONKO-NIX 2 年之前
父节点
当前提交
348cf45569
共有 1 个文件被更改,包括 39 次插入1 次删除
  1. 39 1
      web/crf/crfVisit.js

+ 39 - 1
web/crf/crfVisit.js

@@ -1781,6 +1781,17 @@ function changeCRFStatus(data){
 
 function sendEmail(data){
 
+	let st=config.formConfig.settings;
+	let cvar='sendEmail';
+	if (cvar in st){
+		print(cvar+' set to '+st[cvar]);
+		if (st[cvar]=='FALSE'){
+			print('Skipping sending emails');
+			redirect();
+			return;
+		}
+	}
+	
 	print('send email'+data.rows.length);
 	let crf=data.rows[0]['entryId'];
 	let formId=data.rows[0]['Form'];
@@ -2361,7 +2372,7 @@ function setFormConfig(){
 	//add object to store form related data
 	config.formConfig=new Object();
 
-	config.formConfig.softwareVersion='0.11.a';
+	config.formConfig.softwareVersion='0.12.6';
 	let debug=true;
 
 	if (debug)
@@ -2376,6 +2387,32 @@ function setFormConfig(){
 	setContainer('config',LABKEY.ActionURL.getContainer());
 	setContainer('CRF',LABKEY.ActionURL.getContainer());
 
+	let selectRows=new Object();
+	//this is local data
+	selectRows.containerPath=getContainer('config');
+	selectRows.schemaName='lists';
+	selectRows.queryName='crfSettings';
+	//store form related data to this object
+	selectRows.success=afterSettings;
+	LABKEY.Query.selectRows(selectRows);
+
+}
+
+
+function afterSettings(data){
+
+	config.formConfig.settings=new Array();
+	for (let i=0;i<data.rows.length;i++){
+		let n=data.rows[i]['name'];
+		let v=data.rows[i]['value'];
+		config.formConfig.settings[n]=v;
+	}
+
+	let st=config.formConfig.settings;
+	print('afterSettings');
+	for (let k in st){
+		print('\t'+k+'='+st[k]);
+	}
 
 	let selectRows=new Object();
 	//this is local data
@@ -2387,6 +2424,7 @@ function setFormConfig(){
 	//store form related data to this object
 	selectRows.success=afterCRFEntry;
 	LABKEY.Query.selectRows(selectRows);
+
 }
 
 function afterCRFEntry(data){