Support for Active Directory (#463)
[openemr.git] / interface / usergroup / usergroup_admin_add.php
bloba4fe2fcd0240873ab686b5a7223a8ee2a0f6aef1
1 <?php
2 require_once("../globals.php");
3 require_once("../../library/acl.inc");
4 require_once("$srcdir/options.inc.php");
5 require_once("$srcdir/erx_javascript.inc.php");
7 $alertmsg = '';
9 ?>
10 <html>
11 <head>
13 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
14 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
15 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
16 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
17 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-9-1/index.js"></script>
18 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
19 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
21 <script src="checkpwd_validation.js" type="text/javascript"></script>
23 <!-- validation library -->
24 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
25 <?php $use_validate_js = 1;?>
26 <?php require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?>
27 <?php
28 //Gets validation rules from Page Validation list.
29 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
30 $collectthis = collectValidationPageRules("/interface/usergroup/usergroup_admin_add.php");
31 if (empty($collectthis)) {
32 $collectthis = "undefined";
34 else {
35 $collectthis = $collectthis["new_user"]["rules"];
38 <script language="JavaScript">
41 * validation on the form with new client side validation (using validate.js).
42 * this enable to add new rules for this form in the pageValidation list.
43 * */
44 var collectvalidation = <?php echo($collectthis); ?>;
46 function trimAll(sString)
48 while (sString.substring(0,1) == ' ')
50 sString = sString.substring(1, sString.length);
52 while (sString.substring(sString.length-1, sString.length) == ' ')
54 sString = sString.substring(0,sString.length-1);
56 return sString;
59 function submitform() {
61 var valid = submitme(1, undefined, 'new_user', collectvalidation);
62 if (!valid) return;
64 top.restoreSession();
66 //Checking if secure password is enabled or disabled.
67 //If it is enabled and entered password is a weak password, alert the user to enter strong password.
68 if(document.new_user.secure_pwd.value == 1){
69 var password = trim(document.new_user.stiltskin.value);
70 if(password != "") {
71 var pwdresult = passwordvalidate(password);
72 if(pwdresult == 0){
73 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'; ?>");
74 return false;
77 } //secure_pwd if ends here
79 <?php if($GLOBALS['erx_enable']){ ?>
80 alertMsg='';
81 f=document.forms[0];
82 for(i=0;i<f.length;i++){
83 if(f[i].type=='text' && f[i].value)
85 if(f[i].name == 'rumple')
87 alertMsg += checkLength(f[i].name,f[i].value,35);
88 alertMsg += checkUsername(f[i].name,f[i].value);
90 else if(f[i].name == 'fname' || f[i].name == 'mname' || f[i].name == 'lname')
92 alertMsg += checkLength(f[i].name,f[i].value,35);
93 alertMsg += checkUsername(f[i].name,f[i].value);
95 else if(f[i].name == 'federaltaxid')
97 alertMsg += checkLength(f[i].name,f[i].value,10);
98 alertMsg += checkFederalEin(f[i].name,f[i].value);
100 else if(f[i].name == 'state_license_number')
102 alertMsg += checkLength(f[i].name,f[i].value,10);
103 alertMsg += checkStateLicenseNumber(f[i].name,f[i].value);
105 else if(f[i].name == 'npi')
107 alertMsg += checkLength(f[i].name,f[i].value,35);
108 alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
110 else if(f[i].name == 'federaldrugid')
112 alertMsg += checkLength(f[i].name,f[i].value,30);
113 alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
117 if(alertMsg)
119 alert(alertMsg);
120 return false;
122 <?php } // End erx_enable only include block?>
124 document.forms[0].submit();
125 parent.$.fn.fancybox.close();
128 function authorized_clicked() {
129 var f = document.forms[0];
130 f.calendar.disabled = !f.authorized.checked;
131 f.calendar.checked = f.authorized.checked;
134 </script>
135 <style type="text/css">
136 .physician_type_class{
137 width: 120px !important;
139 </style>
140 </head>
141 <body class="body_top">
142 <table><tr><td>
143 <span class="title"><?php xl('Add User','e'); ?></span>&nbsp;</td>
144 <td>
145 <a class="css_button" name='form_save' id='form_save' href='#' onclick="return submitform()">
146 <span><?php xl('Save','e');?></span></a>
147 <a class="css_button large_button" id='cancel' href='#'>
148 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
149 </a>
150 </td></tr></table>
151 <br><br>
153 <table border=0>
155 <tr><td valign=top>
156 <form name='new_user' id="new_user" method='post' target="_parent" action="usergroup_admin.php"
157 onsubmit='return top.restoreSession()'>
158 <input type='hidden' name='mode' value='new_user'>
159 <input type='hidden' name='secure_pwd' value="<?php echo $GLOBALS['secure_password']; ?>">
161 <span class="bold">&nbsp;</span>
162 <table border=0 cellpadding=0 cellspacing=0 style="width:600px;">
163 <tr>
164 <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>
165 <?php if(!$GLOBALS['use_active_directory']) { ?>
166 <td style="width:150px;"><span class="text"><?php xl('Password','e'); ?>: </span></td><td style="width:250px;"><input type="password" style="width:120px;" name="stiltskin"><span class="mandatory">&nbsp;*</span></td>
167 <?php }else{ ?>
168 <td> <input type="hidden" value="124" name="stiltskin" /></td>
169 <?php } ?>
170 </tr>
171 <tr>
172 <td style="width:150px;"></td><td style="width:220px;"></span></td>
173 <TD style="width:200px;"><span class=text><?php xl('Your Password','e'); ?>: </span></TD>
174 <TD class='text' style="width:280px;"><input type='password' name=adminPass style="width:120px;" value="" autocomplete='off'><font class="mandatory">*</font></TD>
176 </tr>
177 <tr>
178 <td><span class="text"<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>><?php xl('Groupname','e'); ?>: </span></td>
179 <td>
180 <select name=groupname<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
181 <?php
182 $res = sqlStatement("select distinct name from groups");
183 $result2 = array();
184 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
185 $result2[$iter] = $row;
186 foreach ($result2 as $iter) {
187 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
190 </select></td>
191 <td><span class="text"><?php xl('Provider','e'); ?>: </span></td><td>
192 <input type='checkbox' name='authorized' value='1' onclick='authorized_clicked()' />
193 &nbsp;&nbsp;<span class='text'><?php xl('Calendar','e'); ?>:
194 <input type='checkbox' name='calendar' disabled />
195 </td>
196 </tr>
197 <tr>
198 <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>
199 <td><span class="text"><?php xl('Middle Name','e'); ?>: </span></td><td><input type=entry name='mname' style="width:120px;"></td>
200 </tr>
201 <tr>
202 <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>
203 <td><span class="text"><?php xl('Default Facility','e'); ?>: </span></td><td><select style="width:120px;" name=facility_id>
204 <?php
205 $fres = sqlStatement("select * from facility where service_location != 0 order by name");
206 if ($fres) {
207 for ($iter = 0;$frow = sqlFetchArray($fres);$iter++)
208 $result[$iter] = $frow;
209 foreach($result as $iter) {
211 <option value="<?php echo $iter{'id'};?>"><?php echo $iter{'name'};?></option>
212 <?php
216 </select></td>
217 </tr>
218 <tr>
219 <td><span class="text"><?php xl('Federal Tax ID','e'); ?>: </span></td><td><input type=entry name='federaltaxid' style="width:120px;"></td>
220 <td><span class="text"><?php xl('Federal Drug ID','e'); ?>: </span></td><td><input type=entry name='federaldrugid' style="width:120px;"></td>
221 </tr>
222 <tr>
223 <td><span class="text"><?php xl('UPIN','e'); ?>: </span></td><td><input type="entry" name="upin" style="width:120px;"></td>
224 <td class='text'><?php xl('See Authorizations','e'); ?>: </td>
225 <td><select name="see_auth" style="width:120px;">
226 <?php
227 foreach (array(1 => xl('None'), 2 => xl('Only Mine'), 3 => xl('All')) as $key => $value)
229 echo " <option value='$key'";
230 echo ">$value</option>\n";
233 </select></td>
235 <tr>
236 <td><span class="text"><?php xl('NPI','e'); ?>: </span></td><td><input type="entry" name="npi" style="width:120px;"></td>
237 <td><span class="text"><?php xl('Job Description','e'); ?>: </span></td><td><input type="entry" name="specialty" style="width:120px;"></td>
238 </tr>
240 <tr>
241 <td>
242 <span class="text"><?php xl('Provider Type','e'); ?>: </span>
243 </td>
244 <td>
245 <?php echo generate_select_list("physician_type", "physician_type", '','',xl('Select Type'),'physician_type_class','','',''); ?>
246 </td>
247 </tr>
249 <!-- (CHEMED) Calendar UI preference -->
250 <tr>
251 <td><span class="text"><?php xl('Taxonomy','e'); ?>: </span></td>
252 <td><input type="entry" name="taxonomy" style="width:120px;" value="207Q00000X"></td>
253 <td><span class="text"><?php xl('Calendar UI','e'); ?>: </span></td><td><select name="cal_ui" style="width:120px;">
254 <?php
255 foreach (array(3 => xl('Outlook'), 1 => xl('Original'), 2 => xl('Fancy')) as $key => $value)
257 echo " <option value='$key'>$value</option>\n";
260 </select></td>
261 </tr>
262 <!-- END (CHEMED) Calendar UI preference -->
264 <tr>
265 <td><span class="text"><?php xl('State License Number','e'); ?>: </span></td>
266 <td><input type="text" name="state_license_number" style="width:120px;"></td>
267 <td class='text'><?php xl('NewCrop eRX Role','e'); ?>:</td>
268 <td>
269 <?php echo generate_select_list("erxrole", "newcrop_erx_role", '','','--Select Role--','','','',array('style'=>'width:120px')); ?>
270 </td>
271 </tr>
273 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
274 <tr>
275 <td class="text"><?php xl('Default Warehouse','e'); ?>: </td>
276 <td class='text'>
277 <?php
278 echo generate_select_list('default_warehouse', 'warehouse',
279 '', '');
281 </td>
282 <td class="text"><?php xl('Invoice Refno Pool','e'); ?>: </td>
283 <td class='text'>
284 <?php
285 echo generate_select_list('irnpool', 'irnpool', '',
286 xl('Invoice reference number pool, if used'));
288 </td>
289 </tr>
290 <?php } ?>
292 <?php
293 // List the access control groups if phpgacl installed
294 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
296 <tr>
297 <td class='text'><?php xl('Access Control','e'); ?>:</td>
298 <td><select name="access_group[]" multiple style="width:120px;">
299 <?php
300 $list_acl_groups = acl_get_group_title_list();
301 $default_acl_group = 'Administrators';
302 foreach ($list_acl_groups as $value) {
303 if ($default_acl_group == $value) {
304 // Modified 6-2009 by BM - Translate group name if applicable
305 echo " <option value='$value' selected>" . xl_gacl_group($value) . "</option>\n";
307 else {
308 // Modified 6-2009 by BM - Translate group name if applicable
309 echo " <option value='$value'>" . xl_gacl_group($value) . "</option>\n";
313 </select></td>
314 <td><span class="text"><?php xl('Additional Info','e'); ?>: </span></td>
315 <td><textarea name=info style="width:120px;" cols=27 rows=4 wrap=auto></textarea></td>
317 </tr>
318 <tr height="25"><td colspan="4">&nbsp;</td></tr>
319 <?php
323 </table>
325 <br>
326 <input type="hidden" name="newauthPass">
327 </form>
328 </td>
330 </tr>
332 <tr<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
334 <td valign=top>
335 <form name='new_group' method='post' action="usergroup_admin.php"
336 onsubmit='return top.restoreSession()'>
337 <br>
338 <input type=hidden name=mode value=new_group>
339 <span class="bold"><?php xl('New Group','e'); ?>:</span>
340 </td><td>
341 <span class="text"><?php xl('Groupname','e'); ?>: </span><input type=entry name=groupname size=10>
342 &nbsp;&nbsp;&nbsp;
343 <span class="text"><?php xl('Initial User','e'); ?>: </span>
344 <select name=rumple>
345 <?php
346 $res = sqlStatement("select distinct username from users where username != ''");
347 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
348 $result[$iter] = $row;
349 foreach ($result as $iter) {
350 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
353 </select>
354 &nbsp;&nbsp;&nbsp;
355 <input type="submit" value=<?php xl('Save','e'); ?>>
356 </form>
357 </td>
359 </tr>
361 <tr <?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
363 <td valign=top>
364 <form name='new_group' method='post' action="usergroup_admin.php"
365 onsubmit='return top.restoreSession()'>
366 <input type=hidden name=mode value=new_group>
367 <span class="bold"><?php xl('Add User To Group','e'); ?>:</span>
368 </td><td>
369 <span class="text">
370 <?php xl('User','e'); ?>
371 : </span>
372 <select name=rumple>
373 <?php
374 $res = sqlStatement("select distinct username from users where username != ''");
375 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
376 $result3[$iter] = $row;
377 foreach ($result3 as $iter) {
378 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
381 </select>
382 &nbsp;&nbsp;&nbsp;
383 <span class="text"><?php xl('Groupname','e'); ?>: </span>
384 <select name=groupname>
385 <?php
386 $res = sqlStatement("select distinct name from groups");
387 $result2 = array();
388 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
389 $result2[$iter] = $row;
390 foreach ($result2 as $iter) {
391 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
394 </select>
395 &nbsp;&nbsp;&nbsp;
396 <input type="submit" value=<?php xl('Add User To Group','e'); ?>>
397 </form>
398 </td>
399 </tr>
401 </table>
403 <?php
404 if (empty($GLOBALS['disable_non_default_groups'])) {
405 $res = sqlStatement("select * from groups order by name");
406 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
407 $result5[$iter] = $row;
409 foreach ($result5 as $iter) {
410 $grouplist{$iter{"name"}} .= $iter{"user"} .
411 "(<a class='link_submit' href='usergroup_admin.php?mode=delete_group&id=" .
412 $iter{"id"} . "' onclick='top.restoreSession()'>Remove</a>), ";
415 foreach ($grouplist as $groupname => $list) {
416 print "<span class='bold'>" . $groupname . "</span><br>\n<span class='text'>" .
417 substr($list,0,strlen($list)-2) . "</span><br>\n";
422 <script language="JavaScript">
423 <?php
424 if ($alertmsg = trim($alertmsg)) {
425 echo "alert('$alertmsg');\n";
428 $(document).ready(function(){
429 $("#cancel").click(function() {
430 parent.$.fn.fancybox.close();
434 </script>
435 <table>
437 </table>
439 </body>
440 </html>