forked from ndlibersa/auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax_forms.php
129 lines (90 loc) · 4 KB
/
ajax_forms.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/*
**************************************************************************************************************************
** CORAL Authentication Module v. 1.0
**
** Copyright (c) 2011 University of Notre Dame
**
** This file is part of CORAL.
**
** CORAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
**
** CORAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License along with CORAL. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************************************************************
*/
include_once 'directory.php';
switch ($_GET['action']) {
case 'getAdminUserUpdateForm':
if (isset($_GET['loginID'])) $loginID = $_GET['loginID']; else $loginID = '';
$eUser = new User(new NamedArguments(array('primaryKey' => $loginID)));
if ($eUser->isAdmin()){
$adminInd = 'checked';
}else{
$adminInd = '';
}
?>
<div id='div_updateForm'>
<div class='formTitle' style='width:295px;'><span class='headerText' style='margin-left:7px;'><?php if ($loginID){ echo "Edit User"; } else { echo "Add New User"; } ?></span></div>
<span class='smallDarkRedText' id='span_errors'></span>
<input type='hidden' id='editLoginID' value='<?php echo $loginID; ?>' />
<table class="surroundBox" style="width:300px;">
<tr>
<td>
<div style='width:260px; margin:10px;'>
<label for='submitLoginID' class='formLabel' <?php if ($loginID) { ?>style='margin-bottom:8px;'<?php } ?>><b>Login ID</b></label>
<?php if (!$loginID) { ?><input type='text' id='textLoginID' value='' style='width:110px;'/> <?php } else { echo $loginID; } ?>
<?php if ($loginID) { ?><div class='smallDarkRedText' style="clear:left;margin-left:5px;margin-bottom:3px;">Enter password for changes only</div> <?php }else{ echo "<br />"; } ?>
<label for='password' class='formLabel'><b><?php if ($loginID) { echo "New "; } ?>Password</b></label>
<input type='password' id='password' value="" style='width:110px;' />
<br />
<label for='passwordReenter' class='formLabel'><b>Reenter Password</b></label>
<input type='password' id='passwordReenter' value="" style='width:110px;'/>
<br />
<label for='adminInd' class='formLabel'><b>Admin?</b></label>
<input type='checkbox' id='adminInd' value='Y' <?php echo $adminInd; ?> />
<br />
</div>
</td>
</tr>
</table>
<br />
<table class='noBorderTable' style='width:125px;'>
<tr>
<td style='text-align:left'><input type='button' value='submit' id ='submitUser' class='submitButton' /></td>
<td style='text-align:right'><input type='button' value='cancel' onclick="window.parent.tb_remove(); return false;" class='submitButton' /></td>
</tr>
</table>
</div>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript">
//attach enter key event to new input and call add data when hit
$('#loginID').keyup(function(e) {
if(e.keyCode == 13) {
window.parent.submitUserForm();
}
});
$('#password').keyup(function(e) {
if(e.keyCode == 13) {
window.parent.submitUserForm();
}
});
$('#passwordReenter').keyup(function(e) {
if(e.keyCode == 13) {
window.parent.submitUserForm();
}
});
//bind all of the inputs
$("#submitUser").click(function () {
window.parent.submitUserForm();
});
</script>
<?php
break;
default:
echo "Action " . $action . " not set up!";
break;
}
?>