changeset 26:f9b1d429f9ab

Added a user-finder.
author Atul Varma <varmaa@toolness.com>
date Thu, 11 Mar 2010 04:26:11 -0800
parents 6b52ea022121
children b6b1f0af8516
files find-user.html js/find-user.js
diffstat 2 files changed, 66 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/find-user.html	Thu Mar 11 04:26:11 2010 -0800
@@ -0,0 +1,42 @@
+<html>
+<head>
+  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+  <link rel="stylesheet" type="text/css" media="all"
+        href="css/jquery-ui.css" />
+  <link rel="stylesheet" type="text/css" media="all"
+        href="css/dashboard.css" />
+  <link rel="stylesheet" type="text/css" media="all"
+        href="css/file-bug.css" />
+  <title>Atul's User-Finder</title>
+</head>
+<body>
+<div id="reports">
+  <h1>Atul's User-Finder</h1>
+  <form id="find-user">
+  <p>Just type in part of a user name below.</p>
+  <p>You'll also need to provide your username and password to perform
+  the search (these are sent to Bugzilla over a secure connection and
+  are not proxied via any third parties).</p>
+  <table>
+    <tr>
+      <td>Your Username</td>
+      <td><input type="text" id="username"
+                 value="avarma@mozilla.com"/></td>
+    </tr>
+    <tr>
+      <td>Your Password</td>
+      <td><input type="password" id="password"/></td>
+    </tr>
+    <tr>
+      <td>Name</td>
+      <td><input type="text" id="query"/></td>
+    </tr>
+  </table>
+  </form>
+</div>
+</body>
+<script src="js/jquery.js"></script>
+<script src="js/jquery-ui.js"></script>
+<script src="js/bugzilla.js"></script>
+<script src="js/find-user.js"></script>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/find-user.js	Thu Mar 11 04:26:11 2010 -0800
@@ -0,0 +1,24 @@
+$(window).ready(
+  function() {
+    var currReq;
+
+    var options = {
+      minLength: 2,
+      source: function(request, response) {
+        function success(result) {
+          var suggs = [];
+          result.users.forEach(
+            function(user) {
+              suggs.push(user.real_name + " (" + user.name + ")");
+            });
+          response(suggs);
+        }
+        currReq = Bugzilla.ajax({url: "/user",
+                                 data: {match: request.term,
+                                        username: $("#username").val(),
+                                        password: $("#password").val()},
+                                 success: success});
+      }
+    };
+    $("input#query").autocomplete(options);
+  });