implemented navigation bars

This commit is contained in:
Roland Gruber 2003-05-13 15:55:30 +00:00
parent 0e34df01c7
commit 5c7c694ad2
3 changed files with 153 additions and 27 deletions

View File

@ -103,6 +103,14 @@ tr.userlist_checked {
* *
*/ */
/* */
table.groupnav {
background-color:#a8c3ff;
border-width:1px;
border-style:solid;
border-color:#7167bf;//#0050ff;
}
/* table preferences */ /* table preferences */
table.grouplist { table.grouplist {
border-width:1px; border-width:1px;
@ -118,7 +126,11 @@ tr.grouplist {
/* color of head row */ /* color of head row */
tr.grouplist_head { tr.grouplist_head {
background-color:#a8c3ff; background-color:#a8c3ff;
font-weight:bold; }
/* color of sorted column in head row */
th.grouplist_sort {
background-color:#d6e3ff;
} }
/* color of rows on mouseOver */ /* color of rows on mouseOver */
@ -136,6 +148,14 @@ tr.grouplist_checked {
* *
*/ */
/* */
table.hostnav {
background-color:#ffc4ba;
border-width:1px;
border-style:solid;
border-color:#911a1a;
}
/* table preferences */ /* table preferences */
table.hostlist { table.hostlist {
border-width:1px; border-width:1px;
@ -151,7 +171,11 @@ tr.hostlist {
/* color of head row */ /* color of head row */
tr.hostlist_head { tr.hostlist_head {
background-color:#ffc4ba; background-color:#ffc4ba;
font-weight:bold; }
/* color of sorted column in head row */
th.hostlist_sort {
background-color:#ffe2dd;
} }
/* color of rows on mouseOver */ /* color of rows on mouseOver */

View File

@ -90,7 +90,6 @@ else {
// configure search filter // configure search filter
// Groups have the attribute "posixGroup" // Groups have the attribute "posixGroup"
$filter = "(objectClass=posixGroup)";
$filter = "(&(objectClass=posixGroup)"; $filter = "(&(objectClass=posixGroup)";
for ($k = 0; $k < sizeof($desc_array); $k++) { for ($k = 0; $k < sizeof($desc_array); $k++) {
if ($_POST["filter" . strtolower($attr_array[$k])]) if ($_POST["filter" . strtolower($attr_array[$k])])
@ -117,12 +116,18 @@ else StatusMessage("ERROR", _("LDAP Search failed! Please check your preferences
echo ("<form action=\"listgroups.php\" method=\"post\">\n"); echo ("<form action=\"listgroups.php\" method=\"post\">\n");
draw_navigation_bar(sizeof($info));
echo ("<br>");
// print group table header // print group table header
echo "<table rules=\"all\" class=\"grouplist\" width=\"100%\">\n"; echo "<table rules=\"all\" class=\"grouplist\" width=\"100%\">\n";
echo "<tr class=\"grouplist_head\"><th width=22 height=34></th><th></th>"; echo "<tr class=\"grouplist_head\"><th width=22 height=34></th><th></th>";
// table header // table header
for ($k = 0; $k < sizeof($desc_array); $k++) { for ($k = 0; $k < sizeof($desc_array); $k++) {
echo "<th><a href=\"listgroups.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>"; if (strtolower($attr_array[$k]) == $list) {
echo "<th class=\"grouplist_sort\"><a href=\"listgroups.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>";
}
else echo "<th><a href=\"listgroups.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>";
} }
echo "</tr>\n"; echo "</tr>\n";
@ -139,8 +144,13 @@ for ($k = 0; $k < sizeof ($desc_array); $k++) {
} }
echo "</tr>\n"; echo "</tr>\n";
// calculate which rows to show
$table_begin = ($page - 1) * $max_pageentrys;
if (($page * $max_pageentrys) > sizeof($info)) $table_end = sizeof($info);
else $table_end = ($page * $max_pageentrys);
// print group list // print group list
for ($i = 0; $i < sizeof($info); $i++) { // ignore last entry in array which is "count" for ($i = $table_begin; $i < $table_end; $i++) {
echo("<tr class=\"grouplist\" onMouseOver=\"group_over(this, '" . $info[$i]["dn"] . "')\"" . echo("<tr class=\"grouplist\" onMouseOver=\"group_over(this, '" . $info[$i]["dn"] . "')\"" .
" onMouseOut=\"group_out(this, '" . $info[$i]["dn"] . "')\"" . " onMouseOut=\"group_out(this, '" . $info[$i]["dn"] . "')\"" .
" onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\"" . " onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\"" .
@ -178,14 +188,54 @@ for ($i = 0; $i < sizeof($info); $i++) { // ignore last entry in array which is
echo("</tr>\n"); echo("</tr>\n");
} }
echo ("</table>"); echo ("</table>");
echo ("<p>&nbsp</p>\n"); echo ("<br>");
echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td align=\"left\"><input type=\"submit\" name=\"new_group\" value=\"" . _("New Group") . "\"></td>"); draw_navigation_bar(sizeof($info));
echo ("<td align=\"left\"><input type=\"submit\" name=\"del_group\" value=\"" . _("Delete Group(s)") . "\"></td></tr>");
echo ("<br>\n");
echo ("<table align=\"left\" border=\"0\"\n>");
echo ("<tr><td align=\"left\"><input type=\"submit\" name=\"new_group\" value=\"" . _("New Group") . "\"></td>\n");
echo ("<td align=\"left\"><input type=\"submit\" name=\"del_group\" value=\"" . _("Delete Group(s)") . "\"></td></tr>\n");
echo ("</table>\n"); echo ("</table>\n");
echo ("</form>\n"); echo ("</form>\n");
echo "</body></html>\n"; echo "</body></html>\n";
/**
* @brief draws a navigation bar to switch between pages
*
*
* @return void
*/
function draw_navigation_bar ($count) {
global $max_pageentrys;
global $page;
global $list;
echo ("<table class=\"groupnav\" width=\"100%\" border=\"0\">\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">&nbsp;&nbsp;");
if ($page != 1)
echo ("<a align=\"right\" class=\"userlist\" href=\"listgroups.php?page=" . ($page - 1) . "&list=" . $list . "\"><=</a>\n");
else
echo ("<=");
echo ("&nbsp;");
if ($page < ($count / $max_pageentrys))
echo ("<a align=\"right\" class=\"userlist\" href=\"listgrous.php?page=" . ($page + 1) . "&list=" . $list . "\">=></a>\n");
else
echo ("=></td>");
echo ("<td style=\"color:red\" align=\"right\">");
for ($i = 0; $i < ($count / $max_pageentrys); $i++) {
if ($i == $page - 1)
echo ("&nbsp;" . ($i + 1));
else
echo ("&nbsp;<a align=\"right\" class=\"userlist\" href=\"listgroups.php?page=" . ($i + 1) .
"&list=" . $list . "\">" . ($i + 1) . "</a>\n");
}
echo ("</td></tr></table>\n");
}
// compare function used for usort-method // compare function used for usort-method
// rows are sorted with the first attribute entry of the sort column // rows are sorted with the first attribute entry of the sort column
// if objects have attributes with multiple values the others are ignored // if objects have attributes with multiple values the others are ignored

View File

@ -116,12 +116,18 @@ else StatusMessage("ERROR", _("LDAP Search failed! Please check your preferences
echo ("<form action=\"listhosts.php\" method=\"post\">\n"); echo ("<form action=\"listhosts.php\" method=\"post\">\n");
draw_navigation_bar(sizeof($info));
echo ("<br>");
// print host table header // print host table header
echo "<table rules=\"all\" class=\"hostlist\" width=\"100%\">\n"; echo "<table rules=\"all\" class=\"hostlist\" width=\"100%\">\n";
echo "<tr class=\"hostlist_head\"><th width=22 height=34></th><th></th>"; echo "<tr class=\"hostlist_head\"><th width=22 height=34></th><th></th>";
// table header // table header
for ($k = 0; $k < sizeof($desc_array); $k++) { for ($k = 0; $k < sizeof($desc_array); $k++) {
echo "<th><a href=\"listhosts.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>"; if (strtolower($attr_array[$k]) == $list) {
echo "<th class=\"hostlist_sort\"><a href=\"listhosts.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>";
}
else echo "<th><a href=\"listhosts.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>";
} }
echo "</tr>\n"; echo "</tr>\n";
@ -138,8 +144,13 @@ for ($k = 0; $k < sizeof ($desc_array); $k++) {
} }
echo "</tr>\n"; echo "</tr>\n";
// calculate which rows to show
$table_begin = ($page - 1) * $max_pageentrys;
if (($page * $max_pageentrys) > sizeof($info)) $table_end = sizeof($info);
else $table_end = ($page * $max_pageentrys);
// print host list // print host list
for ($i = 0; $i < sizeof($info); $i++) { for ($i = $table_begin; $i < $table_end; $i++) {
echo("<tr class=\"hostlist\" onMouseOver=\"host_over(this, '" . $info[$i]["dn"] . "')\"" . echo("<tr class=\"hostlist\" onMouseOver=\"host_over(this, '" . $info[$i]["dn"] . "')\"" .
" onMouseOut=\"host_out(this, '" . $info[$i]["dn"] . "')\"" . " onMouseOut=\"host_out(this, '" . $info[$i]["dn"] . "')\"" .
" onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\"" . " onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\"" .
@ -159,14 +170,55 @@ for ($i = 0; $i < sizeof($info); $i++) {
echo("</tr>\n"); echo("</tr>\n");
} }
echo ("</table>"); echo ("</table>");
echo ("<p>&nbsp</p>\n");
echo ("<table align=\"left\" border=\"0\">"); echo ("<br>");
echo ("<tr><td align=\"left\"><input type=\"submit\" name=\"new_host\" value=\"" . _("New Host") . "\"></td>");
echo ("<td align=\"left\"><input type=\"submit\" name=\"del_host\" value=\"" . _("Delete Host(s)") . "\"></td></tr>"); draw_navigation_bar(sizeof($info));
echo ("<br>\n");
echo ("<table align=\"left\" border=\"0\">\n");
echo ("<tr><td align=\"left\"><input type=\"submit\" name=\"new_host\" value=\"" . _("New Host") . "\"></td>\n");
echo ("<td align=\"left\"><input type=\"submit\" name=\"del_host\" value=\"" . _("Delete Host(s)") . "\"></td></tr>\n");
echo ("</table>\n"); echo ("</table>\n");
echo ("</form>\n"); echo ("</form>\n");
echo "</body></html>\n"; echo "</body></html>\n";
/**
* @brief draws a navigation bar to switch between pages
*
*
* @return void
*/
function draw_navigation_bar ($count) {
global $max_pageentrys;
global $page;
global $list;
echo ("<table class=\"hostnav\" width=\"100%\" border=\"0\">\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">&nbsp;&nbsp;");
if ($page != 1)
echo ("<a align=\"right\" class=\"userlist\" href=\"listhosts.php?page=" . ($page - 1) . "&list=" . $list . "\"><=</a>\n");
else
echo ("<=");
echo ("&nbsp;");
if ($page < ($count / $max_pageentrys))
echo ("<a align=\"right\" class=\"userlist\" href=\"listgrous.php?page=" . ($page + 1) . "&list=" . $list . "\">=></a>\n");
else
echo ("=></td>");
echo ("<td style=\"color:red\" align=\"right\">");
for ($i = 0; $i < ($count / $max_pageentrys); $i++) {
if ($i == $page - 1)
echo ("&nbsp;" . ($i + 1));
else
echo ("&nbsp;<a align=\"right\" class=\"userlist\" href=\"listhosts.php?page=" . ($i + 1) .
"&list=" . $list . "\">" . ($i + 1) . "</a>\n");
}
echo ("</td></tr></table>\n");
}
// compare function used for usort-method // compare function used for usort-method
// rows are sorted with the first attribute entry of the sort column // rows are sorted with the first attribute entry of the sort column
// if objects have attributes with multiple values the others are ignored // if objects have attributes with multiple values the others are ignored