Ext.define('Ext.ux.file.store.TreeHive', {
	extend: "Ext.data.TreeStore",

	model: 'Ext.ux.file.model.TreeHive',

	constructor: function (config) {

		var o_config = Ext.Object.merge(config);
		o_config.proxy = config.proxy || {};

		var i_store = this;
		var o_proxy = {
			$configStrict: false,
			type: "hive",
			url: '/ip2-Services/webbios.aspx',
			useSystem: config.useSystem != undefined ? config.useSystem : true
		};

		Ext.Object.merge(o_config.proxy, o_proxy);

		i_store.callParent([o_config]);
	},

	listeners: {
		beforeload: {
			fn: function(store, operation) {

				var node = operation.node;
				var i_proxy = store.getProxy();
				var o_params = operation.getParams();

				Ext.Object.merge(o_params, {
					func: "listdir",
					extension: "folder",
					path: node.get("path")
				});

				i_proxy.idParam = "path";

				store.proxy.reader.__requests || (store.proxy.reader.__requests = []);

				store.proxy.reader.__requests.push(node.get('path'));
				delete operation.node;
			}
		}
	}
});
