From 1121dd01dfb9d3f86d8850ffb472e3472f5f53ab Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 29 Apr 2011 14:08:07 +1000 Subject: [PATCH] SF Feature #2879726 - sort the server select list --- lib/ds.php | 2 ++ lib/ds_ldap_pla.php | 13 +++++++++++++ lib/functions.php | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/ds.php b/lib/ds.php index 281c479..24f321c 100644 --- a/lib/ds.php +++ b/lib/ds.php @@ -661,6 +661,8 @@ class Datastore { if (! $isVisible || ($isVisible && $server->getValue('server','visible'))) $CACHE[$isVisible][$id] = $server; + masort($CACHE[$isVisible],'name'); + return $CACHE[$isVisible]; } diff --git a/lib/ds_ldap_pla.php b/lib/ds_ldap_pla.php index d3ae234..fe2274b 100644 --- a/lib/ds_ldap_pla.php +++ b/lib/ds_ldap_pla.php @@ -127,6 +127,19 @@ class ldap_pla extends ldap { 'default'=>null); } + public function __get($key) { + switch ($key) { + case 'name': + return $this->getValue('server','name'); + + default: + system_message(array( + 'title'=>_('Unknown request for Object value.'), + 'body'=>sprintf(_('Attempt to obtain value %s from %s'),$key,get_class($this)), + 'type'=>'error')); + } + } + /** * Gets whether the admin has configured phpLDAPadmin to show the "Create New" link in the tree viewer. * diff --git a/lib/functions.php b/lib/functions.php index 381a434..d26813a 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1000,7 +1000,7 @@ function get_custom_file($index,$filename,$path) { * @return array Sorted multi demension array. */ function masort(&$data,$sortby,$rev=0) { - if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); # if the array to sort is null or empty