
Hedera.Connections = new Class
({
	Extends: Hedera.Form
	
	,_timeoutId: null

	,onModelStatusChange: function (model)
	{
		if (!model.ready)
			return;

		if (this._timeoutId)
			clearTimeout (this._timeoutId);
			
		this._timeoutId = setTimeout (this.onRefreshClick.bind (this), 60000);
	}
	
	,deactivate: function ()
	{
		clearTimeout (this._timeoutId);
	}
	
	,onRefreshClick: function ()
	{
		this.$.sessions.refresh ();	
	}

	,repeaterFunc: function (res, form)
	{
		res.$.link.href = this.hash.make ({
			form: 'admin/access-log',
			user: form.$.userId
		});
	}

	,onChangeUserClick: function (button, form)
	{
		this.gui.supplantUser (form.get ('user'),
			this._onUserSupplant.bind (this));
	}
	
	,_onUserSupplant: function ()
	{
		this.hash.setAll ({form: 'ecomerce/orders'});
	}
	
	,sessionsFunc: function ()
	{
		return 1;
	}
});

