diff options
author | Adam Young <ayoung@redhat.com> | 2010-06-16 15:11:03 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-06-17 14:41:47 -0400 |
commit | 3c9096f97c30e8d6afcbce251ef130d526991a62 (patch) | |
tree | 9ddbec767efa6b0b0a65cfa3bd0c41f4b33ddf44 | |
parent | e695042e1b82ba31d4f5287409436f63450b8773 (diff) | |
download | freeipa-3c9096f97c30e8d6afcbce251ef130d526991a62.tar.gz freeipa-3c9096f97c30e8d6afcbce251ef130d526991a62.tar.xz freeipa-3c9096f97c30e8d6afcbce251ef130d526991a62.zip |
Find populates table from json.
-rw-r--r-- | web/ipa.xhtml | 1 | ||||
-rw-r--r-- | web/user-find.inc | 31 | ||||
-rw-r--r-- | web/user.js | 31 |
3 files changed, 45 insertions, 18 deletions
diff --git a/web/ipa.xhtml b/web/ipa.xhtml index 4eff59285..d7c435ebb 100644 --- a/web/ipa.xhtml +++ b/web/ipa.xhtml @@ -16,6 +16,7 @@ rel="stylesheet" type="text/css" /> </style> <script type="text/javascript" src="pageparams.js" /> +<script type="text/javascript" src="user.js" /> <script type="text/javascript"> diff --git a/web/user-find.inc b/web/user-find.inc index 379babcd8..a3cae73f2 100644 --- a/web/user-find.inc +++ b/web/user-find.inc @@ -1,7 +1,15 @@ -<div><form><input type="text"/><input type="submit" value="find" />...............................................<a href="ipa.xhtml?bodycontent=user-edit.inc">New User</a></form></div> +<script type="text/javascript"> -<div> - <table border="1"> + $(document).ready(function(){ + setupUserSearch(); + }); + +</script> +<div><input type="text"/><input id="userquery" type="submit" value="find" />...............................................<a href="ipa.xhtml?bodycontent=user-edit.inc">New User</a></div> + +<div > + <table id="usersTable" border="1"> + <thead> <tr> <th>User Name</th> <th>Email Address</th> @@ -9,21 +17,8 @@ <th>Job Title</th> <th>Actions</th> </tr> - - <tr> - <td>Pat DeBoonie</td> - <td>pdboonie@lonmgcompanyrname.com</td> - <td>(617) 555-1111</td> - <td>Director</td> - <td><a href="ipa.xhtml?bodycontent=user-edit.inc" >Modify</a>|<a href="#">Delete</a></td> - </tr> - <tr> - <td>Mary Smith</td> - <td>ms@lonmgcompanyrname.com</td> - <td>(617) 555-1111</td> - <td>Engineer</td> - <td><a href="ipa.xhtml?bodycontent=user-edit.inc" >Modify</a>|<a href="#">Delete</a></td> - </tr> + </thead> + <tbody></tbody> </table> </div> diff --git a/web/user.js b/web/user.js new file mode 100644 index 000000000..7597bff00 --- /dev/null +++ b/web/user.js @@ -0,0 +1,31 @@ +function setupUserSearch(){ + + +$("#userquery").click(function(){ + + var jsonData = {"method":"user_find","params":[["kfrog"],{}],"id":0} + var jsonRequest = JSON.stringify(jsonData); + + $.ajax({ + beforeSend: function(xhrObj){ + xhrObj.setRequestHeader("Content-Type","application/json"); + xhrObj.setRequestHeader("Accept","application/json"); + }, + type: "POST", + url: "/ipa/json", + processData: false, + data: jsonRequest, + dataType: "json", + success: function(json){ + $('#usersTable tbody:last').append('<tr>' + +'<td>' + json.result.result[0].uid + '</td>' + +'<td>' + json.result.result[0].givenname + '</td>' + +'<td>' + json.result.result[0].sn + '</td>' + +'<td>' + json.result.result[0].homedirectory + '</td>' + +'<td>' + json.result.result[0].loginshell + '</td>' + + +'</tr>'); + } + }); +}); +}
\ No newline at end of file |