4 * Copyright (C) 2016 Kevin Yeh <kevin.y@integralemr.com>
5 * Copyright (C) 2016 Brady Miller <brady.g.miller@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @author Kevin Yeh <kevin.y@integralemr.com>
20 * @author Brady Miller <brady.g.miller@gmail.com>
21 * @link http://www.open-emr.org
24 $fake_register_globals=false;
25 $sanitize_all_escapes=true;
27 /* Include our required headers */
28 require_once('../../globals.php');
29 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
31 $esignApi = new Api();
33 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
36 <title
><?php
echo text($openemr_name); ?
></title
>
38 <script type
="text/javascript">
39 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
41 // Since this should be the parent window, this is to prevent calls to the
42 // window that opened this window. For example when a new window is opened
43 // from the Patient Flow Board or the Patient Finder.
46 // This flag indicates if another window or frame is trying to reload the login
47 // page to this top-level window. It is set by javascript returned by auth.inc
48 // and is checked by handlers of beforeunload events.
49 var timed_out
= false;
51 // Include this variable for backward compatibility
52 var loadedFrameCount
= 0;
54 function allFramesLoaded() {
55 // Stub function for backward compatibility with frame race condition mechanism
59 function goRepeaterServices(){
61 // Ensure send the skip_timeout_reset parameter to not count this as a manual entry in the
62 // timing out mechanism in OpenEMR.
64 // Send the skip_timeout_reset parameter to not count this as a manual entry in the
65 // timing out mechanism in OpenEMR.
66 $
.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/dated_reminders_counter.php",
67 { skip_timeout_reset
: "1" },
70 app_view_model
.application_data
.user().messages(data
);
74 // run background-services
75 $
.post("<?php echo $GLOBALS['webroot']; ?>/library/ajax/execute_background_services.php",
76 { skip_timeout_reset
: "1", ajax
: "1" }
79 // auto run this function every 60 seconds
80 var repeater
= setTimeout("goRepeaterServices()", 60000);
83 function isEncounterLocked( encounterId
) {
84 <?php
if ( $esignApi->lockEncounters() ) { ?
>
85 // If encounter locking is enabled, make a syncronous call (async=false) to check the
86 // DB to see if the encounter is locked.
87 // Call restore session, just in case
91 url
: '<?php echo $GLOBALS['webroot
']?>/interface/esign/index.php?module=encounter&method=esign_is_encounter_locked',
92 data
: { encounterId
: encounterId
},
93 success
: function( data
) {
94 encounter_locked
= data
;
99 return encounter_locked
;
101 // If encounter locking isn't enabled then always return false
105 var webroot_url
="<?php echo $web_root; ?>";
107 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
108 <link rel
="stylesheet" type
="text/css" href
="<?php echo $webroot; ?>/interface/themes/<?php echo $GLOBALS['theme_tabs_layout']; ?>?v=<?php echo $v_js_includes; ?>"/>
109 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative'] ?>/font-awesome-4-6-3/css/font-awesome.min.css">
111 <link rel
="shortcut icon" href
="<?php echo $GLOBALS['images_static_relative']; ?>/favicon.ico" />
113 <script type
="text/JavaScript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-2-2-0/index.js"></script
>
114 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/knockout-3-4-0/dist/knockout.js"></script
>
115 <script type
="text/javascript" src
="js/custom_bindings.js?v=<?php echo $v_js_includes; ?>"></script
>
117 <script type
="text/javascript" src
="js/user_data_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
118 <script type
="text/javascript" src
="js/patient_data_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
119 <script type
="text/javascript" src
="js/therapy_group_data_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
121 <script type
="text/javascript">
122 // Create translations to be used in the menuActionClick() function in below js/tabs_view_model.js script
123 var xl_strings_tabs_view_model
= <?php
echo json_encode( array(
124 'encounter_locked' => xla('This encounter is locked. No new forms can be added.'),
125 'must_select_patient' => $GLOBALS['enable_group_therapy'] ?
xla('You must first select or add a patient or therapy group.') : xla('You must first select or add a patient.'),
126 'must_select_encounter' => xla('You must first select or create an encounter.')
130 <script type
="text/javascript" src
="js/tabs_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
132 <script type
="text/javascript" src
="js/application_view_model.js?v=<?php echo $v_js_includes; ?>"></script
>
133 <script type
="text/javascript" src
="js/frame_proxies.js?v=<?php echo $v_js_includes; ?>"></script
>
134 <script type
="text/javascript" src
="js/dialog_utils.js?v=<?php echo $v_js_includes; ?>"></script
>
137 // Below code block is to prepare certain elements for deciding what links to show on the menu
139 // prepare newcrop globals that are used in creating the menu
140 if ($GLOBALS['erx_enable']) {
141 $newcrop_user_role_sql = sqlQuery("SELECT `newcrop_user_role` FROM `users` WHERE `username` = ?", array($_SESSION['authUser']));
142 $GLOBALS['newcrop_user_role'] = $newcrop_user_role_sql['newcrop_user_role'];
143 if ($GLOBALS['newcrop_user_role'] === 'erxadmin') {
144 $GLOBALS['newcrop_user_role_erxadmin'] = 1;
147 // prepare track anything to be used in creating the menu
148 $track_anything_sql = sqlQuery("SELECT `state` FROM `registry` WHERE `directory` = 'track_anything'");
149 $GLOBALS['track_anything_state'] = $track_anything_sql['state'];
150 // prepare Issues popup link global that is used in creating the menu
151 $GLOBALS['allow_issue_menu_link'] = ((acl_check('encounters','notes','','write') ||
acl_check('encounters','notes_a','','write')) &&
152 acl_check('patients','med','','write'));
155 <?php
require_once("templates/tabs_template.php"); ?
>
156 <?php
require_once("templates/menu_template.php"); ?
>
157 <?php
require_once("templates/patient_data_template.php"); ?
>
158 <?php
require_once("templates/therapy_group_template.php"); ?
>
159 <?php
require_once("templates/user_data_template.php"); ?
>
160 <?php
require_once("menu/menu_json.php"); ?
>
161 <?php
$userQuery = sqlQuery("select * from users where username = ?", array($_SESSION['authUser'])); ?
>
162 <script type
="text/javascript">
164 <?php
if(!empty($_SESSION['frame1url']) && !empty($_SESSION['frame1target'])) { ?
>
165 app_view_model
.application_data
.tabs
.tabsList()[0].url(<?php
echo json_encode("../".$_SESSION['frame1url']); ?
>);
166 app_view_model
.application_data
.tabs
.tabsList()[0].name(<?php
echo json_encode($_SESSION['frame1target']); ?
>);
168 <?php
unset($_SESSION['frame1url']); ?
>
169 <?php
unset($_SESSION['frame1target']); ?
>
171 app_view_model
.application_data
.user(new user_data_view_model(<?php
echo json_encode($_SESSION{"authUser"})
172 .',' . json_encode($userQuery['fname'])
173 .',' . json_encode($userQuery['lname'])
174 .',' . json_encode($_SESSION['authGroup']); ?
>));
180 <!-- Below iframe is to support auto logout when timeout is reached
-->
181 <iframe name
="timeout" style
="visibility:hidden; position:absolute; left:0; top:0; height:0; width:0; border:none;" src
="timeout_iframe.php"></iframe
>
183 <div id
="dialogDiv"></div
>
184 <div
class="body_top">
185 <a href
="http://www.open-emr.org" title
="OpenEMR <?php echo xla("Website
"); ?>" target
="_blank"><img
class="logo" alt
="openEMR small logo" style
="float: left; margin:3px 4px 0px 10px;width:20px;z-index:10000;" border
="0" src
="<?php echo $GLOBALS['images_static_relative']; ?>/menu-logo.png"></a
>
186 <span id
="menu logo" data
-bind
="template: {name: 'menu-template', data: application_data} "></span
>
187 <span id
="userData" data
-bind
="template: {name: 'user-data-template', data:application_data} "></span
>
189 <div id
="attendantData" class="body_title acck" data
-bind
="template: {name: app_view_model.attendant_template_type, data: application_data} ">
191 <div
class="body_title" data
-bind
="template: {name: 'tabs-controls', data: application_data} "> </div
>
193 <div
class="mainFrames">
194 <div id
="framesDisplay" data
-bind
="template: {name: 'tabs-frames', data: application_data}"> </div
>
198 $
("#dialogDiv").hide();
199 ko
.applyBindings(app_view_model
);
201 $
(document
).ready(function() {
202 goRepeaterServices();
203 $
('#patient_caret').click(function() {
204 $
('#attendantData').slideToggle();
205 $
('#patient_caret').toggleClass('fa-caret-down').toggleClass('fa-caret-up');