<%@ Page Language="c#" Inherits="WebApp.Admin.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/adminCssEdit.htm" -->
    <script charset="utf-8" src="../Editor/kindeditor.js"></script>
    <script charset="utf-8" src="../editor/lang/zh_CN.js"></script>
</head>
<body>
    <form id="frmPublicNews" method="post" runat="server">
    <div class="list-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="useListTitle" Style="cursor: hand" runat="server" Text="使用标题简写">
                        </asp:CheckBox>
                        <asp:CheckBox ID="isTop" runat="server" Text="固顶新闻"></asp:CheckBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        标题简写：
                    </th>
                    <td>
                        <asp:TextBox ID="subheading" runat="server" CssClass="input-txt input-txt3" MaxLength="100"></asp:TextBox>
                    </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 txt-c">
                <asp:Button ID="ok" runat="server" Text="添 加" CssClass="btn" OnClick="ok_Click">
                </asp:Button>
                &nbsp;
                <asp:Button ID="cancel" runat="server" Text="取 消" CssClass="btn" OnClick="cancel_Click"></asp:Button>
            </div>
            <!--/action-field-->
        </div>
    </div>

    <script type="text/javascript" language="javascript">

        //声明编辑器
        var editor;
        
		KindEditor.ready(function(K) {
		    //把textarea变为编辑器
		    editor = K.create('textarea[name="content"]', {
					        resizeType : 1,
                            allowFileManager : true,
                            allowFileUpload : true,
					        uploadJson : '../Editor/asp.net/upload_json.ashx',
                            fileManagerJson : '../Editor/asp.net/file_manager_json.ashx'
				        });
 		
		    //加载内容至编辑器
            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>
