Update copyright page (consolidated to one page):
[openemr.git] / interface / usergroup / usergroup_admin_add.php
blob2bb34e427f0fb36fbc91f680fec538f78e6f333e
1 <?php
2 require_once("../globals.php");
3 require_once("../../library/acl.inc");
4 require_once("$srcdir/md5.js");
5 require_once("$srcdir/sql.inc");
6 require_once("$srcdir/formdata.inc.php");
7 require_once("$srcdir/options.inc.php");
8 require_once(dirname(__FILE__) . "/../../library/classes/WSProvider.class.php");
10 $alertmsg = '';
13 <html>
14 <head>
16 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
17 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
18 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
19 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
20 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
21 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
22 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
23 <script src="checkpwd_validation.js" type="text/javascript"></script>
25 <script language="JavaScript">
27 function submitform() {
28 if (document.forms[0].rumple.value.length>0 && document.forms[0].stiltskin.value.length>0) {
29 top.restoreSession();
31 //Checking if secure password is enabled or disabled.
32 //If it is enabled and entered password is a weak password, alert the user to enter strong password.
33 if(document.new_user.secure_pwd.value == 1){
34 var password = trim(document.new_user.stiltskin.value);
35 if(password != "") {
36 var pwdresult = passwordvalidate(password);
37 if(pwdresult == 0){
38 alert("<?php echo xl('The password must be at least eight characters, and should'); echo '\n'; echo xl('contain at least three of the four following items:'); echo '\n'; echo xl('A number'); echo '\n'; echo xl('A lowercase letter'); echo '\n'; echo xl('An uppercase letter'); echo '\n'; echo xl('A special character');echo '('; echo xl('not a letter or number'); echo ').'; echo '\n'; echo xl('For example:'); echo ' healthCare@09'; ?>");
39 return false;
42 } //secure_pwd if ends here
43 document.forms[0].newauthPass.value=MD5(document.forms[0].stiltskin.value);
44 document.forms[0].stiltskin.value='';
45 document.forms[0].submit();
46 } else {
47 if (document.forms[0].rumple.value.length<=0)
48 {document.forms[0].rumple.focus();document.forms[0].rumple.style.backgroundColor="red";}
49 if (document.forms[0].stiltskin.value.length<=0)
50 {document.forms[0].stiltskin.focus();document.forms[0].stiltskin.style.backgroundColor="red";}
53 function authorized_clicked() {
54 var f = document.forms[0];
55 f.calendar.disabled = !f.authorized.checked;
56 f.calendar.checked = f.authorized.checked;
59 </script>
61 </head>
62 <body class="body_top">
63 <table><tr><td>
64 <span class="title"><?php xl('Add User','e'); ?></span>&nbsp;</td>
65 <td>
66 <a class="css_button" name='form_save' id='form_save' href='#' onclick="return submitform()">
67 <span><?php xl('Save','e');?></span></a>
68 <a class="css_button large_button" id='cancel' href='#'>
69 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
70 </a>
71 </td></tr></table>
72 <br><br>
74 <table border=0>
76 <tr><td valign=top>
77 <form name='new_user' method='post' target="_parent" action="usergroup_admin.php"
78 onsubmit='return top.restoreSession()'>
79 <input type=hidden name=mode value=new_user>
80 <input type=hidden name=secure_pwd value="<? echo $GLOBALS['secure_password']; ?>">
81 <span class="bold">&nbsp;</span>
82 </td><td>
83 <table border=0 cellpadding=0 cellspacing=0 style="width:600px;">
84 <tr>
85 <td style="width:150px;"><span class="text"><?php xl('Username','e'); ?>: </span></td><td style="width:220px;"><input type=entry name=rumple style="width:120px;"> <span class="mandatory">&nbsp;*</span></td>
86 <td style="width:150px;"><span class="text"><?php xl('Password','e'); ?>: </span></td><td style="width:250px;"><input type="entry" style="width:120px;" name=stiltskin><span class="mandatory">&nbsp;*</span></td>
87 </tr>
88 <tr>
89 <td><span class="text"<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>><?php xl('Groupname','e'); ?>: </span></td>
90 <td>
91 <select name=groupname<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
92 <?php
93 $res = sqlStatement("select distinct name from groups");
94 $result2 = array();
95 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
96 $result2[$iter] = $row;
97 foreach ($result2 as $iter) {
98 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
101 </select></td>
102 <td><span class="text"><?php xl('Provider','e'); ?>: </span></td><td>
103 <input type='checkbox' name='authorized' value='1' onclick='authorized_clicked()' />
104 &nbsp;&nbsp;<span class='text'><?php xl('Calendar','e'); ?>:
105 <input type='checkbox' name='calendar' disabled />
106 </td>
107 </tr>
108 <tr>
109 <td><span class="text"><?php xl('First Name','e'); ?>: </span></td><td><input type=entry name='fname' style="width:120px;"></td>
110 <td><span class="text"><?php xl('Middle Name','e'); ?>: </span></td><td><input type=entry name='mname' style="width:120px;"></td>
111 </tr>
112 <tr>
113 <td><span class="text"><?php xl('Last Name','e'); ?>: </span></td><td><input type=entry name='lname' style="width:120px;"></td>
114 <td><span class="text"><?php xl('Default Facility','e'); ?>: </span></td><td><select style="width:120px;" name=facility_id>
115 <?php
116 $fres = sqlStatement("select * from facility where service_location != 0 order by name");
117 if ($fres) {
118 for ($iter = 0;$frow = sqlFetchArray($fres);$iter++)
119 $result[$iter] = $frow;
120 foreach($result as $iter) {
122 <option value="<?php echo $iter{id};?>"><?php echo $iter{name};?></option>
123 <?php
127 </select></td>
128 </tr>
129 <tr>
130 <td><span class="text"><?php xl('Federal Tax ID','e'); ?>: </span></td><td><input type=entry name='federaltaxid' style="width:120px;"></td>
131 <td><span class="text"><?php xl('Federal Drug ID','e'); ?>: </span></td><td><input type=entry name='federaldrugid' style="width:120px;"></td>
132 </tr>
133 <tr>
134 <td><span class="text"><?php xl('UPIN','e'); ?>: </span></td><td><input type="entry" name="upin" style="width:120px;"></td>
135 <td class='text'><?php xl('See Authorizations','e'); ?>: </td>
136 <td><select name="see_auth" style="width:120px;">
137 <?php
138 foreach (array(1 => xl('None'), 2 => xl('Only Mine'), 3 => xl('All')) as $key => $value)
140 echo " <option value='$key'";
141 echo ">$value</option>\n";
144 </select></td>
146 <tr>
147 <td><span class="text"><?php xl('NPI','e'); ?>: </span></td><td><input type="entry" name="npi" style="width:120px;"></td>
148 <td><span class="text"><?php xl('Job Description','e'); ?>: </span></td><td><input type="entry" name="specialty" style="width:120px;"></td>
149 </tr>
151 <!-- (CHEMED) Calendar UI preference -->
152 <tr>
153 <td><span class="text"><?php xl('Taxonomy','e'); ?>: </span></td>
154 <td><input type="entry" name="taxonomy" style="width:120px;" value="207Q00000X"></td>
155 <td><span class="text"><?php xl('Calendar UI','e'); ?>: </span></td><td><select name="cal_ui" style="width:120px;">
156 <?php
157 foreach (array(3 => xl('Outlook'), 1 => xl('Original'), 2 => xl('Fancy')) as $key => $value)
159 echo " <option value='$key'";
160 if ($key == $iter['cal_ui']) echo " selected";
161 echo ">$value</option>\n";
164 </select></td>
165 </tr>
166 <!-- END (CHEMED) Calendar UI preference -->
168 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
169 <tr>
170 <td class="text"><?php xl('Default Warehouse','e'); ?>: </td>
171 <td class='text'>
172 <?php
173 echo generate_select_list('default_warehouse', 'warehouse',
174 '', '');
176 </td>
177 <td class="text"><?php xl('Invoice Refno Pool','e'); ?>: </td>
178 <td class='text'>
179 <?php
180 echo generate_select_list('irnpool', 'irnpool', '',
181 xl('Invoice reference number pool, if used'));
183 </td>
184 </tr>
185 <?php } ?>
187 <?php
188 // List the access control groups if phpgacl installed
189 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
191 <tr>
192 <td class='text'><?php xl('Access Control','e'); ?>:</td>
193 <td><select name="access_group[]" multiple style="width:120px;">
194 <?php
195 $list_acl_groups = acl_get_group_title_list();
196 $default_acl_group = 'Administrators';
197 foreach ($list_acl_groups as $value) {
198 if ($default_acl_group == $value) {
199 // Modified 6-2009 by BM - Translate group name if applicable
200 echo " <option value='$value' selected>" . xl_gacl_group($value) . "</option>\n";
202 else {
203 // Modified 6-2009 by BM - Translate group name if applicable
204 echo " <option value='$value'>" . xl_gacl_group($value) . "</option>\n";
208 </select></td>
209 <td><span class="text"><?php xl('Additional Info','e'); ?>: </span></td>
210 <td><textarea name=info style="width:120px;" cols=27 rows=4 wrap=auto></textarea></td>
212 </tr>
213 <tr height="25"><td colspan="4">&nbsp;</td></tr>
214 <?php
218 </table>
220 <br>
221 <input type="hidden" name="newauthPass">
222 </form>
223 </td>
225 </tr>
227 <tr<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
229 <td valign=top>
230 <form name='new_group' method='post' action="usergroup_admin.php"
231 onsubmit='return top.restoreSession()'>
232 <br>
233 <input type=hidden name=mode value=new_group>
234 <span class="bold"><?php xl('New Group','e'); ?>:</span>
235 </td><td>
236 <span class="text"><?php xl('Groupname','e'); ?>: </span><input type=entry name=groupname size=10>
237 &nbsp;&nbsp;&nbsp;
238 <span class="text"><?php xl('Initial User','e'); ?>: </span>
239 <select name=rumple>
240 <?php
241 $res = sqlStatement("select distinct username from users where username != ''");
242 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
243 $result[$iter] = $row;
244 foreach ($result as $iter) {
245 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
248 </select>
249 &nbsp;&nbsp;&nbsp;
250 <input type="submit" value=<?php xl('Save','e'); ?>>
251 </form>
252 </td>
254 </tr>
256 <tr <?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
258 <td valign=top>
259 <form name='new_group' method='post' action="usergroup_admin.php"
260 onsubmit='return top.restoreSession()'>
261 <input type=hidden name=mode value=new_group>
262 <span class="bold"><?php xl('Add User To Group','e'); ?>:</span>
263 </td><td>
264 <span class="text">
265 <?php xl('User','e'); ?>
266 : </span>
267 <select name=rumple>
268 <?php
269 $res = sqlStatement("select distinct username from users where username != ''");
270 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
271 $result3[$iter] = $row;
272 foreach ($result3 as $iter) {
273 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
276 </select>
277 &nbsp;&nbsp;&nbsp;
278 <span class="text"><?php xl('Groupname','e'); ?>: </span>
279 <select name=groupname>
280 <?php
281 $res = sqlStatement("select distinct name from groups");
282 $result2 = array();
283 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
284 $result2[$iter] = $row;
285 foreach ($result2 as $iter) {
286 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
289 </select>
290 &nbsp;&nbsp;&nbsp;
291 <input type="submit" value=<?php xl('Add User To Group','e'); ?>>
292 </form>
293 </td>
294 </tr>
296 </table>
298 <?php
299 if (empty($GLOBALS['disable_non_default_groups'])) {
300 $res = sqlStatement("select * from groups order by name");
301 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
302 $result5[$iter] = $row;
304 foreach ($result5 as $iter) {
305 $grouplist{$iter{"name"}} .= $iter{"user"} .
306 "(<a class='link_submit' href='usergroup_admin.php?mode=delete_group&id=" .
307 $iter{"id"} . "' onclick='top.restoreSession()'>Remove</a>), ";
310 foreach ($grouplist as $groupname => $list) {
311 print "<span class='bold'>" . $groupname . "</span><br>\n<span class='text'>" .
312 substr($list,0,strlen($list)-2) . "</span><br>\n";
317 <script language="JavaScript">
318 <?php
319 if ($alertmsg = trim($alertmsg)) {
320 echo "alert('$alertmsg');\n";
323 $(document).ready(function(){
324 $("#cancel").click(function() {
325 parent.$.fn.fancybox.close();
329 </script>
330 <table>
332 </table>
334 </body>
335 </html>