fixed error display of error message/table if no users are found

This commit is contained in:
dechutes 2003-05-27 19:30:41 +00:00
parent 4babfb0ddd
commit d83d1a7eba
1 changed files with 69 additions and 53 deletions

View File

@ -130,7 +130,9 @@ if ($_SESSION["userlist"] && $_GET["norefresh"]) {
$userinfo = ldap_get_entries ($_SESSION["ldap"]->server, $sr); $userinfo = ldap_get_entries ($_SESSION["ldap"]->server, $sr);
ldap_free_result ($sr); ldap_free_result ($sr);
if ($userinfo["count"] == 0) if ($userinfo["count"] == 0)
StatusMessage("WARN", "", _("No Users found!")); StatusMessage ("WARN", "",
_("No User(s) found with applied search filter <") .
$filter . ">");
// delete first array entry which is "count" // delete first array entry which is "count"
array_shift($userinfo); array_shift($userinfo);
@ -146,12 +148,19 @@ $user_count = sizeof ($_SESSION["userlist"]);
echo ("<form action=\"listusers.php\" method=\"post\">\n"); echo ("<form action=\"listusers.php\" method=\"post\">\n");
// display table only if users exist in LDAP
if ($user_count != 0) {
// create navigation bar on top of user table // create navigation bar on top of user table
draw_navigation_bar ($user_count); draw_navigation_bar ($user_count);
echo ("<br />"); echo ("<br />");
}
// print user table header // print user table header
echo "<table rules=\"all\" class=\"userlist\" width=\"100%\">\n"; echo "<table rules=\"all\" class=\"userlist\" width=\"100%\">\n";
echo "<tr class=\"userlist_head\"><th width=22 height=34></th><th></th>\n"; echo "<tr class=\"userlist_head\"><th width=22 height=34></th><th></th>\n";
// table header // table header
for ($k = 0; $k < sizeof ($desc_array); $k++) { for ($k = 0; $k < sizeof ($desc_array); $k++) {
@ -164,6 +173,7 @@ for ($k = 0; $k < sizeof ($desc_array); $k++) {
$desc_array[$k] . "</a></th>\n"; $desc_array[$k] . "</a></th>\n";
} }
echo "</tr>\n"; echo "</tr>\n";
echo "<tr class=\"test\"><th width=22 height=34></th><th>\n"; echo "<tr class=\"test\"><th width=22 height=34></th><th>\n";
echo "<input type=\"submit\" name=\"apply_filter\" value=\"" . _("Apply") . "\">"; echo "<input type=\"submit\" name=\"apply_filter\" value=\"" . _("Apply") . "\">";
echo "</th>\n"; echo "</th>\n";
@ -177,6 +187,7 @@ for ($k = 0; $k < sizeof ($desc_array); $k++) {
} }
echo "</tr>\n"; echo "</tr>\n";
if ($user_count != 0) {
// print user list // print user list
$userinfo = array_slice ($userinfo, ($page - 1) * $max_pageentrys, $userinfo = array_slice ($userinfo, ($page - 1) * $max_pageentrys,
$max_pageentrys); $max_pageentrys);
@ -200,17 +211,22 @@ for ($i = 0; $i < sizeof ($userinfo); $i++) { // ignore last entry in array whic
echo ("</td>"); echo ("</td>");
} }
echo("</tr>\n"); echo("</tr>\n");
}
echo ("</table>"); echo ("</table>");
echo ("<br />"); echo ("<br />");
if ($user_count != 0) {
draw_navigation_bar ($user_count); draw_navigation_bar ($user_count);
echo ("<br />"); echo ("<br />");
}
echo ("<table align=\"left\" border=\"0\">"); echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td align=\"left\"><input type=\"submit\" name=\"new_user\" value=\"" . _("New User") . "\"></td>"); echo ("<tr><td align=\"left\"><input type=\"submit\" name=\"new_user\" value=\"" . _("New User") . "\"></td>");
if ($user_count != 0) {
echo ("<td align=\"left\"><input type=\"submit\" name=\"del_user\" value=\"" . _("Delete User(s)") . "\"></td></tr>"); echo ("<td align=\"left\"><input type=\"submit\" name=\"del_user\" value=\"" . _("Delete User(s)") . "\"></td></tr>");
}
echo ("</table>\n"); echo ("</table>\n");
echo ("</form>\n"); echo ("</form>\n");
echo "</body></html>\n"; echo "</body></html>\n";