<%@ page contentType="text/html; charset=GBK" session="false"%>
<%@ taglib uri="/cmsTag" prefix="cms"%>
<%@ page contentType="text/html; charset=GBK"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		<link href="../style/blue/css/main.css" type="text/css" rel="stylesheet" />
		<link href="../style/blue/css/reset-min.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../javascript/commonUtil_src.js"></script>
		<script type="text/javascript" src="../javascript/editor/fckeditor.js"></script>
		<script language="javascript" type="text/javascript" src="../javascript/My97DatePicker/WdatePicker.js"></script>
		<script>  
	 		var api = frameElement.api, W = api.opener; 
			 
	         if("true"==="${param.fromFlow}")
	         { 
	         	W.$.dialog
			    ({ 
			      
			  		title : '提示',
			    	width: '160px', 
			    	height: '60px', 
			        lock: true, 
			    	icon: '32X32/succ.png', 
			    	parent: api,
			        content: '发送会员信息成功!', 
			       	ok: function()
			       	{
			       		W.window.location.reload();
			       	}
				 });
	         	
	         }
        </script>
	</head>
	<body>
		<cms:CurrentSite>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td align="left" valign="top">
						<!--main start-->
						<div class="addtit">
							<img src="../style/blue/icon/application-import.png" width="16" height="16" />
							发送会员消息
						</div>
						
						<cms:QueryData querySign="query_single_msg_template" objName="MTP" var="${param.mtId}" single="true">	
					
						<form id="mgtForm" name="mgtForm" method="post">
							<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">

								<tr>
									<td width="16%" class="input-title">
										<strong>标题</strong>
									</td>
									<td class="td-input">
										<input type="text" size="83" id="templateTitle" name="templateTitle" class="form-input" value="${MTP.templateTitle}"></input>

									</td>
								</tr>

								<tr>
									<td class="input-title">
										<strong>模板内容</strong>
									</td>
									<td class="td-input">
										<textarea id="templateContent" name="templateContent" style="height:180px;width:400px" class="form-textarea">${MTP.templateContent}</textarea>

										<script type="text/javascript">
                                                   var editor1 = new FCKeditor('templateContent');
                                                   editor1.BasePath = "<cms:BasePath/>core/javascript/editor/";
                                                   
                                                   editor1.ToolbarSet = 'Mid'; 
                                                   editor1.Height = 300;
                                                   editor1.Width = 442;
                                                   editor1.Config["EnterMode"] = "p";
                                                   editor1.ReplaceTextarea();   
                                 	</script>
									</td>
								</tr>
								<tr>
									<td class="input-title">
										<strong>内容变量</strong>
									</td>
									<td class="td-input">
										<select class="form-select" onchange="javascript:selectParamForFCK(this,'templateContent')">
											<option value="">
												--------- 备选参数 ---------
											</option>

											<cms:SystemList querySign="query_mg_template_param" objName="MGTP" var="${CurrSite.siteId}">
												<option value="{${MGTP.paramFlag}}">
													${MGTP.paramName}
												</option>
											</cms:SystemList>

										</select>
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<span class="input-title"><strong>可选模板</strong>
										<select id="tempId" class="form-select" onchange="javascript:selectTemplate(this);">
											<option value="-1">
												--------- 手动书写 ---------
											</option>

											<cms:QueryData querySign="SELECT_MEMBER_MG_TEMPLATE" objName="Tmp" var="${CurrSite.siteId}">
												<option value="${Tmp.mtId}">
													${Tmp.templateName}
												</option>
											</cms:QueryData>

										</select>
										</span>
									</td>
								</tr>



							</table>
							<!-- hidden -->
							
							</cms:QueryData>

						</form>
						<div style="height:15px"></div>
						<div class="breadnavTab">
							<table width="100%" border="0" cellspacing="0" cellpadding="0" >
								<tr class="btnbg100">
									<td width="74%" class="input-title"></td>
									<td class="td-input">
										<a name="btnwithicosysflag" href="javascript:submitMsg();"  class="btnwithico"><img src="../style/icons/tick.png" width="16" height="16" /><b>发送消息&nbsp;</b> </a>
										<a href="javascript:close();"  class="btnwithico" onclick=""><img src="../style/icon/close.png" width="16" height="16"/><b>取消&nbsp;</b> </a>
									</td>
									<td valign="top">
										<br />
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>

				<tr>
					<td height="10">
						&nbsp;
					</td>
				</tr>
			</table>
			<!--[if lt IE 7]>
        <script type="text/javascript" src="js/unitpngfix.js"></script>
<![endif]-->
	</body>
</html>
<script>  
initSelect('tempId','${param.mtId}');

function submitMsg()
{
	var cidCheck = W.document.getElementsByName('checkedMemberId');
	
	var ids='';
	for(var i=0; i<cidCheck.length;i++)
	{
		if(cidCheck[i].checked)
		{
			ids += cidCheck[i].value+',';
		}
	} 
	
	if(ids == '')
	{
		alert('请选择ID');
		return;
	}
	
	disableAnchorElementByName("btnwithicosysflag",true);
		
	var tip = W.$.dialog.tips('正在执行...',3600000000,'loading.gif');
	
	
	var form = document.getElementById("mgtForm");
	
	form.action = '<cms:BasePath/>member/sendMsg.cmd?ids='+ids;
	
	form.submit();

	
 	
}

function selectTemplate(obj)
{
	window.location.href='SystemManagerSendMessage.jsp?mtId='+obj.value;
}


function close()
{
	api.close();
}
  
</script>
</cms:CurrentSite>
