Advertisement
Guest User

detail

a guest
Jun 8th, 2011
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.45 KB | None | 0 0
  1. In this code, there is one line which goes
  2. "<openmrs_tag:obsAttribute concept="${obs.concept}" formFieldName="valueComplex"/> "
  3. this calls to the obsAttribute.tag which gives the error.
  4.  
  5.  
  6. <%@ include file="/WEB-INF/template/include.jsp" %>
  7. <%@ page import="org.openmrs.ConceptComplex" %>
  8. <%@ page import="org.openmrs.Concept" %>
  9. <openmrs:require privilege="Edit Observations" otherwise="/login.htm" redirect="/admin/observations/obs.form" />
  10.  
  11. <%@ include file="/WEB-INF/template/header.jsp" %>
  12. <%@ include file="localHeader.jsp" %>
  13.  
  14. <openmrs:htmlInclude file="/scripts/calendar/calendar.js" />
  15.  
  16. <script type="text/javascript">
  17. <c:set var="message" value="Hello"/>
  18. var locationCheck = false;
  19. // on concept select:
  20. function onQuestionSelect(concept) {
  21. //window.location.reload();
  22. $j("#conceptDescription").show();
  23. $j('#valueNumericRow').show();
  24. //$j("#conceptDescription").html(concept.description);
  25. updateObsValues(concept);
  26. }
  27.  
  28. // on answer select:
  29. function onAnswerSelect(concept) {
  30. $j("#codedDescription").show();
  31. $j("#codedDescription").html(concept.description);
  32. }
  33.  
  34. function showProposeConceptForm() {
  35. var qs = "?";
  36. var encounterId = "${obs.encounter.encounterId}" || $j("#encounterId").val();
  37. if (encounterId != "")
  38. qs += "&encounterId=" + encounterId;
  39. var obsConceptId = "${obs.concept.conceptId}" || $j("#conceptId").val();
  40. if (obsConceptId != "")
  41. qs += "&obsConceptId=" + obsConceptId;
  42. document.location = "${pageContext.request.contextPath}/admin/concepts/proposeConcept.form" + qs;
  43. }
  44.  
  45. function updateObsValues(tmpConcept) {
  46. var values = ['valueBooleanRow', 'valueCodedRow', 'valueDatetimeRow', 'valueModifierRow', 'valueTextRow', 'valueNumericRow', 'valueInvalidRow', 'valueComplex','valueComplexRow'];
  47. $j.each(values, function(x, val) { $j("#" + val).hide() });
  48.  
  49. if (tmpConcept != null) {
  50. var datatype = tmpConcept.hl7Abbreviation;
  51. if (typeof datatype != 'string'){
  52. datatype = tmpConcept.datatype.hl7Abbreviation;
  53. }
  54.  
  55. if (datatype == 'BIT') {
  56. $j('#valueBooleanRow').show();
  57. }
  58. else if (datatype == 'NM' || datatype == 'SN') {
  59. $j('#valueNumericRow').show();
  60. DWRConceptService.getConceptNumericUnits(tmpConcept.conceptId, fillNumericUnits);
  61. }
  62. else if (datatype == 'CWE') {
  63. $j('#valueCodedRow').show();
  64.  
  65. // clear any old values:
  66. $j("#valueCoded").val("");
  67. $j("#valueCoded_selection").val("");
  68. $j("#codedDescription").html("");
  69.  
  70. // set up the autocomplete for the answers
  71. var conceptId = $j("#conceptId").val();
  72. new AutoComplete("valueCoded_selection", new CreateCallback({showAnswersFor: conceptId}).conceptAnswersCallback(), {'minLength':'0'});
  73. $j("#valueCoded_selection").autocomplete().focus(function(event, ui) {
  74. if (event.target.value == "")
  75. $j("#valueCoded_selection").trigger('keydown.autocomplete');
  76. }); // trigger the drop down on focus
  77.  
  78. // something in the autocomplete is setting the focus to the conceptId box after
  79. // this method is done. get around this and focus on our answer box by putting
  80. // a very small delay on the call using setTimeout
  81. setTimeout("$j('#valueCoded_selection').focus();", 0);
  82. }
  83. else if (datatype == 'ST') {
  84. $j('#valueTextRow').show();
  85. }
  86. else if (datatype == 'DT' || datatype == 'TS' || datatype == 'TM') {
  87. $j('#valueDatetimeRow').show();
  88. }
  89. // TODO move datatype 'TM' to own time box. How to have them select?
  90. else if (datatype == 'ED') {
  91. //$j('#valueComplexRow').show();
  92. DWRConceptService.isConceptComplexDomainObjectType(tmpConcept.conceptId,displayObsValueField);
  93.  
  94. /* if(tmpConcept instanceof ConceptComplex){
  95. tmpConcept = (ConceptComplex)tmpConcept;
  96. var v = tmpConcept.getHandler();
  97. if(v == 'LocationHandler'){
  98. //alert(v);
  99. //$j('#valueComplex').show();
  100. locationCheck = true;
  101. $j('#valueTextRow').show();
  102. }
  103. } */
  104. }
  105.  
  106. else {
  107. $j('#valueInvalidRow').show();
  108. DWRConceptService.getQuestionsForAnswer(tmpConcept.conceptId, fillValueInvalidPossible(tmpConcept));
  109. }
  110. }
  111. }
  112.  
  113. function displayObsValueField(con){
  114. if(con == 'PatientHandler'){
  115. $j('#valueDomainObjectRow').show();
  116. }
  117. else if(con == 'LocationHandler'){
  118. $j('#valueLocationRow').show();
  119. }
  120. else{
  121. $j('#valueComplexRow').show();
  122. }
  123.  
  124. }
  125.  
  126. function fillNumericUnits(units) {
  127. $j('#numericUnits').html(units);
  128. }
  129.  
  130. function validateNumericRange(value) {
  131. if (!isNaN(value) && value != '') {
  132. var conceptId = $j("#conceptId").val();
  133. var numericErrorMessage = function(validValue) {
  134. var errorTag = document.getElementById('numericRangeError');
  135. errorTag.className = "error";
  136. if (validValue == false)
  137. errorTag.innerHTML = '<spring:message code="ConceptNumeric.invalid.msg"/>';
  138. else
  139. errorTag.innerHTML = errorTag.className = "";
  140. }
  141. DWRConceptService.isValidNumericValue(value, conceptId, numericErrorMessage);
  142. }
  143. }
  144.  
  145. function removeHiddenRows() {
  146. var rows = document.getElementsByTagName("TR");
  147. var i = 0;
  148. while (i < rows.length) {
  149. if (rows[i].style.display == "none")
  150. rows[i].parentNode.removeChild(rows[i]);
  151. else
  152. i = i + 1;
  153. }
  154. }
  155.  
  156. var fillValueInvalidPossible = function(invalidConcept) {
  157. return function(questions) {
  158. var div = document.getElementById('valueInvalidPossibleConcepts');
  159. div.innerHTML = "";
  160. var txt = document.createTextNode('<spring:message code="Obs.valueInvalid.didYouMean"/> ');
  161. for (var i=0; i<questions.length && i < 10; i++) {
  162. if (i == 0)
  163. div.appendChild(txt);
  164. var concept = questions[i];
  165. var link = document.createElement("a");
  166. link.href = "#selectAsQuestion";
  167. link.onclick = selectNewQuestion(concept, invalidConcept);
  168. link.title = concept.description;
  169. link.innerHTML = concept.name;
  170. if (i == (questions.length - 1) || i == 9)
  171. link.innerHTML += "?";
  172. else
  173. link.innerHTML += ", ";
  174. div.appendChild(link);
  175. }
  176. }
  177. }
  178.  
  179. var selectNewQuestion = function (question, answer) {
  180. return function() {
  181. var msg = new Object();
  182. msg.objs = [question];
  183. dojo.event.topic.publish(conceptSearch.eventNames.select, msg);
  184. msg.objs = [answer];
  185. dojo.event.topic.publish(codedSearch.eventNames.select, msg);
  186. return false;
  187. };
  188. }
  189.  
  190. </script>
  191.  
  192. <style>
  193. th {
  194. text-align: left;
  195. }
  196. *>#numericRangeError, *>.obsValue {
  197. visibility: visible;
  198. }
  199. #numericRangeError {
  200. font-weight: bold;
  201. padding: 2px 4px 2px 4px;
  202. }
  203. .numericRangeErrorNormal {
  204. background-color: green;
  205. color: white;
  206. }
  207. .numericRangeErrorCritical {
  208. background-color: yellow;
  209. color: black;
  210. }
  211. .numericRangeErrorAbsolute {
  212. background-color: orange;
  213. color: white;
  214. }
  215. .numericRangeErrorInvalid {
  216. background-color: red;
  217. color: white;
  218. }
  219. .obsValue {
  220. display: none;
  221. }
  222. </style>
  223.  
  224. <h2><spring:message code="Obs.title"/></h2>
  225.  
  226. <spring:hasBindErrors name="obs">
  227. <spring:message code="fix.error"/>
  228. <div class="error">
  229. <c:forEach items="${errors.globalErrors}" var="error">
  230. <spring:message code="${error.defaultMessage}" text="${error.defaultMessage}"/><br/><!-- ${error} -->
  231. </c:forEach>
  232. </div>
  233. <br/>
  234. </spring:hasBindErrors>
  235.  
  236. <c:if test="${obs.voided}">
  237. <form action="" method="post">
  238. <div class="retiredMessage">
  239. <div>
  240. <spring:message code="general.voidedBy"/>
  241. ${obs.voidedBy.personName}
  242. <openmrs:formatDate date="${obs.dateVoided}" type="medium" />
  243. -
  244. ${obs.voidReason}
  245. <input type="submit" value='<spring:message code="Obs.unvoidObs"/>' name="unvoidObs"/>
  246. </div>
  247. </div>
  248. </form>
  249. </c:if>
  250.  
  251. <form method="post" onSubmit="removeHiddenRows()" enctype="multipart/form-data">
  252.  
  253. <fieldset>
  254.  
  255. <spring:nestedPath path="obs">
  256.  
  257. <table id="obsTable">
  258. <c:if test="${obs.obsId != null}">
  259. <tr>
  260. <th><spring:message code="general.id"/></th>
  261. <td>
  262. <spring:bind path="obsId">
  263. ${status.value}
  264. </spring:bind>
  265. </td>
  266. </tr>
  267. </c:if>
  268. <tr>
  269. <th><spring:message code="Obs.person"/></th>
  270. <td>
  271. <spring:bind path="person">
  272. <openmrs_tag:personField formFieldName="person" searchLabelCode="Person.findBy" initialValue="${status.editor.value.personId}" linkUrl="" callback="" />
  273. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  274. </spring:bind>
  275. </td>
  276. </tr>
  277. <tr>
  278. <th><spring:message code="Obs.encounter"/></th>
  279. <td>
  280. <spring:bind path="encounter">
  281. <c:choose>
  282. <c:when test="${obs.encounter == null}">
  283. <openmrs_tag:encounterField formFieldName="encounter" formFieldId="encounterId" />
  284. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  285. </c:when>
  286. <c:otherwise>
  287. ${status.editor.value.location.name} - <openmrs:formatDate date="${status.editor.value.encounterDatetime}" type="medium" />
  288. <a href="${pageContext.request.contextPath}/admin/encounters/encounter.form?encounterId=${status.editor.value.encounterId}"><spring:message code="general.view"/>/<spring:message code="general.edit"/></a>
  289. </c:otherwise>
  290. </c:choose>
  291. </spring:bind>
  292. </td>
  293. </tr>
  294. <tr>
  295. <th><spring:message code="Obs.order"/></th>
  296. <td>
  297. <spring:bind path="order">
  298. <input type="text" name="order" id="order" value="${status.editor.value.orderId}" size="7" <c:if test="${obs.obsId != null}">disabled</c:if> />
  299. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  300. </spring:bind>
  301. </td>
  302. </tr>
  303. <tr>
  304. <th><spring:message code="Obs.location"/></th>
  305. <td>
  306. <spring:bind path="location">
  307. <openmrs_tag:locationField formFieldName="location" initialValue="${status.value}"/>
  308. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  309. </spring:bind>
  310. </td>
  311. </tr>
  312. <tr>
  313. <th><spring:message code="Obs.datetime"/></th>
  314. <td>
  315. <spring:bind path="obsDatetime">
  316. <input type="text" name="${status.expression}" size="10"
  317. value="${status.value}" onClick="showCalendar(this)" id="${status.expression}" />
  318. (<spring:message code="general.format"/>: <openmrs:datePattern />)
  319. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  320. </spring:bind>
  321. </td>
  322. </tr>
  323. <tr>
  324. <th><spring:message code="Obs.concept"/></th>
  325. <td>
  326. <spring:bind path="obs.concept">
  327. <openmrs_tag:conceptField formFieldName="concept" formFieldId="conceptId" excludeDatatypes="N/A" initialValue="${status.editor.value.conceptId}" onSelectFunction="onQuestionSelect" />
  328. <div class="description" id="conceptDescription"></div>
  329. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  330. </spring:bind>
  331. </td>
  332. </tr>
  333. <c:if test="${1 == 2}">
  334. <tr>
  335. <th><spring:message code="Obs.accessionNumber"/></th>
  336. <td>
  337. <spring:bind path="accessionNumber">
  338. <input type="text" name="${status.expression}" id="accessionNumber" value="${status.value}" size="10" <c:if test="${obs.obsId != null}">disabled</c:if> />
  339. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  340. </spring:bind>
  341. </td>
  342. </tr>
  343. <tr>
  344. <th><spring:message code="Obs.valueGroupId"/></th>
  345. <spring:bind path="valueGroupId">
  346. <td>
  347. <input type="text" name="${status.expression}" id="valueGroupId" value="${status.value}" size="10" <c:if test="${obs.obsId != null}">disabled</c:if> />
  348. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  349. </td>
  350. </spring:bind>
  351. </tr>
  352. </c:if>
  353. <tr id="valueBooleanRow" class="obsValue">
  354. <th><spring:message code="Obs.booleanAnswer"/></th>
  355. <spring:bind path="valueBoolean">
  356. <td>
  357. <select name="${status.expression}" id="valueBooleanSelect">
  358. <option value="" <c:if test="${status.value == null || status.value == ''}">selected</c:if>></option>
  359. <option value="true" <c:if test="${status.value == 'true'}">selected</c:if>><spring:message code="general.true"/></option>
  360. <option value="false" <c:if test="${status.value == 'false'}">selected</c:if>><spring:message code="general.false"/></option>
  361. </select>
  362. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  363. </td>
  364. </spring:bind>
  365. </tr>
  366. <tr id="valueCodedRow" class="obsValue">
  367. <%-- TODO: add switch on drug search here. <drugId="${obs.valueDrug.drugId}" showVerboseListing="true" includeDrugConcepts="true"></div> --%>
  368. <th valign="top"><spring:message code="Obs.codedAnswer"/></th>
  369. <td>
  370. <spring:bind path="valueCoded">
  371. <openmrs_tag:conceptField formFieldName="valueCoded" formFieldId="valueCoded" initialValue="${status.editor.value.conceptId}" showAnswers="${obs.concept.conceptId}" onSelectFunction="onAnswerSelect"/>
  372. <div class="description" id="codedDescription"></div>
  373. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  374. </spring:bind>
  375. <spring:bind path="valueDrug">
  376. <input type="hidden" id="valueDrugId" value="${status.editor.value.drugId}" name="valueDrug" />
  377. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  378. </spring:bind>
  379. </td>
  380. </tr>
  381. <tr id="valueDatetimeRow" class="obsValue">
  382. <th><spring:message code="Obs.datetimeAnswer"/></th>
  383. <td>
  384. <spring:bind path="valueDatetime">
  385. <input type="text" name="${status.expression}" size="10"
  386. value="${status.value}" onClick="showCalendar(this)" />
  387. (<spring:message code="general.format"/>: <openmrs:datePattern />)
  388. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  389. </spring:bind>
  390. </td>
  391. </tr>
  392. <tr id="valueNumericRow" class="obsValue">
  393. <th><spring:message code="Obs.numericAnswer"/></th>
  394. <spring:bind path="valueNumeric">
  395. <td>
  396. <input type="text" name="${status.expression}" value="${status.value}" size="10" onKeyUp="validateNumericRange(this.value)"/>
  397. <span id="numericUnits"></span>
  398. <span id="numericRangeError"></span>
  399. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  400. </td>
  401. </spring:bind>
  402. </tr>
  403. <tr id="valueModifierRow" class="obsValue">
  404. <th><spring:message code="Obs.valueModifier"/></th>
  405. <spring:bind path="valueModifier">
  406. <td>
  407. <input type="text" name="${status.expression}" id="valueModifierInput" value="${status.value}" size="3" maxlength="2"/>
  408. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  409. </td>
  410. </spring:bind>
  411. </tr>
  412. <tr id="valueTextRow" class="obsValue">
  413. <th><spring:message code="Obs.textAnswer"/></th>
  414. <spring:bind path="valueText">
  415. <td>
  416. <textarea name="${status.expression}" rows="9" cols="80">${status.value}</textarea>
  417. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  418. </td>
  419. </spring:bind>
  420. </tr>
  421.  
  422. <tr id="valueComplexRow" class="obsValue">
  423. <th><spring:message code="Obs.complexAnswer"/></th>
  424. <spring:bind path="valueComplex">
  425. <c:choose>
  426. <c:when test="${status.editor.value.concept.complex}">
  427. <jsp:useBean scope="request" class="org.openmrs.ConceptComplex" type="org.openmrs.Concept" id="complex">
  428. <c:when test="${status.editor.value.concept.complex.handler =='LocationHandler'}">
  429. <td>
  430. ${status.value}<br/>
  431. <a href="${hyperlinkView}" target="_blank"><spring:message code="Obs.viewCurrentComplexValue"/></a><br/>
  432. ${htmlView}<br/><br/>
  433. <spring:message code="Obs.valueComplex.uploadNew"/>
  434. <input type="file" name="complexDataFile" />
  435. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  436. </td>
  437. </c:when>
  438. </jsp:useBean>
  439. </c:when>
  440. <c:otherwise>
  441. <td>
  442. ${status.value}<br/>
  443. <a href="${hyperlinkView}" target="_blank"><spring:message code="Obs.viewCurrentComplexValue"/></a><br/>
  444. ${htmlView}<br/><br/>
  445. <spring:message code="Obs.valueComplex.uploadNew"/>
  446. <input type="file" name="complexDataFile" />
  447. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  448. </td>
  449. </td>
  450. </c:otherwise>
  451. </c:choose>
  452.  
  453. </spring:bind>
  454. </tr>
  455.  
  456.  
  457. <tr id="valueDomainObjectRow" class="obsValue">
  458. <th><spring:message code="Obs.complexAnswer"/></th>
  459. <spring:bind path="valueComplex">
  460. <td>
  461. <%-- <c:if test="${ not empty obs.concept }"> --%>
  462. <%-- <tr valign="top">
  463. <th class="visitLabel"><spring:message code="Visit.attributes" /></th>
  464. <td> --%>
  465. <%-- <table>
  466. <c:forEach var="attrType" items="${ visitAttributeTypes }">
  467. --%>
  468. <openmrs_tag:obsAttribute concept="${obs.concept}" formFieldName="valueComplex"/>
  469. <%-- </c:forEach>
  470. </table> --%>
  471. <!-- </td>
  472. </tr> -->
  473. <%-- </c:if> --%>
  474. </td>
  475. </spring:bind>
  476. </tr>
  477.  
  478.  
  479.  
  480.  
  481. <tr id="valuePatientRow" class="obsValue">
  482. <th><spring:message code="Obs.complexAnswer"/></th>
  483. <spring:bind path="valueComplex">
  484. <td>
  485. <openmrs:fieldGen type="org.openmrs.Patient" formFieldName="valueComplex" val="${status.editor.value}"/>
  486. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  487. <br/>${status.value}
  488. <%-- <br/><a href="${pageContext.request.contextPath}/admin/patients/patient.form?patientId=${hyperlinkView}"><spring:message code="general.view"/>/<spring:message code="general.edit"/></a><br/>${htmlView}<br/>
  489. --%></td>
  490. </spring:bind>
  491. </tr>
  492. <%-- <tr id="valueLocationRow" class="obsValue">
  493. <th><spring:message code="Obs.complexAnswer"/></th>
  494. <spring:bind path="valueComplex">
  495. <td>
  496. <openmrs:fieldGen type="org.openmrs.Location" formFieldName="valueComplex" val="${status.editor.value}"/>
  497. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  498. <br/>${status.value}
  499. <br/><a href="${pageContext.request.contextPath}/admin/locations/location.form?locationId=${hyperlinkView}"><spring:message code="general.view"/>/<spring:message code="general.edit"/></a><br/>${htmlView}<br/>
  500. </td>
  501. </spring:bind>
  502. </tr> --%>
  503. <tr id="valueInvalidRow" class="obsValue">
  504. <th> &nbsp; </th>
  505. <td>
  506. <div class="error"><spring:message code="Obs.valueInvalid.description"/></div>
  507. <div id="valueInvalidPossibleConcepts"></div>
  508. </td>
  509. </tr>
  510.  
  511. <openmrs:extensionPoint pointId="org.openmrs.admin.observations.belowValueRow" type="html" parameters="obsId=${obs.obsId}"></openmrs:extensionPoint>
  512.  
  513. <%--
  514. <tr>
  515. <th><spring:message code="Obs.dateStarted"/></th>
  516. <td>
  517. <spring:bind path="dateStarted">
  518. <input type="text" name="${status.expression}" size="10"
  519. value="${status.value}" onClick="showCalendar(this)" />
  520. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  521. </spring:bind>
  522. </td>
  523. </tr>
  524. <tr>
  525. <th><spring:message code="Obs.dateStopped"/></th>
  526. <td>
  527. <spring:bind path="dateStopped">
  528. <input type="text" name="${status.expression}" size="10"
  529. value="${status.value}" onClick="showCalendar(this)" />
  530. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  531. </spring:bind>
  532. </td>
  533. </tr>
  534. --%>
  535.  
  536. <tr>
  537. <th><spring:message code="Obs.comment"/></th>
  538. <spring:bind path="comment">
  539. <td>
  540. <textarea name="${status.expression}" rows="2" cols="45">${status.value}</textarea>
  541. <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if>
  542. </td>
  543. </spring:bind>
  544. </tr>
  545. <c:if test="${obs.creator != null}">
  546. <tr>
  547. <th><spring:message code="general.createdBy" /></th>
  548. <td>
  549. ${obs.creator.personName} -
  550. <openmrs:formatDate date="${obs.dateCreated}" type="medium" />
  551. </td>
  552. </tr>
  553. </c:if>
  554. </table>
  555. </spring:nestedPath>
  556. <input type="hidden" name="phrase" value="<request:parameter name="phrase" />"/>
  557. <br /><br />
  558.  
  559. <c:if test="${obs.obsId != null}">
  560. <b><spring:message code="Obs.edit.reason"/></b> <input type="text" value="${editReason}" size="40" name="editReason"/>
  561. <spring:hasBindErrors name="obs">
  562. <c:forEach items="${errors.allErrors}" var="error">
  563. <c:if test="${error.code == 'editReason'}"><span class="error"><spring:message code="${error.defaultMessage}" text="${error.defaultMessage}"/></span></c:if>
  564. </c:forEach>
  565. </spring:hasBindErrors>
  566. <br/><br/>
  567. </c:if>
  568.  
  569. <%-- You can't edit a voided obs --%>
  570. <input type="submit" name="saveObs" value='<spring:message code="Obs.save"/>' <c:if test="${obs.voided}">disabled</c:if> >
  571.  
  572. &nbsp;
  573. <input type="button" value='<spring:message code="general.cancel"/>' onclick="history.go(-1);">
  574.  
  575. </fieldset>
  576. </form>
  577.  
  578. <br/>
  579. <br/>
  580.  
  581. <c:if test="${not obs.voided && not empty obs.obsId}">
  582. <form action="" method="post">
  583. <fieldset>
  584. <h4><spring:message code="Obs.voidObs"/></h4>
  585.  
  586. <b><spring:message code="general.reason"/></b>
  587. <input type="text" value="" size="40" name="voidReason" />
  588. <spring:hasBindErrors name="obs">
  589. <c:forEach items="${errors.allErrors}" var="error">
  590. <c:if test="${error.code == 'voidReason'}"><span class="error"><spring:message code="${error.defaultMessage}" text="${error.defaultMessage}"/></span></c:if>
  591. </c:forEach>
  592. </spring:hasBindErrors>
  593. <br/>
  594. <input type="submit" value='<spring:message code="Obs.voidObs"/>' name="voidObs"/>
  595. </fieldset>
  596. </form>
  597. </c:if>
  598.  
  599. <c:if test="${obs.obsId != null}">
  600. <br/>
  601. <openmrs:extensionPoint pointId="org.openmrs.admin.observations.obsFormBottom" type="html" parameters="obsId=${obs.obsId}">
  602. <openmrs:hasPrivilege privilege="${extension.requiredPrivilege}">
  603. <div class="boxHeader" style="font-weight: bold;"><spring:message code="${extension.title}" /></div>
  604. <div class="box" style="padding: 0px 0px 5px;"><spring:message code="${extension.content}" />
  605. <c:if test="${extension.portletUrl != null}">
  606. <openmrs:portlet url="${extension.portletUrl}" moduleId="${extension.moduleId}" id="${extension.portletUrl}" parameters="allowEdits=true|obsId=${obs.obsId}"/>
  607. </c:if>
  608. </div>
  609. <br />
  610. </openmrs:hasPrivilege>
  611. </openmrs:extensionPoint>
  612. </c:if>
  613.  
  614. <%@ include file="/WEB-INF/template/footer.jsp" %>
  615.  
  616.  
  617. ===================================
  618.  
  619. obsAttribute.tag
  620.  
  621. Here the problem is caused due to the inclusion of
  622.  
  623. "<%@tag import="org.openmrs.obs.handler.TextHandler" %>"
  624.  
  625.  
  626. <%@tag import="org.openmrs.web.attribute.handler.FieldGenAttributeHandler"%>
  627. <%@tag import="java.util.Map"%>
  628. <%@tag import="org.openmrs.api.context.Context"%>
  629. <%@tag import="org.openmrs.ConceptComplex"%>
  630. <%@tag import="org.openmrs.Patient" %>
  631. <%@tag import="org.openmrs.api.PatientService" %>
  632. <%@tag import="org.openmrs.obs.handler.TextHandler" %>
  633.  
  634. <%@ include file="/WEB-INF/tRemplate/include.jsp" %>
  635. <%--
  636. You must specify either attributeType or handler.
  637. You must specify formFieldName
  638. --%>
  639. <%@ attribute name="concept" required="true" type="org.openmrs.Concept" %>
  640. <%@ attribute name="formFieldName" required="true" type="java.lang.String" %>
  641.  
  642. <%
  643. ConceptComplex conceptComplex = null;
  644. String handler = null;
  645.  
  646. if(concept != null){
  647. conceptComplex = Context.getConceptService().getConceptComplex(concept.getConceptId());
  648. handler = conceptComplex.getHandler();
  649. handler.toUpperCase();
  650. }
  651.  
  652.  
  653. %>
  654. <% if (true) {
  655. String s3 = null;
  656. String s = "org.openmrs.";
  657. /* if(handler != null || handler !=""){
  658. String s2 =handler.replace( "Handler", "" );
  659. s3 = s+s2;
  660. } */
  661. // FieldGenAttributeHandler<?> h = (FieldGenAttributeHandler) handler;
  662. String widgetName = "org.openmrs.Patient";
  663. String formFieldName ="valueComplex";
  664.  
  665. /* if(handler != null){
  666. widgetName = handler;
  667. } */
  668. /* Map<String, Object> widgetConfig = h.getWidget
  669. Configuration(); */
  670. /* String x = null;
  671. if (handler != null || handler !=""){
  672. x = s3;
  673. }else{
  674. x = widgetName;
  675. } */
  676.  
  677. %>
  678. <openmrs:fieldGen
  679. formFieldName="${ formFieldName }"
  680. type="<%= widgetName %>"
  681. val="" />
  682.  
  683. <% } else {
  684. String valueAsString = "";
  685. if (false)
  686. //valueAsString = value.getSerializedValue();
  687. %>
  688. <input type="text" name="${ formFieldName }" value="<%= valueAsString %>"/>
  689. <% } %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement