cleanup of fee sheet js scripts and changes to avoid js script loading timing issues
[openemr.git] / interface / forms_admin / forms_admin.php
bloba71f68426a30c268f2d4604f3da8b92ac0028199
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 $sanitize_all_escapes = true;
8 $fake_register_globals = false;
10 //INCLUDES, DO ANY ACTIONS, THEN GET OUR DATA
11 require_once("../globals.php");
12 require_once("$srcdir/acl.inc");
13 require_once("$phpgacl_location/gacl_api.class.php");
14 require_once("$srcdir/registry.inc");
16 if ($_GET['method'] == "enable"){
17 updateRegistered ( $_GET['id'], "state=1" );
19 elseif ($_GET['method'] == "disable"){
20 updateRegistered ( $_GET['id'], "state=0" );
22 elseif ($_GET['method'] == "install_db"){
23 $dir = getRegistryEntry ( $_GET['id'], "directory" );
24 if (installSQL ("$srcdir/../interface/forms/{$dir['directory']}"))
25 updateRegistered ( $_GET['id'], "sql_run=1" );
26 else
27 $err = xl('ERROR: could not open table.sql, broken form?');
29 elseif ($_GET['method'] == "register"){
30 registerForm ( $_GET['name'] ) or $err=xl('error while registering form!');
32 $bigdata = getRegistered("%") or $bigdata = false;
34 //START OUT OUR PAGE....
36 <html>
37 <head>
38 <?php html_header_show();?>
39 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
40 </head>
41 <body class="body_top">
42 <span class="title"><?php xl('Forms Administration','e');?></span>
43 <br><br>
44 <?php
45 foreach($_POST as $key => $val) {
46 if (preg_match('/nickname_(\d+)/', $key, $matches)) {
47 sqlQuery("update registry set nickname = ? where id = ?", array($val, $matches[1]));
49 else if (preg_match('/category_(\d+)/', $key, $matches)) {
50 sqlQuery("update registry set category = ? where id = ?", array($val, $matches[1]));
52 else if (preg_match('/priority_(\d+)/', $key, $matches)) {
53 sqlQuery("update registry set priority = ? where id = ?", array($val, $matches[1]));
55 else if (preg_match('/aco_spec_(\d+)/', $key, $matches)) {
56 sqlQuery("update registry set aco_spec = ? where id = ?", array($val, $matches[1]));
61 <?php //ERROR REPORTING
62 if ($err)
63 echo "<span class=bold>" . text($err) . "</span><br><br>\n";
66 <?php //REGISTERED SECTION ?>
67 <span class=bold><?php xl('Registered','e');?></span><br>
68 <form method=POST action ='./forms_admin.php'>
69 <i><?php echo xlt('click here to update priority, category, nickname and access control settings'); ?></i>
70 <input type='submit' name='update' value='<?php echo xla('update'); ?>'><br>
71 <table border=0 cellpadding=1 cellspacing=2 width="500">
72 <tr>
73 <td> </td>
74 <td> </td>
75 <td> </td>
76 <td> </td>
77 <td> </td>
78 <td><?php echo xlt('Priority'); ?> </td>
79 <td><?php echo xlt('Category'); ?> </td>
80 <td><?php echo xlt('Nickname'); ?> </td>
81 <td><?php echo xlt('Access Control'); ?></td>
82 </tr>
83 <?php
84 $color="#CCCCCC";
85 if ($bigdata != false)
86 foreach($bigdata as $registry)
88 $priority_category = sqlQuery("select priority, category, nickname, aco_spec from registry where id = ?",
89 array($registry['id']));
91 <tr>
92 <td bgcolor="<?php echo $color; ?>" width="2%">
93 <span class='text'><?php echo text($registry['id']); ?></span>
94 </td>
95 <td bgcolor="<?php echo attr($color); ?>" width="30%">
96 <span class='bold'><?php echo xl_form_title($registry['name']); ?></span>
97 </td>
98 <?php
99 if ($registry['sql_run'] == 0)
100 echo "<td bgcolor='" . attr($color) . "' width='10%'><span class='text'>" . xlt('registered') . "</span>";
101 elseif ($registry['state'] == "0")
102 echo "<td bgcolor='#FFCCCC' width='10%'><a class='link_submit' href='./forms_admin.php?id={$registry['id']}&method=enable'>" . xlt('disabled') . "</a>";
103 else
104 echo "<td bgcolor='#CCFFCC' width='10%'><a class='link_submit' href='./forms_admin.php?id={$registry['id']}&method=disable'>" . xlt('enabled') . "</a>";
105 ?></td>
106 <td bgcolor="<?php echo attr($color); ?>" width="10%">
107 <span class='text'><?php
108 if ($registry['unpackaged'])
109 echo xlt('PHP extracted');
110 else
111 echo xlt('PHP compressed');
112 ?></span>
113 </td>
114 <td bgcolor="<?php echo attr($color); ?>" width="10%">
115 <?php
116 if ($registry['sql_run'])
117 echo "<span class='text'>" . xlt('DB installed') . "</span>";
118 else
119 echo "<a class='link_submit' href='./forms_admin.php?id=" . attr($registry['id']) . "&method=install_db'>" . xlt('install DB') . "</a>";
121 </td>
122 <?php
123 echo "<td><input type='text' size='4' name='priority_" . attr($registry['id']) . "' value='" . attr($priority_category['priority']) . "'></td>";
124 echo "<td><input type='text' size='10' name='category_" . attr($registry['id']) . "' value='" . attr($priority_category['category']) . "'></td>";
125 echo "<td><input type='text' size='10' name='nickname_" . attr($registry['id']) . "' value='" . attr($priority_category['nickname']) . "'></td>";
126 echo "<td>";
127 echo "<select name='aco_spec_" . attr($registry['id']) . "'>";
128 echo "<option value=''></option>";
129 echo gen_aco_html_options($priority_category['aco_spec']);
130 echo "</select>";
131 echo "</td>";
133 </tr>
134 <?php
135 if ($color=="#CCCCCC")
136 $color="#999999";
137 else
138 $color="#CCCCCC";
139 } //end of foreach
141 </table>
142 <hr>
144 <?php //UNREGISTERED SECTION ?>
145 <span class='bold'><?php echo xlt('Unregistered'); ?></span><br>
146 <table border=0 cellpadding=1 cellspacing=2 width="500">
147 <?php
148 $dpath = "$srcdir/../interface/forms/";
149 $dp = opendir($dpath);
150 $color="#CCCCCC";
151 for ($i=0; false != ($fname = readdir($dp)); $i++)
152 if ($fname != "." && $fname != ".." && $fname != "CVS" && $fname != "LBF" &&
153 (is_dir($dpath.$fname) || stristr($fname, ".tar.gz") ||
154 stristr($fname, ".tar") || stristr($fname, ".zip") ||
155 stristr($fname, ".gz")))
156 $inDir[$i] = $fname;
158 // ballards 11/05/2005 fixed bug in removing registered form from the list
159 if ($bigdata != false)
161 foreach ( $bigdata as $registry )
163 $key = array_search($registry['directory'], $inDir) ; /* returns integer or FALSE */
164 unset($inDir[$key]);
168 foreach ( $inDir as $fname )
170 // added 8-2009 by BM - do not show the metric vitals form as option since deprecated
171 // also added a toggle in globals.php in case user wants the option to add this deprecated form
172 if (($fname == "vitalsM") && ($GLOBALS['disable_deprecated_metrics_form'])) continue;
174 if (stristr($fname, ".tar.gz") || stristr($fname, ".tar") || stristr($fname, ".zip") || stristr($fname, ".gz"))
175 $phpState = "PHP compressed";
176 else
177 $phpState = "PHP extracted";
179 <tr>
180 <td bgcolor="<?php echo $color?>" width="1%">
181 <span class=text> </span>
182 </td>
183 <td bgcolor="<?php echo $color?>" width="20%">
184 <?php
185 $form_title_file = @file($GLOBALS['srcdir']."/../interface/forms/$fname/info.txt");
186 if ($form_title_file)
187 $form_title = $form_title_file[0];
188 else
189 $form_title = $fname;
191 <span class=bold><?php echo xl_form_title($form_title); ?></span>
192 </td>
193 <td bgcolor="<?php echo $color?>" width="10%"><?php
194 if ($phpState == "PHP extracted")
195 echo '<a class=link_submit href="./forms_admin.php?name=' . urlencode($fname) . '&method=register">' . xl('register') . '</a>';
196 else
197 echo '<span class=text>' . xl('n/a') . '</span>';
198 ?></td>
199 <td bgcolor="<?php echo $color?>" width="20%">
200 <span class=text><?php echo xl($phpState); ?></span>
201 </td>
202 <td bgcolor="<?php echo $color?>" width="10%">
203 <span class=text><?php xl('n/a','e'); ?></span>
204 </td>
205 </tr>
206 <?php
207 if ($color=="#CCCCCC")
208 $color="#999999";
209 else
210 $color="#CCCCCC";
211 flush();
212 }//end of foreach
214 </table>
216 </body>
217 </html>