<?php
/***************************************************************************
*
* xajax.php
* -------------------
*
* begin : Okt, 31, 2006
* copyright : (C) 2006 Guseynov Alexey
* email : hide@address.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
* (http://www.gnu.org/licenses/gpl.html)
*
***************************************************************************/
include_once("includes/Config.php");
include_once("includes/Tree.php");
include_once("includes/LDAPinterface.php");
include_once("includes/XMLinterface.php");
include_once("includes/smarty/Smarty.class.php");
include_once('includes/dnInterpreter.php');
include_once("includes/TPLInterface.php");
include_once('includes/ControlFactory.php');
$xajax->registerFunction('get_tree');
$xajax->processRequests();
function get_tree( $base_dn, $form_id )
{
$objResponse = new xajaxResponse();
$ldap = new LDAPinterface($_SESSION['host'], $_SESSION['user'] ,$_SESSION['pass']);
$config = new Config("config.xml");
$options = $config->get_options();
$ldap_base = $config->get_host_ldapbase( $_SESSION['host'] );
// Generate filter
$formfilter = $config->get_host_form_filter($_SESSION['host'], $form_id);
$filter = $HTTP_POST_VARS["filter"];
if ( $filter )
{
$postfilter = $filter;
$filter = "(&".$formfilter."".$filter.")";
}
else
{
$filter = $formfilter;
$emptyfilter = $config->get_host_form_emptyfilter($_SESSION['host'], $form_id);
if ( $emptyfilter != "" )
$filter = "(&".$emptyfilter."".$formfilter.")";
}
$tree = new Tree( $ldap, $base_dn, $filter, false, $form_id, null);
$treeview = $tree->get_view();
$objResponse->addAssign( $base_dn, 'innerHTML', $treeview);
return $objResponse;
}
?>