Advertisement
Guest User

Untitled

a guest
Jun 12th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.28 KB | None | 0 0
  1. <%@ include file="/WEB-INF/template/include.jsp"%>
  2.  
  3. <openmrs:require privilege="View Patients, View Patient Cohorts"
  4. otherwise="/login.htm" redirect="/module/patientmatching/config.list" />
  5.  
  6. <openmrs:htmlInclude file="/dwr/interface/DWRMatchingConfigUtilities.js"/>
  7. <openmrs:htmlInclude file="/dwr/engine.js"/>
  8. <openmrs:htmlInclude file="/dwr/util.js"/>
  9. <%@ include file="/WEB-INF/template/header.jsp"%>
  10. <%@ include file="localHeader.jsp"%>
  11.  
  12. <br />
  13.  
  14. <script type="text/javascript">
  15.  
  16. function test(obj){
  17. alert ("Form submitted - Thank you!");
  18. var mutli_education = document.getElementByName['configurationEntries[]'];
  19. alert(mutli_education);
  20. DWRMatchingConfigUtilities.test("X", methodName);
  21. }
  22.  
  23. function methodName(text){
  24. alert ("Form submitted ----------------- Thank you!");
  25. alert(text);
  26. }
  27.  
  28. function selectOnly(fieldName) {
  29. var blocking = "blocking";
  30. var included = "included";
  31.  
  32. var fieldSep = fieldName.indexOf(".");
  33. var objectName = fieldName.substring(0, fieldSep + 1);
  34.  
  35. var includedField = document.getElementById(objectName + included);
  36. var blockingField = document.getElementById(objectName + blocking);
  37.  
  38. if (fieldName == includedField.name) {
  39. if(includedField.checked) {
  40. blockingField.checked = false;
  41. }
  42. } else {
  43. if(blockingField.checked) {
  44. includedField.checked = false;
  45. }
  46. }
  47. }
  48.  
  49. function changeSM(obj) {
  50. var c2b1=obj.name;
  51. document.getElementById(c2b1).style.color="green";
  52. document.getElementById(c2b1).style.fontWeight="bold";
  53. checkConfiguration();
  54.  
  55. }
  56.  
  57. function changeMM(obj) {
  58. var c2i1=obj.name;
  59. document.getElementById(c2i1).style.color="red";
  60. document.getElementById(c2i1).style.fontWeight="bold";
  61. checkConfiguration();
  62.  
  63. }
  64.  
  65. function ignore(obj) {
  66. var c2n1=obj.name;
  67. document.getElementById(c2n1).style.color="black";
  68. document.getElementById(c2n1).style.fontWeight="normal";
  69. checkConfiguration();
  70. }
  71.  
  72. function checkConfiguration() {
  73. var errorMessage = "<spring:message code="patientmatching.config.new.selectionErrorMessage"/>";
  74. var warningMessage = "<spring:message code="patientmatching.config.new.selectionWarningMessage"/>";
  75. var noSMErrorMessage = "<spring:message code="patientmatching.config.new.noSMErrorMessage"/>";
  76. var noMMErrorMessage = "<spring:message code="patientmatching.config.new.noMMErrorMessage"/>";
  77.  
  78. //In case of js failure, user can still to save the stratergy with any selection
  79. document.getElementById('submitButton').disabled = false;
  80. document.getElementById('warningArea').style.display = "none";
  81.  
  82. var shouldMatchExists = checkSMExists();
  83. var mustMatchExists = checkMMExists();
  84. var messageHTML = "";
  85. if (!shouldMatchExists || !mustMatchExists) {
  86. messageHTML = errorMessage;
  87. messageHTML += "<br/><ul>";
  88. if (!shouldMatchExists) {
  89. messageHTML += "<li>" + noSMErrorMessage + "</li>";
  90. }
  91. if (!mustMatchExists) {
  92. messageHTML += "<li>" + noMMErrorMessage + "</li>";
  93. }
  94. messageHTML += "</ul>";
  95. document.getElementById('submitButton').disabled = true;
  96. document.getElementById('warningArea').style.display = "block";
  97. }
  98. document.getElementById('warningBox').innerHTML = messageHTML;
  99. }
  100.  
  101. function checkSMExists() {
  102. return checkSelections("INCLUDED");
  103. }
  104.  
  105. function checkMMExists() {
  106. return checkSelections("BLOCKING");
  107. }
  108.  
  109. function checkSelections(type) {
  110. var count = 0;
  111. var inputs = document.getElementsByTagName('input');
  112. for(var i=0; i<inputs.length;i++){
  113. if(inputs[i].name.indexOf('configurationEntries')==0 &&
  114. inputs[i].value == type &&
  115. inputs[i].checked){
  116. count++;
  117. }
  118. }
  119. count;
  120. return count>0;
  121. }
  122. </script>
  123.  
  124. <form method="post" name="XYZ">
  125. <b class="boxHeader"><spring:message
  126. code="patientmatching.config.new" /> </b>
  127. <div class="box">
  128. <table cellspacing="2" cellpadding="2"
  129. style="height: 93px; width: 414px;">
  130. <tr class="oddRow">
  131. <td><span style="padding-left: 5px; font-weight: bold;"><spring:message
  132. code="patientmatching.config.new.name" /> </span>
  133. </td>
  134. <td style="vertical-align: middle"><spring:bind
  135. path="patientMatchingConfiguration.configurationName">
  136. <input type="text" name="${status.expression}"
  137. id="${status.expression}" value="${status.value}" size="40" />
  138. </spring:bind>
  139. </td>
  140. </tr>
  141. </table>
  142.  
  143. <!--
  144. <table cellspacing="2" cellpadding="2">
  145. <tr>
  146. <td colspan="2">
  147. <spring:bind path="patientMatchingConfiguration.usingRandomSample">
  148. <input type="hidden" name="_<c:out value="${status.expression}"/>">
  149. <input type="checkbox" name="<c:out value="${status.expression}"/>" value="true"
  150. <c:if test="${status.value}">checked</c:if>/>
  151. </spring:bind><spring:message code="patientmatching.config.new.useRandomSampling"/>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td><spring:message code="patientmatching.config.new.randomSampleSize"/></td>
  156. <td>
  157. <spring:bind path="patientMatchingConfiguration.randomSampleSize">
  158. <input type="text"
  159. name="${status.expression}" id="${status.expression}"
  160. value="${status.value}" size="10" />
  161. </spring:bind>
  162. </td>
  163. </tr>
  164. </table>
  165. -->
  166.  
  167. <table cellspacing="2" cellpadding="2">
  168. <tr>
  169. <td valign="top"><b class="boxHeader"><spring:message
  170. code="patientmatching.config.new.availableField" /> </b>
  171. <div class="box" style="padding-right: 10px;">
  172. <table name="x" cellspacing="2" cellpadding="2">
  173. <tr>
  174. <th><spring:message
  175. code="patientmatching.config.new.fieldName" /></th>
  176. <th><spring:message
  177. code="patientmatching.config.new.fieldNameIgnore" /></th>
  178. <th><spring:message
  179. code="patientmatching.config.new.fieldNameInclude" /></th>
  180. <th><spring:message
  181. code="patientmatching.config.new.fieldNameBlocking" /></th>
  182. <th><spring:message
  183. code="patientmatching.config.new.interchangeable" /></th>
  184. <th>&nbsp;</th>
  185. <th><spring:message
  186. code="patientmatching.config.new.fieldName" /></th>
  187. <th><spring:message
  188. code="patientmatching.config.new.fieldNameIgnore" /></th>
  189. <th><spring:message
  190. code="patientmatching.config.new.fieldNameInclude" /></th>
  191. <th><spring:message
  192. code="patientmatching.config.new.fieldNameBlocking" /></th>
  193. <th><spring:message
  194. code="patientmatching.config.new.interchangeable" /></th>
  195. </tr>
  196. <c:forEach
  197. items="${patientMatchingConfiguration.configurationEntries}"
  198. var="configEntry" varStatus="entriesIndex">
  199. <c:if test="${(entriesIndex.count - 1) % 2 == 0}">
  200. <tr
  201. <c:if test="${entriesIndex.count % 2 == 0}">class="oddRow"</c:if>
  202. <c:if test="${entriesIndex.count % 2 != 0}">class="evenRow"</c:if>>
  203. </c:if>
  204. <spring:bind path="patientMatchingConfiguration.configurationEntries[${entriesIndex.count-1}].inclusion">
  205. <td nowrap="nowrap"
  206. name="<c:out value="${status.expression}"/>" id="fieldName"
  207. value="<spring:message code="${configEntry.fieldViewName}"/>">
  208. <font
  209. <c:if test='${status.value == "INCLUDED"}'>face="arial black" color="green"</c:if>
  210. <c:if test='${status.value == "BLOCKING"}'>face="arial black" color="red"</c:if>
  211. <c:if test='${status.value == "IGNORED"}'>color="black"</c:if>>
  212. <c:if
  213. test='${status.value == "INCLUDED" ||status.value == "BLOCKING"}'>
  214. <b>
  215. </c:if>
  216. <div id="<c:out value="${status.expression}"/>">
  217. <spring:message code="${configEntry.fieldViewName}" />
  218. </div> </b> </font>
  219. </td>
  220. <td align="center"><input type="radio"
  221. name="<c:out value="${status.expression}"/>" value="IGNORED"
  222. onclick="ignore(this)"
  223. <c:if test='${status.value == "IGNORED"}'>checked</c:if> />
  224. </td>
  225. <td align="center"><input type="radio"
  226. name="<c:out value="${status.expression}"/>"
  227. value="INCLUDED" onclick="changeSM(this)"
  228. <c:if test='${status.value == "INCLUDED"}' >checked</c:if> />
  229. </td>
  230. <td align="center"><input type="radio"
  231. name="<c:out value="${status.expression}"/>"
  232. value="BLOCKING" onclick="changeMM(this)"
  233. <c:if test='${status.value == "BLOCKING"}'>checked</c:if> />
  234. </td>
  235. </spring:bind>
  236. <spring:bind
  237. path="patientMatchingConfiguration.configurationEntries[${entriesIndex.count - 1}].flag">
  238. <td align="center">
  239. <select name="interchangeable"
  240. id="${configEntry.fieldViewName}"
  241. onchange="document.getElementById('${configEntry.fieldViewName}h').value=document.getElementById('${configEntry.fieldViewName}').value;
  242. document.getElementById('${configEntry.fieldViewName}h').checked='true';">
  243. <option value="0" <c:if test='${status.value == "0"}'>selected</c:if>>None</option>
  244. <option value="1" <c:if test='${status.value == "1"}'>selected</c:if>>1</option>
  245. <br />
  246. </select></td>
  247. <div id="divh" >
  248. <input type="hidden" id="${configEntry.fieldViewName}h"
  249. name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"/>
  250. </div>
  251. </spring:bind>
  252.  
  253. <c:if test="${(entriesIndex.count - 1) % 2 < 1}">
  254. <td>&nbsp;</td>
  255. </c:if>
  256. <c:if test="${(entriesIndex.count - 1) % 2 == 1}">
  257. </tr>
  258. </c:if>
  259. </c:forEach>
  260. </table>
  261. </div>
  262. </td>
  263. </tr>
  264. <tr>
  265.  
  266. </tr>
  267. </table>
  268. <td valign="top" style="height: 150px; width: 403px;"><b
  269. class="boxHeader"><spring:message
  270. code="patientmatching.config.new.inclusionLevels" /> </b>
  271. <div class="box" style="padding-right: 10px;">
  272. <ul>
  273. <li><b><spring:message
  274. code="patientmatching.config.new.fieldNameIgnore" /> </b>: <spring:message
  275. code="patientmatching.config.new.fieldNameIgnore.description" />
  276. </li>
  277. <li><b><spring:message
  278. code="patientmatching.config.new.fieldNameInclude" /> </b>: <spring:message
  279. code="patientmatching.config.new.fieldNameInclude.description" />
  280. </li>
  281. <li><b><spring:message
  282. code="patientmatching.config.new.fieldNameBlocking" /> </b>: <spring:message
  283. code="patientmatching.config.new.fieldNameBlocking.description" />
  284. </li>
  285. </ul>
  286. </div>
  287. </td>
  288. <div id="warningArea" valign="top" style="padding-top:10px;"><b
  289. class="boxHeader"><spring:message
  290. code="patientmatching.config.new.errorMessageBoxHeader" /> </b>
  291. <div id="warningBox" class="box" style="padding-right: 10px;">
  292. </div>
  293. </div>
  294. </div>
  295. <br /> <input name="submit" id="submitButton" type="submit" onclick="return test(this)"
  296. value="<spring:message code="general.save" />" />
  297. </form>
  298. <script>
  299. checkConfiguration();
  300. </script>
  301. <%@ include file="/WEB-INF/template/footer.jsp"%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement