<%@ Page Language="c#" Inherits="Web.User.addBoard" CodeBehind="addBoard.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" -->
    <script type="text/javascript">
        //声明编辑器
        var editor;

        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]');

            //加载内容至编辑器
            var content1 = document.getElementById("content1");
            editor.insertHtml(content1.value);

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

        });

    </script>
</head>
<body>
    <form id="addNews" method="post" runat="server">
        <div class="edit-func-box func-box">
            <div class="hd">
                编辑
            </div>
            <div class="bd">
                <table class="edit-table" id="Table1">
                    <tr>
                        <th>公告标题：
                        </th>
                        <td>
                            <asp:TextBox ID="name" runat="server" notNull="true" msgName="公告标题" class="input-md w3"
                                MaxLength="200"></asp:TextBox>
                            &nbsp;<asp:CheckBox ID="IsTop" runat="server" Text="固顶"></asp:CheckBox>
                            &nbsp;<asp:TextBox ID="showDay" runat="server" notNull="true" dataType="integer"
                                maxValue="999" minValue="0" msgName="显示天数" CssClass="input-md w2" Visible="false">7</asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>浏览权限：
                        </th>
                        <td>
                            <asp:DropDownList ID="gate" runat="server" CssClass="input-md">
                            </asp:DropDownList>
                            &nbsp;显示等级：
                        <asp:DropDownList ID="grade" runat="server" DataValueField="pkId" DataTextField="name" CssClass="input-md">
                        </asp:DropDownList>
                        </td>
                    </tr>
                    <tr id="tr_Duplicate" runat="server">
                        <th>抄送信息：
                        </th>
                        <td>
                            <asp:TextBox ID="txtDuplicateBigClass" runat="server" ReadOnly="True" class="input-md w3"></asp:TextBox>
                            <asp:Label ID="cslabel" runat="server"><a href="#" id="select" ><span class="blue">选择抄送栏目</span></a>
                        &nbsp;&nbsp; <a href="#" onclick="clearDuplicate();"><span class="blue">取消抄送</span></a>&nbsp;&nbsp;</asp:Label><asp:CheckBox ID="issynchronization" runat="server" Text="同步更新源信息" Visible="false" />
                        </td>
                    </tr>
                    <tr>
                        <th>公告内容：
                        </th>
                        <td>
                            <textarea name="content" style="width: 100%; height: 505px; visibility: hidden;"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="ft">
                <div class="action-field text-center">
                    <asp:Button ID="ok" runat="server" Text="添 加" class="btn btn-sm btn-primary" OnClick="Btn_Click"></asp:Button>
                    &nbsp;
                <asp:Button ID="cancel" runat="server" Text="取 消" class="btn btn-sm btn-primary" CausesValidation="False" OnClick="Btn_Click"></asp:Button>
                </div>
                <!--/action-field-->
            </div>
            <div>
                <input id="content1" type="hidden" name="content1" runat="server" />
                <input id="hiddenName" runat="server" type="hidden" />
                <input id="hiddenValue" runat="server" type="hidden" />
                <input id="hiddenDuplicate" runat="server" name="hiddenDuplicate" type="hidden" />
                <input id="hiddenOldValue" runat="server" name="hiddenOldValue" type="hidden" />
                <input id="hiddenIsDup" runat="server" name="hiddenIsDup" type="hidden" />
                <input id="hiddenOldBoardId" runat="server" name="hiddenOldBoardId" type="hidden" />
                <input id="hiddenFrom" runat="server" name="hiddenFrom" type="hidden" />
            </div>
        </div>
        <!--#include file = "../Css/foot.htm" -->
        <script type="text/javascript" language="javascript">
            jQuery(function ($) {
                //改用弹出层，因为201409发布的最新ghome开始不支持showModalDialog()
                $("#select").click(function () {
                    return true;
                }).fancybox({
                    'type': 'iframe',
                    'width': 540,
                    'height': 450,
                    'hideOnOverlayClick': false,
                    autoSize: false,
                    'href': 'selectBigClass.aspx?menuId=<%=menuId %>&bigClassId=<%=bigClassId %>',
                'padding': '0'
            });
             })
            //选择抄送栏目
            //	function ShowDialog(menuId, bigClassId)
            //	{
            //	    window.open("selectBigClass.aspx?menuId=" + menuId + "&bigClassId=" + bigClassId, window, "dialogWidth:550px; dialogHeight:350px;help:no;scroll:no;status:no;resizable:no");			
            //	}

            //取消抄送
            function clearDuplicate() {
                document.getElementById("txtDuplicateBigClass").value = "";
                document.getElementById("hiddenName").value = "";
                document.getElementById("hiddenValue").value = "";
            }

            //检查抄送栏目
            function checkform(optionName, optionValue) {
                if (optionName.LTrim().RTrim().length == 0) {
                    clearDuplicate();
                }
                if (optionName.indexOf("|") == 0) {
                    optionName = optionName.substring(1, optionName.length);
                    optionValue = optionValue.substring(1, optionValue.length);
                }
                document.getElementById("hiddenName").value = optionName;
                document.getElementById("hiddenValue").value = optionValue;
                document.getElementById("txtDuplicateBigClass").value = optionName;
            }

            String.prototype.Trim = function () {
                return this.replace(/(^\s*)|(\s*$)/g, "");
            }

            String.prototype.LTrim = function () {
                return this.replace(/(^\s*)/g, "");
            }

            String.prototype.RTrim = function () {
                return this.replace(/(\s*$)/g, "");
            }

        </script>

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