added new datepicker to amendments gui
[openemr.git] / interface / usergroup / usergroup_admin_add.php
blob54a2ae11e23eeba7e4dd8c9482029b3a360a0b1c
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 <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>
166 </tr>
167 <tr>
168 <td style="width:150px;"></td><td style="width:220px;"></span></td>
169 <TD style="width:200px;"><span class=text><?php xl('Your Password','e'); ?>: </span></TD>
170 <TD class='text' style="width:280px;"><input type='password' name=adminPass style="width:120px;" value="" autocomplete='off'><font class="mandatory">*</font></TD>
172 </tr>
173 <tr>
174 <td><span class="text"<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>><?php xl('Groupname','e'); ?>: </span></td>
175 <td>
176 <select name=groupname<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
177 <?php
178 $res = sqlStatement("select distinct name from groups");
179 $result2 = array();
180 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
181 $result2[$iter] = $row;
182 foreach ($result2 as $iter) {
183 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
186 </select></td>
187 <td><span class="text"><?php xl('Provider','e'); ?>: </span></td><td>
188 <input type='checkbox' name='authorized' value='1' onclick='authorized_clicked()' />
189 &nbsp;&nbsp;<span class='text'><?php xl('Calendar','e'); ?>:
190 <input type='checkbox' name='calendar' disabled />
191 </td>
192 </tr>
193 <tr>
194 <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>
195 <td><span class="text"><?php xl('Middle Name','e'); ?>: </span></td><td><input type=entry name='mname' style="width:120px;"></td>
196 </tr>
197 <tr>
198 <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>
199 <td><span class="text"><?php xl('Default Facility','e'); ?>: </span></td><td><select style="width:120px;" name=facility_id>
200 <?php
201 $fres = sqlStatement("select * from facility where service_location != 0 order by name");
202 if ($fres) {
203 for ($iter = 0;$frow = sqlFetchArray($fres);$iter++)
204 $result[$iter] = $frow;
205 foreach($result as $iter) {
207 <option value="<?php echo $iter{'id'};?>"><?php echo $iter{'name'};?></option>
208 <?php
212 </select></td>
213 </tr>
214 <tr>
215 <td><span class="text"><?php xl('Federal Tax ID','e'); ?>: </span></td><td><input type=entry name='federaltaxid' style="width:120px;"></td>
216 <td><span class="text"><?php xl('Federal Drug ID','e'); ?>: </span></td><td><input type=entry name='federaldrugid' style="width:120px;"></td>
217 </tr>
218 <tr>
219 <td><span class="text"><?php xl('UPIN','e'); ?>: </span></td><td><input type="entry" name="upin" style="width:120px;"></td>
220 <td class='text'><?php xl('See Authorizations','e'); ?>: </td>
221 <td><select name="see_auth" style="width:120px;">
222 <?php
223 foreach (array(1 => xl('None'), 2 => xl('Only Mine'), 3 => xl('All')) as $key => $value)
225 echo " <option value='$key'";
226 echo ">$value</option>\n";
229 </select></td>
231 <tr>
232 <td><span class="text"><?php xl('NPI','e'); ?>: </span></td><td><input type="entry" name="npi" style="width:120px;"></td>
233 <td><span class="text"><?php xl('Job Description','e'); ?>: </span></td><td><input type="entry" name="specialty" style="width:120px;"></td>
234 </tr>
236 <tr>
237 <td>
238 <span class="text"><?php xl('Provider Type','e'); ?>: </span>
239 </td>
240 <td>
241 <?php echo generate_select_list("physician_type", "physician_type", '','',xl('Select Type'),'physician_type_class','','',''); ?>
242 </td>
243 </tr>
245 <!-- (CHEMED) Calendar UI preference -->
246 <tr>
247 <td><span class="text"><?php xl('Taxonomy','e'); ?>: </span></td>
248 <td><input type="entry" name="taxonomy" style="width:120px;" value="207Q00000X"></td>
249 <td><span class="text"><?php xl('Calendar UI','e'); ?>: </span></td><td><select name="cal_ui" style="width:120px;">
250 <?php
251 foreach (array(3 => xl('Outlook'), 1 => xl('Original'), 2 => xl('Fancy')) as $key => $value)
253 echo " <option value='$key'>$value</option>\n";
256 </select></td>
257 </tr>
258 <!-- END (CHEMED) Calendar UI preference -->
260 <tr>
261 <td><span class="text"><?php xl('State License Number','e'); ?>: </span></td>
262 <td><input type="text" name="state_license_number" style="width:120px;"></td>
263 <td class='text'><?php xl('NewCrop eRX Role','e'); ?>:</td>
264 <td>
265 <?php echo generate_select_list("erxrole", "newcrop_erx_role", '','','--Select Role--','','','',array('style'=>'width:120px')); ?>
266 </td>
267 </tr>
269 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
270 <tr>
271 <td class="text"><?php xl('Default Warehouse','e'); ?>: </td>
272 <td class='text'>
273 <?php
274 echo generate_select_list('default_warehouse', 'warehouse',
275 '', '');
277 </td>
278 <td class="text"><?php xl('Invoice Refno Pool','e'); ?>: </td>
279 <td class='text'>
280 <?php
281 echo generate_select_list('irnpool', 'irnpool', '',
282 xl('Invoice reference number pool, if used'));
284 </td>
285 </tr>
286 <?php } ?>
288 <?php
289 // List the access control groups if phpgacl installed
290 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
292 <tr>
293 <td class='text'><?php xl('Access Control','e'); ?>:</td>
294 <td><select name="access_group[]" multiple style="width:120px;">
295 <?php
296 $list_acl_groups = acl_get_group_title_list();
297 $default_acl_group = 'Administrators';
298 foreach ($list_acl_groups as $value) {
299 if ($default_acl_group == $value) {
300 // Modified 6-2009 by BM - Translate group name if applicable
301 echo " <option value='$value' selected>" . xl_gacl_group($value) . "</option>\n";
303 else {
304 // Modified 6-2009 by BM - Translate group name if applicable
305 echo " <option value='$value'>" . xl_gacl_group($value) . "</option>\n";
309 </select></td>
310 <td><span class="text"><?php xl('Additional Info','e'); ?>: </span></td>
311 <td><textarea name=info style="width:120px;" cols=27 rows=4 wrap=auto></textarea></td>
313 </tr>
314 <tr height="25"><td colspan="4">&nbsp;</td></tr>
315 <?php
319 </table>
321 <br>
322 <input type="hidden" name="newauthPass">
323 </form>
324 </td>
326 </tr>
328 <tr<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
330 <td valign=top>
331 <form name='new_group' method='post' action="usergroup_admin.php"
332 onsubmit='return top.restoreSession()'>
333 <br>
334 <input type=hidden name=mode value=new_group>
335 <span class="bold"><?php xl('New Group','e'); ?>:</span>
336 </td><td>
337 <span class="text"><?php xl('Groupname','e'); ?>: </span><input type=entry name=groupname size=10>
338 &nbsp;&nbsp;&nbsp;
339 <span class="text"><?php xl('Initial User','e'); ?>: </span>
340 <select name=rumple>
341 <?php
342 $res = sqlStatement("select distinct username from users where username != ''");
343 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
344 $result[$iter] = $row;
345 foreach ($result as $iter) {
346 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
349 </select>
350 &nbsp;&nbsp;&nbsp;
351 <input type="submit" value=<?php xl('Save','e'); ?>>
352 </form>
353 </td>
355 </tr>
357 <tr <?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
359 <td valign=top>
360 <form name='new_group' method='post' action="usergroup_admin.php"
361 onsubmit='return top.restoreSession()'>
362 <input type=hidden name=mode value=new_group>
363 <span class="bold"><?php xl('Add User To Group','e'); ?>:</span>
364 </td><td>
365 <span class="text">
366 <?php xl('User','e'); ?>
367 : </span>
368 <select name=rumple>
369 <?php
370 $res = sqlStatement("select distinct username from users where username != ''");
371 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
372 $result3[$iter] = $row;
373 foreach ($result3 as $iter) {
374 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
377 </select>
378 &nbsp;&nbsp;&nbsp;
379 <span class="text"><?php xl('Groupname','e'); ?>: </span>
380 <select name=groupname>
381 <?php
382 $res = sqlStatement("select distinct name from groups");
383 $result2 = array();
384 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
385 $result2[$iter] = $row;
386 foreach ($result2 as $iter) {
387 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
390 </select>
391 &nbsp;&nbsp;&nbsp;
392 <input type="submit" value=<?php xl('Add User To Group','e'); ?>>
393 </form>
394 </td>
395 </tr>
397 </table>
399 <?php
400 if (empty($GLOBALS['disable_non_default_groups'])) {
401 $res = sqlStatement("select * from groups order by name");
402 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
403 $result5[$iter] = $row;
405 foreach ($result5 as $iter) {
406 $grouplist{$iter{"name"}} .= $iter{"user"} .
407 "(<a class='link_submit' href='usergroup_admin.php?mode=delete_group&id=" .
408 $iter{"id"} . "' onclick='top.restoreSession()'>Remove</a>), ";
411 foreach ($grouplist as $groupname => $list) {
412 print "<span class='bold'>" . $groupname . "</span><br>\n<span class='text'>" .
413 substr($list,0,strlen($list)-2) . "</span><br>\n";
418 <script language="JavaScript">
419 <?php
420 if ($alertmsg = trim($alertmsg)) {
421 echo "alert('$alertmsg');\n";
424 $(document).ready(function(){
425 $("#cancel").click(function() {
426 parent.$.fn.fancybox.close();
430 </script>
431 <table>
433 </table>
435 </body>
436 </html>