/* $Id */

Ext.namespace('NGMP.admin');

NGMP.admin.MailModule = function(A) {
	if (!A) {
		A = {};
	}
	Ext.apply(this, A);

	this.sidebarSubStore = new Ext.data.SimpleStore({
		fields:['id', 'text'],
		data:[
			['mailEmailUtilities', LANG_email + ' ' + LANG_utilities],
			['mailEmailAlias', LANG_email + ' ' +LANG_aliases_forwarding]

		]
	});

	this.sidebarItemStore = new Ext.data.SimpleStore({
		fields:['sub', 'id', 'text', 'iconCls'],
		data:[
			//['mailEmailUtilities', 'mailEmailUtilities_purgeMessages', LANG_purge_messages, 'icon-sub-trash'],
			['mailEmailUtilities', 'mailEmailUtilities_massmail', LANG_massmail, 'icon-sub-mailinglist'],
			['mailEmailUtilities', 'mailEmailUtilities_undeliverable', LANG_undeliverable, 'icon-sub-warning'],
			['mailEmailAlias', 'mailEmailAlias_listAliases', LANG_list_aliases, 'icon-sub-users']

		]
	});

	this.navigationPanel = new NGMP.form.SideBar({
		width:210,
		region:'west',
		subs:this.sidebarSubStore,
		subItems:this.sidebarItemStore,
		handler:function(a,b) {
			console.log(b);
		},
		scope:this
	});

	this.purgeMessagesPanel = new Ext.Panel({
		region:'center',
		title:LANG_purge_messages
	});

	this.massmailPanel = new Ext.Panel({
		region:'center',
		title:LANG_massmail
	});

	this.undeliverablePanel = new Ext.Panel({
		region:'center',
		title:LANG_undeliverable
	});

	this.listAddAliasesPanel = new Ext.Panel({
		region:'center',
		title:LANG_list_aliases
	});

	this.centerPanel = new Ext.Panel({
		region:'center',
		layout:'card',
		items:[this.purgeMessagesPanel,this.massmailPanel, this.undeliverablePanel, this.listAddAliasesPanel]
	});

	NGMP.admin.MailModule.superclass.constructor.call(this, {
		layout:'border',
		items:[this.navigationPanel, this.centerPanel]
	});
};

Ext.extend(NGMP.admin.MailModule, Ext.Panel, {
});

NGMP.moduleManager.addAdminModule('mail', NGMP.admin.MailModule, {
	title:LANG_mail,
	iconCls:'icon-mail'
});
