|
@@ -122,7 +122,7 @@ function setHTML(config,data,elementId,varName){
|
|
|
|
|
|
}
|
|
|
|
|
|
-function setAdditionalData(config,additionalData,entry){
|
|
|
+function setAdditionalData(config, additionalData,entry){
|
|
|
let debug=true;
|
|
|
if (debug) print(config,"setAdditionalData");
|
|
|
if (entry["showFlag"]==="NONE") {
|
|
@@ -163,87 +163,106 @@ function readonlySetup(config){
|
|
|
return setup;
|
|
|
}
|
|
|
|
|
|
-function generateForm(config,data){
|
|
|
+function afterFormSetup(config,formConfig,data){
|
|
|
|
|
|
let debug=true;
|
|
|
- if (debug) print(config,"generateForm ["+data.rows.length+"]");
|
|
|
- for (let i=0;i<data.rows.length;i++){
|
|
|
+ if (debug) print(config,"afterFormSetup ["+data.rows.length+"]");
|
|
|
+ formConfig.formSetup=data;
|
|
|
|
|
|
- if (debug) print(config,"generateForm ["+i+"/"+data.rows.length+"]");
|
|
|
+ //get list of queries
|
|
|
+ let fields=formConfig.formSetup.metaData.fields;
|
|
|
|
|
|
- let entry=data.rows[i];
|
|
|
- //this is actually a pointer into another list (==lookup)
|
|
|
- //another selectRows is needed to actually get the name for the queryName
|
|
|
- //
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- let fields=data.metaData.fields;
|
|
|
- if (debug) print(config,"generateForm ["+i+"]: fields: "+fields);
|
|
|
- let field="NONE";
|
|
|
- //if (debug) printTableSetup(config,data);
|
|
|
- for (f in fields){
|
|
|
- if (fields[f]['name']!='queryName') continue;
|
|
|
- field=fields[f];
|
|
|
- break;
|
|
|
- }
|
|
|
- if (debug) print(config,"generateForm ["+i+"]: field: "+field);
|
|
|
- let lookup=field.lookup;
|
|
|
- if (debug) print(config,"generateForm ["+i+"]: lookup: "+lookup);
|
|
|
- let qconfig=new Object();
|
|
|
- qconfig.containerPath=config.containerPath;
|
|
|
- qconfig.schemaName=lookup.schemaName;
|
|
|
- qconfig.queryName=lookup.queryName;
|
|
|
- qconfig.filterArray=[LABKEY.Filter.create(lookup.keyColumn,entry['queryName'])];
|
|
|
- qconfig.success=function(data){generateFormLookup(config,data,entry)};
|
|
|
- LABKEY.Query.selectRows(qconfig);
|
|
|
+ if (debug) print(config,"generateForm: fields: "+fields);
|
|
|
+ let field="NONE";
|
|
|
+ //if (debug) printTableSetup(config,data);
|
|
|
+ for (f in fields){
|
|
|
+ if (fields[f]['name']!='queryName') continue;
|
|
|
+ field=fields[f];
|
|
|
+ break;
|
|
|
}
|
|
|
+ if (debug) print(config,"generateForm: field: "+field);
|
|
|
+ let lookup=field.lookup;
|
|
|
+ if (debug) print(config,"generateForm: lookup: "+lookup);
|
|
|
+ let qconfig=new Object();
|
|
|
+ qconfig.containerPath=config.containerPath;
|
|
|
+ qconfig.schemaName=lookup.schemaName;
|
|
|
+ qconfig.queryName=lookup.queryName;
|
|
|
+
|
|
|
+ //qconfig.filterArray=[LABKEY.Filter.create(lookup.keyColumn,entry['queryName'])];
|
|
|
+ qconfig.filterArray=[];
|
|
|
+ qconfig.success=function(data){afterFormSetupLookup(config,formConfig,data)};
|
|
|
+ LABKEY.Query.selectRows(qconfig);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-function generateFormLookup(config,data,entry){
|
|
|
- //id : entry[queryName]
|
|
|
- //name: dentry[queryName]
|
|
|
-
|
|
|
+function afterFormSetupLookup(config,formConfig,data){
|
|
|
+ //walk through the list of datasets/list and generate tables for each list
|
|
|
let debug=true;
|
|
|
- let queryId=entry['queryName'];
|
|
|
|
|
|
- if (data.rows.length==0){
|
|
|
- alert("No rows found for listId: "+entry['queryName']);
|
|
|
- return;
|
|
|
- }
|
|
|
- let dentry=data.rows[0];
|
|
|
- if (debug)
|
|
|
- for (f in dentry) print(config,"generateFormLookup field: "+f+" value: "+dentry[f]);
|
|
|
+ formConfig.formSetupLookup=data;
|
|
|
+
|
|
|
+ let rows=formConfig.formSetup.rows;
|
|
|
+ //extract list of forms from formConfig
|
|
|
+ for (let i=0;i<rows.length;i++){
|
|
|
+
|
|
|
+ //each from has multiple lists associated with it
|
|
|
+ if (debug) print(config,"generateForm ["+i+"/"+rows.length+"]");
|
|
|
+
|
|
|
+ let entry=rows[i];
|
|
|
+ //this is actually a pointer into another list (==lookup)
|
|
|
+ //another selectRows is needed to actually get the name for the queryName
|
|
|
+
|
|
|
+ //id : entry[queryName]
|
|
|
+ //name: dentry[queryName]
|
|
|
|
|
|
- let queryName=dentry["queryName"];
|
|
|
+ let queryId=entry['queryName'];
|
|
|
|
|
|
- if (debug) print(config,"generateFormLookup: ID: "+queryId+" name: "+queryName);
|
|
|
+ //walk over keys to get the right lookup entry
|
|
|
+ let lookupRows=formConfig.formSetupLookup.rows;
|
|
|
+ let dentry=undefined;
|
|
|
+ for (let j=0;j<lookupRows.length;j++){
|
|
|
+
|
|
|
+ if (lookupRows[j].Key!=queryId)
|
|
|
+ continue;
|
|
|
+ dentry=lookupRows[j];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (dentry===undefined){
|
|
|
+ print(config,"generateForm ["+i+"] no list found");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (debug)
|
|
|
+ for (f in dentry)
|
|
|
+ print(config,"generateFormLookup field: "+f+" value: "+dentry[f]);
|
|
|
|
|
|
- //update fields for review
|
|
|
- if (!(queryName in config.fields))
|
|
|
- config.fields[queryName]=new Object();
|
|
|
+ let queryName=dentry["queryName"];
|
|
|
|
|
|
- if (!(queryId in config.queryMap))
|
|
|
- config.queryMap[queryId]=queryName;
|
|
|
+ if (debug) print(config,"generateFormLookup: ID: "+queryId+" name: "+queryName);
|
|
|
+
|
|
|
+ //update fields for review
|
|
|
+ if (!(queryName in config.fields))
|
|
|
+ config.fields[queryName]=new Object();
|
|
|
|
|
|
- let field=config.fields[queryName];
|
|
|
-
|
|
|
- field.title=entry["title"];
|
|
|
- field.queryId=queryId;
|
|
|
+ if (!(queryId in config.queryMap))
|
|
|
+ config.queryMap[queryId]=queryName;
|
|
|
+
|
|
|
+ let field=config.fields[queryName];
|
|
|
|
|
|
- if (debug) print(config,"entry[showFlag]: "+entry["showFlag"]);
|
|
|
+ field.title=entry["title"];
|
|
|
+ field.queryId=queryId;
|
|
|
|
|
|
- let additionalData=new Object();
|
|
|
- setAdditionalData(config,additionalData,entry);
|
|
|
- generateSection(config,queryName,entry["title"],queryName, additionalData);
|
|
|
+ if (debug) print(config,"entry[showFlag]: "+entry["showFlag"]);
|
|
|
|
|
|
+ let additionalData=new Object();
|
|
|
+ setAdditionalData(config,additionalData,entry);
|
|
|
+ //section fits one dataset/list
|
|
|
+ generateSection(config,formConfig,queryName,entry["title"],queryName, additionalData);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
-function generateSection(config, sectionName, sectionTitle, listName, additionalData){
|
|
|
+function generateSection(config, formConfig, sectionName, sectionTitle, listName, additionalData){
|
|
|
|
|
|
- let formName=config.masterForm;
|
|
|
+ let formName=config.masterForm;//this is HTML designator of area on page
|
|
|
let debug=true;
|
|
|
if (debug) print(config,"generateSection "+sectionName);
|
|
|
let tb=config.document.createElement('table');
|
|
@@ -291,18 +310,28 @@ function generateSection(config, sectionName, sectionTitle, listName, additional
|
|
|
}
|
|
|
if (debug) print(config,"generate master table");
|
|
|
|
|
|
-
|
|
|
+
|
|
|
let setup=fullAccessSetup(config,listName);
|
|
|
- if ("reviewMode" in config)
|
|
|
+ if (formConfig.formStatus=="Submitted")
|
|
|
+ setup=readonlySetup(config);
|
|
|
+ if (formConfig.formStatus=="Approved")
|
|
|
setup=readonlySetup(config);
|
|
|
+
|
|
|
+
|
|
|
//master table is unique per visit
|
|
|
+
|
|
|
+
|
|
|
setup.unique=true;
|
|
|
- generateTable(config,listName,divTable.id,true,additionalData,setup);
|
|
|
+ generateTable(config,formConfig,listName,divTable.id,true,additionalData,setup);
|
|
|
|
|
|
if (debug) print(config,"generate master table: done");
|
|
|
|
|
|
let generateSubTable=true;
|
|
|
- if ("reviewMode" in config) generateSubTable=false;
|
|
|
+ if (formConfig.formStatus=="Submitted")
|
|
|
+ generateSubTable=false;
|
|
|
+ if (formConfig.formStatus=="Approved")
|
|
|
+ generateSubTable=false;
|
|
|
+
|
|
|
if (! ("showFlag" in additionalData) ) generateSubTable=false;
|
|
|
|
|
|
if (generateSubTable){
|
|
@@ -311,11 +340,12 @@ function generateSection(config, sectionName, sectionTitle, listName, additional
|
|
|
|
|
|
|
|
|
let setup=fullAccessSetup(config,qName);
|
|
|
- if ("reviewMode" in config)
|
|
|
- setup=readonlySetup(config);
|
|
|
- generateTable(config,qName,dName,false,additionalData,setup);
|
|
|
+ //if (readonly) setup=readonlySetup(config);
|
|
|
+ generateTable(config,formConfig,qName,dName,false,additionalData,setup);
|
|
|
}
|
|
|
|
|
|
+ print(config,"generate review");
|
|
|
+
|
|
|
let divReviewList=config.document.createElement('div');
|
|
|
divReviewList.id=sectionName+"ReviewList";
|
|
|
div.appendChild(divReviewList);
|
|
@@ -327,34 +357,16 @@ function generateSection(config, sectionName, sectionTitle, listName, additional
|
|
|
|
|
|
//assume we already have listId (content of config.setupQueryName is listId)
|
|
|
//we need listName also
|
|
|
- let qconfig=new Object();
|
|
|
- qconfig.containerPath=config.containerPath;
|
|
|
- qconfig.schemaName='lists';
|
|
|
//qconfig.queryName=config.setupQueryName;
|
|
|
- qconfig.queryName="FormSetup";
|
|
|
- qconfig.filterArray=[LABKEY.Filter.create("formName",config.formId)];
|
|
|
-
|
|
|
- qconfig.success=function(data){
|
|
|
- generateReview(config,data,divReview.id,divReviewList.id,listName)};
|
|
|
- LABKEY.Query.selectRows(qconfig);
|
|
|
+ generateReview(config,formConfig,divReview.id,divReviewList.id,listName);
|
|
|
}
|
|
|
|
|
|
-function generateReview(config,data,divReviewId,divReviewListId, listName){
|
|
|
+function generateReview(config,formConfig,divReviewId,divReviewListId, listName){
|
|
|
let listId=config.fields[listName].queryId;
|
|
|
|
|
|
let debug=true;
|
|
|
if (debug) print(config,"Generate review for: "+listId);
|
|
|
|
|
|
- //don't need this
|
|
|
- //let listId=-1;
|
|
|
- //for (let i=0;i<data.rows.length;i++){
|
|
|
- // let entry=data.rows[i];
|
|
|
- // if (entry["queryName"]!=listName) continue;
|
|
|
- // listId=entry["Key"];
|
|
|
- // break;
|
|
|
- //}
|
|
|
- //if (debug) print(config,"Review: setting listId: "+listId);
|
|
|
-
|
|
|
let reviewSetup=new Object();
|
|
|
reviewSetup.readonlyFlag=function(vName){
|
|
|
if (vName=="queryName") return true;
|
|
@@ -364,7 +376,7 @@ function generateReview(config,data,divReviewId,divReviewListId, listName){
|
|
|
reviewSetup.addApply="Add Review";
|
|
|
|
|
|
let generateTableFlag=true;
|
|
|
- if ("reviewMode" in config && config.reviewMode == "APPROVED" ){
|
|
|
+ if (formConfig.formStatus == "Approved" ){
|
|
|
delete reviewSetup.addApply;
|
|
|
reviewSetup.readonlyFlag=function(vName){return false;}
|
|
|
generateTableFlag=false;
|
|
@@ -372,9 +384,10 @@ function generateReview(config,data,divReviewId,divReviewListId, listName){
|
|
|
|
|
|
reviewSetup.filters=new Object();
|
|
|
reviewSetup.filters["crfRef"]=getCRFref(config);
|
|
|
- reviewSetup.filters["queryName"]=listId;//entry in reviewComments list is queryname, all in small caps
|
|
|
- //reviewSetup.filters["ModifiedBy"]=LABKEY.Security.currentUser.id;
|
|
|
+
|
|
|
+ reviewSetup.filters["queryName"]=listId;//entry in reviewComments list is queryname, all in small caps
|
|
|
//needs listName, in argument
|
|
|
+
|
|
|
reviewSetup.getInputId=function(vName){return listName+"_add"+vName};
|
|
|
reviewSetup.divReviewListId=divReviewListId;
|
|
|
|
|
@@ -388,10 +401,11 @@ function generateReview(config,data,divReviewId,divReviewListId, listName){
|
|
|
|
|
|
if (! generateTableFlag) return;
|
|
|
|
|
|
- generateTable(config,"reviewComments",divReviewId,false,new Object(),reviewSetup);
|
|
|
+
|
|
|
+ generateTable(config, formConfig,"reviewComments",divReviewId,false,new Object(),reviewSetup);
|
|
|
}
|
|
|
|
|
|
-function setListVisibility(config,setup,additionalData,readonlyFlag){
|
|
|
+function setListVisibility(config, setup,additionalData,readonlyFlag){
|
|
|
let debug=true;
|
|
|
if (debug){
|
|
|
print(config,"Set list visibility ");
|
|
@@ -415,16 +429,18 @@ function setListVisibility(config,setup,additionalData,readonlyFlag){
|
|
|
let filters=new Object();
|
|
|
if ("filters" in additionalData) filters=additionalData.filters;
|
|
|
x.style.display = "block";
|
|
|
- updateListDisplay(config,additionalData.divQueryName,additionalData.queryName,filters,readonlyFlag);
|
|
|
+ updateListDisplay(config,
|
|
|
+ additionalData.divQueryName,additionalData.queryName,filters,readonlyFlag);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function updateListDisplay(config,divName,queryName,filters,readonlyFlag){
|
|
|
+function updateListDisplay(config, divName,queryName,filters,readonlyFlag){
|
|
|
let debug=true;
|
|
|
|
|
|
if (debug) print(config,"UpdateListDisplay: Query - "+queryName+" div - "+divName);
|
|
|
|
|
|
if (divName=="NONE") return;
|
|
|
+
|
|
|
let crfRef=getCRFref(config);
|
|
|
let div=config.document.getElementById(divName);
|
|
|
|
|
@@ -508,12 +524,14 @@ function generateButton(config,divName,title,buttonName,callback,callbackParamet
|
|
|
|
|
|
}
|
|
|
|
|
|
-function generateTable(config,listName,divName,unique,additionalData,setup){
|
|
|
+function generateTable(config,formConfig,listName,divName,unique,additionalData,setup){
|
|
|
let debug=true;
|
|
|
|
|
|
if (debug) print(config,"generateTable: "+listName);
|
|
|
+ //these objects will contain respective data for the entry
|
|
|
|
|
|
//add temp variables
|
|
|
+ //this will capture the state of the data prior to updating
|
|
|
let qconfig=new Object();
|
|
|
qconfig.containerPath=config.containerPath;
|
|
|
qconfig.schemaName='lists';
|
|
@@ -523,7 +541,7 @@ function generateTable(config,listName,divName,unique,additionalData,setup){
|
|
|
for (f in setup.filters){
|
|
|
qconfig.filterArray.push(LABKEY.Filter.create(f,setup.filters[f]));
|
|
|
}
|
|
|
- qconfig.success=function(data){populateTable(config,data,divName,unique,additionalData,setup)};
|
|
|
+ qconfig.success=function(data){populateTable(config,formConfig, data,divName,unique,additionalData,setup)};
|
|
|
LABKEY.Query.selectRows(qconfig);
|
|
|
}
|
|
|
|
|
@@ -543,11 +561,14 @@ function printTableSetup(config,data){
|
|
|
}
|
|
|
|
|
|
|
|
|
-function populateTable(config,data,divName,unique,additionalData,setup){
|
|
|
+function populateTable(config,formConfig, data,divName,unique,additionalData,setup){
|
|
|
//generate and populate table with the first suitable entry
|
|
|
let debug=true;
|
|
|
+ //avoid resetting of values
|
|
|
+ if (!(data.queryName in formConfig.dataFields))
|
|
|
+ formConfig.dataFields[data.queryName]=data.metaData.fields;
|
|
|
+
|
|
|
|
|
|
-
|
|
|
if (debug){
|
|
|
print(config,"populateTable Query: "+data.queryName+" divName: "+divName+" setup: "+setup);
|
|
|
|
|
@@ -560,14 +581,21 @@ function populateTable(config,data,divName,unique,additionalData,setup){
|
|
|
|
|
|
if (debug)
|
|
|
print(config,"Data: nrows "+data.rows.length);
|
|
|
-
|
|
|
- if (data.rows.length > 0) entry=data.rows[0];
|
|
|
+
|
|
|
+ //copy values from queryName to formConfig.entries
|
|
|
+ if (data.rows.length > 0) formConfig.entries[data.queryName]=data.rows[0];
|
|
|
+
|
|
|
+ //this is the current data snapshot
|
|
|
+ if (data.queryName in formConfig.entries)
|
|
|
+ entry=formConfig.entries[data.queryName];
|
|
|
+
|
|
|
|
|
|
let tb=config.document.createElement('table');
|
|
|
tb.className="t2";
|
|
|
config.document.getElementById(divName).appendChild(tb);
|
|
|
|
|
|
- let fields=data.metaData.fields;
|
|
|
+ //this are the fields (probably constant)
|
|
|
+ let fields=formConfig.dataFields[data.queryName];
|
|
|
for (f in fields){
|
|
|
let field=fields[f];
|
|
|
if (field.hidden) continue;
|
|
@@ -1504,13 +1532,97 @@ function generateMasterForm(config){
|
|
|
selectRows.schemaName='lists';
|
|
|
selectRows.queryName='crfEntry';
|
|
|
selectRows.filterArray=[LABKEY.Filter.create('entryId',getCRFref(config))];
|
|
|
- selectRows.success=function(data){populateBasicData(config,data)};
|
|
|
- //requires populateBasicData
|
|
|
+
|
|
|
+ let formConfig=new Object();
|
|
|
+ //selectRows.success=function(data){populateBasicData(config,data)};
|
|
|
+ selectRows.success=function(data){afterCrf(config,formConfig,data)};
|
|
|
LABKEY.Query.selectRows(selectRows);
|
|
|
+}
|
|
|
+
|
|
|
+//requires populateBasicData
|
|
|
+function afterCrf(config,formConfig,data){
|
|
|
+ formConfig.crfEntry=data.rows[0];
|
|
|
+ //schedule basic data for later
|
|
|
+ populateBasicData(config,data);
|
|
|
+
|
|
|
+ let selectRows=new Object();
|
|
|
+ selectRows.containerPath=config.containerPath;
|
|
|
+ selectRows.schemaName='lists';
|
|
|
+ selectRows.queryName='FormStatus';
|
|
|
+ selectRows.filterArray=[];
|
|
|
+
|
|
|
+ selectRows.success=function(data){afterFormStatus(config,formConfig,data)};
|
|
|
+ LABKEY.Query.selectRows(selectRows);
|
|
|
+
|
|
|
+
|
|
|
+ //use crfEntry['FormStatus'] to determine what configuration to display
|
|
|
+ //reviewMode equivalence table:
|
|
|
+ //
|
|
|
+ //FormStatus reviewMode
|
|
|
+ //In Progress undefined/EDIT
|
|
|
+ //Review Pending undefined/EDIT
|
|
|
+ //Submitted REVIEW
|
|
|
+ //Approved APPROVED
|
|
|
+
|
|
|
+ //two level indirect -
|
|
|
+ //
|
|
|
+ //1. learn of the FormStatus options by reading in the FormStatus list
|
|
|
+ //
|
|
|
+ //2. Load the crfEntry for this crfId
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function afterFormStatus(config, formConfig, data){
|
|
|
+ print(config,"afterFormStatus: ");
|
|
|
+ formConfig.formStatusData=data;
|
|
|
+
|
|
|
+ let rows=formConfig.formStatusData.rows;
|
|
|
+
|
|
|
+ for (let i=0; i<rows.length; i++){
|
|
|
+ let key=rows[i].Key;
|
|
|
+ if (formConfig.crfEntry["FormStatus"]!=key)
|
|
|
+ continue;
|
|
|
+ formConfig.formStatus=rows[i].formStatus;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ print(config,"Generating buttons for formStatus \""+formStatus+"\"");
|
|
|
+
|
|
|
+ let done="FALSE";
|
|
|
+ if (formConfig.formStatus=="Submitted"){
|
|
|
+ generateButton(config,"submitDiv","Complete submission",
|
|
|
+ "Upload to database",onDatabaseUpload,config);
|
|
|
+ generateButton(config,"submitDiv","Review submission",
|
|
|
+ "Ask for further review",onUpdateForReview,config);
|
|
|
+ generateButton(config,"submitDiv","Remove submission",
|
|
|
+ "Remove CRF form",onRemoveCRF,config);
|
|
|
+ done="TRUE";
|
|
|
+ }
|
|
|
+ if (formConfig.formStatus=="Approved"){
|
|
|
+ generateButton(config,"submitDiv","Review submission",
|
|
|
+ "Restore form for further review",onUpdateForReview,config);
|
|
|
+ done="TRUE";
|
|
|
+ }
|
|
|
+ if (done=="FALSE"){
|
|
|
+ generateButton(config,"submitDiv","Complete submission",
|
|
|
+ "Submit",onSubmit,config);
|
|
|
+ generateButton(config,"submitDiv","Remove submission",
|
|
|
+ "Remove CRF form",onRemoveCRF,config);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ generateButton(config,"submitDiv","Done","Exit",redirect,config);
|
|
|
+
|
|
|
+ //schedule actual forms
|
|
|
config.fields=new Object();
|
|
|
config.queryMap=new Object();
|
|
|
|
|
|
+ //data and layout of actual forms
|
|
|
+ //filled in generateTable
|
|
|
+ formConfig.entries=new Object();
|
|
|
+ formConfig.dataFields=new Object();
|
|
|
+
|
|
|
let configSelectRows=new Object();
|
|
|
configSelectRows.containerPath=config.containerPath;
|
|
|
configSelectRows.schemaName='lists';
|
|
@@ -1519,31 +1631,11 @@ function generateMasterForm(config){
|
|
|
configSelectRows.queryName="FormSetup";
|
|
|
configSelectRows.filterArray=[LABKEY.Filter.create("formName",config.formId)];
|
|
|
|
|
|
- configSelectRows.success=function(data){generateForm(config,data);};
|
|
|
+ configSelectRows.success=function(data){afterFormSetup(config,formConfig,data);};
|
|
|
configSelectRows.failure=onFailure;//function(errorTxt){print(config,"generateForm fail" + errorTxt)};
|
|
|
LABKEY.Query.selectRows(configSelectRows);
|
|
|
|
|
|
- if (debug)
|
|
|
- print(config,"Generating buttons");
|
|
|
-
|
|
|
- //requires onSubmit
|
|
|
- if ("reviewMode" in config){
|
|
|
- if (config.reviewMode=="REVIEW"){
|
|
|
-
|
|
|
- generateButton(config,"submitDiv","Complete submission","Upload to database",onDatabaseUpload,config);
|
|
|
- generateButton(config,"submitDiv","Review submission","Ask for further review",onUpdateForReview,config);
|
|
|
- generateButton(config,"submitDiv","Remove submission","Remove CRF form",onRemoveCRF,config);
|
|
|
- }
|
|
|
- if (config.reviewMode=="APPROVED"){
|
|
|
- generateButton(config,"submitDiv","Review submission","Restore form for further review",onUpdateForReview,config);
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- else{
|
|
|
- generateButton(config,"submitDiv","Complete submission","Submit",onSubmit,config);
|
|
|
- generateButton(config,"submitDiv","Remove submission","Remove CRF form",onRemoveCRF,config);
|
|
|
- }
|
|
|
- generateButton(config,"submitDiv","Done","Exit",redirect,config);
|
|
|
|
|
|
}
|
|
|
|