forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_form.php
226 lines (209 loc) · 6.33 KB
/
new_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
include_once("../../globals.php");
?>
<html>
<head>
<?php html_header_show();?>
<link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css">
<script language="JavaScript">
function openNewForm(sel) {
top.restoreSession();
<?php if ($GLOBALS['concurrent_layout']) { ?>
FormNameValueArray = sel.split('formname=');
if(FormNameValueArray[1] == 'newpatient')
{
parent.location.href = sel
}
else
{
parent.Forms.location.href = sel;
}
<?php } else { ?>
top.frames['Main'].location.href = sel;
<?php } ?>
}
function toggleFrame1(fnum) {
top.frames['left_nav'].document.forms[0].cb_top.checked=false;
top.window.parent.left_nav.toggleFrame(fnum);
}
</script>
<style type="text/css">
#sddm
{ margin: 0;
padding: 0;
z-index: 30;
}
</style>
<script type="text/javascript" language="javascript">
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
var oldddmenuitem = 0;
var flag = 0;
// open hidden layer
function mopen(id)
{
// cancel close timer
//mcancelclosetime();
flag=10;
// close old layer
//if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
//if(ddmenuitem) ddmenuitem.style.display = 'none';
// get new layer and show it
oldddmenuitem = ddmenuitem;
ddmenuitem = document.getElementById(id);
if((ddmenuitem.style.visibility == '')||(ddmenuitem.style.visibility == 'hidden')){
if(oldddmenuitem) oldddmenuitem.style.visibility = 'hidden';
if(oldddmenuitem) oldddmenuitem.style.display = 'none';
ddmenuitem.style.visibility = 'visible';
ddmenuitem.style.display = 'block';
}else{
ddmenuitem.style.visibility = 'hidden';
ddmenuitem.style.display = 'none';
}
}
// close showed layer
function mclose()
{
if(flag==10)
{
flag=11;
return;
}
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
if(ddmenuitem) ddmenuitem.style.display = 'none';
}
// close layer when click-out
document.onclick = mclose;
//=================================================
function findPosX(id)
{
obj=document.getElementById(id);
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
PropertyWidth=document.getElementById(id).offsetWidth;
if(PropertyWidth>curleft)
{
document.getElementById(id).style.left=0;
}
}
function findPosY(obj)
{
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
}
</script>
</head>
<body class="bgcolor2">
<dl>
<?php //DYNAMIC FORM RETREIVAL
include_once("$srcdir/registry.inc");
function myGetRegistered($state="1", $limit="unlimited", $offset="0") {
$sql = "SELECT category, nickname, name, state, directory, id, sql_run, " .
"unpackaged, date FROM registry WHERE " .
"state LIKE \"$state\" ORDER BY category, priority, name";
if ($limit != "unlimited") $sql .= " limit $limit, $offset";
$res = sqlStatement($sql);
if ($res) {
for($iter=0; $row=sqlFetchArray($res); $iter++) {
$all[$iter] = $row;
}
}
else {
return false;
}
return $all;
}
$reg = myGetRegistered();
$old_category = '';
$DivId=1;
if (!empty($reg)) {
$StringEcho= '<ul id="sddm">';
if(isset($hide)){
$StringEcho.= "<li><a id='enc2' >Encounter Summary</a></li>";
}else{
$StringEcho.= "<li><a href='JavaScript:void(0);' id='enc2' onclick=\" return top.window.parent.left_nav.loadFrame2('enc2','RBot','patient_file/encounter/encounter_top.php')\">Encounter Summary</a></li>";
}
foreach ($reg as $entry) {
$new_category = trim($entry['category']);
$new_nickname = trim($entry['nickname']);
if ($new_category == '') {$new_category = htmlspecialchars(xl('Miscellaneous'),ENT_QUOTES);}
if ($new_nickname != '') {$nickname = $new_nickname;}
else {$nickname = $entry['name'];}
if ($old_category != $new_category) {
$new_category_ = $new_category;
$new_category_ = str_replace(' ','_',$new_category_);
if ($old_category != '') {$StringEcho.= "</table></div></li>";}
$StringEcho.= "<li><a href='JavaScript:void(0);' onClick=\"mopen('$DivId');\" >$new_category</a><div id='$DivId' ><table border='0' cellspacing='0' cellpadding='0'>";
$old_category = $new_category;
$DivId++;
}
$StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=\"openNewForm('" . $rootdir .'/patient_file/encounter/load_form.php?formname=' .urlencode($entry['directory']) .
"')\" href='JavaScript:void(0);'>" . xl_form_title($nickname) . "</a></td></tr>";
}
$StringEcho.= '</table></div></li>';
}
if($StringEcho){
$StringEcho2= '<div style="clear:both"></div>';
}else{
$StringEcho2="";
}
?>
<!--<table style="border:solid 1px black" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><?php //echo $StringEcho; ?></td>
</tr>
</table>-->
<?php
//$StringEcho='';
// This shows Layout Based Form names just like the above.
//
$lres = sqlStatement("SELECT * FROM list_options " .
"WHERE list_id = 'lbfnames' ORDER BY seq, title");
if (sqlNumRows($lres)) {
if(!$StringEcho){
$StringEcho= '<ul id="sddm">';
}
$StringEcho.= "<li><a href='JavaScript:void(0);' onClick=\"mopen('lbf');\" >".xl('Layout Based') ."</a><div id='lbf' ><table border='0' cellspacing='0' cellpadding='0'>";
while ($lrow = sqlFetchArray($lres)) {
$option_id = $lrow['option_id']; // should start with LBF
$title = $lrow['title'];
$StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a href='" . $rootdir .'/patient_file/encounter/load_form.php?formname='
.urlencode($option_id) ."' >" . xl_form_title($title) . "</a></td></tr>";
}
}
if($StringEcho){
$StringEcho.= "</table></div></li></ul>".$StringEcho2;
}
?>
<table cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top"><?php echo $StringEcho; ?></td>
</tr>
</table>
</dl>
</body>
</html>