//系统公告.
Ext.namespace('Fecsp.surf.base');

Fecsp.surf.base.BulletionWindow = new Ext.extend(Ext.Window, {
	initComponent: function() {
		var store = new EasyExt.data.JsonStore({
			autoDestroy: true,
			lazyInit: true,
			fields: [{
				name: 'id'
			}, {
				name: 'title'
			},{
				name: 'content'
			}, {
				name: 'publicTime'
			},{
				name: 'isNew'
			}],
			//jsdpcn: 'scipf.fecsp.surf.infopublic.webapp.action.BulletionJSDProvider'
			jsdpcn: 'scipf.fecsp.surf.infopublic.webapp.action.SystemBulletinJSDProvider'
		});
		store.setBaseParam('infoSize', 5);
		store.load({
			callback: function(r, o, s) {
				if (s && r.length < 1) {
					this.hide();
				} else {
					this.show();
				}
			},
			scope: this
		});
		
		Ext.apply(this, {
			layout: 'fit',	
			resizable: false,
			width: 240,
			height: 180,
			modal: false,
			frame: false,
			border: false,
			collapsible: true,
			title: '业务公告',
			bodyCfg : {
				cls: 'bulletion-header'
			},
			headerCfg: {
				cls: 'bulletion-title bulletion-header'
			},
			items: {
				xtype: 'panel',
				autoScroll: true,
				items: {
					xtype: 'dataview',
					store: store,
					itemSelector: '',
					tpl: new Ext.XTemplate(
						'<table cellspacing="4" cellpadding="0" border="0" width="100%" height="100%" class="bulletion-content-bg">',
						'	<tr><td valign="top"><table cellspacing="0" cellpadding="0" border="0" width="100%"><tpl for=".">',
						'		<tr class="bulletion-content">',
						'			<td><div style="white-space:nowrap;text-overflow:ellipsis;overflow:hidden;width:165px;"><a href="'+CONTEXT_PATH+'/fecsp/surf/infopublic/sysbultcontent.do?action=carryout&infoId={id}" title="{title}" target="_blank"">{title}</a></div></td>',
						'		</tr>',
						'	</tpl></td></tr></table>',
						'	<tr><td align="right" colspan="2"><a href="'+CONTEXT_PATH+'/fecsp/surf/infopublic/sysbult.do?action=carryout">更多..&nbsp;&nbsp;&nbsp;</a></td></tr>',
						'</table>',
						{
							compiled: true,
							disableFormats: true
						}
					)
				}
			}
		})
		Fecsp.surf.base.BulletionWindow.superclass.initComponent.apply(this, arguments);
	}
});

