Mys.CommunicationView = function(data, config)
{
	Mys.CommunicationView.superclass.constructor.call(this, data, config);
};

Ext.extend(Mys.CommunicationView, Mys.boardView, {
	id : "item_id",
	
	bodyTemplate : (new Ext.Template([
		'<div style="margin-bottom : 10px;text-align : right;">',
			'{admin}',
			'<a href="{modifyURL}" onfocus="blur()" onclick="return Global.Session.checkLogin(this.href);"><img src="/images/common/btn_writesemi.gif" width="57" height="17" hspace="5" /></a></div>',
		'</div>',
		'<table width="100%" border="0" cellspacing="0" cellpadding="0">',
			'<tr>',
				'<td style="border:solid 5px #e7e7e7;" class="ptb5">',
				'<table width="100%" border="0" cellspacing="0" cellpadding="0">',
					'<tr>',
						'<td width="50" height="30" class="c c88 b"><span>제목</span></td>',
						'<td width="5" bgcolor="#e7e7e7"></td>',
						'<td style="padding-left:10px" class="subject"><span>{title}</span></td>',
					'</tr>',
				'</table></td>',
			'</tr>',
			'<tr>',
				'<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">',
					'<tr>',
						'<td width="55"><img src="/images/common/stit_writer.gif" width="39" height="13" hspace="5" /></td>',
						'<td class="c66">{nick}</td>',
					'</tr>',
				'</table></td>',
			'</tr>',
			'<tr>',
				'<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">',
					'<tr>',
						'<td width="55"><img src="/images/common/stit_date.gif" width="39" height="13" hspace="5" /></td>',
						'<td class="c66">{insertDate}</td>',
					'</tr>',
				'</table></td>',
			'</tr>',
			'<tr>',
				'<td height="1" bgcolor="#e7e7e7"></td>',
			'</tr>',
			'<tr>',
				'<td></td>',
			'</tr>',
			'<tr>',
				'<td class="contents"><div class="view-static-contents">{content}</div></td>',
			'</tr>',
		'</table>',
		'{files}'
	])).compile(),
	
	fileTemplate : (new Ext.Template('<img class="added_file_img1" src="../images/common/icon_file.gif" width="10" height="13" align="absmiddle" /><a class="added_file_link" href="{url}" target="_blank">{name}<a class="added_file_img2_a"href="{url}" target="_blank"><img class="added_file_img2" src="../images/common/btn_filedown.gif" width="47" border="0" align="absmiddle" /></a>')).compile(),
	
	className : "mys-boardView-item",
	modifyURL : "/hrd/communication_write.htm",
	
	prepareData : function(data){
		data = Mys.CommunicationView.superclass.prepareData.call(this, data);
		
		data.modifyURL = ViewManager.getModifyURL(data) + "?board_id=" + data.board_id + location.hash;
		
		return data;
	},
	
	createAdmin : function(data)
	{
		if(Global.Session.isAdmin() || Global.Session.getID() == data.writer_id)
		{
			var tag = this.safeArray(data.tag);
			
			for(var i = 0, tags = []; i < tag.length; i++)
				tags.push(tag[i].tag_name);
			var admin = '' +
				'<a href="' + ViewManager.getModifyURL(data) + '?item_id=' + data.item_id + location.hash + '" onfocus="blur()"><img src="/images/common/btn_fixsemi.gif" width="32" height="17" /></a>' +
				'<img src="/images/common/line_devidebtn.gif" width="1" height="17" />' +
				'<a href="javascript:;" onfocus="blur()" class="mys-item-del"><img src="/images/common/btn_delsemi.gif" width="32" height="17" /></a>';
			return admin;
		}
		else
			return '';
	}
});