From 467ad9b6513a2f06e948e10c01adc46272babc6e Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Wed, 1 Aug 2007 03:50:20 +0000 Subject: [PATCH] initial support for multiple browser windows --- interface/fax/fax_dispatch.php | 6 +----- interface/globals.php | 7 +++++++ interface/login/login.php | 17 +++++++++-------- interface/main/calendar/add_edit_event.php | 6 +----- interface/main/finder/patient_finder.php | 7 +------ interface/main/main_screen.php | 13 +------------ interface/new/new_patient.php | 7 +------ interface/patient_file/front_payment.php | 8 +------- interface/patient_file/patient_file.php | 10 +++------- interface/patient_file/problem_encounter.php | 6 +----- interface/practice/ins_search.php | 6 +----- interface/reports/injury_overview_report.php | 6 +----- interface/usergroup/usergroup.php | 25 +++++++++++++++---------- library/restoreSession.php | 25 +++++++++++++++++++++++++ 14 files changed, 68 insertions(+), 81 deletions(-) create mode 100644 library/restoreSession.php diff --git a/interface/fax/fax_dispatch.php b/interface/fax/fax_dispatch.php index 26c3c4ffa..077b68061 100644 --- a/interface/fax/fax_dispatch.php +++ b/interface/fax/fax_dispatch.php @@ -331,11 +331,7 @@ div.section { var mypcc = ''; - // See main_screen.php for an explanation of this. - function restoreSession() { - document.cookie = '; path=/'; - return true; - } + function divclick(cb, divid) { var divstyle = document.getElementById(divid).style; diff --git a/interface/globals.php b/interface/globals.php index 3b39663b5..a6ca30b10 100644 --- a/interface/globals.php +++ b/interface/globals.php @@ -82,6 +82,13 @@ session_start(); // $GLOBALS['concurrent_layout'] = true; +// If true this will enforce a separate PHP session for each top-level +// browser window. You must log in separately for each. This is not +// thoroughly tested yet and some browsers might have trouble with it, +// so make it false if you must. Alternatively, you can set it to the +// string 'debug' to be notified when the session ID changes. +$GLOBALS['restore_sessions'] = true; + // used in Add new event for multiple providers $GLOBALS['select_multi_providers'] = false; diff --git a/interface/login/login.php b/interface/login/login.php index c89f03641..76ef049e3 100644 --- a/interface/login/login.php +++ b/interface/login/login.php @@ -1,4 +1,4 @@ - function imsubmitted() { + // Delete the session cookie by setting its expiration date in the past. // This forces the server to create a new session ID. var olddate = new Date(); olddate.setFullYear(olddate.getFullYear() - 1); document.cookie = '; path=/; expires=' + olddate.toGMTString(); + + return true; } @@ -28,9 +31,9 @@ function imsubmitted() {
+ name="login_form" onsubmit="return imsubmitted();"> - - - @@ -92,8 +95,6 @@ if (count($result) != 1) {
- -
diff --git a/interface/main/calendar/add_edit_event.php b/interface/main/calendar/add_edit_event.php index 403f34485..edcfd054e 100644 --- a/interface/main/calendar/add_edit_event.php +++ b/interface/main/calendar/add_edit_event.php @@ -500,11 +500,7 @@ td { font-size:10pt; } } ?> - // See main_screen.php for an explanation of this. - function restoreSession() { - document.cookie = '; path=/'; - return true; - } + // This is for callback by the find-patient popup. function setpatient(pid, lname, fname, dob) { diff --git a/interface/main/finder/patient_finder.php b/interface/main/finder/patient_finder.php index 6fc3f4bc9..5f8e51bba 100644 --- a/interface/main/finder/patient_finder.php +++ b/interface/main/finder/patient_finder.php @@ -9,12 +9,7 @@ include_once("../../globals.php"); diff --git a/interface/main/main_screen.php b/interface/main/main_screen.php index 994279284..72016d274 100644 --- a/interface/main/main_screen.php +++ b/interface/main/main_screen.php @@ -24,18 +24,7 @@ diff --git a/interface/new/new_patient.php b/interface/new/new_patient.php index 5b43ffa13..fee89560c 100644 --- a/interface/new/new_patient.php +++ b/interface/new/new_patient.php @@ -9,12 +9,7 @@ $_SESSION["encounter"] = ""; diff --git a/interface/patient_file/front_payment.php b/interface/patient_file/front_payment.php index 16f490b12..26022b69b 100644 --- a/interface/patient_file/front_payment.php +++ b/interface/patient_file/front_payment.php @@ -152,13 +152,7 @@ diff --git a/interface/patient_file/patient_file.php b/interface/patient_file/patient_file.php index 1d4948084..54928826b 100644 --- a/interface/patient_file/patient_file.php +++ b/interface/patient_file/patient_file.php @@ -9,15 +9,11 @@ setpid($_GET["set_pid"]); - + ,*" cols="*" frameborder="0" border="0" framespacing="0" onunload="imclosing()"> diff --git a/interface/patient_file/problem_encounter.php b/interface/patient_file/problem_encounter.php index f09f8dc2f..8aa2b39e9 100644 --- a/interface/patient_file/problem_encounter.php +++ b/interface/patient_file/problem_encounter.php @@ -100,11 +100,7 @@ var pselected = new Object(); var eselected = new Object(); var keyid = null; // id of currently hilited key, if any -// See main_screen.php for an explanation of this. -function restoreSession() { - document.cookie = '; path=/'; - return true; -} + // callback from add_edit_issue.php: function refreshIssue(issue, title) { diff --git a/interface/practice/ins_search.php b/interface/practice/ins_search.php index 261eb98a4..8d11143ff 100644 --- a/interface/practice/ins_search.php +++ b/interface/practice/ins_search.php @@ -72,11 +72,7 @@ td { font-size:10pt; } var mypcc = ''; - // See main_screen.php for an explanation of this. - function restoreSession() { - document.cookie = '; path=/'; - return true; - } + function doescape(value) { return escape(value); diff --git a/interface/reports/injury_overview_report.php b/interface/reports/injury_overview_report.php index 98235ff45..878be4881 100644 --- a/interface/reports/injury_overview_report.php +++ b/interface/reports/injury_overview_report.php @@ -39,11 +39,7 @@ $form_squads = $_POST['form_squads']; // this is an array var mypcc = ''; - // See main_screen.php for an explanation of this. - function restoreSession() { - document.cookie = '; path=/'; - return true; - } + // callback from add_edit_issue.php: function refreshIssue(issue, title) { diff --git a/interface/usergroup/usergroup.php b/interface/usergroup/usergroup.php index b22014178..d3462e048 100644 --- a/interface/usergroup/usergroup.php +++ b/interface/usergroup/usergroup.php @@ -1,4 +1,4 @@ - + + + ,*" cols="*" frameborder="NO" border="0" framespacing="0"> + src="usergroup_admin.php" - + src="../forms_admin/forms_admin.php" - + src="/controller.php?practice_settings" - + src="../main/calendar/index.php?module=PostCalendar&type=admin&func=modifyconfig" - + src="../main/myadmin/index.php" - + src="/logview/logview.php" - + name="Main" scrolling="auto" noresize frameborder="NO"> @@ -38,7 +43,7 @@ if (/*$userauthorized*/ true) { - @@ -53,6 +58,6 @@ window.location=""; - diff --git a/library/restoreSession.php b/library/restoreSession.php new file mode 100644 index 000000000..02777be8c --- /dev/null +++ b/library/restoreSession.php @@ -0,0 +1,25 @@ +// login.php makes sure the session ID captured here is different for each +// new login. We maintain it here because most browsers do not have separate +// cookie storage for different top-level windows. This function should be +// called just prior to invoking any server script that requires correct +// session data. onclick="top.restoreSession()" usually does the job. +// +var oemr_session_name = ''; +var oemr_session_id = ''; +// +function restoreSession() { + + var mystatus = ''; + var ca = document.cookie.split('; '); + for (var i = 0; i < ca.length; ++i) { + var c = ca[i].split('='); + if (c[0] == oemr_session_name && c[1] != oemr_session_id) { + document.cookie = oemr_session_name + '=' + oemr_session_id + '; path=/'; + + alert('Session ID changed from\n"' + c[1] + '" to\n"' + oemr_session_id + '"'); + + } + } + + return true; +} -- 2.11.4.GIT