Update X12_5010_837P.php (#2599)
[openemr.git] / interface / expand_contract_js.php
blob45dab90ee6a1ae6cd14ab5e5887f57d891f0a1b9
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 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 // ensure that $user_settings_php_path, $arr_files_php variables are set in the script calling this script
15 use OpenEMR\Common\Csrf\CsrfUtils;
18 $( document ).ready(function() {
19 $('.expand_contract').click(function() {
20 var elementTitle = $(this).prop('title');
21 var contractTitle = <?php echo xlj('Click to Contract and set to henceforth open in Centered mode'); ?>;
22 var expandTitle = <?php echo xlj('Click to Expand and set to henceforth open in Expanded mode'); ?>;
23 var arrFiles = <?php echo json_encode($arr_files_php) ?>;
25 if (elementTitle == contractTitle) {
26 elementTitle = expandTitle;
27 $(this).toggleClass('fa-expand fa-compress');
28 $('.expandable').toggleClass('container container-fluid');
29 if ($(arrFiles).length) {
30 $.each(arrFiles, function (index, value) {
31 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
33 target: arrFiles[index].trim(),
34 setting: 0,
35 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
38 });
40 } else if (elementTitle == expandTitle) {
41 elementTitle = contractTitle;
42 $(this).toggleClass('fa-compress fa-expand');
43 $('.expandable').toggleClass('container-fluid container');
44 if ($(arrFiles).length) {
45 $.each(arrFiles, function (index, value) {
46 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
48 target: arrFiles[index].trim(),
49 setting: 1,
50 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
53 });
56 $(this).prop('title', elementTitle);
57 });
58 });