robots.txt (#2077)
[openemr.git] / interface / code_systems / dataloads_ajax.php
blobc83df4752cd404b4478c64aaddd593cc973313aa
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.g.miller@gmail.com>
24 * @link http://www.open-emr.org
30 require_once("../../interface/globals.php");
31 require_once("$srcdir/acl.inc");
33 // Ensure script doesn't time out and has enough memory
34 set_time_limit(0);
35 ini_set('memory_limit', '150M');
37 // Control access
38 if (!acl_check('admin', 'super')) {
39 echo xlt('Not Authorized');
40 exit;
43 $activeAccordionSection = isset($_GET['aas']) ? $_GET['aas'] : '0';
46 <html>
47 <head>
48 <title><?php echo xlt('External Data Loads'); ?></title>
49 <link rel='stylesheet' href='<?php echo $css_header ?>' type='text/css'/>
50 <link rel='stylesheet' href='../../library/css/jquery-ui-1.8.21.custom.css' type='text/css'/>
53 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-1-7-2/jquery.min.js"></script>
54 <script type="text/javascript" src="../../library/js/jquery-ui-1.8.21.custom.min.js"></script>
55 <script>
57 // placemaker for when support DSMIV
58 // var db_list = [ "DSMIV", "ICD9", "ICD10", "RXNORM", "SNOMED"];
59 var db_list = [ "ICD9", "ICD10", "RXNORM", "SNOMED", "CQM_VALUESET"];
60 var accOpts = {
61 header: "h3",
62 autoHeight: false,
64 //add change event callback
65 change: function(e, ui) {
66 var parm = 'db=' + $(ui.newContent).attr('id');
67 var inst_dets_id = '#' + $(ui.newContent).attr('id') + "_install_details";
68 var stg_dets_id = '#' + $(ui.newContent).attr('id') + "_stage_details";
69 var inst_load_id = '#' + $(ui.newContent).attr('id') + "_inst_loading";
70 var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
71 top.restoreSession()
72 $(inst_load_id).show();
73 $(stg_load_id).show();
74 $.ajax({
75 url: 'list_installed.php',
76 data: parm,
77 cache: false,
78 success: function(data) {
79 $(inst_dets_id).html(data);
81 });
82 $.ajax({
83 url: 'list_staged.php',
84 data: parm,
85 cache: false,
86 success: function(data) {
87 $(stg_load_id).hide();
88 $(stg_dets_id).html(data);
89 $("#" + $(ui.newContent).attr('id') + "_instrmsg").hover(
90 function() {
91 var dlg = "#" + $(ui.newContent).attr('id') + "_dialog";
92 $(dlg).dialog('open');
93 $(dlg).load($(ui.newContent).attr('id').toLowerCase() + '_howto.php');
95 function() {
98 $("#" + $(ui.newContent).attr('id') + "_unsupportedmsg").hover(
99 function() {
100 $(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>');
102 function() {
103 $("div.tooltip").remove();
106 $("#" + $(ui.newContent).attr('id') + "_dirmsg").hover(
107 function() {
108 $(this).append('<div class="tooltip"><p><?php echo xla("Please create the following directory before proceeding"); ?>' + ': contrib/' + $(ui.newContent).attr('id').toLowerCase() + '</p></div>');
110 function() {
111 $("div.tooltip").remove();
114 $("#" + $(ui.newContent).attr('id') + "_msg").hover(
115 function() {
116 $(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>');
118 function() {
119 $("div.tooltip").remove();
122 $("#" + $(ui.newContent).attr('id') + "_install_button").click(
123 function(e){
124 $(this).attr("disabled", "disabled");
125 var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
126 $(stg_load_id).show();
127 var thisInterval;
128 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');
129 var stg_dets_id = '#' + $(ui.newContent).attr('id') + "_stage_details";
130 $activeAccordionSection = $("#accordion").accordion('option', 'active');
132 $.ajax({
133 url: 'standard_tables_manage.php',
134 data: parm,
135 cache: false,
136 success: function(data) {
137 var stg_load_id = '#' + $(ui.newContent).attr('id') + "_stg_loading";
138 $(stg_load_id).hide();
139 var $dialog=$('<div class=stg id="response_dialog"></div>').dialog({
140 buttons: { "Close": function() { $(this).dialog("close"); } },
141 close: function(event,ui){$(this).remove ();},
142 autoOpen:false,
143 resizable:'false',
144 modal:true,
145 show:'blind',
146 hide:{effect:'blind',duration:300}
148 $dialog.dialog('open');
149 $("#response_dialog").html(data);
150 $("#accordion").accordion("activate", 0);
151 $("#accordion").accordion("activate", <?php echo $activeAccordionSection; ?>);
156 return false;
162 $(function() {
163 $("#accordion").accordion(accOpts);
165 $.each(db_list, function() {
166 $("#" + this + "_inst_loading").hide();
167 $("#" + this + "_stg_loading").hide();
168 var dialog_name = this + '_dialog';
169 var dialog_title = this + ' Installation Details';
170 var this_button = "#" + this + "_button";
171 var stg_load_id = '#' + this + "_stg_loading";
173 $(".body_top").append('<div class="dialog" id="' + dialog_name + '" title="' + dialog_title + '"></div>');
174 $( "#" + this + "_dialog" ).dialog({
175 modal: true,
176 autoOpen: false,
177 show: "slide",
178 bounce: true,
179 hide: "fade",
180 width: "800px",
181 position: "top",
182 buttons: { "Close": function() { $(this).dialog("close"); } }
185 $( ".history_button" ).button({ icons: {primary:'ui-icon-triangle-1-s'}});
186 $("#accordion").accordion("activate", <?php echo $activeAccordionSection; ?>);
189 </script>
190 <style>
191 .ui-accordion-header { font-size: .7em; font-weight: bold; }
192 .ui-accordion-content { background-color: #E4E7EA; }
193 .hdr { font-size: 1.1em; font-weight: bold; }
194 .overview { font-size: 1.1em; font-weight: normal; width: 700px; color: blue; }
195 .atr { font-size: .8em; font-weight: normal; clear: both; width: 300px; }
196 .left_wrpr { float: left; clear: both; padding:20px; background-color: #E4E7EA}
197 .wrpr { float: left; padding:20px; background-color: #E4E7EA}
198 .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; }
199 .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}
200 .stg { font-size: .8em; font-weight: normal; font-style: italic; margin: 10px;}
201 .dialog { color: blue; padding: 20px; font-size: .9em; font-weight: normal; font-style: italic; left: 20px; top:20px; }
202 a.dialog { text-decoration: underline; font-size: 1.1em; font-weight: bold; margin: 10px; }
203 .status { font-size: .8em; font-weight: normal; width: 350px; }
204 .error_msg { font-size: .9em; font-style: italic; font-weight: bold; color: red; margin: 10px; }
206 span.msg {
207 cursor: pointer;
208 display: inline-block;
209 margin-left: 10px;
210 width: 16px;
211 height: 16px;
212 background-color: #89A4CC;
213 line-height: 16px;
214 color: White;
215 font-size: 13px;
216 font-weight: bold;
217 border-radius: 8px;
218 text-align: center;
219 position: relative;
221 span.msg:hover { background-color: #3D6199; }
223 div.tooltip {
224 background-color: #3D6199;
225 color: White;
226 position: absolute;
227 left: 25px;
228 top: -25px;
229 z-index: 1000000;
230 border-radius: 5px;
232 div.tooltip:before {
233 border-color: transparent #3D6199 transparent transparent;
234 border-right: 6px solid #3D6199;
235 border-style: solid;
236 border-width: 6px 6px 6px 0px;
237 content: "";
238 display: block;
239 height: 0;
240 width: 0;
241 line-height: 0;
242 position: absolute;
243 top: 40%;
244 left: -6px;
246 div.tooltip p {
247 margin: 10px;
248 color: White;
249 width: 350px;
251 </style>
252 </head>
253 <body class="body_top">
254 <h4><?php echo xlt("External Database Import Utility"); ?></h4>
255 <div id="accordion">
256 <h3><a href="#"><?php echo xlt("Overview"); ?></a></h3>
257 <div id="overivew" class="stg">
258 <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."); ?>
259 <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>
260 </div>
261 </div>
262 <?php
264 // setup the divs for each supported external dataload
266 // placemaker for when support DSMIV
267 //$db_list = array("DSMIV", "ICD9", "ICD10", "RXNORM", "SNOMED");
268 $db_list = array("ICD9", "ICD10", "RXNORM", "SNOMED","CQM_VALUESET");
269 foreach ($db_list as $db) {
271 <h3><a href="#"><?php echo attr($db); ?></a></h3>
272 <div id="<?php echo attr($db); ?>" class="hdr">
273 <div class="status" id="<?php echo attr($db); ?>_status"></div>
274 <div class="left_wrpr">
275 <div class="inst_dets">
276 <div class="inst_hdr"><?php echo xlt("Installed Release"); ?></div>
277 <hr>
278 <div id="<?php echo attr($db); ?>_install_details">
279 <div id='<?php echo attr($db); ?>_inst_loading' style='margin:10px;display:none;'><img src='../pic/ajax-loader.gif'/></div>
280 </div>
281 </div>
282 </div>
283 <div class="wrpr">
284 <div class="stg_dets">
285 <div class="stg_hdr" id="<?php echo attr($db); ?>_stg_hdr"><?php echo xlt("Staged Releases"); ?></div>
286 <hr>
287 <div id="<?php echo attr($db); ?>_stage_details"></div>
288 <div id='<?php echo attr($db); ?>_stg_loading' style='margin:10px;display:none;'><img src='../pic/ajax-loader.gif'/></div>
289 </div>
290 </div>
291 </div>
292 <?php
295 </div>
297 </body>
298 </html>