Improved fix for race conditions when creating a new instance of the main window.
[openemr.git] / interface / main / main_screen.php
blob862fa5b340f95b9b0170c59723d3d90a40664128
1 <?php
2 include_once("../globals.php");
3 require_once("$srcdir/formdata.inc.php");
4 $_SESSION["encounter"] = "";
6 // Fetching the password expiration date
7 $is_expired=false;
8 if($GLOBALS['password_expiration_days'] != 0){
9 $is_expired = false;
10 $q=formData('authUser','P');
11 $result = sqlStatement("select pwd_expiration_date from users where username = '".$q."'");
12 $current_date = date("Y-m-d");
13 $pwd_expires_date = $current_date;
14 if($row = sqlFetchArray($result)) {
15 $pwd_expires_date = $row['pwd_expiration_date'];
18 // Displaying the password expiration message (starting from 7 days before the password gets expired)
19 $pwd_alert_date = date("Y-m-d", strtotime($pwd_expires_date . "-7 days"));
21 if (strtotime($pwd_alert_date) != "" && strtotime($current_date) >= strtotime($pwd_alert_date) &&
22 (!isset($_SESSION['expiration_msg']) or $_SESSION['expiration_msg'] == 0)) {
24 $is_expired = true;
25 $_SESSION['expiration_msg'] = 1; // only show the expired message once
29 if ($is_expired) {
30 $frame1url = "pwd_expires_alert.php"; //php file which display's password expiration message.
32 else if (!empty($_POST['patientID'])) {
33 $patientID = 0 + $_POST['patientID'];
34 $frame1url = "../patient_file/summary/demographics.php?set_pid=$patientID";
36 else if ($GLOBALS['athletic_team']) {
37 $frame1url = "../reports/players_report.php?embed=1";
39 else if (isset($_GET['mode']) && $_GET['mode'] == "loadcalendar") {
40 $frame1url = "calendar/index.php?pid=" . $_GET['pid'];
41 if (isset($_GET['date'])) $frame1url .= "&date=" . $_GET['date'];
43 else if ($GLOBALS['concurrent_layout']) {
44 // new layout
45 if ($GLOBALS['default_top_pane']) {
46 $frame1url=$GLOBALS['default_top_pane'];
47 } else {
48 $frame1url = "main_info.php";
51 else {
52 // old layout
53 $frame1url = "main.php?mode=" . $_GET['mode'];
56 $nav_area_width = $GLOBALS['athletic_team'] ? '230' : '130';
57 if (!empty($GLOBALS['gbl_nav_area_width'])) $nav_area_width = $GLOBALS['gbl_nav_area_width'];
59 <html>
60 <head>
61 <title>
62 <?php echo $openemr_name ?>
63 </title>
64 <script type="text/javascript" src="../../library/topdialog.js"></script>
66 <script language='JavaScript'>
67 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
69 // This counts the number of frames that have reported themselves as loaded.
70 // Currently only left_nav and Title do this, so the maximum will be 2.
71 // This is used to determine when those frames are all loaded.
72 var loadedFrameCount = 0;
74 function allFramesLoaded() {
75 // Change this number if more frames participate in reporting.
76 return loadedFrameCount >= 2;
78 </script>
80 </head>
82 <?php if ($GLOBALS['concurrent_layout']) { // start new layout ?>
84 <?php if (empty($GLOBALS['gbl_tall_nav_area'])) { // not tall nav area ?>
86 <!-- border (mozilla) and framespacing (ie) are the same thing. -->
87 <!-- frameborder specifies a 3d look, not whether there are borders. -->
88 <frameset rows='<?php echo $GLOBALS['titleBarHeight'] + 5 ?>,*' frameborder='1' border='1' framespacing='1' onunload='imclosing()'>
89 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' noresize />
90 <frameset cols='<?php echo $nav_area_width; ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4'>
91 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
92 <frame src='left_nav.php' name='left_nav' />
93 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
94 border='0' framespacing='0' />
95 </frameset>
96 <?php if (empty($GLOBALS['athletic_team'])) { ?>
97 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1'>
98 <?php } else { ?>
99 <frameset rows='100%,*' id='fsright' bordercolor='#999999' frameborder='1'>
100 <?php } ?>
101 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
102 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
103 </frameset>
104 </frameset>
105 </frameset>
107 <?php } else { // use tall nav area ?>
109 <frameset cols='<?php echo $nav_area_width; ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4' onunload='imclosing()'>
110 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
111 <frame src='left_nav.php' name='left_nav' />
112 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
113 border='0' framespacing='0' />
114 </frameset>
115 <frameset rows='<?php echo $GLOBALS['titleBarHeight'] + 5 ?>,*' frameborder='1' border='1' framespacing='1'>
116 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' />
117 <?php if (empty($GLOBALS['athletic_team'])) { ?>
118 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
119 <?php } else { ?>
120 <frameset rows='100%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
121 <?php } ?>
122 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
123 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
124 </frameset>
125 </frameset>
126 </frameset>
128 <?php } // end tall nav area ?>
130 <?php } else { // start old layout ?>
132 </head>
133 <frameset rows="<?php echo "$GLOBALS[navBarHeight],$GLOBALS[titleBarHeight]" ?>,*"
134 cols="*" frameborder="no" border="0" framespacing="0"
135 onunload="imclosing()">
136 <frame src="main_navigation.php" name="Navigation" scrolling="no" noresize frameborder="no">
137 <frame src="main_title.php" name="Title" scrolling="no" noresize frameborder="no">
138 <frame src='<?php echo $frame1url ?>' name='Main' scrolling='auto' noresize frameborder='no'>
139 </frameset>
140 <noframes><body bgcolor="#FFFFFF">
141 Frame support required
142 </body></noframes>
144 <?php } // end old layout ?>
146 </html>