Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. <%@ include file="/WEB-INF/template/include.jsp"%>
  2. <%@ include file="/WEB-INF/template/header.jsp"%>
  3. <%@ include file="template/localHeader.jsp"%>
  4. <openmrs:htmlInclude file="<openmrs:contextPath/>/dwr/interface/DWRMyModuleService.js"/>
  5. <script type="text/javascript">
  6. $j(document).ready(function(){
  7. $j('#vitalSigns').data("counter",0);
  8. $j('#socialHistory').data("counter",0);
  9.  
  10.  
  11.  
  12. $j('#post').click(function(){
  13.  
  14. $j('#vitalSignsCounter').val($j('#vitalSigns').data("counter"));
  15. $j('#socialHistoryCounter').val($j('#socialHistory').data("counter"));
  16. $j('form').submit();
  17.  
  18. });
  19.  
  20. $j(':button.addButton').click(function(){
  21.  
  22. var parent=$j(this).parent();
  23. var count=$j(parent).data("counter");
  24.  
  25. var parentId=$j(parent).attr('id');
  26. var generatedId=parentId+count+"";
  27. alert($j('#'+parentId+'_conceptId_selection').val());
  28. DWRMyModuleService.getConceptMappings($j('#'+parentId+'_conceptId').val(),getConceptReferenceTerms);
  29.  
  30. $j(parent).data("counter",count+1);
  31. var spanId=generatedId+"_span";
  32. var v='</br><span id="'+spanId+'">'+$j('#'+parentId+'_conceptId_selection').val()+'<input type="hidden" id="'+spanId+'_hid" name="'+spanId+'_hid" value="'+$j('#'+parentId+'_conceptId').val()+'"/><input id="'+spanId+'_remove" type="button" value="remove" onClick="$j(this).parent().remove();refresh(\''+parentId+'\')"/></span>';
  33.  
  34. $j(parent).append(v);
  35.  
  36. });
  37.  
  38. });
  39.  
  40. function getConceptReferenceTerms(map)
  41. {
  42. alert("The no of reference source to this concept is"+map.length);
  43. }
  44.  
  45. function refresh (superParentId) {
  46. var flag=true;
  47. $j('#'+superParentId+' span').each(function(index) {
  48.  
  49. $j('#'+superParentId).data("counter",index+1);
  50. flag=false;
  51. var spanId=this.id;
  52. var newSpanId=superParentId+index+"_span";
  53. this.id=newSpanId;
  54. $j('#'+spanId+'_hid').attr('name',newSpanId+'_hid').attr('id',newSpanId+'_hid');
  55. $j('#'+spanId+'_remove').removeAttr('onclick',null).unbind('click').attr('id',newSpanId+'_remove').click(function() {
  56. $j('#'+newSpanId).remove();
  57.  
  58.  
  59. refresh(superParentId);
  60. });
  61. });
  62. if(flag)
  63. $j('#'+superParentId).data("counter",0);
  64.  
  65. }
  66.  
  67.  
  68. </script>
  69.  
  70.  
  71. <form id='ccdSections' method="POST">
  72.  
  73. <div class="boxHeader"><spring:message code="ExportCCD.configure.vital.signs"/></div>
  74. <div id="vitalSigns" class="box">
  75. <spring:message code="Concept.find"/><openmrs_tag:conceptField formFieldName="vitalSigns_conceptId" formFieldId="vitalSigns_conceptId" />
  76. <input type="button" value="ADD" id="addButton" class="addButton"/>
  77. <input type="hidden" id="vitalSignsCounter" name="vitalSignsCounter"/>
  78. </div>
  79. <br>
  80. <div class="boxHeader"><spring:message code="ExportCCD.configure.social.history"/></div>
  81. <div id="socialHistory" class="box">
  82. <spring:message code="Concept.find"/><openmrs_tag:conceptField formFieldName="socialHistory_conceptId" formFieldId="socialHistory_conceptId" />
  83. <input type="button" value="ADD" id="addButton" class="addButton"/>
  84. <input type="hidden" id="socialHistoryCounter" name="socialHistoryCounter"/>
  85. </div>
  86. <input type="submit" value='<spring:message code="general.save" />' /></td>
  87. </form>
  88.  
  89.  
  90. <%@ include file="/WEB-INF/template/footer.jsp"%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement