From 56830f1fa470a78516266f534a135695e35c3683 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 6 Oct 2011 12:22:55 +1100 Subject: [PATCH] SF Patch #3391389 - Option to initially open the tree --- config/config.php.example | 3 +++ lib/Tree.php | 11 +++++++++-- lib/ds_ldap_pla.php | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config/config.php.example b/config/config.php.example index 362da19..fa06bfa 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -414,6 +414,9 @@ $servers->setValue('server','name','My LDAP Server'); in the tree viewer. */ // $servers->setValue('appearance','show_create',true); +/* Set to true if you would like to initially open the first level of each tree. */ +// $servers->setValue('appearance','open_tree',false); + /* This feature allows phpLDAPadmin to automatically determine the next available uidNumber for a new entry. */ // $servers->setValue('auto_number','enable',true); diff --git a/lib/Tree.php b/lib/Tree.php index b4d468f..e7542fc 100644 --- a/lib/Tree.php +++ b/lib/Tree.php @@ -57,10 +57,17 @@ abstract class Tree { if (is_null($server->getLogin(null))) return $tree; - foreach ($server->getBaseDN(null) as $base) - if ($base) + foreach ($server->getBaseDN(null) as $base) { + if ($base) { $tree->addEntry($base); + if ($server->getValue('appearance','open_tree')) { + $baseEntry = $tree->getEntry($base); + $baseEntry->open(); + } + } + } + set_cached_item($server_id,'tree','null',$tree); } diff --git a/lib/ds_ldap_pla.php b/lib/ds_ldap_pla.php index 879e37d..7ece393 100644 --- a/lib/ds_ldap_pla.php +++ b/lib/ds_ldap_pla.php @@ -24,6 +24,10 @@ class ldap_pla extends ldap { 'desc'=>'Whether to show the "Create new Entry here" in the tree browser', 'default'=>true); + $this->default->appearance['open_tree'] = array( + 'desc'=>'Whether to initially open each tree', + 'default'=>false); + $this->default->login['fallback_dn'] = array( 'desc'=>'If the attribute base login fails, see if a DN was entered', 'default'=>false);