Fixes #4497 - FHIR search via POST (#4498)
[openemr.git] / interface / expand_contract_js.php
blob266371a344e92b8d9261a30d93c329a36ab88021
1 <?php
3 /**
4 * expand contract jquery script
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Ranganath Pathak <pathak@scrs1.org>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
11 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 // ensure that $user_settings_php_path, $arr_files_php variables are set in the script calling this script
17 use OpenEMR\Common\Csrf\CsrfUtils;
20 $(function () {
21 $('.expand_contract').click(function() {
22 var elementTitle = $(this).prop('title');
23 var contractTitle = <?php echo xlj('Click to Contract and set to henceforth open in Centered mode'); ?>;
24 var expandTitle = <?php echo xlj('Click to Expand and set to henceforth open in Expanded mode'); ?>;
25 var arrFiles = <?php echo json_encode($arr_files_php) ?>;
27 if (elementTitle == contractTitle) {
28 elementTitle = expandTitle;
29 $(this).toggleClass('fa-expand fa-compress');
30 $('.expandable').toggleClass('container container-fluid');
31 if ($(arrFiles).length) {
32 $.each(arrFiles, function (index, value) {
33 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
35 target: arrFiles[index].trim(),
36 setting: 0,
37 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
40 });
42 } else if (elementTitle == expandTitle) {
43 elementTitle = contractTitle;
44 $(this).toggleClass('fa-compress fa-expand');
45 $('.expandable').toggleClass('container-fluid container');
46 if ($(arrFiles).length) {
47 $.each(arrFiles, function (index, value) {
48 $.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
50 target: arrFiles[index].trim(),
51 setting: 1,
52 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
55 });
58 $(this).prop('title', elementTitle);
59 });
60 });