<%@ Page Language="c#" Inherits="Web.User.PublicNews" CodeBehind="PublicNews.aspx.cs" %>

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>新闻编辑</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file="../Css/head.htm"-->
    <!--#include file = "../Css/userCssEdit.htm" -->
    
</head>
<body>
    <form id="frmPublicNews" method="post" runat="server">
    <div class="edit-func-box func-box">
            <div class="hd">共享信息维护</div>
            <div class="bd">
            <table class="edit-table">
                <tr>
                    <th>
                        标题：
                    </th>
                    <td>
                        <asp:TextBox ID="intactTitle" runat="server" CssClass="input-txt input-txt3" notnull="true" MaxLength="100" msgname="标题"></asp:TextBox>
                        <asp:CheckBox ID="isTop" runat="server" Text="固顶" CssClass="chkbox"></asp:CheckBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        作者：
                    </th>
                    <td>
                        <asp:TextBox ID="author" runat="server" CssClass="input-txt input-txt1" MaxLength="100"></asp:TextBox>&nbsp;
                        来源：<asp:TextBox ID="copyFrom" runat="server" CssClass="input-txt input-txt1" MaxLength="100"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        信箱：
                    </th>
                    <td>
                        <asp:TextBox ID="authorMail" runat="server" CssClass="input-txt input-txt1" MaxLength="100"></asp:TextBox>&nbsp;
                        来源地址：<asp:TextBox ID="copyFromLink" runat="server" CssClass="input-txt input-txt1"
                            MaxLength="100"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        相关信息：
                    </th>
                    <td>
                        <asp:TextBox ID="about" runat="server" CssClass="input-txt input-txt1" MaxLength="100"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="非法字符串！"
                            ControlToValidate="about" Display="Dynamic" ValidationExpression="[^&quot;^'^\*^\?^,^\.^(^)]+"></asp:RegularExpressionValidator>用来查找相关文章，中间用“|”隔开；不能出现""'*?,.()等字符
                    </td>
                </tr>
                <tr>
                    <th>
                        内容：
                    </th>
                    <td>
                        <input id="content1" type="hidden" name="content1" runat="server" />
                        <textarea  name="content" style="width: 100%; height: 480px; visibility: hidden;"></textarea>
                        <p style="color: Green">
                            【如子站无法显示图片等内容，可点其右键查看属性设置，url链接须使用格式为“http://网站域名/图片路径”的完整地址】</p>
                    </td>
                </tr>
            </table>
        </div>
        <div class="ft">
            <div class="action-field text-center">
                <asp:Button ID="ok" runat="server" Text="添 加" CssClass="btn btn-sm btn-primary" OnClick="ok_Click"></asp:Button>
                &nbsp;
                <asp:Button ID="cancel" runat="server" Text="取 消" CssClass="btn btn-sm btn-primary" OnClick="cancel_Click"></asp:Button>
            </div>
            <!--/action-field-->
        </div>
    </div>
    <!--#include file = "../Css/foot.htm" -->
    <script type="text/javascript" language="javascript">

        //声明编辑器
        var editor;
        
		KindEditor.ready(function(K) {
		    //把textarea变为编辑器
		    editor = K.create('textarea[name="content"]', {
		                    width : '800',//防止首次打开样式错乱
				            height : '480',
					        
                            allowFileManager : true,
                            allowFileUpload : true
				        });
 		
		    //加载内容至编辑器
            var initcontxt=document.getElementById("content1");
            editor.insertHtml(initcontxt.value);                

            
            $("#ok").click(function() {
                var txt = editor.html().trim();
                if (txt =="")
                {
                    alert("文章内容不能为空！");
                    return false;
                }
                
                if (checkAllValidate())
                {
                    $("#content1").val(txt) ; //给隐藏的content1赋值 
                    return true;
                }else{
                    return false;
                }                
            });              
            
		});	
		
    </script>

    </form>
</body>
</html>
