crfPortal.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <style>
  2. p.hidden{
  3. display:none;
  4. }
  5. table {margin-bottom:20px;table-layout:fixed; border-collapse:collapse; border-spacing:10px}
  6. table.t1 {width:400px; border:1px solid black}
  7. table.t1 th {border:1px solid black;padding:4px;background-color:#e0e0e0}
  8. table.t1 td {text-align:center}
  9. table.t2 {width:800px; border:1px solid black;}
  10. table.t2 th {border:1px solid black;padding:4px;background-color:#e0e0e0}
  11. table.t2 td {border:1px solid black; text-align:center}
  12. table.headTable {width:800px}
  13. table.headTable th {font-size:20px,text-align:center,background-color:#e0e0e0}
  14. table.headTable td {font-size:20px,text-align:center}
  15. div.d1 {text-align:center; width=400px; background-color:#e0e0e0;
  16. font-size: 20px; margin-bottom:20px}
  17. </style>
  18. <div class="d1">Clinical Report Form Portal</div>
  19. <div id="generalDataHead"></div>
  20. <div id="generalDataDiv" style="display:none">
  21. <table id="generalDataTable" cellspacing="2" cellpadding="5" border="0">
  22. <tr><td>Eudra CT Number: </td><td><strong id="eudraCTNumber">Loading</strong></td></tr>
  23. <tr><td>Study Sponsor: </td><td><strong id="studySponsor">Loading</strong></td></tr>
  24. <tr><td>Study Coordinator: </td><td><strong id="studyCoordinator">Loading</strong></td></tr>
  25. <tr><td>Regulatory authority Entry Number:</td><td><strong id="regulatoryNumber">Loading</strong></td></tr>
  26. </table>
  27. </div>
  28. <div id="pickFormHead"></div>
  29. <div id="pickFormDiv" style="display:none">
  30. <div id="formDiv"></div>
  31. <div id="selectFormDiv" style="display:block"></div>
  32. <div id="listDiv"></div>
  33. </div>
  34. <div id="startDiv"></div>
  35. <div id="debugAreaHead"></div>
  36. <div id="debugAreaDiv" style="display:none">
  37. <textarea cols="95" rows="5" name="formStatus" id="formStatus">Entering data</textarea>
  38. </div>
  39. <script type="text/javascript">
  40. document.getElementById("formStatus").value+="\nStarting";
  41. window.onload = init();
  42. // Initialize the form by populating the Reagent drop-down list and
  43. // entering data associated with the current user.
  44. function init() {
  45. var config=new Object();
  46. config.document=document;
  47. config.debugId='formStatus';
  48. generateHead(config,"debugAreaHead","debugAreaDiv","Debug info");
  49. generateHead(config,"generalDataHead","generalDataDiv","General data");
  50. generateHead(config,"pickFormHead","pickFormDiv","Select CRF");
  51. print(config,"Added generateHead");
  52. //parameters should include
  53. //parameters should include
  54. //divName - place to render select entry table
  55. //masterQuery - the master query that will collect al the data
  56. //masterSelectVarName - variable that is going to fill the content of select.
  57. // Typically, the variable is a lookup in the master query
  58. //masterUserVarName - variable that stores the user id in the master query
  59. // only entries matching current user in the master query will be selected
  60. //authorization - additional data to check:
  61. // * if the current user is authorized to perform action and/or
  62. // * limit number of different queryVariable values user is entitled to use
  63. //authorization should contain:
  64. // * queryName - query of user/queryVariable pairs to check for authorized access
  65. // * authUserVarName - name of the variable in authorization.queryName that contain usesId
  66. // * authSelectVarName - name of the selectVar in authorization query
  67. //callback - function that executes when value of the select changes (onchange).
  68. // argument to callback are the parameters
  69. //selectId - id of the DOM element where select is rendered - to check for value in callback
  70. //dataDiv - div element to render potential output of the callback
  71. //rework to enable addNew
  72. let par=new Object();
  73. par.masterQuery="crfEntry";
  74. par.dataDiv="listDiv";
  75. par.masterUserVarName="UserId";
  76. par.formStatusName="FormStatus";
  77. par.formStatus=1;
  78. par.addDiv="selectFormDiv";
  79. par.config=config;
  80. par.source=new Object();
  81. par.source.queryName="StudyProperties";
  82. par.source.schemaName="study";
  83. par.source.vars=["eudraCTNumber","studyCoordinator","regulatoryNumber","studySponsor"];
  84. par.vars=new Object();
  85. //User
  86. let parUser=new Object();
  87. parUser.masterSelectVarName="UserId";
  88. parUser.callback=function(){};
  89. parUser.selectId="UserSelect";
  90. parUser.inputType="select";
  91. //only display users in crfEditors list
  92. parUser.filter=new Object();
  93. parUser.filter.queryName="crfEditors";
  94. parUser.filter.filterVarName="User";
  95. parUser.filter.filters=new Object();
  96. parUser.filter.filters["User"]=LABKEY.Security.currentUser.id;
  97. par.vars["User"]=parUser;
  98. //Crf
  99. let parCrf=new Object();
  100. parCrf.masterSelectVarName="entryId";
  101. parCrf.callback=generateList;
  102. parCrf.selectId="crfSelect";
  103. parCrf.addSelect=true;
  104. parCrf.addNewFlag=-1;
  105. parCrf.inputType="select";
  106. par.vars["Crf"]=parCrf;
  107. //Site
  108. let parSite=new Object();
  109. parSite.masterSelectVarName="Site";
  110. parSite.callback=generateListAndPopulateDaughterSelect;
  111. parSite.selectId="SiteSelect";
  112. parSite.daughterSelect="Crf";
  113. parSite.inputType="select";
  114. //apply additional filter to variable - specify
  115. //- queryName,
  116. //- name of variable in queryName
  117. // - list of filters with name of the variable associated targeted value
  118. parSite.filter=new Object();
  119. parSite.filter.queryName="crfEditors";
  120. parSite.filter.filterVarName="Site";
  121. parSite.filter.filters=new Object();
  122. parSite.filter.filters["User"]=LABKEY.Security.currentUser.id;
  123. par.vars["Site"]=parSite;
  124. //Form
  125. par.vars["Form"]=new Object();
  126. let parForm=par.vars["Form"];
  127. parForm.masterSelectVarName="Form";
  128. parForm.callback=function(){};
  129. parForm.selectId="FormSelect";
  130. parForm.selectAll=true;
  131. parForm.inputType="select";
  132. parForm.urlName="viewURL";
  133. //FormStatus;
  134. par.vars["FormStatus"]=new Object();
  135. let parFormStatus=par.vars["FormStatus"];
  136. parFormStatus.masterSelectVarName="FormStatus";
  137. parFormStatus.callback=generateListAndPopulateDaughterSelect;
  138. parFormStatus.selectId="FormStatusSelect";
  139. parFormStatus.daughterSelect="Crf";
  140. parFormStatus.inputType="select";
  141. parFormStatus.filter=new Object();
  142. parFormStatus.filter.queryName="formStatusVisibility";
  143. parFormStatus.filter.filterVarName="formStatus";
  144. parFormStatus.filter.filters=new Object();
  145. parFormStatus.filter.filters["visibilityLevel"]="crfEditor";
  146. par.vars["eudraCTNumber"]=sourceVar("EudraCTNumber","eudraCTNumber","EudraCTNumber");
  147. par.vars["studyCoordinator"]=sourceVar("StudyCoordinator","studyCoordinator","StudyCoordinator");
  148. par.vars["studySponsor"]=sourceVar("StudySponsor","studySponsor","StudySponsor");
  149. par.vars["regulatoryNumber"]=sourceVar("RegulatoryNumber","regulatoryNumber","RegulatoryNumber");
  150. par.filters=["User","Site","FormStatus"];
  151. //par.filters=["User","Site"];
  152. drawForm(par);
  153. }
  154. </script>