NewCrop E-Prescription Module.
[openemr.git] / interface / usergroup / usergroup_admin_add.php
blobce85d4db9b1ca99792223ebf0918036550263f05
1 <?php
2 require_once("../globals.php");
3 require_once("../../library/acl.inc");
4 require_once("$srcdir/sha1.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");
9 require_once("$srcdir/erx_javascript.inc.php");
11 $alertmsg = '';
14 <html>
15 <head>
17 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
18 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
19 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
20 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
21 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
22 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
23 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
24 <script src="checkpwd_validation.js" type="text/javascript"></script>
26 <script language="JavaScript">
28 function submitform() {
29 if (document.forms[0].rumple.value.length>0 && document.forms[0].stiltskin.value.length>0) {
30 top.restoreSession();
32 //Checking if secure password is enabled or disabled.
33 //If it is enabled and entered password is a weak password, alert the user to enter strong password.
34 if(document.new_user.secure_pwd.value == 1){
35 var password = trim(document.new_user.stiltskin.value);
36 if(password != "") {
37 var pwdresult = passwordvalidate(password);
38 if(pwdresult == 0){
39 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'; ?>");
40 return false;
43 } //secure_pwd if ends here
44 // ViCareplus : As per NIST standard, SHA1 encryption algorithm is used
45 document.forms[0].newauthPass.value=SHA1(document.forms[0].stiltskin.value);
46 document.forms[0].stiltskin.value='';
47 <?php if($GLOBALS['erx_enable']){ ?>
48 alertMsg='';
49 f=document.forms[0];
50 for(i=0;i<f.length;i++){
51 if(f[i].type=='text' && f[i].value)
53 if(f[i].name == 'rumple')
55 alertMsg += checkLength(f[i].name,f[i].value,35);
56 alertMsg += checkUsername(f[i].name,f[i].value);
58 else if(f[i].name == 'fname' || f[i].name == 'mname' || f[i].name == 'lname')
60 alertMsg += checkLength(f[i].name,f[i].value,35);
61 alertMsg += checkUsername(f[i].name,f[i].value);
63 else if(f[i].name == 'federaltaxid')
65 alertMsg += checkLength(f[i].name,f[i].value,10);
66 alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
68 else if(f[i].name == 'state_license_number')
70 alertMsg += checkLength(f[i].name,f[i].value,10);
71 alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
73 else if(f[i].name == 'npi')
75 alertMsg += checkLength(f[i].name,f[i].value,35);
76 alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
78 else if(f[i].name == 'federaldrugid')
80 alertMsg += checkLength(f[i].name,f[i].value,30);
81 alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
85 if(alertMsg)
87 alert(alertMsg);
88 return false;
90 <?php } ?>
91 document.forms[0].submit();
92 } else {
93 if (document.forms[0].rumple.value.length<=0)
94 {document.forms[0].rumple.focus();document.forms[0].rumple.style.backgroundColor="red";}
95 if (document.forms[0].stiltskin.value.length<=0)
96 {document.forms[0].stiltskin.focus();document.forms[0].stiltskin.style.backgroundColor="red";}
99 function authorized_clicked() {
100 var f = document.forms[0];
101 f.calendar.disabled = !f.authorized.checked;
102 f.calendar.checked = f.authorized.checked;
105 </script>
107 </head>
108 <body class="body_top">
109 <table><tr><td>
110 <span class="title"><?php xl('Add User','e'); ?></span>&nbsp;</td>
111 <td>
112 <a class="css_button" name='form_save' id='form_save' href='#' onclick="return submitform()">
113 <span><?php xl('Save','e');?></span></a>
114 <a class="css_button large_button" id='cancel' href='#'>
115 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
116 </a>
117 </td></tr></table>
118 <br><br>
120 <table border=0>
122 <tr><td valign=top>
123 <form name='new_user' method='post' target="_parent" action="usergroup_admin.php"
124 onsubmit='return top.restoreSession()'>
125 <input type=hidden name=mode value=new_user>
126 <input type=hidden name=secure_pwd value="<?php echo $GLOBALS['secure_password']; ?>">
127 <span class="bold">&nbsp;</span>
128 </td><td>
129 <table border=0 cellpadding=0 cellspacing=0 style="width:600px;">
130 <tr>
131 <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>
132 <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>
133 </tr>
134 <tr>
135 <td><span class="text"<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>><?php xl('Groupname','e'); ?>: </span></td>
136 <td>
137 <select name=groupname<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
138 <?php
139 $res = sqlStatement("select distinct name from groups");
140 $result2 = array();
141 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
142 $result2[$iter] = $row;
143 foreach ($result2 as $iter) {
144 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
147 </select></td>
148 <td><span class="text"><?php xl('Provider','e'); ?>: </span></td><td>
149 <input type='checkbox' name='authorized' value='1' onclick='authorized_clicked()' />
150 &nbsp;&nbsp;<span class='text'><?php xl('Calendar','e'); ?>:
151 <input type='checkbox' name='calendar' disabled />
152 </td>
153 </tr>
154 <tr>
155 <td><span class="text"><?php xl('First Name','e'); ?>: </span></td><td><input type=entry name='fname' style="width:120px;"></td>
156 <td><span class="text"><?php xl('Middle Name','e'); ?>: </span></td><td><input type=entry name='mname' style="width:120px;"></td>
157 </tr>
158 <tr>
159 <td><span class="text"><?php xl('Last Name','e'); ?>: </span></td><td><input type=entry name='lname' style="width:120px;"></td>
160 <td><span class="text"><?php xl('Default Facility','e'); ?>: </span></td><td><select style="width:120px;" name=facility_id>
161 <?php
162 $fres = sqlStatement("select * from facility where service_location != 0 order by name");
163 if ($fres) {
164 for ($iter = 0;$frow = sqlFetchArray($fres);$iter++)
165 $result[$iter] = $frow;
166 foreach($result as $iter) {
168 <option value="<?php echo $iter{id};?>"><?php echo $iter{name};?></option>
169 <?php
173 </select></td>
174 </tr>
175 <tr>
176 <td><span class="text"><?php xl('Federal Tax ID','e'); ?>: </span></td><td><input type=entry name='federaltaxid' style="width:120px;"></td>
177 <td><span class="text"><?php xl('Federal Drug ID','e'); ?>: </span></td><td><input type=entry name='federaldrugid' style="width:120px;"></td>
178 </tr>
179 <tr>
180 <td><span class="text"><?php xl('UPIN','e'); ?>: </span></td><td><input type="entry" name="upin" style="width:120px;"></td>
181 <td class='text'><?php xl('See Authorizations','e'); ?>: </td>
182 <td><select name="see_auth" style="width:120px;">
183 <?php
184 foreach (array(1 => xl('None'), 2 => xl('Only Mine'), 3 => xl('All')) as $key => $value)
186 echo " <option value='$key'";
187 echo ">$value</option>\n";
190 </select></td>
192 <tr>
193 <td><span class="text"><?php xl('NPI','e'); ?>: </span></td><td><input type="entry" name="npi" style="width:120px;"></td>
194 <td><span class="text"><?php xl('Job Description','e'); ?>: </span></td><td><input type="entry" name="specialty" style="width:120px;"></td>
195 </tr>
197 <!-- (CHEMED) Calendar UI preference -->
198 <tr>
199 <td><span class="text"><?php xl('Taxonomy','e'); ?>: </span></td>
200 <td><input type="entry" name="taxonomy" style="width:120px;" value="207Q00000X"></td>
201 <td><span class="text"><?php xl('Calendar UI','e'); ?>: </span></td><td><select name="cal_ui" style="width:120px;">
202 <?php
203 foreach (array(3 => xl('Outlook'), 1 => xl('Original'), 2 => xl('Fancy')) as $key => $value)
205 echo " <option value='$key'";
206 if ($key == $iter['cal_ui']) echo " selected";
207 echo ">$value</option>\n";
210 </select></td>
211 </tr>
212 <!-- END (CHEMED) Calendar UI preference -->
214 <tr>
215 <td><span class="text"><?php xl('State License Number','e'); ?>: </span></td>
216 <td><input type="text" name="state_license_number" style="width:120px;"></td>
217 <td class='text'><?php xl('NewCrop eRX Role','e'); ?>:</td>
218 <td>
219 <?php echo generate_select_list("erxrole", "newcrop_erx_role", $iter['newcrop_user_role'],'','--Select Role--','','','',array('style'=>'width:120px')); ?>
220 </td>
221 </tr>
223 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
224 <tr>
225 <td class="text"><?php xl('Default Warehouse','e'); ?>: </td>
226 <td class='text'>
227 <?php
228 echo generate_select_list('default_warehouse', 'warehouse',
229 '', '');
231 </td>
232 <td class="text"><?php xl('Invoice Refno Pool','e'); ?>: </td>
233 <td class='text'>
234 <?php
235 echo generate_select_list('irnpool', 'irnpool', '',
236 xl('Invoice reference number pool, if used'));
238 </td>
239 </tr>
240 <?php } ?>
242 <?php
243 // List the access control groups if phpgacl installed
244 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
246 <tr>
247 <td class='text'><?php xl('Access Control','e'); ?>:</td>
248 <td><select name="access_group[]" multiple style="width:120px;">
249 <?php
250 $list_acl_groups = acl_get_group_title_list();
251 $default_acl_group = 'Administrators';
252 foreach ($list_acl_groups as $value) {
253 if ($default_acl_group == $value) {
254 // Modified 6-2009 by BM - Translate group name if applicable
255 echo " <option value='$value' selected>" . xl_gacl_group($value) . "</option>\n";
257 else {
258 // Modified 6-2009 by BM - Translate group name if applicable
259 echo " <option value='$value'>" . xl_gacl_group($value) . "</option>\n";
263 </select></td>
264 <td><span class="text"><?php xl('Additional Info','e'); ?>: </span></td>
265 <td><textarea name=info style="width:120px;" cols=27 rows=4 wrap=auto></textarea></td>
267 </tr>
268 <tr height="25"><td colspan="4">&nbsp;</td></tr>
269 <?php
273 </table>
275 <br>
276 <input type="hidden" name="newauthPass">
277 </form>
278 </td>
280 </tr>
282 <tr<?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
284 <td valign=top>
285 <form name='new_group' method='post' action="usergroup_admin.php"
286 onsubmit='return top.restoreSession()'>
287 <br>
288 <input type=hidden name=mode value=new_group>
289 <span class="bold"><?php xl('New Group','e'); ?>:</span>
290 </td><td>
291 <span class="text"><?php xl('Groupname','e'); ?>: </span><input type=entry name=groupname size=10>
292 &nbsp;&nbsp;&nbsp;
293 <span class="text"><?php xl('Initial User','e'); ?>: </span>
294 <select name=rumple>
295 <?php
296 $res = sqlStatement("select distinct username from users where username != ''");
297 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
298 $result[$iter] = $row;
299 foreach ($result as $iter) {
300 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
303 </select>
304 &nbsp;&nbsp;&nbsp;
305 <input type="submit" value=<?php xl('Save','e'); ?>>
306 </form>
307 </td>
309 </tr>
311 <tr <?php if ($GLOBALS['disable_non_default_groups']) echo " style='display:none'"; ?>>
313 <td valign=top>
314 <form name='new_group' method='post' action="usergroup_admin.php"
315 onsubmit='return top.restoreSession()'>
316 <input type=hidden name=mode value=new_group>
317 <span class="bold"><?php xl('Add User To Group','e'); ?>:</span>
318 </td><td>
319 <span class="text">
320 <?php xl('User','e'); ?>
321 : </span>
322 <select name=rumple>
323 <?php
324 $res = sqlStatement("select distinct username from users where username != ''");
325 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
326 $result3[$iter] = $row;
327 foreach ($result3 as $iter) {
328 print "<option value='".$iter{"username"}."'>" . $iter{"username"} . "</option>\n";
331 </select>
332 &nbsp;&nbsp;&nbsp;
333 <span class="text"><?php xl('Groupname','e'); ?>: </span>
334 <select name=groupname>
335 <?php
336 $res = sqlStatement("select distinct name from groups");
337 $result2 = array();
338 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
339 $result2[$iter] = $row;
340 foreach ($result2 as $iter) {
341 print "<option value='".$iter{"name"}."'>" . $iter{"name"} . "</option>\n";
344 </select>
345 &nbsp;&nbsp;&nbsp;
346 <input type="submit" value=<?php xl('Add User To Group','e'); ?>>
347 </form>
348 </td>
349 </tr>
351 </table>
353 <?php
354 if (empty($GLOBALS['disable_non_default_groups'])) {
355 $res = sqlStatement("select * from groups order by name");
356 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
357 $result5[$iter] = $row;
359 foreach ($result5 as $iter) {
360 $grouplist{$iter{"name"}} .= $iter{"user"} .
361 "(<a class='link_submit' href='usergroup_admin.php?mode=delete_group&id=" .
362 $iter{"id"} . "' onclick='top.restoreSession()'>Remove</a>), ";
365 foreach ($grouplist as $groupname => $list) {
366 print "<span class='bold'>" . $groupname . "</span><br>\n<span class='text'>" .
367 substr($list,0,strlen($list)-2) . "</span><br>\n";
372 <script language="JavaScript">
373 <?php
374 if ($alertmsg = trim($alertmsg)) {
375 echo "alert('$alertmsg');\n";
378 $(document).ready(function(){
379 $("#cancel").click(function() {
380 parent.$.fn.fancybox.close();
384 </script>
385 <table>
387 </table>
389 </body>
390 </html>