bug fix march continued (#1921)
[openemr.git] / interface / expand_contract_js.php
blob6b01213bbe7fd51c29d49215a6173dbf2f0be929
1 <?php
2 /**
3 * expand contract jquery script
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Ranganath Pathak <pathak@scrs1.org>
8 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
11 // ensure that $user_settings_php_path, $arr_files_php variables are set in the script calling this script
13 $( document ).ready(function() {
14 $('.expand_contract').click(function() {
15 var elementTitle = $(this).prop('title');
16 var contractTitle = '<?php echo xla('Click to Contract and set to henceforth open in Centered mode'); ?>';
17 var expandTitle = '<?php echo xla('Click to Expand and set to henceforth open in Expanded mode'); ?>';
18 var arrFiles = <?php echo json_encode($arr_files_php) ?>;
20 if (elementTitle == contractTitle) {
21 elementTitle = expandTitle;
22 $(this).toggleClass('fa-expand fa-compress');
23 $('.expandable').toggleClass('container container-fluid');
24 if ($(arrFiles).length) {
25 $.each(arrFiles, function (index, value) {
26 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
28 target: arrFiles[index].trim(),
29 setting: 0,
30 csrf_token_form: "<?php echo attr(collectCsrfToken()); ?>"
33 });
35 } else if (elementTitle == expandTitle) {
36 elementTitle = contractTitle;
37 $(this).toggleClass('fa-compress fa-expand');
38 $('.expandable').toggleClass('container-fluid container');
39 if ($(arrFiles).length) {
40 $.each(arrFiles, function (index, value) {
41 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
43 target: arrFiles[index].trim(),
44 setting: 1,
45 csrf_token_form: "<?php echo attr(collectCsrfToken()); ?>"
48 });
51 $(this).prop('title', elementTitle);
52 });
53 });