"Popups" menu shenanigans

avantsys wrote on Friday, July 13, 2012:

We have been asked by some of our clients to remove the “popups” menu, because they don’t see how and why some of its options might be useful to them and because they find its presence in the GUI distracting and even confusing.

But, when we tried to remove it, it caused an undesirable side-effect. Hiding it also removed vital information from the top bar: the patient’s name, his birth date and his age.

We’re still working to figure out how to hide this menu without causing other parts of the application’s functionality to go haywire. However, it’s things like these that make a code cleanup de riguer.

avantsys wrote on Friday, July 13, 2012:

Update:

We managed to hide the “popups” menu without having the aforementioned side-effects. What’s displayed on the top bar, however, should be less dependent of customizations to the left-hand menu.

Konstantinos
AvantSys Informatics

sunsetsystems wrote on Friday, July 13, 2012:

If you remove an element, you also have to remove/adjust any Javascript that references it.  Otherwise a thread of execution encountering that code will abort and any subsequent actions in it will not happen.

While there are many arguments for code cleanup, this is not one of them.  :slight_smile:

Rod
www.sunsetsystems.com

avantsys wrote on Friday, July 13, 2012:

Rod,

Allow me to elaborate:

Let’s go to left_nav.php, shall we?

The genPopupsList(); function had to become a comment in order to hide the “Popups” menu as follows:

//genPopupsList();

If in the left_nav.php, there is code  function that affects main_title.php, this is a code design error.

And now, let’s go to the million dollar question: Is there a standard place where the Javascript code is in OpenEMR so that we’ll know if it references something we’re hiding or disabling? Or is the Javascript code all over the place, making even the most minute of fixes and customizations more difficult than necessary?

Konstantinos
AvantSys Informatics

sunsetsystems wrote on Friday, July 13, 2012:

If you look at the HTML element that was removed:

<select name='popups' onchange='selpopup(this)' style='background-color:transparent;font-size:9pt;<?php echo $style; ?>'>

… you’ll notice it can be referenced by its name, “popups”.  Then if you search for “popups” in that same module you’ll find this in the function syncRadios():

  f.popups.disabled = (active_pid == 0);

… and it becomes obvious that this line of code will fail, causing anything that comes after it in the execution thread to fail.

Alternatively, you can turn on the error console in your browser and it will report this kind of error.

Rod
www.sunsetsystems.com

avantsys wrote on Friday, July 13, 2012:

Let me show you how we finally made it work:

Always in the left_nav.php:

We set  style=“visibility:hidden;” in line 230 where the HTML creates the select. We made it as follows:
<select style=“visibility:hidden;” name=‘popups’ onchange=‘selpopup(this)’ style=‘background-color:transparent;font-size:9pt;<?php echo $style;
?>’>

After this change, it worked.