Commit c1ba157f authored by Leigh B Stoller's avatar Leigh B Stoller

The search user/project tabs now searches all users in all portals

and all projects in all portals.
parent 78142b6b
......@@ -138,7 +138,9 @@ $(function ()
"<td><a href='user-dashboard.php?user=" + user.usr_uid + "'>" +
user.usr_uid + "</a></td>" +
"<td>" + user.usr_name + "</td>" +
"<td>" + user.usr_affil + "</td></tr>";
"<td>" + user.usr_email + "</td>" +
"<td>" + user.usr_affil + "</td>" +
"<td>" + user.portal + "</td></tr>";
}
$('#search_users_table tbody').html(html);
$('#search_users_table').trigger("update", [false]);
......@@ -168,7 +170,8 @@ $(function ()
project.pid + "</a></td>" +
"<td><a href='user-dashboard.php?user=" + project.usr_uid + "'>" +
project.usr_name + "</a></td>" +
"<td>" + project.usr_affil + "</td></tr>";
"<td>" + project.usr_affil + "</td>" +
"<td>" + project.portal + "</td></tr>";
}
$('#search_projects_table tbody').html(html);
$('#search_projects_table').trigger("update", [false]);
......
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -65,16 +65,12 @@ function Do_SearchUsers()
SPITAJAX_ERROR(-1, "Illegal text to search for");
return -1;
}
$portal_test = "portal='$PORTAL_GENESIS'";
if ($ISEMULAB) {
$portal_test = "(portal is null or $portal_test)";
}
$safe_text = addslashes("%${text}%");
$query_result =
DBQueryFatal("select uid,usr_name,usr_affil,portal from users ".
"where $portal_test and ".
" (uid like '$safe_text' or ".
DBQueryFatal("select uid,usr_name,usr_affil,usr_email,portal ".
" from users ".
"where (uid like '$safe_text' or ".
" usr_affil like '$safe_text' or ".
" LCASE(usr_email) like '$safe_text' or ".
" usr_name like '$safe_text') ".
......@@ -83,9 +79,14 @@ function Do_SearchUsers()
while ($row = mysql_fetch_array($query_result)) {
$blob = array();
if (!isset($row["portal"])) {
$row["portal"] = "Classic";
}
$blob["usr_uid"] = $row["uid"];
$blob["usr_name"] = $row["usr_name"];
$blob["usr_affil"] = $row["usr_affil"];
$blob["usr_email"] = $row["usr_email"];
$blob["portal"] = $row["portal"];
$results[] = $blob;
}
SPITAJAX_RESPONSE($results);
......@@ -110,17 +111,12 @@ function Do_SearchProjects()
SPITAJAX_ERROR(-1, "Illegal text to search for");
return -1;
}
$portal_test = "p.portal='$PORTAL_GENESIS'";
if ($ISEMULAB) {
$portal_test = "(p.portal is null or $portal_test)";
}
$safe_text = addslashes("%${text}%");
$query_result =
DBQueryFatal("select pid,u.uid,u.usr_name,u.usr_affil,p.portal ".
" from projects as p ".
"left join users as u on u.uid_idx=p.head_idx ".
"where $portal_test and ".
" (pid like '$safe_text' or ".
"where (pid like '$safe_text' or ".
" p.name like '$safe_text' or ".
" p.why like '$safe_text' or ".
" u.usr_name like '$safe_text' or ".
......@@ -130,10 +126,15 @@ function Do_SearchProjects()
while ($row = mysql_fetch_array($query_result)) {
$blob = array();
if (!isset($row["portal"])) {
$row["portal"] = "Classic";
}
$blob = array();
$blob["pid"] = $row["pid"];
$blob["usr_uid"] = $row["uid"];
$blob["usr_name"] = $row["usr_name"];
$blob["usr_affil"] = $row["usr_affil"];
$blob["portal"] = $row["portal"];
$results[] = $blob;
}
SPITAJAX_RESPONSE($results);
......
......@@ -120,7 +120,9 @@
<tr>
<th>UID</th>
<th>Name</th>
<th>Email</th>
<th>Affiliation</th>
<th>Portal</th>
</tr>
</thead>
<tbody>
......@@ -145,6 +147,7 @@
<th>PID</th>
<th>Leader</th>
<th>Affiliation</th>
<th>Portal</th>
</tr>
</thead>
<tbody>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment