SF Patch #3391389 - Option to initially open the tree

This commit is contained in:
Roland Gruber 2011-10-06 12:22:55 +11:00 committed by Deon George
parent 6c8b623788
commit 56830f1fa4
3 changed files with 16 additions and 2 deletions

View File

@ -414,6 +414,9 @@ $servers->setValue('server','name','My LDAP Server');
in the tree viewer. */ in the tree viewer. */
// $servers->setValue('appearance','show_create',true); // $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 /* This feature allows phpLDAPadmin to automatically determine the next
available uidNumber for a new entry. */ available uidNumber for a new entry. */
// $servers->setValue('auto_number','enable',true); // $servers->setValue('auto_number','enable',true);

View File

@ -57,10 +57,17 @@ abstract class Tree {
if (is_null($server->getLogin(null))) if (is_null($server->getLogin(null)))
return $tree; return $tree;
foreach ($server->getBaseDN(null) as $base) foreach ($server->getBaseDN(null) as $base) {
if ($base) if ($base) {
$tree->addEntry($base); $tree->addEntry($base);
if ($server->getValue('appearance','open_tree')) {
$baseEntry = $tree->getEntry($base);
$baseEntry->open();
}
}
}
set_cached_item($server_id,'tree','null',$tree); set_cached_item($server_id,'tree','null',$tree);
} }

View File

@ -24,6 +24,10 @@ class ldap_pla extends ldap {
'desc'=>'Whether to show the "Create new Entry here" in the tree browser', 'desc'=>'Whether to show the "Create new Entry here" in the tree browser',
'default'=>true); 'default'=>true);
$this->default->appearance['open_tree'] = array(
'desc'=>'Whether to initially open each tree',
'default'=>false);
$this->default->login['fallback_dn'] = array( $this->default->login['fallback_dn'] = array(
'desc'=>'If the attribute base login fails, see if a DN was entered', 'desc'=>'If the attribute base login fails, see if a DN was entered',
'default'=>false); 'default'=>false);