/*
 * WebBase
 * Copyright(c) 2008-2015, oapro.
 * lxz@oapro.com
 * 
 * http://www.oapro.com
 */

/*
 *模块名称:OA界面的中控面板
 *
*/

//构造函数
MainCenterPanel = function(strTitle, strUrl, strIconCls) 
{
	if(strIconCls == "")
		strIconCls = "icon-Function-menu";

    MainCenterPanel.superclass.constructor.call(this, {
			region:'center',
			deferredRender:false,
			activeTab:0,
			enableTabScroll:true,
			defaults: {autoScroll:true},
			plugins: new Ext.ux.TabCloseMenu(),

			items:
			[
				{
					id: strUrl,
					title: strTitle,
					iconCls: strIconCls,	
					html:'<div id=\"center1\"><iframe id=\"'+strTitle+'\"  src=\"'+strUrl+'\" height =\"100%\" width =\"100%\" frameborder=\"0\" scrolling=\"auto\" style=\"border:0px none;\"></iframe></div>',
					//closable:true,
					autoScroll:true
				}				
			]
		});
};

//继承扩展
Ext.extend(MainCenterPanel, Ext.TabPanel, 
{
	// 在中间的面板加入tab
	addTab : function(strTitle, strUrl, strIconCls)
	{
		if(strIconCls == "")
			strIconCls = "icon-Function-menu";

		var objTab = this.getItem(strUrl);
		if(objTab)//如有,则切换显示
			this.setActiveTab(objTab);
		else//如没有,则添加
		{
			this.add({
				id:strUrl,
				title: strTitle,
				iconCls: strIconCls,
				html:'<div id=\"center1\"><iframe id=\"'+strTitle+'\"  src=\"'+strUrl+'\" height =\"100%\" width =\"100%\" frameborder=\"0\" scrolling=\"auto\" style=\"border:0px none;\"></iframe></div>',
				closable:true
			}).show();
		}
	}
});