migrated ubiquitous libraries to composer autoloader (#421)
[openemr.git] / interface / usergroup / usergroup_admin_add.php
blobdf67ecc31546531afcf07bfe3472491f6e6a4e94
1 <?php
2 require_once("../globals.php");
3 require_once("../../library/acl.inc");
4 require_once("$srcdir/sql.inc");
5 require_once("$srcdir/options.inc.php");
6 require_once("$srcdir/erx_javascript.inc.php");
8 $alertmsg = '';
11 <html>
12 <head>
14 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
15 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
16 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
17 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
18 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-9-1/index.js"></script>
19 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
20 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
22 <script src="checkpwd_validation.js" type="text/javascript"></script>
24 <!-- validation library -->
25 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
26 <?php $use_validate_js = 1;?>
27 <?php require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?>
28 <?php
29 //Gets validation rules from Page Validation list.
30 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
31 $collectthis = collectValidationPageRules("/interface/usergroup/usergroup_admin_add.php");
32 if (empty($collectthis)) {
33 $collectthis = "undefined";
35 else {
36 $collectthis = $collectthis["new_user"]["rules"];
39 <script language="JavaScript">
42 * validation on the form with new client side validation (using validate.js).
43 * this enable to add new rules for this form in the pageValidation list.
44 * */
45 var collectvalidation = <?php echo($collectthis); ?>;
47 function trimAll(sString)
49 while (sString.substring(0,1) == ' ')
51 sString = sString.substring(1, sString.length);
53 while (sString.substring(sString.length-1, sString.length) == ' ')
55 sString = sString.substring(0,sString.length-1);
57 return sString;
60 function submitform() {
62 var valid = submitme(1, undefined, 'new_user', collectvalidation);
63 if (!valid) return;
65 top.restoreSession();
67 //Checking if secure password is enabled or disabled.
68 //If it is enabled and entered password is a weak password, alert the user to enter strong password.
69 if(document.new_user.secure_pwd.value == 1){
70 var password = trim(document.new_user.stiltskin.value);
71 if(password != "") {
72 var pwdresult = passwordvalidate(password);
73 if(pwdresult == 0){
74 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'; ?>");
75 return false;
78 } //secure_pwd if ends here
80 <?php if($GLOBALS['erx_enable']){ ?>
81 alertMsg='';
82 f=document.forms[0];
83 for(i=0;i<f.length;i++){
84 if(f[i].type=='text' && f[i].value)
86 if(f[i].name == 'rumple')
88 alertMsg += checkLength(f[i].name,f[i].value,35);
89 alertMsg += checkUsername(f[i].name,f[i].value);
91 else if(f[i].name == 'fname' || f[i].name == 'mname' || f[i].name == 'lname')
93 alertMsg += checkLength(f[i].name,f[i].value,35);
94 alertMsg += checkUsername(f[i].name,f[i].value);
96 else if(f[i].name == 'federaltaxid')
98 alertMsg += checkLength(f[i].name,f[i].value,10);
99 alertMsg += checkFederalEin(f[i].name,f[i].value);
101 else if(f[i].name == 'state_license_number')
103 alertMsg += checkLength(f[i].name,f[i].value,10);
104 alertMsg += checkStateLicenseNumber(f[i].name,f[i].value);
106 else if(f[i].name == 'npi')
108 alertMsg += checkLength(f[i].name,f[i].value,35);
109 alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
111 else if(f[i].name == 'federaldrugid')
113 alertMsg += checkLength(f[i].name,f[i].value,30);
114 alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
118 if(alertMsg)
120 alert(alertMsg);
121 return false;
123 <?php } // End erx_enable only include block?>
125 document.forms[0].submit();
126 parent.$.fn.fancybox.close();
129 function authorized_clicked() {
130 var f = document.forms[0];
131 f.calendar.disabled = !f.authorized.checked;
132 f.calendar.checked = f.authorized.checked;
135 </script>
136 <style type="text/css">
137 .physician_type_class{
138 width: 120px !important;
140 </style>
141 </head>
142 <body class="body_top">
143 <table><tr><td>
144 <span class="title"><?php xl('Add User','e'); ?></span>&nbsp;</td>
145 <td>
146 <a class="css_button" name='form_save' id='form_save' href='#' onclick="return submitform()">
147 <span><?php xl('Save','e');?></span></a>
148 <a class="css_button large_button" id='cancel' href='#'>
149 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
150 </a>
151 </td></tr></table>
152 <br><br>
154 <table border=0>
156 <tr><td valign=top>
157 <form name='new_user' id="new_user" method='post' target="_parent" action="usergroup_admin.php"
158 onsubmit='return top.restoreSession()'>
159 <input type='hidden' name='mode' value='new_user'>
160 <input type='hidden' name='secure_pwd' value="<?php echo $GLOBALS['secure_password']; ?>">
162 <span class="bold">&nbsp;</span>
163 <table border=0 cellpadding=0 cellspacing=0 style="width:600px;">
164 <tr>
165 <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>
166 <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>
167 </tr>
168 <tr>
169 <td style="width:150px;"></td><td style="width:220px;"></span></td>
170 <TD style="width:200px;"><span class=text><?php xl('Your Password','e'); ?>: </span></TD>
171 <TD class='text' style="width:280px;"><input type='password' name=adminPass style="width:120px;" value="" autocomplete='off'><font class="mandatory">*</font></TD>
173 </tr>
174 <tr>
175 <td><span class="text"<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>><?php xl('Groupname','e'); ?>: </span></td>
176 <td>
177 <select name=groupname<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
178 <?php
179 $res = sqlStatement("select distinct name from groups");
180 $result2 = array();
181 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
182 $result2[$iter] = $row;
183 foreach ($result2 as $iter) {
184 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
187 </select></td>
188 <td><span class="text"><?php xl('Provider','e'); ?>: </span></td><td>
189 <input type='checkbox' name='authorized' value='1' onclick='authorized_clicked()' />
190 &nbsp;&nbsp;<span class='text'><?php xl('Calendar','e'); ?>:
191 <input type='checkbox' name='calendar' disabled />
192 </td>
193 </tr>
194 <tr>
195 <td><span class="text"><?php xl('First Name','e'); ?>: </span></td><td><input type=entry name='fname' id='fname' style="width:120px;"><span class="mandatory">&nbsp;*</span></td>
196 <td><span class="text"><?php xl('Middle Name','e'); ?>: </span></td><td><input type=entry name='mname' style="width:120px;"></td>
197 </tr>
198 <tr>
199 <td><span class="text"><?php xl('Last Name','e'); ?>: </span></td><td><input type=entry name='lname' id='lname' style="width:120px;"><span class="mandatory">&nbsp;*</span></td>
200 <td><span class="text"><?php xl('Default Facility','e'); ?>: </span></td><td><select style="width:120px;" name=facility_id>
201 <?php
202 $fres = sqlStatement("select * from facility where service_location != 0 order by name");
203 if ($fres) {
204 for ($iter = 0;$frow = sqlFetchArray($fres);$iter++)
205 $result[$iter] = $frow;
206 foreach($result as $iter) {
208 <option value="<?php echo $iter{'id'};?>"><?php echo $iter{'name'};?></option>
209 <?php
213 </select></td>
214 </tr>
215 <tr>
216 <td><span class="text"><?php xl('Federal Tax ID','e'); ?>: </span></td><td><input type=entry name='federaltaxid' style="width:120px;"></td>
217 <td><span class="text"><?php xl('Federal Drug ID','e'); ?>: </span></td><td><input type=entry name='federaldrugid' style="width:120px;"></td>
218 </tr>
219 <tr>
220 <td><span class="text"><?php xl('UPIN','e'); ?>: </span></td><td><input type="entry" name="upin" style="width:120px;"></td>
221 <td class='text'><?php xl('See Authorizations','e'); ?>: </td>
222 <td><select name="see_auth" style="width:120px;">
223 <?php
224 foreach (array(1 => xl('None'), 2 => xl('Only Mine'), 3 => xl('All')) as $key => $value)
226 echo " <option value='$key'";
227 echo ">$value</option>\n";
230 </select></td>
232 <tr>
233 <td><span class="text"><?php xl('NPI','e'); ?>: </span></td><td><input type="entry" name="npi" style="width:120px;"></td>
234 <td><span class="text"><?php xl('Job Description','e'); ?>: </span></td><td><input type="entry" name="specialty" style="width:120px;"></td>
235 </tr>
237 <tr>
238 <td>
239 <span class="text"><?php xl('Provider Type','e'); ?>: </span>
240 </td>
241 <td>
242 <?php echo generate_select_list("physician_type", "physician_type", '','',xl('Select Type'),'physician_type_class','','',''); ?>
243 </td>
244 </tr>
246 <!-- (CHEMED) Calendar UI preference -->
247 <tr>
248 <td><span class="text"><?php xl('Taxonomy','e'); ?>: </span></td>
249 <td><input type="entry" name="taxonomy" style="width:120px;" value="207Q00000X"></td>
250 <td><span class="text"><?php xl('Calendar UI','e'); ?>: </span></td><td><select name="cal_ui" style="width:120px;">
251 <?php
252 foreach (array(3 => xl('Outlook'), 1 => xl('Original'), 2 => xl('Fancy')) as $key => $value)
254 echo " <option value='$key'>$value</option>\n";
257 </select></td>
258 </tr>
259 <!-- END (CHEMED) Calendar UI preference -->
261 <tr>
262 <td><span class="text"><?php xl('State License Number','e'); ?>: </span></td>
263 <td><input type="text" name="state_license_number" style="width:120px;"></td>
264 <td class='text'><?php xl('NewCrop eRX Role','e'); ?>:</td>
265 <td>
266 <?php echo generate_select_list("erxrole", "newcrop_erx_role", '','','--Select Role--','','','',array('style'=>'width:120px')); ?>
267 </td>
268 </tr>
270 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
271 <tr>
272 <td class="text"><?php xl('Default Warehouse','e'); ?>: </td>
273 <td class='text'>
274 <?php
275 echo generate_select_list('default_warehouse', 'warehouse',
276 '', '');
278 </td>
279 <td class="text"><?php xl('Invoice Refno Pool','e'); ?>: </td>
280 <td class='text'>
281 <?php
282 echo generate_select_list('irnpool', 'irnpool', '',
283 xl('Invoice reference number pool, if used'));
285 </td>
286 </tr>
287 <?php } ?>
289 <?php
290 // List the access control groups if phpgacl installed
291 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
293 <tr>
294 <td class='text'><?php xl('Access Control','e'); ?>:</td>
295 <td><select name="access_group[]" multiple style="width:120px;">
296 <?php
297 $list_acl_groups = acl_get_group_title_list();
298 $default_acl_group = 'Administrators';
299 foreach ($list_acl_groups as $value) {
300 if ($default_acl_group == $value) {
301 // Modified 6-2009 by BM - Translate group name if applicable
302 echo " <option value='$value' selected>" . xl_gacl_group($value) . "</option>\n";
304 else {
305 // Modified 6-2009 by BM - Translate group name if applicable
306 echo " <option value='$value'>" . xl_gacl_group($value) . "</option>\n";
310 </select></td>
311 <td><span class="text"><?php xl('Additional Info','e'); ?>: </span></td>
312 <td><textarea name=info style="width:120px;" cols=27 rows=4 wrap=auto></textarea></td>
314 </tr>
315 <tr height="25"><td colspan="4">&nbsp;</td></tr>
316 <?php
320 </table>
322 <br>
323 <input type="hidden" name="newauthPass">
324 </form>
325 </td>
327 </tr>
329 <tr<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
331 <td valign=top>
332 <form name='new_group' method='post' action="usergroup_admin.php"
333 onsubmit='return top.restoreSession()'>
334 <br>
335 <input type=hidden name=mode value=new_group>
336 <span class="bold"><?php xl('New Group','e'); ?>:</span>
337 </td><td>
338 <span class="text"><?php xl('Groupname','e'); ?>: </span><input type=entry name=groupname size=10>
339 &nbsp;&nbsp;&nbsp;
340 <span class="text"><?php xl('Initial User','e'); ?>: </span>
341 <select name=rumple>
342 <?php
343 $res = sqlStatement("select distinct username from users where username != ''");
344 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
345 $result[$iter] = $row;
346 foreach ($result as $iter) {
347 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
350 </select>
351 &nbsp;&nbsp;&nbsp;
352 <input type="submit" value=<?php xl('Save','e'); ?>>
353 </form>
354 </td>
356 </tr>
358 <tr <?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
360 <td valign=top>
361 <form name='new_group' method='post' action="usergroup_admin.php"
362 onsubmit='return top.restoreSession()'>
363 <input type=hidden name=mode value=new_group>
364 <span class="bold"><?php xl('Add User To Group','e'); ?>:</span>
365 </td><td>
366 <span class="text">
367 <?php xl('User','e'); ?>
368 : </span>
369 <select name=rumple>
370 <?php
371 $res = sqlStatement("select distinct username from users where username != ''");
372 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
373 $result3[$iter] = $row;
374 foreach ($result3 as $iter) {
375 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
378 </select>
379 &nbsp;&nbsp;&nbsp;
380 <span class="text"><?php xl('Groupname','e'); ?>: </span>
381 <select name=groupname>
382 <?php
383 $res = sqlStatement("select distinct name from groups");
384 $result2 = array();
385 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
386 $result2[$iter] = $row;
387 foreach ($result2 as $iter) {
388 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
391 </select>
392 &nbsp;&nbsp;&nbsp;
393 <input type="submit" value=<?php xl('Add User To Group','e'); ?>>
394 </form>
395 </td>
396 </tr>
398 </table>
400 <?php
401 if (empty($GLOBALS['disable_non_default_groups'])) {
402 $res = sqlStatement("select * from groups order by name");
403 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
404 $result5[$iter] = $row;
406 foreach ($result5 as $iter) {
407 $grouplist{$iter{"name"}} .= $iter{"user"} .
408 "(<a class='link_submit' href='usergroup_admin.php?mode=delete_group&id=" .
409 $iter{"id"} . "' onclick='top.restoreSession()'>Remove</a>), ";
412 foreach ($grouplist as $groupname => $list) {
413 print "<span class='bold'>" . $groupname . "</span><br>\n<span class='text'>" .
414 substr($list,0,strlen($list)-2) . "</span><br>\n";
419 <script language="JavaScript">
420 <?php
421 if ($alertmsg = trim($alertmsg)) {
422 echo "alert('$alertmsg');\n";
425 $(document).ready(function(){
426 $("#cancel").click(function() {
427 parent.$.fn.fancybox.close();
431 </script>
432 <table>
434 </table>
436 </body>
437 </html>