<?php
include_once("_dirinfo.php");
include_once(PATH_TO_ROOT."init.php");
include_once(PATH_TO_ROOT."_class/class.Extjs_grid.php");


	$tabId = $_POST['uniqueTabId'];
	$tableName = '_userDefineModules';
	
	$grid = new MakeGrid( 'grid_'.$tabId );
	
	$grid->setMainTable($tableName,DB_WARPIT_WEBCATI_BASE)->setTitle('User define modules');
	$grid->selectSQL = "SELECT * FROM $tableName";
	
	$grid->setReqUrl("webcati/_ajax/userDefine/ajax.userDefine.php");
	
	$grid->addColumn('id','Id')->width(50);
	$grid->addColumn('id_sup','parent')->width(50);
	$grid->addColumn('idLab','Script name')->width(250);
	$grid->addColumn('node_img','Script icon',"new Ext.form.TextField()")->width(150);
	$grid->addColumn('file_name','Script file name',"new Ext.form.TextField()")->width(250);
	$grid->addColumn('module_type','Exec. type')->type('combo')
					  ->comboTable('_userDefineTypes')
					  ->comboValue('id')
					  ->comboSQL("SELECT * FROM _userDefineTypes")
					  ->comboDisplay('name',false)
					  ->comboRender('name');	
	
	$grid->setPaging()
		->region('center')
		->setCheckBoxSelectionModel(true)
		->setRemoteSort()
		->setGrouping('id_sup',"{showGroupName:false,hideGroupedColumn:true,enableGroupingMenu:false}")
		->setFiltering(true)
		->setSearchField('Search','top');
		
	echo $grid->createGrid();
	
	
	echo "
		mainTabPanel.add({
		id: '$tabId', 
		iconCls:'RMicon_userDefine',
		layout:'border',
		title: 'User define modules',
		closable: true,
		items:[$grid]
	 })";
	 
	 if(!$_POST['uniqueNotShow']) echo  ".show();";

	 
?>