Highway to PSR2
[openemr.git] / interface / super / edit_layout_props.php
blobd7bec4246c03e55540844524ccd89c8e61641e6c
1 <?php
2 /**
3 * Edit Layout Properties.
5 * Copyright (C) 2016-2017 Rod Roark <rod@sunsetsystems.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Rod Roark <rod@sunsetsystems.com>
20 * @link http://www.open-emr.org
26 require_once("../globals.php");
27 require_once("$srcdir/acl.inc");
28 require_once("$phpgacl_location/gacl_api.class.php");
30 $info_msg = "";
32 // Check authorization.
33 $thisauth = acl_check('admin', 'super');
34 if (!$thisauth) {
35 die(xlt('Not authorized'));
38 $opt_line_no = intval($_GET['lineno']);
40 <html>
41 <head>
42 <?php html_header_show();?>
43 <title><?php echo xlt("Edit Layout Properties"); ?></title>
44 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
46 <style>
47 td { font-size:10pt; }
48 </style>
50 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js?v=<?php echo $v_js_includes; ?>"></script>
51 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
52 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
53 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
55 <script language="JavaScript">
57 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
59 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
60 var target = opener.document.forms[0]['opt[<?php echo $opt_line_no; ?>][notes]'];
62 $(document).ready(function () {
63 var jobj = {};
64 if (target.value.length) {
65 try {
66 jobj = JSON.parse(target.value);
67 $("#fm_props").find('input,select').each(function() {
68 var fm_prop = $(this).prop('name').slice(5);
69 if ((typeof(jobj[fm_prop]) !== 'undefined') && (fm_prop !== '')) {
70 $(this).val(jobj[fm_prop]);
72 });
74 catch (e) {
75 alert('<?php echo xls('Invalid data, will be ignored and replaced.'); ?>');
78 });
80 // Onclick handler for Submit button.
81 function submitProps() {
82 var jobj = {};
83 $("#fm_props").find('input,select').each(function() {
84 var fm_prop = $(this).prop('name').slice(5);
85 if (($(this).val() !== '') && (fm_prop !== '')) {
86 jobj[fm_prop] = $(this).val();
88 });
89 target.value = ((Object.keys(jobj).length > 0) ? JSON.stringify(jobj) : '');
90 window.close();
93 </script>
95 </head>
97 <body class="body_top">
99 <form id='fm_props' method='post'>
100 <center>
102 <table border='0' width='100%'>
104 <tr>
105 <td valign='top' nowrap>
106 <?php echo xlt('Layout Columns'); ?>
107 </td>
108 <td>
109 <select name='form_columns'>
110 <?php
111 echo "<option value=''>" . xlt('Default') . " (4)</option>\n";
112 for ($cols = 2; $cols <= 10; ++$cols) {
113 if ($cols != 4) {
114 echo "<option value='$cols'>$cols</option>\n";
118 </select>
119 </td>
120 </tr>
122 <tr>
123 <td valign='top' nowrap>
124 <?php echo xlt('Font Size'); ?>
125 </td>
126 <td>
127 <select name='form_size'>
128 <?php
129 echo "<option value=''>" . xlt('Default') . "</option>\n";
130 for ($size = 5; $size <= 15; ++$size) {
131 echo "<option value='$size'";
132 echo ">$size</option>\n";
135 </select>
136 </td>
137 </tr>
139 <tr>
140 <td valign='top' nowrap>
141 <?php echo xlt('Access Control'); ?>
142 </td>
143 <td>
144 <select name='form_aco'>
145 <option value=''></option>
146 <?php echo gen_aco_html_options(); ?>
147 </select>
148 </td>
149 </tr>
151 <tr>
152 <td valign='top' nowrap>
153 <label for='form_category'><?php echo xlt('Category'); ?></label>
154 </td>
155 <td>
156 <input type="text" id='form_category' name='form_category' size="40">
157 </td>
158 </tr>
160 </table>
163 <input type='button' value='<?php echo xla('Submit'); ?>' onclick='submitProps()' />
165 &nbsp;
166 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='window.close()' />
167 </p>
169 </center>
170 </form>
171 <script language='JavaScript'>
172 <?php
173 if ($info_msg) {
174 echo " alert('".addslashes($info_msg)."');\n";
175 echo " window.close();\n";
178 </script>
179 </body>
180 </html>