<?php 

include_once("_dirinfo.php");
include_once(PATH_TO_ROOT."init.php");
include_once(PATH_TO_ROOT."_class/class.Extjs_tree.php");
include (PATH_TO_ROOT."/_support/repository.php");

loadPlugin($_repository,'fileUpload');


$tableNameTree = '_RedirectProjects';

$tree = new MakeTree($tabId.'_tree');

$tree->SetTable($tableNameTree,DB_WARPIT_USERSPOOL);
$tree->SetRootVisible('true','Redirect Projects')
	->setWidth('250')
;
$tree
	->addConfig('region',"'west'")
	->activateDD()
	->setReqUrl('webuserspool/_ajax/redirectionManager/ajax.redirectionManager.php')
	->afterAddItem = "if(r.warning) Ext.Msg.alert('Warning',r.warning);
	CallScript('webuserspool/_forms/redirectionManager/forms.redirectionProject.php',{id_project: r.insertId,projName:text});";
	$tree->setContAddItem('Add project','false','icon-add-record',null,2)
	
	->setContAddGroup('Add folder','false','icon-add-folder',2)
	->setContRename()
	->setContDelete('Delete','node.hasChildNodes()','icon-delete-record',2)
	->addConfig('collapseMode', "'mini'")
;	 



echo $tree->CreateTree();

echo "
	$tree.on('dblclick',function(node) {
		if(node.attributes.leaf)
		{
			var tmp = Ext.getCmp('redirectionProject_'+node.id );
			if( tmp )
			{
				tmp.show();
				return;
			}
			CallScript('webuserspool/_forms/redirectionManager/forms.redirectionProject.php',{id_project: node.id,projName:node.text});
		}
	 });
	
	var $tabId = new Ext.Panel({
		id:'$tabId',
		title:'Redirections',
		iconCls:'RMicon_redirect',
		defaults:{split:true,border:false},
	
		layout:'border',
		border: false,
		closable:true,
		items:[$tree, { xtype:'tabpanel',id:'redirectionManagerTabPanel',region:'center'  }   ]
	});
mainTabPanel.add( $tabId ).show();  ";

?>