Compact css tweak
[openemr.git] / interface / main / main_screen.php
blob4988d95c3084bf576b9a97d7c3389de1aee19847
1 <?php
2 /**
3 * The outside frame that holds all of the OpenEMR User Interface.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Brady Miller <brady.g.miller@gmail.com>
18 * @link http://www.open-emr.org
24 /* Include our required headers */
25 require_once('../globals.php');
27 // Creates a new session id when load this outer frame
28 // (allows creations of separate OpenEMR frames to view patients concurrently
29 // on different browser frame/windows)
30 // This session id is used below in the restoreSession.php include to create a
31 // session cookie for this specific OpenEMR instance that is then maintained
32 // within the OpenEMR instance by calling top.restoreSession() whenever
33 // refreshing or starting a new script.
34 if (isset($_POST['new_login_session_management'])) {
35 // This is a new login, so create a new session id and remove the old session
36 session_regenerate_id(true);
37 } else {
38 // This is not a new login, so create a new session id and do NOT remove the old session
39 session_regenerate_id(false);
42 $_SESSION["encounter"] = '';
44 // Fetch the password expiration date
45 $is_expired=false;
46 if ($GLOBALS['password_expiration_days'] != 0) {
47 $is_expired=false;
48 $q= (isset($_POST['authUser'])) ? $_POST['authUser'] : '';
49 $result = sqlStatement("select pwd_expiration_date from users where username = ?", array($q));
50 $current_date = date('Y-m-d');
51 $pwd_expires_date = $current_date;
52 if ($row = sqlFetchArray($result)) {
53 $pwd_expires_date = $row['pwd_expiration_date'];
56 // Display the password expiration message (starting from 7 days before the password gets expired)
57 $pwd_alert_date = date('Y-m-d', strtotime($pwd_expires_date . '-7 days'));
59 if (strtotime($pwd_alert_date) != '' &&
60 strtotime($current_date) >= strtotime($pwd_alert_date) &&
61 (!isset($_SESSION['expiration_msg'])
62 or $_SESSION['expiration_msg'] == 0)) {
63 $is_expired = true;
64 $_SESSION['expiration_msg'] = 1; // only show the expired message once
68 if ($is_expired) {
69 //display the php file containing the password expiration message.
70 $frame1url = "pwd_expires_alert.php";
71 $frame1target = "adm";
72 } else if (!empty($_POST['patientID'])) {
73 $patientID = 0 + $_POST['patientID'];
74 if (empty($_POST['encounterID'])) {
75 // Open patient summary screen (without a specific encounter)
76 $frame1url = "../patient_file/summary/demographics.php?set_pid=".attr($patientID);
77 $frame1target = "pat";
78 } else {
79 // Open patient summary screen with a specific encounter
80 $encounterID = 0 + $_POST['encounterID'];
81 $frame1url = "../patient_file/summary/demographics.php?set_pid=".attr($patientID)."&set_encounterid=".attr($encounterID);
82 $frame1target = "pat";
84 } else if (isset($_GET['mode']) && $_GET['mode'] == "loadcalendar") {
85 $frame1url = "calendar/index.php?pid=" . attr($_GET['pid']);
86 if (isset($_GET['date'])) {
87 $frame1url .= "&date=" . attr($_GET['date']);
90 $frame1target = "cal";
91 } else {
92 // standard layout
93 $map_paths_to_targets = array(
94 'main_info.php' => ('cal'),
95 '../new/new.php' => ('pat'),
96 '../../interface/main/finder/dynamic_finder.php' => ('fin'),
97 '../../interface/patient_tracker/patient_tracker.php?skip_timeout_reset=1' => ('flb'),
98 '../../interface/main/messages/messages.php?form_active=1' => ('msg')
100 if ($GLOBALS['default_top_pane']) {
101 $frame1url=attr($GLOBALS['default_top_pane']);
102 $frame1target = $map_paths_to_targets[$GLOBALS['default_top_pane']];
103 if (empty($frame1target)) {
104 $frame1target = "msc";
106 } else {
107 $frame1url = "main_info.php";
108 $frame1target = "cal";
110 if ($GLOBALS['default_second_tab']) {
111 $frame2url=attr($GLOBALS['default_second_tab']);
112 $frame2target = $map_paths_to_targets[$GLOBALS['default_second_tab']];
113 if (empty($frame2target)) {
114 $frame2target = "msc";
116 } else {
117 $frame2url = "../../interface/main/messages/messages.php?form_active=1";
118 $frame2target = "msg";
122 $nav_area_width = '130';
123 if (!empty($GLOBALS['gbl_nav_area_width'])) {
124 $nav_area_width = $GLOBALS['gbl_nav_area_width'];
127 // This is where will decide whether to use tabs layout or non-tabs layout
128 // Will also set Session variables to communicate settings to tab layout
129 if ($GLOBALS['new_tabs_layout']) {
130 $_SESSION['frame1url'] = $frame1url;
131 $_SESSION['frame1target'] = $frame1target;
132 $_SESSION['frame2url'] = $frame2url;
133 $_SESSION['frame2target'] = $frame2target;
134 // mdsupport - Apps processing invoked for valid app selections from list
135 if ((isset($_POST['appChoice'])) && ($_POST['appChoice'] !== '*OpenEMR')) {
136 $_SESSION['app1'] = $_POST['appChoice'];
139 header('Location: '.$web_root."/interface/main/tabs/main.php");
140 exit();
144 <html>
145 <head>
146 <title>
147 <?php echo text($openemr_name) ?>
148 </title>
149 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script>
150 <script type="text/javascript" src="../../library/topdialog.js"></script>
151 <script type="text/javascript" src="tabs/js/dialog_utils.js?v=<?php echo $v_js_includes; ?>"></script>
153 <link rel="shortcut icon" href="<?php echo $GLOBALS['images_static_relative']; ?>/favicon.ico" />
155 <script language='JavaScript'>
157 // Flag that tab mode is off
158 var tab_mode=false;
160 var webroot_url = '<?php echo $GLOBALS['web_root']; ?>';
161 var jsLanguageDirection = "<?php echo $_SESSION["language_direction"]; ?>";
163 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
165 // Since this should be the parent window, this is to prevent calls to the
166 // window that opened this window. For example when a new window is opened
167 // from the Patient Flow Board or the Patient Finder.
168 window.opener = null;
170 // This flag indicates if another window or frame is trying to reload the login
171 // page to this top-level window. It is set by javascript returned by auth.inc
172 // and is checked by handlers of beforeunload events.
173 var timed_out = false;
175 // This counts the number of frames that have reported themselves as loaded.
176 // Currently only left_nav and Title do this, so the maximum will be 2.
177 // This is used to determine when those frames are all loaded.
178 var loadedFrameCount = 0;
180 function allFramesLoaded() {
181 // Change this number if more frames participate in reporting.
182 return loadedFrameCount >= 2;
184 </script>
186 </head>
188 <?php
190 * for RTL layout we need to change order of frames in framesets
192 $lang_dir = $_SESSION['language_direction'];
194 $sidebar_tpl = "<frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
195 <frame src='left_nav.php' name='left_nav' />
196 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
197 border='0' framespacing='0' />
198 </frameset>";
200 $main_tpl = "<frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1'>" ;
201 $main_tpl .= "<frame src='". $frame1url ."' name='RTop' scrolling='auto' />
202 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' /></frameset>";
204 // Please keep in mind that border (mozilla) and framespacing (ie) are the
205 // same thing. use both.
206 // frameborder specifies a 3d look, not whether there are borders.
208 if (empty($GLOBALS['gbl_tall_nav_area'])) {
209 // not tall nav area ?>
210 <frameset rows='<?php echo attr($GLOBALS['titleBarHeight']) + 5 ?>,*' frameborder='1' border='1' framespacing='1' onunload='imclosing()'>
211 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' noresize />
212 <?php if ($lang_dir != 'rtl') { ?>
214 <frameset cols='<?php echo attr($nav_area_width) . ',*'; ?>' id='fsbody' frameborder='1' border='4' framespacing='4'>
215 <?php echo $sidebar_tpl ?>
216 <?php echo $main_tpl ?>
217 </frameset>
219 <?php } else { ?>
221 <frameset cols='<?php echo '*,' . attr($nav_area_width); ?>' id='fsbody' frameborder='1' border='4' framespacing='4'>
222 <?php echo $main_tpl ?>
223 <?php echo $sidebar_tpl ?>
224 </frameset>
226 <?php }?>
228 </frameset>
229 </frameset>
231 <?php } else { // use tall nav area ?>
233 <frameset cols='<?php echo attr($nav_area_width); ?>,*' id='fsbody' frameborder='1' border='4' framespacing='4' onunload='imclosing()'>
234 <frameset rows='*,0' frameborder='0' border='0' framespacing='0'>
235 <frame src='left_nav.php' name='left_nav' />
236 <frame src='daemon_frame.php' name='Daemon' scrolling='no' frameborder='0'
237 border='0' framespacing='0' />
238 </frameset>
239 <frameset rows='<?php echo attr($GLOBALS['titleBarHeight']) + 5 ?>,*' frameborder='1' border='1' framespacing='1'>
240 <frame src='main_title.php' name='Title' scrolling='no' frameborder='1' />
241 <frameset rows='60%,*' id='fsright' bordercolor='#999999' frameborder='1' border='4' framespacing='4'>
242 <frame src='<?php echo $frame1url ?>' name='RTop' scrolling='auto' />
243 <frame src='messages/messages.php?form_active=1' name='RBot' scrolling='auto' />
244 </frameset>
245 </frameset>
246 </frameset>
248 <?php } // end tall nav area ?>
250 </html>