moved printing of table header to lists.inc

This commit is contained in:
Roland Gruber 2004-06-11 11:01:56 +00:00
parent 4a47e56f45
commit 212c5c4f5f
5 changed files with 46 additions and 83 deletions

View File

@ -107,7 +107,6 @@ function listDrawNavigationBar($count, $max_page_entries, $page, $sort, $searchF
}
echo("<td class=\"" . $scope . "nav-text\">");
//echo"&nbsp;" . $count . " " . _("Group(s) found");
echo"&nbsp;";
printf($text, $count);
echo("</td>");
@ -124,6 +123,45 @@ function listDrawNavigationBar($count, $max_page_entries, $page, $sort, $searchF
echo("</td></tr></table>\n");
}
/**
* Prints the attribute and filter row at the account table head
*
* @param string $scope account type (user, group, host)
* @param string $searchFilter search filter for hyperlinks
* @param array $desc_array list of attribute descriptions
* @param array $attr_array list of attribute names
* @param array $_POST HTTP-POST values
* @param string $sort sort attribute
*/
function listPrintTableHeader($scope, $searchFilter, $desc_array, $attr_array, $_POST, $sort) {
// print table header
echo "<table rules=\"all\" class=\"" . $scope . "list\" width=\"100%\">\n";
echo "<tr class=\"" . $scope . "list-head\">\n<th width=22 height=34></th>\n<th></th>\n";
// table header
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (strtolower($attr_array[$k]) == $sort) {
echo "<th class=\"" . $scope . "list-sort\"><a href=\"list" . $scope . "s.php?".
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>\n";
}
else echo "<th><a href=\"list" . $scope . "s.php?".
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>\n";
}
echo "</tr>\n";
// print filter row
echo "<tr align=\"center\" class=\"" . $scope . "list\">\n<td width=22 height=34></td>\n<td>";
echo "<input type=\"submit\" name=\"apply_filter\" value=\"" . _("Filter") . "\">";
echo "</td>\n";
// print input boxes for filters
for ($k = 0; $k < sizeof ($desc_array); $k++) {
echo "<td>";
echo ("<input type=\"text\" size=15 name=\"filter" . strtolower ($attr_array[$k]) .
"\" value=\"" . $_POST["filter" . strtolower($attr_array[$k])] . "\">");
echo "</td>\n";
}
echo "</tr>\n";
}
/**
* Returns the LDAP attribute names and their description for the user list

View File

@ -129,7 +129,7 @@ td.usernav-text {
}
/* style of active column */
th.userlist-activecolumn {
th.userlist-sort {
background-color:#fffde2;
}

View File

@ -207,32 +207,8 @@ listDrawNavigationBar(sizeof($grp_info), $max_page_entries, $page, $sort, $searc
echo ("<br>");
}
// print group table header
echo "<table rules=\"all\" class=\"grouplist\" width=\"100%\">\n";
echo "<tr class=\"grouplist-head\"><th width=22 height=34></th><th></th>";
// table header
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (strtolower($attr_array[$k]) == $sort) {
echo "<th class=\"grouplist-sort\"><a href=\"listgroups.php?".
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
else echo "<th><a href=\"listgroups.php?".
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
echo "</tr>\n";
// print filter row
echo "<tr align=\"center\" class=\"grouplist\"><td width=22 height=34></td><td>";
echo "<input type=\"submit\" name=\"apply_filter\" value=\"" . _("Filter") . "\">";
echo "</td>";
// print input boxes for filters
for ($k = 0; $k < sizeof ($desc_array); $k++) {
echo "<td>";
echo ("<input type=\"text\" size=15 name=\"filter" . strtolower ($attr_array[$k]) .
"\" value=\"" . $_POST["filter" . strtolower($attr_array[$k])] . "\">");
echo "</td>";
}
echo "</tr>\n";
// account table head
listPrintTableHeader("group", $searchFilter, $desc_array, $attr_array, $_POST, $sort);
// calculate which rows to show
$table_begin = ($page - 1) * $max_page_entries;

View File

@ -203,32 +203,8 @@ listDrawNavigationBar(sizeof($hst_info), $max_page_entries, $page, $sort, $searc
echo ("<br>\n");
}
// print host table header
echo "<table rules=\"all\" class=\"hostlist\" width=\"100%\">\n";
echo "<tr class=\"hostlist-head\"><th width=22 height=34></th><th></th>";
// table header
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (strtolower($attr_array[$k]) == $sort) {
echo "<th class=\"hostlist-sort\"><a href=\"listhosts.php?".
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
else echo "<th><a href=\"listhosts.php?".
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
echo "</tr>\n";
// print filter row
echo "<tr align=\"center\" class=\"hostlist\"><td width=22 height=34></td><td>";
echo "<input type=\"submit\" name=\"apply_filter\" value=\"" . _("Filter") . "\">";
echo "</td>";
// print input boxes for filters
for ($k = 0; $k < sizeof ($desc_array); $k++) {
echo "<td>";
echo ("<input type=\"text\" size=15 name=\"filter" . strtolower ($attr_array[$k]) .
"\" value=\"" . $_POST["filter" . strtolower($attr_array[$k])] . "\">");
echo "</td>";
}
echo "</tr>\n";
// account table head
listPrintTableHeader("host", $searchFilter, $desc_array, $attr_array, $_POST, $sort);
// calculate which rows to show
$table_begin = ($page - 1) * $max_page_entries;

View File

@ -246,35 +246,8 @@ if ($user_count != 0) {
echo ("<br />");
}
// print user table header
echo "<table rules=\"all\" class=\"userlist\" width=\"100%\">\n";
echo "<tr class=\"userlist-head\"><th width=22 height=34></th><th></th>\n";
// table header
for ($k = 0; $k < sizeof ($desc_array); $k++) {
if ($sort == strtolower($attr_array[$k]))
echo "<th class=\"userlist-activecolumn\">\n";
else
echo "<th>\n";
echo "<a class=\"userlist\" href=\"listusers.php?norefresh=1&amp;sort=" .
strtolower($attr_array[$k]) . $searchFilter . "&amp;trans_primary=" . $trans_primary . "\">" .
$desc_array[$k] . "</a></th>\n";
}
echo "</tr>\n";
echo "<tr class=\"userlist\"><th width=22 height=34></th>\n<th>\n";
echo "<input type=\"submit\" name=\"apply_filter\" value=\"" . _("Filter") . "\">\n";
echo "</th>\n";
// print input boxes for filters
for ($k = 0; $k < sizeof ($desc_array); $k++) {
echo "<th>\n";
echo ("<input type=\"text\" size=15 name=\"filter" . strtolower ($attr_array[$k]) .
"\" value=\"" . $_POST["filter" . strtolower($attr_array[$k])] . "\">\n");
echo "</th>\n";
}
echo "</tr>\n";
// account table head
listPrintTableHeader("user", $searchFilter . "&amp;trans_primary=" . $trans_primary, $desc_array, $attr_array, $_POST, $sort);
if ($user_count != 0) {
// translate GIDs and resort array if selected