Skip to content

Commit

Permalink
Persistent top/bottom frame display selection in left_nav (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsupport authored and bradymiller committed Sep 23, 2016
1 parent 8ad2a23 commit 585c840
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 17 deletions.
48 changes: 39 additions & 9 deletions interface/main/left_nav.php
Expand Up @@ -91,6 +91,13 @@
require_once($GLOBALS['fileroot']."/library/patient.inc");
require_once($GLOBALS['fileroot']."/library/lists.inc");
require_once $GLOBALS['srcdir'].'/ESign/Api.php';
require_once $GLOBALS['srcdir'].'/user.inc';

// Fetch user preferences saved from prior session
$uspfx = substr(__FILE__, strlen($GLOBALS['fileroot']."/")) . '.';
$cb_top_chk = prevSetting($uspfx, 'cb_top', 'frame0_chk', 'checked');
$cb_bot_chk = prevSetting($uspfx, 'cb_bot', 'frame1_chk', 'checked');
$usrval = json_encode( array ( $cb_top_chk, $cb_bot_chk ) );

// This array defines the list of primary documents that may be
// chosen. Each element value is an array of 3 values:
Expand Down Expand Up @@ -388,6 +395,8 @@ function genFindBlock() {
<script type="text/javascript" src="../../library/dialog.js"></script>

<script language='JavaScript'>
// User settings
var usrval = jQuery.parseJSON('<?php echo $usrval ?>');

// tajemo work by CB 2012/01/31 12:32:57 PM dated reminders counter
function getReminderCount(){
Expand All @@ -410,10 +419,9 @@ function(data) {
$(document).ready(function (){
getReminderCount();//
parent.loadedFrameCount += 1;
<?php if ($GLOBALS['drop_bottom'] ==1) { ?>
$("input[name=cb_bot]").trigger('click');
toggleFrame(2);
<?php } ?>
for (var i = 0, len = usrval.length; i < len; i++) {
if (usrval[i] != "checked") toggleFrame(i+1);
}
})
// end of tajemo work dated reminders counter

Expand All @@ -438,7 +446,7 @@ function toggleFrame(fnum) {
var rows = f.cb_top.checked ? '*' : '0';
rows += f.cb_bot.checked ? ',*' : ',0';
fset.rows = rows;
fset.rows = rows;
save_setting ([(f.cb_top.checked ? 'checked' : '&nbsp;'), (f.cb_bot.checked ? 'checked' : '&nbsp;')]);
}

// Load the specified url into the specified frame (RTop or RBot).
Expand Down Expand Up @@ -1065,12 +1073,12 @@ function selpopup(selobj) {
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td class='smalltext' nowrap>
<input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked />
<input type='checkbox' name='cb_top' onclick='toggleFrame(1)' <?php echo $cb_top_chk ?> />
<b><?php xl('Top','e') ?></b>
</td>
<td class='smalltext' align='right' nowrap>
<b><?php xl('Bot','e') ?></b>
<input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' checked />
<input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' <?php echo $cb_bot_chk ?> />
</td>
</tr>
</table>
Expand Down Expand Up @@ -1474,10 +1482,10 @@ function selpopup(selobj) {
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td class='smalltext' nowrap>
<input type='checkbox' name='cb_top' onclick='toggleFrame(1)' checked /><b><?php xl('Top','e') ?></b>
<input type='checkbox' name='cb_top' onclick='toggleFrame(1)' <?php echo $cb_top_chk ?> /><b><?php xl('Top','e') ?></b>
</td>
<td class='smalltext' align='right' nowrap>
<b><?php xl('Bot','e') ?></b><input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' checked />
<b><?php xl('Bot','e') ?></b><input type='checkbox' name='cb_bot' onclick='toggleFrame(2)' <?php echo $cb_bot_chk ?> />
</td>
</tr>
</table>
Expand Down Expand Up @@ -1534,6 +1542,28 @@ function selpopup(selobj) {

<script language='JavaScript'>
syncRadios();

function save_setting (cb_frames) {
for (var i = 0, len = cb_frames.length; i < len; i++) {
try {
var fref = '<?php echo $uspfx ?>frame' + i + '_chk';
var ureq = $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
{ lab: fref, val: cb_frames[i] })
.done(function(data) {
// alert( "Data Loaded: " + data );
})
.fail(function(xhr, textStatus, errorThrown) {
alert("Error:"+xhr.responseText+"\n"+textStatus+"\n"+errorThrown);
})
.always(function() {
// alert( "finished" );
});

} catch (err) {
alert (err.message);
}
}
}
</script>

</body>
Expand Down
5 changes: 5 additions & 0 deletions library/ajax/user_settings.php
Expand Up @@ -30,4 +30,9 @@
setUserSetting($_POST['target'], $_POST['mode']);

}

//mdsupport : Generic user setting
if ((isset($_POST['lab'])) && (isset($_POST['val']))) {
setUserSetting($_POST['lab'], $_POST['val']);
}
?>
8 changes: 0 additions & 8 deletions library/globals.inc.php
Expand Up @@ -104,7 +104,6 @@
'css_header',
'gbl_pt_list_page_size',
'gbl_pt_list_new_window',
'drop_bottom',
'units_of_measurement',
'us_weight_format',
'date_display_format',
Expand Down Expand Up @@ -302,13 +301,6 @@
xl('Phone Number for Vendor Support that Appears on the About Page.')
),

'drop_bottom' => array(
xl('Remove Bottom Pane'),
'bool', // data type
'0', // default = false
xl('Removes the bottom pane by default on start up.')
),

'encounter_page_size' => array(
xl('Encounter Page Size'),
array(
Expand Down

0 comments on commit 585c840

Please sign in to comment.