Merge pull request #1948 from owncloud/improve_user_sorting
Sort after display name + LDAP server side sorting
This commit is contained in:
commit
a54be4acc4
|
@ -624,7 +624,8 @@ abstract class Access {
|
||||||
* @brief executes an LDAP search
|
* @brief executes an LDAP search
|
||||||
* @param $filter the LDAP filter for the search
|
* @param $filter the LDAP filter for the search
|
||||||
* @param $base an array containing the LDAP subtree(s) that shall be searched
|
* @param $base an array containing the LDAP subtree(s) that shall be searched
|
||||||
* @param $attr optional, when a certain attribute shall be filtered out
|
* @param $attr optional, array, one or more attributes that shall be
|
||||||
|
* retrieved. Results will according to the order in the array.
|
||||||
* @returns array with the search result
|
* @returns array with the search result
|
||||||
*
|
*
|
||||||
* Executes an LDAP search
|
* Executes an LDAP search
|
||||||
|
@ -656,6 +657,14 @@ abstract class Access {
|
||||||
\OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), \OCP\Util::ERROR);
|
\OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), \OCP\Util::ERROR);
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do the server-side sorting
|
||||||
|
foreach(array_reverse($attr) as $sortAttr){
|
||||||
|
foreach($sr as $searchResource) {
|
||||||
|
ldap_sort($link_resource, $searchResource, $sortAttr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$findings = array();
|
$findings = array();
|
||||||
foreach($sr as $key => $res) {
|
foreach($sr as $key => $res) {
|
||||||
$findings = array_merge($findings, ldap_get_entries($link_resource, $res ));
|
$findings = array_merge($findings, ldap_get_entries($link_resource, $res ));
|
||||||
|
|
|
@ -530,7 +530,7 @@ class OC_User {
|
||||||
$displayNames = array_merge($displayNames, $backendDisplayNames);
|
$displayNames = array_merge($displayNames, $backendDisplayNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksort($displayNames);
|
asort($displayNames);
|
||||||
return $displayNames;
|
return $displayNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,9 +116,9 @@ var UserList = {
|
||||||
}
|
}
|
||||||
var added = false;
|
var added = false;
|
||||||
if (sort) {
|
if (sort) {
|
||||||
username = username.toLowerCase();
|
displayname = displayname.toLowerCase();
|
||||||
$('tbody tr').each(function () {
|
$('tbody tr').each(function () {
|
||||||
if (username < $(this).attr('data-uid').toLowerCase()) {
|
if (displayname < $(this).attr('data-uid').toLowerCase()) {
|
||||||
$(tr).insertBefore($(this));
|
$(tr).insertBefore($(this));
|
||||||
added = true;
|
added = true;
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue