| Line 1... |
Line 1... |
| 1 |
#!/usr/bin/perl
|
1 |
#!/usr/bin/perl
|
| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| - |
|
3 |
use strict;
|
| 3 |
use strict;
|
4 |
use cPanelUserConfig;
|
| 4 |
use RollerCon;
|
5 |
use RollerCon;
|
| 5 |
use CGI qw/param cookie header start_html url/;
|
6 |
use CGI qw/param cookie header start_html url/;
|
| 6 |
use Email::Valid;
|
7 |
use Email::Valid;
|
| 7 |
use WebDB;
|
8 |
use WebDB;
|
| Line 71... |
Line 72... |
| 71 |
# $F->{level} = param ('level') // '';
|
72 |
# $F->{level} = param ('level') // '';
|
| 72 |
# $F->{type} = param ('type') // '';
|
73 |
# $F->{type} = param ('type') // '';
|
| 73 |
$F->{RCid} = param ('RCid') // '';
|
74 |
$F->{RCid} = param ('RCid') // '';
|
| 74 |
$F->{access} = param ('access') // 0;
|
75 |
$F->{access} = param ('access') // 0;
|
| 75 |
# $F->{clinic_pass} = defined param ('clinic_pass') ? 1 : 0;
|
76 |
# $F->{clinic_pass} = defined param ('clinic_pass') ? 1 : 0;
|
| 76 |
$F->{department} = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//r } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
|
77 |
$F->{department} = join ":", map { "$_-".param ("DEPT-".$_) } map { s/^DEPT-//; $_ } grep { param ($_) ne "" } grep { /^DEPT-/ } param ;
|
| Line 77... |
Line 78... |
| 77 |
|
78 |
|
| 78 |
if ($F->{RCid} eq "New") {
|
79 |
if ($F->{RCid} eq "New") {
|
| 79 |
# Saving a new User...
|
80 |
# Saving a new User...
|
| 80 |
# But first let's do some error checking...0
|
81 |
# But first let's do some error checking...0
|
| Line 88... |
Line 89... |
| 88 |
$F->{email} =~ s/\s+//g; # make sure people aren't accidentally including spaces
|
89 |
$F->{email} =~ s/\s+//g; # make sure people aren't accidentally including spaces
|
| 89 |
$F->{email} = lc $F->{email}; # sometimes people capitalize their email addresses and that's annoying...
|
90 |
$F->{email} = lc $F->{email}; # sometimes people capitalize their email addresses and that's annoying...
|
| 90 |
if (! Email::Valid->address (-address => $F->{email}, -mxcheck => 1, -tldcheck => 1)) { push @ERRORS, "Mal-formatted (or fake) Email Address!"; $F->{email} = ""; }
|
91 |
if (! Email::Valid->address (-address => $F->{email}, -mxcheck => 1, -tldcheck => 1)) { push @ERRORS, "Mal-formatted (or fake) Email Address!"; $F->{email} = ""; }
|
| 91 |
}
|
92 |
}
|
| 92 |
if (checkDupes ('email', $F->{email})) { push @ERRORS, "Email Address already in use. Pick a different one."; $F->{email} = ""; }
|
93 |
if (checkDupes ('email', $F->{email})) { push @ERRORS, "Email Address already in use. Pick a different one."; $F->{email} = ""; }
|
| - |
|
94 |
if (!$F->{department}) { push @ERRORS, "You need to request at least one Department!"; }
|
| 93 |
|
95 |
|
| 94 |
if (scalar @ERRORS) {
|
96 |
if (scalar @ERRORS) {
|
| 95 |
$ERRMSG = join $h->br, @ERRORS;
|
97 |
$ERRMSG = join $h->br, @ERRORS;
|
| 96 |
display_form ("New", "New User", $ERRMSG);
|
98 |
display_form ("New", "New User", $ERRMSG);
|
| 97 |
return;
|
99 |
return;
|
| 98 |
} else {
|
100 |
} else {
|
| Line 343... |
Line 345... |
| 343 |
$errors = $h->div ({ class=>"error" }, $errors);
|
345 |
$errors = $h->div ({ class=>"error" }, $errors);
|
| 344 |
} else {
|
346 |
} else {
|
| 345 |
$errors = "";
|
347 |
$errors = "";
|
| 346 |
}
|
348 |
}
|
| Line 347... |
Line 349... |
| 347 |
|
349 |
|
| 348 |
my @printDepartments = ( $h->div ({ class=>"rTableRow shaded" }, $h->div ({ class=>"rTableCellr" }, "Department Access Levels")) );
|
350 |
my @printDepartments = ( $h->div ({ class=>"index", style=>"display: unset;" }, $h->p ({ class=>"heading" }, "Department Access:")) );
|
| 349 |
foreach (sort grep { !/^PER$/ } keys %{$F->{department}}) {
|
351 |
foreach (sort grep { !/^PER$/ } keys %{$F->{department}}) {
|
| 350 |
push @printDepartments, $h->div ({ class=>"rTableRow" }, [
|
352 |
push @printDepartments, $h->div ({ class=>"rTableRow" }, [
|
| 351 |
$h->div ({ class=>"rTableCellr" }, $depts->{$_}.":", $F->{department}->{$_} =~ /^\d$/ ? $AccessLevel->{$F->{department}->{$_}} : $F->{department}->{$_}),
|
353 |
$h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, $depts->{$_}.":", $F->{department}->{$_} =~ /^\d$/ ? $AccessLevel->{$F->{department}->{$_}} : $F->{department}->{$_}),
|
| 352 |
]);
|
354 |
]);
|
| Line 353... |
Line 355... |
| 353 |
}
|
355 |
}
|
| Line 354... |
Line 356... |
| 354 |
|
356 |
|
| 355 |
printRCHeader ("User Manager");
|
357 |
printRCHeader ("User Manager");
|
| 356 |
|
358 |
|
| 357 |
print $errors;
|
- |
|
| 358 |
print $h->form ({ action=>url, method=>'POST', name=>'Req' },[
|
359 |
print $errors;
|
| 359 |
$h->input ({ type=>"hidden", name=>"referer", value=>$goback }),
|
360 |
print $h->form ({ action=>url, method=>'POST', name=>'Req' },[
|
| 360 |
|
361 |
$h->input ({ type=>"hidden", name=>"referer", value=>$goback }),
|
| 361 |
$h->div ({ class=>"rTable" },[
|
362 |
$h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "User Details:"),
|
| 362 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
|
363 |
$h->div ({ class=>"rTable", style=>"min-width: 0%;" },[
|
| 363 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "User-ID / Email Address: ", $F->{email}) ]),
|
364 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "User-ID / Email Address: ", $F->{email}) ]),
|
| 364 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Password: ", $F->{password}) ]),
|
365 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Password: ", $F->{password}) ]),
|
| 365 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Derby Name: ", $F->{derby_name}) ]),
|
366 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Derby Name: ", $F->{derby_name}) ]),
|
| 366 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Real Name: ", $F->{real_name}) ]),
|
367 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Real Name: ", $F->{real_name}) ]),
|
| 367 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Pronouns: ", $F->{pronouns}) ]),
|
368 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Pronouns: ", $F->{pronouns}) ]),
|
| 368 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "TShirt Size: ", $F->{tshirt}) ]),
|
369 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "TShirt Size: ", $F->{tshirt}) ]),
|
| 369 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Phone: ", $F->{phone}) ]),
|
370 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Phone: ", $F->{phone}) ]),
|
| 370 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Database ID: ", $F->{RCid}) ]),
|
371 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Database ID: ", $F->{RCid}) ]),
|
| 371 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "User Added: ", $F->{added}) ]),
|
372 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "User Added: ", $F->{added}) ]),
|
| 372 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "Last Login: ", $F->{last_login}) ]),
|
373 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "Last Login: ", $F->{last_login}) ]),
|
| 373 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, "vORC Access Level: ", $F->{access}) ]),
|
374 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: unset;" }, "vORC Access Level: ", $F->{access}) ]),
|
| 374 |
@printDepartments,
|
375 |
@printDepartments,
|
| - |
|
376 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
|
| 375 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCell" }, " ") ]),
|
377 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, $h->a ({ href=>$goback }, "[go back]"), $F->{buttons}) ])
|
| 376 |
$h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableCellr" }, $h->a ({ href=>"/schedule/index.pl" }, "[go home]")." ".$h->a ({ href=>$goback }, "[go back]"), $F->{buttons}) ])
|
378 |
])
|
| 377 |
])
|
379 |
])
|
| 378 |
]); # print $h->close('form');
|
380 |
]); # print $h->close('form');
|
| 379 |
print $h->div (["Schedule:", getSchedule ($RCID)]) unless !$RCID;
|
381 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Schedule:"), getSchedule ($RCID)]) unless $RCID !~ /^\d+$/;
|
| Line 380... |
Line 382... |
| 380 |
print $h->div (["Recent Activity:", getLog ($RCID)]) unless !$RCID;
|
382 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Recent Activity:"), getLog ($RCID)]) unless $RCID !~ /^\d+$/;
|
| 381 |
print $h->close ('html');
|
383 |
print $h->close ('html');
|