Session Restore and Frames

yehster wrote on Wednesday, December 21, 2011:

Wanted to start this this topic regarding sessionRestore and the fact that the mechanism for tracking sessions is only on “main_screen.php” and the top frame opened.

Because of this, accessing pages outside of the default frameset breaks easily (as the android app folks are figuring out.)

While the notion of having the javascript exist only on the top frame seems simpler, each individual page needs to be aware of the mechanism anyway.

What I think might be a better approach would be to include the restoreSession.php file on every page or some modified version of it.  That way pages will no longer be dependent on the top frame.  Extra javscript code could also be added to the modified include file which would make restoreSession fire on appropriate events (I’d use jQuery to bind the events.) 
Then a script writer wouldn’t have to worry as much about forgetting to call restoreSession.

I think there is an overall desire for a frameless interface, and this is one piece that I believe is necessary to make this happen.

I don’t have any immediate plans to play with this, this is in part a “thinking aloud” exercise for myself.

tmccormi wrote on Thursday, December 22, 2011:

I am in complete agreement about this one.  We need to unshackle OpenEMR from this ancient frame based technology…
-Tony

yehster wrote on Thursday, January 12, 2012:

Ok, as a quick “proof of concept” I added some code to the top of the “main_info.php”

<?php
require_once("../globals.php");
if (isset($_REQUEST['noframes']))
{?>
<script language='JavaScript'>
<?php    require($GLOBALS['srcdir'] . "/restoreSession.php");?>
top.RTop=top;
</script>
<?php
}
?>

And I can get the calendar working in a “frameless environment”.  

Anyway, where I think I’m going to go with this is to develop a “frameless.php” file that can be included in existing scripts that will detect/manage things so that both operating conditions can be maintained.  

I think this can be accomplished without too much difficulty.  If what I’m saying doesn’t make much sense, don’t worry about it.  I’m still just kind of brainstorming.

yehster wrote on Friday, January 20, 2012:

https://github.com/yehster/openemr/tree/new_session_managment_scheme
https://github.com/yehster/openemr/commit/e8bee0f83a07b2e7ef52add0d5e3dad9e6257a58

Ok, hacking some things up a bit and things seem to be generally working as I expect.
Two main things have to happen in order to work “frameless”.
1. restoreSession needs to be available
2. references to other frames and functions of other frames are stubbed out

What I’ve accomplished so far is implement a new file (restoreSessionNoFrames.php) which when included in the a script element of existing pages makes them work outside of the frameset.  Also, the code checks to see if it is running in a frameless environment before doing requirement 2, so it doesn’t break things if still using frames.  (You can go also go back to the frames session).

If you are bold and want to check this out, pull this branch.
Then after logging into the system, open up another tab and go to
http://ubuntu/openemr/interface/main/main_info.php
also try
http://ubuntu/openemr/interface/patient_file/summary/demographics.php?set_pid=1
(change the pid as you see fit)

The links from off of the demographics page have been enabled to run without frames at this point in this code.

change ubuntu above to your own server obviously. 

There are some obvious deficiencies with this currently (such as lack of navigation, and lack of info regarding current patient/encounter) but I’ve got ideas in mind. 

cybercod wrote on Saturday, January 21, 2012:

If your scripts can check the browser being used, I believe the Android browser comes back as “Android”… This might be helpful if you want to make the frames/no-frames switch automatic.

http://davidwalsh.name/detect-android

yehster wrote on Saturday, January 21, 2012:

I’m using this technique in javascript

if(top.location.href==window.location.href)

to determine frames vs. noFrames. Detecting “Android” won’t accomplish what I want because it needs to work on regular browsers too (and it does).

These server side changes aren’t likely to get onto the demo server anytime soon so if you want to test them out in your android client, here’s another good reason to setup your own server.

krishkam2610 wrote on Sunday, September 28, 2014:

Kevin first of all i apologies to start this discussion despite its being too old, i am also trying to make it frame-less at least left_nav frame but so far no i have not got any success except turning the left frame to horizontal but that’s turning off many pages because of them being dependent on frames, can you please suggest what could be done or at least thought about going in right direction…

krishkam2610 wrote on Sunday, September 28, 2014:

krishkam2610 wrote on Sunday, September 28, 2014: