<?php 
/**
 * Система управления сайтом HostCMS v. 5.xx
 * Copyright © 2005-2010 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 *
 * Обработчик добавления/редактирования категории доп. свойств.
 * 
 * Файл: /admin/InformationSystems/action/add_item_property_dir.php
 * 
 * @author Hostmake LLC
 * @version 5.x
 */
$param = array();

$information_system = & singleton('InformationSystem');

if (isset($_REQUEST['information_propertys_items_dir_id']))
{
	$param['information_propertys_items_dir_id'] = to_int($_REQUEST['information_propertys_items_dir_id']);
}

$param['information_systems_id'] = to_int($_REQUEST['information_systems_id']);
$param['information_propertys_items_dir_parent_id'] = to_int($_REQUEST['information_propertys_items_dir_parent_id']);
$param['information_propertys_items_dir_name'] = to_str($_REQUEST['information_propertys_items_dir_name']);
$param['information_propertys_items_dir_description'] = to_str($_REQUEST['information_propertys_items_dir_description']);
$param['information_propertys_items_dir_order'] = to_int($_REQUEST['information_propertys_items_dir_order']);

if ($insert_propertys_items_dir_id = $information_system->InsertPropertysItemsDir($param))
{
	$admin_forms = new admin_forms();
	$window_id = $admin_forms->GetWindowId();
	?><script type="text/javascript">
	$.appendInput('<?php echo $window_id?>', 'EditAddISDirProperty', 'information_propertys_items_dir_id', '<?php echo $insert_propertys_items_dir_id?>');
	</script><?php

	if ($insert_propertys_items_dir_id)
	{
		if (isset($_REQUEST['information_propertys_items_dir_id']))
		{
			show_message($GLOBALS['MSG_information_systems']['edit_property_item_dir_success']);
		}
		else 
		{
			show_message($GLOBALS['MSG_information_systems']['add_property_item_dir_success']);
		}
	}
	else
	{
		if (isset($_REQUEST['information_propertys_items_dir_id']))
		{
			show_error_message($GLOBALS['MSG_information_systems']['edit_property_item_dir_error']);
		}
		else 
		{
			show_error_message($GLOBALS['MSG_information_systems']['add_property_item_dir_error']);
		}
	}
	
}

?>