fixed sorting of DNs

This commit is contained in:
Roland Gruber 2003-10-28 19:32:10 +00:00
parent 723c21b13a
commit 35bf6395b8
4 changed files with 51 additions and 19 deletions

View File

@ -251,11 +251,19 @@ function cmp_array($a, $b) {
// sort specifies the sort column
global $sort;
global $attr_array;
// sort by first attribute with name $sort
// sort by first column if no attribute is given
if (!$sort) $sort = strtolower($attr_array[0]);
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
if ($sort != "dn") {
// sort by first attribute with name $sort
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
}
else {
if ($a[$sort] == $b[$sort]) return 0;
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
else return -1;
}
}

View File

@ -364,11 +364,19 @@ function cmp_array($a, $b) {
// sort specifies the sort column
global $sort;
global $attr_array;
// sort by first attribute with name $sort
// sort by first column if no attribute is given
if (!$sort) $sort = strtolower($attr_array[0]);
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
if ($sort != "dn") {
// sort by first attribute with name $sort
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
}
else {
if ($a[$sort] == $b[$sort]) return 0;
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
else return -1;
}
}
// save variables to session

View File

@ -355,11 +355,19 @@ function cmp_array($a, $b) {
// sort specifies the sort column
global $sort;
global $attr_array;
// sort by first attribute with name $sort
// sort by first column if no attribute is given
if (!$sort) $sort = strtolower($attr_array[0]);
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
if ($sort != "dn") {
// sort by first attribute with name $sort
if ($a[$sort][0] == $b[$sort][0]) return 0;
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
else return -1;
}
else {
if ($a[$sort] == $b[$sort]) return 0;
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
else return -1;
}
}
// save variables to session

View File

@ -415,14 +415,22 @@ function draw_navigation_bar ($user_count) {
// rows are sorted with the first attribute entry of the sort column
// if objects have attributes with multiple values the others are ignored
function cmp_array($a, $b) {
// sortattrib specifies the sort column
global $sortattrib;
global $attr_array;
// sort by first attribute with name $sortattrib
// sortattrib specifies the sort column
global $sortattrib;
global $attr_array;
// sort by first attribute with name $sortattrib
if (!$sortattrib) $sortattrib = strtolower($attr_array[0]);
if ($a[$sortattrib][0] == $b[$sortattrib][0]) return 0;
else if ($a[$sortattrib][0] == max($a[$sortattrib][0], $b[$sortattrib][0])) return 1;
else return -1;
if ($sortattrib != "dn") {
// sort by first column if no attribute is given
if ($a[$sortattrib][0] == $b[$sortattrib][0]) return 0;
else if ($a[$sortattrib][0] == max($a[$sortattrib][0], $b[$sortattrib][0])) return 1;
else return -1;
}
else {
if ($a[$sortattrib] == $b[$sortattrib]) return 0;
else if ($a[$sortattrib] == max($a[$sortattrib], $b[$sortattrib])) return 1;
else return -1;
}
}
// save variables to session