fixes to prior statements improvements
[openemr.git] / interface / code_systems / dataloads_ajax.php
blob64f77a8d386163078f973af8b0e45e63360f8c0f
1 <?php
2 /**
3 * This file implements the main jquery interface for loading external
4 * database files into openEMR
6 * Copyright (C) 2012 Patient Healthcare Analytics, Inc.
7 * Copyright (C) 2011 Phyaura, LLC <info@phyaura.com>
9 * LICENSE: This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
20 * @package OpenEMR
21 * @author (Mac) Kevin McAloon <mcaloon@patienthealthcareanalytics.com>
22 * @author Rohit Kumar <pandit.rohit@netsity.com>
23 * @author Brady Miller <brady@sparmy.com>
24 * @link http://www.open-emr.org
28 //SANITIZE ALL ESCAPES
29 $sanitize_all_escapes=true;
32 //STOP FAKE REGISTER GLOBALS
33 $fake_register_globals=false;
36 require_once("../../interface/globals.php");
37 require_once("$srcdir/acl.inc");
39 // Ensure script doesn't time out and has enough memory
40 set_time_limit(0);
41 ini_set('memory_limit', '150M');
43 // Control access
44 if (!acl_check('admin', 'super')) {
45 echo xlt('Not Authorized');
46 exit;
49 $activeAccordionSection = isset($_GET['aas']) ? $_GET['aas'] : '0';
52 <html>
53 <head>
54 <link rel='stylesheet' href='<?php echo $css_header ?>' type='text/css'/>
55 <link rel='stylesheet' href='../../library/css/jquery-ui-1.8.21.custom.css' type='text/css'/>
58 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script>
59 <script type="text/javascript" src="../../library/js/jquery-ui-1.8.21.custom.min.js"></script>
60 <script>
62 // placemaker for when support DSMIV
63 // var db_list = [ "DSMIV", "ICD9", "ICD10", "RXNORM", "SNOMED"];
64 var db_list = [ "ICD9", "ICD10", "RXNORM", "SNOMED", "CQM_VALUESET"];
65 var accOpts = {
66 header: "h3",
67 autoHeight: false,
69 //add change event callback
70 change: function(e, ui) {
71 var parm = 'db=' + $(ui.newContent).attr('id');
72 var inst_dets_id = '#' + $(ui.newContent).attr('id') + "_install_details";
73 var stg_dets_id = '#' + $(ui.newContent).attr('id') + "_stage_details";
74 var inst_load_id = '#' + $(ui.newContent).attr('id') + "_inst_loading";
75 var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
76 top.restoreSession()
77 $(inst_load_id).show();
78 $(stg_load_id).show();
79 $.ajax({
80 url: 'list_installed.php',
81 data: parm,
82 cache: false,
83 success: function(data) {
84 $(inst_dets_id).html(data);
86 });
87 $.ajax({
88 url: 'list_staged.php',
89 data: parm,
90 cache: false,
91 success: function(data) {
92 $(stg_load_id).hide();
93 $(stg_dets_id).html(data);
94 $("#" + $(ui.newContent).attr('id') + "_instrmsg").hover(
95 function() {
96 var dlg = "#" + $(ui.newContent).attr('id') + "_dialog";
97 $(dlg).dialog('open');
98 $(dlg).load($(ui.newContent).attr('id').toLowerCase() + '_howto.php');
100 function() {
103 $("#" + $(ui.newContent).attr('id') + "_unsupportedmsg").hover(
104 function() {
105 $(this).append('<div class="tooltip"><p><?php echo xla("OpenEMR does not recognize the incoming file in the contrib directory. This is most likely because you need to configure the release in the supported_external_dataloads table in the MySQL database."); ?></p></div>');
107 function() {
108 $("div.tooltip").remove();
111 $("#" + $(ui.newContent).attr('id') + "_dirmsg").hover(
112 function() {
113 $(this).append('<div class="tooltip"><p><?php echo xla("Please create the following directory before proceeding"); ?>' + ': contrib/' + $(ui.newContent).attr('id').toLowerCase() + '</p></div>');
115 function() {
116 $("div.tooltip").remove();
119 $("#" + $(ui.newContent).attr('id') + "_msg").hover(
120 function() {
121 $(this).append('<div class="tooltip"><p><?php echo xla("Please place your install files in following directory"); ?>' + ': contrib/' + $(ui.newContent).attr('id').toLowerCase() + '</p></div>');
123 function() {
124 $("div.tooltip").remove();
127 $("#" + $(ui.newContent).attr('id') + "_install_button").click(
128 function(e){
129 $(this).attr("disabled", "disabled");
130 var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
131 $(stg_load_id).show();
132 var thisInterval;
133 var parm = 'db=' + $(ui.newContent).attr('id') + '&newInstall=' + (($(this).val() === 'INSTALL') ? 1 : 0) + '&file_checksum=' + $(this).attr('file_checksum') + '&file_revision_date=' + $(this).attr('file_revision_date') + '&version=' + $(this).attr('version');
134 var stg_dets_id = '#' + $(ui.newContent).attr('id') + "_stage_details";
135 $activeAccordionSection = $("#accordion").accordion('option', 'active');
137 $.ajax({
138 url: 'standard_tables_manage.php',
139 data: parm,
140 cache: false,
141 success: function(data) {
142 var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
143 $(stg_load_id).hide();
144 var $dialog=$('<div class=stg id="response_dialog"></div>').dialog({
145 buttons: { "Close": function() { $(this).dialog("close"); } },
146 close: function(event,ui){$(this).remove ();},
147 autoOpen:false,
148 resizable:'false',
149 modal:true,
150 show:'blind',
151 hide:{effect:'blind',duration:300}
153 $dialog.dialog('open');
154 $("#response_dialog").html(data);
155 $("#accordion").accordion("activate", 0);
156 $("#accordion").accordion("activate", <?php echo $activeAccordionSection; ?>);
161 return false;
167 $(function() {
168 $("#accordion").accordion(accOpts);
170 $.each(db_list, function() {
171 $("#" + this + "_inst_loading").hide();
172 $("#" + this + "_stg_loading").hide();
173 var dialog_name = this + '_dialog';
174 var dialog_title = this + ' Installation Details';
175 var this_button = "#" + this + "_button";
176 var stg_load_id = '#' + this + "_stg_loading";
178 $(".body_top").append('<div class="dialog" id="' + dialog_name + '" title="' + dialog_title + '"></div>');
179 $( "#" + this + "_dialog" ).dialog({
180 modal: true,
181 autoOpen: false,
182 show: "slide",
183 bounce: true,
184 hide: "fade",
185 width: "800px",
186 position: "top",
187 buttons: { "Close": function() { $(this).dialog("close"); } }
190 $( ".history_button" ).button({ icons: {primary:'ui-icon-triangle-1-s'}});
191 $("#accordion").accordion("activate", <?php echo $activeAccordionSection; ?>);
194 </script>
195 <style>
196 .ui-accordion-header { font-size: .7em; font-weight: bold; }
197 .ui-accordion-content { background-color: #E4E7EA; }
198 .hdr { font-size: 1.1em; font-weight: bold; }
199 .overview { font-size: 1.1em; font-weight: normal; width: 700px; color: blue; }
200 .atr { font-size: .8em; font-weight: normal; clear: both; width: 300px; }
201 .left_wrpr { float: left; clear: both; padding:20px; background-color: #E4E7EA}
202 .wrpr { float: left; padding:20px; background-color: #E4E7EA}
203 .inst_dets { font-size: .8em; font-weight: normal; clear: both; border-style: solid; border-width: 2px; padding: 25px; margins: 20px; outline-color:#E4E7EA; outline-style: solid; outline-width: 20px; float: left; }
204 .stg_dets { padding-left: 20px; font-size: .8em; font-weight: normal; border-style: solid; border-width: 2px; padding: 25px; margins: 20px; outline-color:#E4E7EA; outline-style: solid; outline-width: 20px; float: left; background-color: #E4E7EA}
205 .stg { font-size: .8em; font-weight: normal; font-style: italic; margin: 10px;}
206 .dialog { color: blue; padding: 20px; font-size: .9em; font-weight: normal; font-style: italic; left: 20px; top:20px; }
207 a.dialog { text-decoration: underline; font-size: 1.1em; font-weight: bold; margin: 10px; }
208 .status { font-size: .8em; font-weight: normal; width: 350px; }
209 .error_msg { font-size: .9em; font-style: italic; font-weight: bold; color: red; margin: 10px; }
211 span.msg {
212 cursor: pointer;
213 display: inline-block;
214 margin-left: 10px;
215 width: 16px;
216 height: 16px;
217 background-color: #89A4CC;
218 line-height: 16px;
219 color: White;
220 font-size: 13px;
221 font-weight: bold;
222 border-radius: 8px;
223 text-align: center;
224 position: relative;
226 span.msg:hover { background-color: #3D6199; }
228 div.tooltip {
229 background-color: #3D6199;
230 color: White;
231 position: absolute;
232 left: 25px;
233 top: -25px;
234 z-index: 1000000;
235 border-radius: 5px;
237 div.tooltip:before {
238 border-color: transparent #3D6199 transparent transparent;
239 border-right: 6px solid #3D6199;
240 border-style: solid;
241 border-width: 6px 6px 6px 0px;
242 content: "";
243 display: block;
244 height: 0;
245 width: 0;
246 line-height: 0;
247 position: absolute;
248 top: 40%;
249 left: -6px;
251 div.tooltip p {
252 margin: 10px;
253 color: White;
254 width: 350px;
256 </style>
257 </head>
258 <body class="body_top">
259 <h4><?php echo xlt("External Database Import Utility"); ?></h4>
260 <div id="accordion">
261 <h3><a href="#"><?php echo xlt("Overview"); ?></a></h3>
262 <div id="overivew" class="stg">
263 <div class="overview"><?php echo xlt("This page allows you to review each of the supported external dataloads that you can install and upgrade. Each section below can be expanded by clicking on the section header to review the status of the particular database of interest."); ?>
264 <div class="error_msg"><?php echo xlt("NOTE: Importing external data can take more than an hour depending on your hardware configuration. For example, one of the RxNorm data tables contain in excess of 6 million rows."); ?></div>
265 </div>
266 </div>
267 <?php
269 // setup the divs for each supported external dataload
271 // placemaker for when support DSMIV
272 //$db_list = array("DSMIV", "ICD9", "ICD10", "RXNORM", "SNOMED");
273 $db_list = array("ICD9", "ICD10", "RXNORM", "SNOMED","CQM_VALUESET");
274 foreach ($db_list as $db) {
276 <h3><a href="#"><?php echo attr($db); ?></a></h3>
277 <div id="<?php echo attr($db); ?>" class="hdr">
278 <div class="status" id="<?php echo attr($db); ?>_status"></div>
279 <div class="left_wrpr">
280 <div class="inst_dets">
281 <div class="inst_hdr"><?php echo xlt("Installed Release"); ?></div>
282 <hr>
283 <div id="<?php echo attr($db); ?>_install_details">
284 <div id='<?php echo attr($db); ?>_inst_loading' style='margin:10px;display:none;'><img src='../pic/ajax-loader.gif'/></div>
285 </div>
286 </div>
287 </div>
288 <div class="wrpr">
289 <div class="stg_dets">
290 <div class="stg_hdr" id="<?php echo attr($db); ?>_stg_hdr"><?php echo xlt("Staged Releases"); ?></div>
291 <hr>
292 <div id="<?php echo attr($db); ?>_stage_details"></div>
293 <div id='<?php echo attr($db); ?>_stg_loading' style='margin:10px;display:none;'><img src='../pic/ajax-loader.gif'/></div>
294 </div>
295 </div>
296 </div>
297 <?php
300 </div>
302 </body>
303 </html>