Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. <title>District Health Profiles</title>
  6.  
  7. <!-- Import ext js/css and plugin js -->
  8.  
  9.  
  10. <link href="//fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet" type="text/css" />
  11. <link rel="stylesheet" href="//dhis2-cdn.org/v217/ext/resources/css/ext-plugin-gray.css" />
  12. <script src="//dhis2-cdn.org/v217/ext/ext-all.js"></script>
  13. <script src="//dhis2-cdn.org/v217/plugin/table.js"></script>
  14. <script src="http://dhis2-cdn.org/v215/plugin/chart.js"></script>
  15. <script src="http://dhis2-cdn.org/v215/openlayers/OpenLayers.js"></script>
  16. <script src="http://dhis2-cdn.org/v215/plugin/map.js"></script>
  17. <script type="text/JavaScript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
  18. <style type="text/css">
  19. #districtmap {
  20. width: 1000px; height: 1000px; /* or whatever the dimensions are */
  21. }
  22. </style>
  23.  
  24.  
  25.  
  26.  
  27. <!-- Login and initialize plugins -->
  28.  
  29. <script>
  30. var base = 'http://172.16.45.72:8080/dhis/';
  31. //var base = 'http://localhost:8080/dhis/';
  32. var district = 'fSyvbMUZWqJ';
  33. // var district = $( "#orgunit option:selected" ).val();
  34. // var district = $('select[name=orgunit]').val();
  35. // var district = $('#orgunit option:selected').val()
  36. // var districtname = $('#orgunit').find(":selected").text();
  37. var districtname = 'Gasabo District';
  38. // var districtname = $('#orgunit option:selected').text();
  39.  
  40.  
  41.  
  42.  
  43.  
  44. Ext.onReady( function() {
  45. Ext.Ajax.request({
  46. url: base + "dhis-web-commons-security/login.action?authOnly=true",
  47. method: 'POST',
  48. params: { j_username: "jmutali", j_password: "PBF2030@" },
  49. crossDomain:true,
  50. success: setLinks
  51. });
  52. });
  53.  
  54. function setLinks() {
  55.  
  56. // OPD per capita chart
  57. DHIS.getChart({
  58. "type": "column",
  59. "columns": [
  60. {
  61. "dimension": "dx",
  62. "items": [
  63. {
  64. "id": "KmuCgGrwpVl"
  65. }
  66. ]
  67. }
  68. ],
  69. "rows": [
  70. {
  71. "dimension": "ou",
  72. "items": [
  73. {
  74. "id": "LEVEL-6"
  75. },
  76. {
  77. "id": district
  78. }
  79. ]
  80. }
  81. ],
  82. "filters": [
  83. {
  84. "dimension": "pe",
  85. "items": [
  86. {
  87. "id": "LAST_YEAR"
  88. }
  89. ]
  90. }
  91. ],
  92. "hideEmptyRows": true,
  93. "rangeAxisDecimals": 1,
  94. "title": "OPD Vists per capita by Facility last Year",
  95. width: 500,
  96. height: 400,
  97. // "url": "http://localhost:8080/dhis",
  98. "url": "http://172.16.45.72:8080/dhis/",
  99. "el": "chart2"
  100. });
  101. //start of districts selection
  102. //get a reference to the select element
  103. var $select = $('#orgunit');
  104. //request the JSON data and parse into the select element
  105. $.ajax({
  106. url: ' http://172.16.45.72:8080/dhis/api/organisationUnits.json?paging=false&level=3',
  107. // url: ' http://localhost:8080/dhis/api/organisationUnits.json?paging=false&level=3',
  108. dataType:'JSON',
  109. success:function(data){
  110. //clear the current content of the select
  111. $select.html('');
  112. //iterate over the data and append a select option
  113. $.each(data.organisationUnits, function(key, val){
  114. $select.append('<option id="' + val.id + '">' + val.name + '</option>');
  115.  
  116. })
  117. },
  118. error:function(){
  119. //if there is an error append a 'none available' option
  120. $select.html('<option id="-1">none available</option>');
  121. }
  122. // $('select[name=orgunit]').change(function() { alert($(this).val()); });
  123. });
  124. //end of districts selection
  125. }
  126.  
  127.  
  128. </script>
  129.  
  130. </head>
  131.  
  132. <body align='center'>
  133. <header>
  134. <h1>District Health Profile</h1>
  135. <select id="orgunit" name="orgunit"></select>
  136. <h1>
  137. <script type="text/javascript">
  138.  
  139. document.write(districtname);
  140. </script>
  141. </h1>
  142. </header>
  143.  
  144.  
  145. <section>
  146.  
  147. <h3>District Facility Map</h3>
  148.  
  149. <img id=districtmap />
  150. <script>
  151.  
  152. $('#districtmap').css('visibility', 'visible').attr('src', "images/"+districtname + '.jpg');
  153.  
  154. </script>
  155.  
  156. <!-- <img src="images/Gasabo.jpg" WIDTH=1000 HEIGHT=1000> !-->
  157.  
  158.  
  159.  
  160. <h3>OPD visits per capita</h3>
  161.  
  162. <div id="chart2" align='center'></div>
  163.  
  164. </section>
  165.  
  166. </body>
  167. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement