3 * This popup is called when choosing a foreign field ID for a form layout.
5 * Copyright (C) 2014 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>.
19 * @author Rod Roark <rod@sunsetsystems.com>
20 * @link http://www.open-emr.org
23 $sanitize_all_escapes = true;
24 $fake_register_globals = false;
26 include_once("../globals.php");
28 $form_encounter_layout = array(
29 array('field_id' => 'date',
30 'title' => xl('Visit Date'),
32 'data_type' => '4', // Text-date
36 array('field_id' => 'facility_id',
37 'title' => xl('Service Facility'),
39 'data_type' => '35', // Facilities
43 array('field_id' => 'pc_catid',
44 'title' => xl('Visit Category'),
46 'data_type' => '18', // Visit Category
50 array('field_id' => 'reason',
51 'title' => xl('Reason for Visit'),
53 'data_type' => '2', // Text
57 array('field_id' => 'onset_date',
58 'title' => xl('Date of Onset'),
60 'data_type' => '4', // Text-date
64 array('field_id' => 'referral_source',
65 'title' => xl('Referral Source'),
67 'data_type' => '1', // List
68 'list_id' => 'refsource',
71 array('field_id' => 'shift',
72 'title' => xl('Shift'),
74 'data_type' => '1', // List
78 array('field_id' => 'billing_facility',
79 'title' => xl('Billing Facility'),
81 'data_type' => '35', // Facilities
85 array('field_id' => 'voucher_number',
86 'title' => xl('Voucher Number'),
88 'data_type' => '2', // Text
94 $source = empty($_REQUEST['source']) ?
'D' : $_REQUEST['source'];
96 function gsr_fixup(&$row, $fldid, $default='') {
97 if (isset($row[$fldid])) {
98 return addslashes($row[$fldid]);
103 function gen_sel_row($row) {
104 echo " <tr class='oneresult' onclick='selectField(";
105 echo '"' . gsr_fixup($row, 'field_id' ) . '",';
106 echo '"' . gsr_fixup($row, 'title' ) . '",';
107 echo '"' . gsr_fixup($row, 'data_type' ) . '",';
108 echo '"' . gsr_fixup($row, 'uor' ) . '",';
109 echo '"' . gsr_fixup($row, 'fld_length', 20) . '",';
110 echo '"' . gsr_fixup($row, 'max_length', 0) . '",';
111 echo '"' . gsr_fixup($row, 'list_id' ) . '",';
112 echo '"' . gsr_fixup($row, 'titlecols' , 1) . '",';
113 echo '"' . gsr_fixup($row, 'datacols' , 3) . '",';
114 echo '"' . gsr_fixup($row, 'edit_options' ) . '",';
115 echo '"' . gsr_fixup($row, 'description' ) . '",';
116 echo '"' . gsr_fixup($row, 'fld_rows' , 0) . '"';
118 echo "<td>" . text($row['field_id']) . "</td>";
119 echo "<td>" . text($row['title' ]) . "</td>";
125 <?php
html_header_show(); ?
>
126 <title
><?php
echo xlt('List layout items'); ?
></title
>
127 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
129 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
131 <script language
="javascript">
133 function selectField(field_id
, title
, data_type
, uor
, fld_length
, max_length
,
134 list_id
, titlecols
, datacols
, edit_options
, description
, fld_rows
)
136 if (opener
.closed ||
! opener
.SetField
) {
137 alert('<?php echo xls('The destination form was closed
; I cannot act on your selection
.'); ?>');
140 opener
.SetField(field_id
, title
, data_type
, uor
, fld_length
, max_length
,
141 list_id
, titlecols
, datacols
, edit_options
, description
, fld_rows
);
147 function newField() {
148 return selectField(document
.forms
[0].new_field_id
.value
, '', 2, 1, 10, 255,
149 '', 1, 3, '', '', 0);
152 $
(document
).ready(function(){
154 $
('.oneresult').mouseover(function() { $
(this
).toggleClass('highlight'); });
155 $
('.oneresult').mouseout(function() { $
(this
).toggleClass('highlight'); });
157 // $('.oneresult').click(function() { SelectField(this); });
158 // var SelectField = function(obj) {
159 // return setAFieldID($(obj).attr('id'));
179 border
-bottom
: 1px solid
#ccc;
180 background
-color
: white
;
183 background
-color
: #336699;
190 <body
class="body_top text">
195 // F should never happen, but just in case.
196 if ($source == 'F') echo xlt('Fields in This Form' ); else
197 if ($source == 'D') echo xlt('Demographics Fields' ); else
198 if ($source == 'H') echo xlt('History Fields' ); else
199 if ($source == 'E') echo xlt('Visit Attributes' ); else
200 if ($source == 'V') echo xlt('Visit Form Attributes');
206 if ($source == 'V') {
207 foreach ($form_encounter_layout as $lrow) {
212 if ($source == 'D' ||
$source == 'H') {
213 $res = sqlStatement("SELECT * FROM layout_options " .
214 "WHERE form_id = ? AND uor > 0 ORDER BY field_id",
215 array($source == 'D' ?
'DEM' : 'HIS'));
218 $res = sqlStatement("SELECT * FROM layout_options WHERE " .
219 "form_id LIKE ? AND uor > 0 AND source = ? ORDER BY field_id, form_id",
223 while ($row = sqlFetchArray($res)) {
224 if ($row['field_id'] === $last_field_id) continue;
225 $last_field_id = $row['field_id'];
232 <?php
if ($source == 'E') { ?
>
236 <input type
='text' name
='new_field_id' size
='20' /> 
;
237 <input type
='button' value
='<?php echo xla('Or create this
new field ID
') ?>' onclick
='newField()' />