save filter if sorting column is changed
This commit is contained in:
parent
f8363863aa
commit
2dc3330651
|
@ -35,6 +35,9 @@ setlanguage();
|
||||||
// get sorting column when register_globals is off
|
// get sorting column when register_globals is off
|
||||||
$list = $_GET['list'];
|
$list = $_GET['list'];
|
||||||
|
|
||||||
|
// copy HTTP-GET variables to HTTP-POST
|
||||||
|
$_POST = $_POST + $_GET;
|
||||||
|
|
||||||
// check if button was pressed and if we have to add/delete a group
|
// check if button was pressed and if we have to add/delete a group
|
||||||
if ($_POST['new_group'] || $_POST['del_group']){
|
if ($_POST['new_group'] || $_POST['del_group']){
|
||||||
// add new group
|
// add new group
|
||||||
|
@ -88,6 +91,15 @@ for ($i = 0; $i < sizeof($temp_array); $i++) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate search filter for sort links
|
||||||
|
$searchfilter = "";
|
||||||
|
for ($k = 0; $k < sizeof($desc_array); $k++) {
|
||||||
|
if ($_POST["filter" . strtolower($attr_array[$k])]) {
|
||||||
|
$searchfilter = $searchfilter . "&filter" . strtolower($attr_array[$k]) . "=".
|
||||||
|
$_POST["filter" . strtolower($attr_array[$k])];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// configure search filter
|
// configure search filter
|
||||||
// Groups have the attribute "posixGroup"
|
// Groups have the attribute "posixGroup"
|
||||||
$filter = "(&(objectClass=posixGroup)";
|
$filter = "(&(objectClass=posixGroup)";
|
||||||
|
@ -125,9 +137,11 @@ 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++) {
|
||||||
if (strtolower($attr_array[$k]) == $list) {
|
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>";
|
echo "<th class=\"grouplist_sort\"><a href=\"listgroups.php?".
|
||||||
|
"list=" . strtolower($attr_array[$k]) . $searchfilter . "\">" . $desc_array[$k] . "</a></th>";
|
||||||
}
|
}
|
||||||
else echo "<th><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]) . $searchfilter . "\">" . $desc_array[$k] . "</a></th>";
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ setlanguage();
|
||||||
// get sorting column when register_globals is off
|
// get sorting column when register_globals is off
|
||||||
$list = $_GET['list'];
|
$list = $_GET['list'];
|
||||||
|
|
||||||
|
// copy HTTP-GET variables to HTTP-POST
|
||||||
|
$_POST = $_POST + $_GET;
|
||||||
|
|
||||||
// check if button was pressed and if we have to add/delete a host
|
// check if button was pressed and if we have to add/delete a host
|
||||||
if ($_POST['new_host'] || $_POST['del_host']){
|
if ($_POST['new_host'] || $_POST['del_host']){
|
||||||
// add new host
|
// add new host
|
||||||
|
@ -88,6 +91,15 @@ else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate search filter for sort links
|
||||||
|
$searchfilter = "";
|
||||||
|
for ($k = 0; $k < sizeof($desc_array); $k++) {
|
||||||
|
if ($_POST["filter" . strtolower($attr_array[$k])]) {
|
||||||
|
$searchfilter = $searchfilter . "&filter" . strtolower($attr_array[$k]) . "=".
|
||||||
|
$_POST["filter" . strtolower($attr_array[$k])];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// configure search filter
|
// configure search filter
|
||||||
// Samba hosts have the attribute "sambaAccount" and end with "$"
|
// Samba hosts have the attribute "sambaAccount" and end with "$"
|
||||||
$filter = "(&(objectClass=sambaAccount) (uid=*$)";
|
$filter = "(&(objectClass=sambaAccount) (uid=*$)";
|
||||||
|
@ -125,9 +137,11 @@ 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++) {
|
||||||
if (strtolower($attr_array[$k]) == $list) {
|
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>";
|
echo "<th class=\"hostlist_sort\"><a href=\"listhosts.php?".
|
||||||
|
"list=" . strtolower($attr_array[$k]) . $searchfilter . "\">" . $desc_array[$k] . "</a></th>";
|
||||||
}
|
}
|
||||||
else echo "<th><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]) . $searchfilter . "\">" . $desc_array[$k] . "</a></th>";
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue