<%@ LANGUAGE = VBScript.Encode %>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/Version.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>网站公告列表</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
<script language="javascript" src="../Script/Admin.js"></script>


<!--kindeditor编辑器-->
		<link rel="stylesheet" href="../KindEditor/themes/default/default.css" />
		<script charset="utf-8" src="../KindEditor/kindeditor-min.js"></script>
		<script charset="utf-8" src="../KindEditor/lang/zh_CN.js"></script>
		<script>
			var editor_ch;
			var editor_en;
			KindEditor.ready(function(K) {
				editor_ch = K.create('textarea[name="ContentCH"]', {
					resizeType : 2,//0:设置kindeditor编辑器大小不可改变; 1:只能该变高度; 2:可以改变高度和宽度
					afterBlur: function(){this.sync();},//失去焦点执行this获得值
					allowPreviewEmoticons : false,
					allowImageUpload : false,					
					items : [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
				});
				editor_en = K.create('textarea[name="ContentEN"]', {
					resizeType : 2,//0:设置kindeditor编辑器大小不可改变; 1:只能该变高度; 2:可以改变高度和宽度
					afterBlur: function(){this.sync();},//失去焦点执行this获得值
					allowPreviewEmoticons : false,
					allowImageUpload : false,					
					items : [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
				});
			});
		</script>
<!--kindeditor编辑器END-->

<script language = "JavaScript">
function CheckForm()
{
	if (document.editForm.TitleCH.value.length == 0) {
		alert("中文标题没有填写.");
		document.editForm.TitleCH.focus();
		return false;
	}
	<%if chinato=1 then%>
	if (document.editForm.TitleEN.value.length == 0) {
		alert("英文标题没有填写.");
		document.editForm.TitleEN.focus();
		return false;
	}
	<%end if%>
var editor_ch=KindEditor.create('#editor_ch');
if (editor_ch.isEmpty())
	{
	  alert("请填中文内容！")	  
	  return false
	 }
	<%if chinato=1 then%>
var editor_en=KindEditor.create('#editor_en');
if (editor_en.isEmpty())
	{
	  alert("请填英文内容！")	  
	  return false
	 }
	<%end if%>  
	return true;
}
</script>
</HEAD>
<%
if Instr(session("AdminPurview"),"|37,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
  response.end
end if
'========判断是否具有管理权限
%>
<%Result=request.querystring("Result")
Action=request.querystring("Action")
id=request.querystring("id")
if Action="Save" then
id=request("id")
TitleCH=request("TitleCH")
ContentCH=Request("ContentCH")
TitleEN=request("TitleEN")
ContentEN=Request("ContentEN")

If TitleCH="" Or (TitleEN="" And chinato=1) Then
 Call Alert ("请输入公告标题!","-1")
response.end
end if

If ContentCH="" Or (ContentEN=""  And chinato=1) Then
 Call Alert ("请输入公告内容!","-1")
response.end
end if

if Result="add" then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from TianTianCMS_Notice"
rs.open sql,conn,1,3
rs.addnew
rs("TitleCH")=TitleCH
rs("TitleEN")=TitleEN
rs("ContentCh")=ContentCh
rs("ContentEn")=ContentEn
rs("topgg")=request("topgg")
rs("Acti")=request("Acti")
rs("Time")=now()
rs.update
rs.close
 Call Alert ("添加成功！","Admin_AddAffiche.asp")
response.end
End If

if Result="Modify" then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from TianTianCMS_Notice where id="&id
rs.open sql,conn,1,3
rs("TitleCH")=TitleCH
if chinato=1 then rs("TitleEN")=TitleEN
rs("ContentCh")=ContentCh
if chinato=1 then rs("ContentEn")=ContentEn
rs("topgg")=request("topgg")
rs("Acti")=request("Acti")
rs.update
rs.close
 Call Alert ("修改成功！","Admin_AddAffiche.asp")
response.end
End If

end If
%>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"> 
	
      <table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">	  
          <tr>
            <th height="22" colspan="2">【
              <%If Result = "add" then%>
              添加
              <%ElseIf Result = "Modify" then%>
              修改
              <%End If%>
              公告】</th>
          </tr> 
<%If Result="Modify" then
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "Select * From TianTianCMS_Notice where id="&id, conn,3,3%>
          <form method="post" name="editForm" action="Admin_editAffiche.asp?Action=Save&Result=Modify"  onSubmit="return CheckForm()"> 
		  <input type=hidden name=id value=<%=id%>>
          <tr>
            <td width="20%" align="right" class="forumRow">中文公告标题：</td>
            <td width="80%" class="forumRowHighlight"><input name="TitleCH" type="text" id="TitleCH" value="<%=rs("TitleCH")%>" size="45" maxlength="100" /><font color="red">*</font>3-10个字符</td>
          </tr>
		  <%if chinato=1 then%>
          <tr>
            <td width="20%" align="right" class="forumRow">英文公告标题：</td>
            <td width="80%" class="forumRowHighlight"><input name="TitleEN" type="text" id="TitleEN" value="<%=rs("TitleEN")%>" size="45" maxlength="100" /><font color="red">*</font>3-10个字符</td>
          </tr>
		  <%End if%>
    <tr>
      <td align="right" class="forumRow">中文内容：</td>
      <td class="forumRowHighlight"><textarea id="editor_ch" name="ContentCH" style="width:670px;height:400px;"><%=rs("ContentCH")%></textarea></td>
    </tr>
	<%if chinato=1 then%>
	<tr>
      <td align="right" class="forumRow">英文内容：</td>
      <td class="forumRowHighlight"><textarea id="editor_en" name="ContentEN" style="width:670px;height:400px;"><%=rs("ContentEN")%></textarea></td>
    </tr>
	<%End if%>
          <tr>
            <td align="right" class="forumRow">是否固顶：</td>
            <td class="forumRowHighlight"><%if rs("topgg")=1 then%>               
                <input type="radio" name="topgg" value="1" id="topgg" checked>
                是&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="topgg" value="0" id="topgg">
                否</td>
                <%else%>                         
                <input type="radio" name="topgg" value="1" id="topgg">
                是&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="topgg" value="0" id="topgg" checked>
                否<%end if%></td>
          </tr>
          <tr>
            <td align="right" class="forumRow">是否活动：</td>
            <td class="forumRowHighlight"><%if rs("Acti")=1 then%>               
                <input type="radio" name="Acti" value="1" id="Acti" checked>
                是&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="Acti" value="0" id="Acti">
                否</td>
                <%else%>                         
                <input type="radio" name="Acti" value="1" id="Acti">
                是&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="Acti" value="0" id="Acti" checked>
                否<%end if%></td>
          </tr>
            <td align="right" class="forumRow"></td>
            <td class="forumRowHighlight"><input name="submit" type="submit" value="确定" /></td>
          </tr>
        </form>
      </table>
<%Else%><form method="post" name="editForm" action="Admin_editAffiche.asp?Action=Save&Result=add" onSubmit="return CheckForm()">	   
          <tr>
            <td width="20%" align="right" class="forumRow">中文公告标题：</td>
            <td width="80%" class="forumRowHighlight"><input name="TitleCH" type="text" id="TitleCH" value="" size="45" maxlength="100" /><font color="red">*</font>100个字符内</td>
          </tr>
		  <%if chinato=1 then%>
          <tr>
            <td width="20%" align="right" class="forumRow">英文公告标题：</td>
            <td width="80%" class="forumRowHighlight"><input name="TitleEN" type="text" id="TitleEN" value="" size="45" maxlength="100" /><font color="red">*</font>100个字符内</td>
          </tr>
		  <%End if%>
    <tr>
      <td align="right" class="forumRow">中文内容：</td>
      <td class="forumRowHighlight"><textarea id="editor_ch" name="ContentCH" style="width:670px;height:400px;"></textarea></td>
    </tr>
	<%if chinato=1 then%>
	<tr>
      <td align="right" class="forumRow">英文内容：</td>
      <td class="forumRowHighlight"><textarea id="editor_en" name="ContentEN" style="width:670px;height:400px;"></textarea></td>
    </tr>
	<%End if%>
          <tr>
            <td align="right" class="forumRow">是否固顶：</td>
            <td class="forumRowHighlight"><input name="topgg" type="radio" value="1">
        是
        <input name="topgg" type="radio" value="0" checked> 否</td>
          </tr>
          <tr>
            <td align="right" class="forumRow">是否活动：</td>
            <td class="forumRowHighlight"><input name="Acti" type="radio" value="1" checked>
        是
        <input name="Acti" type="radio" value="0"> 否</td>
          </tr>
            <td align="right" class="forumRow"></td>
            <td class="forumRowHighlight"><input name="submit" type="submit" value="确定" /></td>
          </tr>
        </form>     
<%End if%>
 </table>

      <p>&nbsp;</p>
      </td>
  </tr>
</table>


