Automagic Entry Chooser\n";
if( $container ) {
echo "Server: " . htmlspecialchars( $servers[ $server_id ][ 'name' ] ) . "
\n";
echo "Looking in: " . htmlspecialchars( $container ) . "
\n";
}
/* Has the use already begun to descend into a specific server tree? */
if( $server_id !== false && $container !== false )
{
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. ".
"Please check your configuration." );
pla_ldap_connect( $server_id ) or pla_error( "Coult not connect to LDAP server." );
$dn_list = get_container_contents( $server_id, $container );
$base_dn = $servers[ $server_id ][ 'base' ];
if( ! $base_dn )
$base_dn = try_to_get_root_dn( $server_id );
if( $container == $base_dn ) {
$parent_container = false;
$up_href = "entry_chooser.php?form_element=$return_form_element";
} else {
$parent_container = get_container( $container );
$up_href = "entry_chooser.php?form_element=$return_form_element&server_id=$server_id&container=" .
rawurlencode( $parent_container );
}
echo " " .
" Back Up...
\n";
if( count( $dn_list ) == 0 )
echo " (no entries)
\n";
else
foreach( $dn_list as $dn ) {
$href = "javascript:returnDN( '$dn' )";
echo " " .
"" . htmlspecialchars( $dn ) . "
\n";
}
}
/* draw the root of the selection tree (ie, list all the servers) */
else
{
foreach( $servers as $id => $server ) {
if( $server['host'] ) {
echo "" . htmlspecialchars( $server['name'] ) . "
\n";
if( ! have_auth_info( $id ) )
echo " (Not logged in)
";
else {
$dn = ( $server['base'] ? $server['base'] : try_to_get_root_dn( $id ) );
if( ! $dn ) {
echo " (Could not determine base DN)
";
} else {
$href = "javascript:returnDN( '$dn' )";
echo " " .
"" . htmlspecialchars( $dn ) . "
\n";
}
}
}
}
}
// added by PD. 14082003,
// adding the element access allows it to work with javascript arrays
// the name of the form extracted from the first part of the URL variable.
$formpart=substr($return_form_element,0,strpos($return_form_element,"."));
// the name of the element extracted from the last part of the URL variable (after the dot)
$elmpart =substr($return_form_element,strpos($return_form_element,".")+1);
// rebuilt return value
$return_form_element = $formpart . ".elements[\"" . $elmpart . "\"]";
?>